@tsteur opened this Issue on August 25th 2020 Member

On request index.php?forceView=1&viewDataTable=sparklines&module=Goals&action=get&idGoal=10&allow_multiple=0&only_summary=1&idSite=2&period=day&date=2020-08-17,2020-08-23&segment=&showtitle=1&random=8740

following error happened because a data table map was returned instead of a regular data table. And in this case the first row is a dataTable and not a row.

Error: {"message":"Call to undefined method Piwik\DataTable\Simple::getComparisons()","file":"\/plugins\/CoreVisualizations\/Visualizations\/Sparklines.php","line":125,"request_id":"12345","backtrace":" on \/plugins\/CoreVisualizations\/Visualizations\/Sparklines.php(125)\n#0 \/plugins\/CoreVisualizations\/Visualizations\/Sparklines.php(94): Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines->fetchConfiguredSparklines()\n#1 \/core\/Plugin\/Report.php(320): Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines->render()\n#2 \/plugins\/CoreHome\/Controller.php(58): Piwik\Plugin\Report->render()\n#3 [internal function]: Piwik\Plugins\CoreHome\Controller->renderReportWidget(Object(Piwik\Plugins\Goals\Reports\Get))\n#4 \/core\/FrontController.php(590): call_user_func_array(Array, Array)\n#5 \/core\/FrontController.php(165): Piwik\FrontController->doDispatch('Goals', 'get', Array)\n#6 \/core\/dispatch.php(34): Piwik\FrontController->dispatch()\n#7 \/index.php(27): require_once('\/c...')\n#8 {main}"}

@diosmosis commented on September 3rd 2020 Member

@tsteur where did this URL come from? It's failing because of period=day&date=date1,date2 (ie, it's a multi-period query). I think the sparklines visualization is meant to be just for a single period. The sparkline visualization URLs ( the requests for the actual sparkline images) can handle multiple periods though.

@tsteur commented on September 3rd 2020 Member

@diosmosis it looks like it came from this:

/index.php?forceView=1&viewDataTable=sparklines&module=Goals&action=get&idGoal=6&allow_multiple=0&only_summary=1&idSite=2&period=day&date=2020-08-17,2020-08-23&segment=&showtitle=1&random=2961
@diosmosis commented on September 3rd 2020 Member

@tsteur is the sparklines visualization meant to be used with multi periods?

@tsteur commented on September 3rd 2020 Member

Haven't looked how it works but would have expected that period=day&date=2020-08-17,2020-08-23 shows 7 data points one for each day? I'm not so much into it though

@diosmosis commented on September 3rd 2020 Member

period=day&date=2020-08-17,2020-08-23 range should work, but I've never seen sparklines work w/ multi period. If you sent 10 periods, would it show sparklines and metrics next to them for each 10 periods for each metric in the widget? Seems like it's meant to be a single period.

@tsteur commented on September 3rd 2020 Member

@diosmosis not sure what you mean with multi period? The request URL looks normal I just compared it to a regular request. Why it returned a datatable map not sure. Maybe it does think there's somewhere a multi period or some other issue. The URL was generated by the UI though and also looks good. Maybe some issue with a plugin or something, not sure.

We can look into it after the Matomo 4 release though.

@diosmosis commented on September 3rd 2020 Member

There are two visualizations, one is sparklines w/ an s, and the other is sparkline. sparkline shows the image, sparklines shows a sparkline + metric data for a set of metrics. I don't think it's currently supported to support multiple periods since then there would be a sparkline & metric for every period.

EDIT: period=day&date=date1,date2 results in a list of periods, not a range, like period=week&date=date1,date2 results in a list of weeks.

@diosmosis commented on September 3rd 2020 Member

I guess we could make the sparklines visualization work when a multi period is used by summing up the datatable\map, but I don't think it natively supports it and I don't think the period selector UI supports clicking through to such a period.

@tsteur commented on September 3rd 2020 Member

If the generated URL is not correct and it's using a multi period, then we'd need to maybe check how the UI would generate this URL as it's maybe a mistake. I'm pretty certain this URL wasn't generated by the user since the request came from our UI.

Not too important right now though.

Powered by GitHub Issue Mirror