I’m trying to create a chart out of grid.
I want to connect the label of the chart the first column of my grid. This is a combo.
Therefor I used the following code:
In this case the chart displays the label as the value of the combo (in our case the ID), but I want to display the combo text in the chart. Is there a possibility for this?
In this case, you will need to use dhtmlxCombo API to get an option label by value. And getColumnCombo(columnIndex) returns combo object. So, the “regtype” template in “map” can be like so:
If combo options are loaded async (loadXML or source attribute in “combo” column), the grid and chart will be initialized before combo options are loaded. Therefore, combo.getOption(obj.data0) may return null.
You may try to use something like so if grid columns are configured in xml:
tree.loadXML(url,function(){
var combo = tree.getColumnCombo(0);
combo.attachEvent("onXLE",function(){
pieChart.clearAll();
pieChart.parse(tree,"dhtmlxgrid");
})
});
In this case chart data will set after combo is loaded.
The chart is created after a click on the chart button in a toolbar.
So in that case the combo must be finished loading. I tried your approach with a alert, but the alert is never called.
we need the complete demo (without libs) to recreate the problem locally. If the combo is loaded before chart init, the method works fine (we tested this approach)
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan