I initialized the chart with no value, added series one by one, and hide all of them except the first one. I could see the combined result, but error occurred while hiding the series as follows.
Uncaught TypeError: Cannot call method 'hideCanvas' of undefined dhtmlx.js:2076
dhtmlXChart.hideSeries dhtmlx.js:2076
SalesStatsHandler.updateChart SalesStats.js:465
$.ajax.success SalesStats.js:336
c jquery-1.9.1.min.js:3
p.fireWith jquery-1.9.1.min.js:3
k jquery-1.9.1.min.js:5
r
and the code for adding and hiding is as follows:
var seriesIndexAt = {};
var seriesIndex = 0;
for (var i in SalesStatsHandler.columnInfo) {
var series = SalesStatsHandler.columnInfo[i];
if (series.seriesColor)
{
seriesIndexAt[series.id] = seriesIndex;
SalesStatsHandler.chart.addSeries({
value : "#" + series.id + "#",
color : series.color,
});
seriesIndex--;
}
}
_log(seriesIndexAt);
_log(seriesIndex);
SalesStatsHandler.chart.parse(SalesStatsHandler.datasetForChart, "json");
for (i = -1 ; i > seriesIndex ; i--) {
_log(i);
SalesStatsHandler.chart.hideSeries(i);
}
And the color doesn’t seem to work either. dhtmlXChart shows all the colors as orange(FF9900).
Anyone has same issue? Any input will be appreciated.
it seems like hideSeries() needs to be called after the parse() ? I changed my code and got another error.
[code]SalesStatsHandler.chart.seriesIndexAt = {};
var seriesIndex = 0;
for (var i in SalesStatsHandler.columnInfo) {
var series = SalesStatsHandler.columnInfo[i];
for (var i in SalesStatsHandler.chart.seriesIndexAt) {
var seriesIndex = SalesStatsHandler.chart.seriesIndexAt[i];
_log(seriesIndex);
SalesStatsHandler.chart.hideSeries(seriesIndex);
}