piechart-panel: Cannot read property 'length' of undefined (influxdb)

Query: SELECT top(total, router,10) FROM (SELECT sum(“value”) as total FROM “autogen”.“sessions” WHERE $timeFilter GROUP BY “router”) Format As: Table

TypeError: Cannot read property ‘length’ of undefined at a.isMsResolutionNeeded (http://192.168.75.40/public/app/boot.8fcdddf2.js:29:26428) at new a (http://192.168.75.40/public/app/boot.8fcdddf2.js:29:23352) at PieChartCtrl.seriesHandler (http://192.168.75.40/public/plugins/grafana-piechart-panel/piechart_ctrl.js?bust=1512049737347:168:26) at Array.map (<anonymous>) at PieChartCtrl.onDataReceived (http://192.168.75.40/public/plugins/grafana-piechart-panel/piechart_ctrl.js?bust=1512049737347:161:36) at f.emit (http://192.168.75.40/public/app/boot.8fcdddf2.js:62:13409) at a.emit (http://192.168.75.40/public/app/boot.8fcdddf2.js:62:15727) at PieChartCtrl.b.handleQueryResult (http://192.168.75.40/public/app/boot.8fcdddf2.js:56:15010) at i (http://192.168.75.40/public/app/boot.8fcdddf2.js:52:15288) at http://192.168.75.40/public/app/boot.8fcdddf2.js:52:15710

If I change the format as time series, it only displays one type of value where as the actual response contains more. The same query works fine if the panel is of type Table.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 1
  • Comments: 15

Most upvoted comments

I had this issue with elastic query and solved it by performing the first group-by on my field and then another group by on date histogram. probably not a good solution for everyone.

The workaround I used was to use Format As: Time Series, name your fields according to what the plugin expects, then insert a dummy time_sec field using now():

SELECT
    UNIX_TIMESTAMP(NOW()) AS time_sec,
    ifnull(some_field, 'unknown') as metric,
    COUNT(some_other_field) as value
FROM
    ...

The ifnull() and COUNT() are just for color in this example.