Open shawafts opened 6 years ago
also facing similar issue
Facing similar issue
Panel data error: TypeError: Cannot read property 'length' of undefined
at t.isMsResolutionNeeded (time_series2.ts:238)
at new t (time_series2.ts:60)
at PieChartCtrl.seriesHandler (piechart_ctrl.js:92)
at Array.map (<anonymous>)
at PieChartCtrl.onDataReceived (piechart_ctrl.js:86)
at o.emit (index.js:129)
at t.emit (emitter.ts:13)
at PieChartCtrl.e.handleQueryResult (metrics_panel_ctrl.ts:297)
at u (angular.js:17051)
at angular.js:17095
Same issue here, using a local PostGreSQL backend on Windows 7 x64 with a query of the form:
SELECT
rating,
COUNT (rating) AS total
FROM myTable
WHERE rating IS NOT NULL
GROUP BY (rating)
Full error looks like:
TypeError: Cannot read property 'length' of undefined
at t.isMsResolutionNeeded (http://localhost:8080/public/build/0.be20b78823b4c9d93a84.js:1:8586)
at new t (http://localhost:8080/public/build/0.be20b78823b4c9d93a84.js:1:5491)
at PieChartCtrl.seriesHandler (http://localhost:8080/public/plugins/grafana-piechart-panel/piechart_ctrl.js:171:26)
at Array.map (<anonymous>)
at PieChartCtrl.onDataReceived (http://localhost:8080/public/plugins/grafana-piechart-panel/piechart_ctrl.js:164:36)
at o.emit (http://localhost:8080/public/build/vendor.ebd7fde2922615864fb4.js:15:520749)
at t.emit (http://localhost:8080/public/build/app.5331f559bd9a1bed9a93.js:1:29217)
at PieChartCtrl.e.handleQueryResult (http://localhost:8080/public/build/0.be20b78823b4c9d93a84.js:7:19860)
at u (http://localhost:8080/public/build/vendor.ebd7fde2922615864fb4.js:43:68722)
at http://localhost:8080/public/build/vendor.ebd7fde2922615864fb4.js:43:69127
Has this been resolved ? OR Is there a workaround? I have a similar query as does @jganseman , connecting grafana with Postgres.
+1
Same error as below:
TypeError: Cannot read property 'length' of undefined
at e.isMsResolutionNeeded (http://10.196.12.26:3000/public/build/app.a4b7f5a163ea89ff6420.js:1:17556)
at new e (http://10.196.12.26:3000/public/build/app.a4b7f5a163ea89ff6420.js:1:14461)
at PieChartCtrl.seriesHandler (http://10.196.12.26:3000/public/plugins/grafana-piechart-panel/piechart_ctrl.js:171:26)
at Array.map (
+1
It appears that the Pie Chart can only handle time series data, if you look at the handler:
this.series = dataList.map(this.seriesHandler.bind(this));
this.data = this.parseSeries(this.series);
this.render(this.data);
}
seriesHandler(seriesData) {
var series = new TimeSeries({
datapoints: seriesData.datapoints,
alias: seriesData.target
});
series.flotpairs = series.getFlotPairs(this.panel.nullPointMode);
return series;
}
It's looking for seriesData.datapoints
, which doesn't appear to exist when using Table as the Format As
option, it probably only works with Format As
Time series (I'm using Postgres instead of Influx, but I assume you have Table Query selected instead of Time Series)
In the case where there are rows and columns returned, there are no datapoints, just seriesData.rows
+1
+1
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.
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.
same issue for "table" format in Clickhouse Grafana data source
This issue literally breaks grafana ui.
@torkelo sorry to bug you - just seems to be a long forgoten issue
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.
I found pie chart only works for time series data too. But this solution will litttlely differ from original requirements.
I think the ultimate solusion is to enable pie chart on general groups-like data,can anyone give some directions?
Query: SELECT top(total, router,10) FROM (SELECT sum("value") as total FROM "autogen"."sessions" WHERE $timeFilter GROUP BY "router") Format As: Table
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.