Hello,
i have used the DHTMLX3 -designer to build an application, with different cells, with an grid in cell a and an chart in cell b.
I am using the example from docs.dhtmlx.com/doku.php?id=dhtm … ntegration , which seems to work with data from an xml-file, but i am using a json-file which contains my data.
I am using the following layout
var main_layout = new dhtmlXLayoutObject(document.body, ‘4H’);
and a grid like the following:
var a = main_layout.cells('a');
var grid_2 = a.attachGrid();
grid_2.setIconsPath('./codebase/imgs/');
grid_2.setHeader([“Datum”,“item1”,“Term1”]);
grid_2.setColTypes(“ro,ro,ro”);
grid_2.setColSorting(‘date,int,str’);
grid_2.setColumnIds(‘year,item1,Term1’);
grid_2.attachHeader("#text_filter,#text_filter,#text_filter");
grid_2.init();
grid_2.load(“data/testdata.js”,refresh_Chart(),‘js’);
grid_2.attachEvent(“onHeaderClick”,function(stage){
if (stage == 2)
refresh_chart();
return true;
});
a chart like the following:
var chart_2 = c.attachChart({
view: ‘bar’ ,
tooltip:’#item1#’,
legend:{“template”:"#year#",“marker”:{“type”:“square”,“width”:25,“height”:15}},
gradient: false,
value:’#item1#’
});
chart_2.load("data/testdata5.js", 'json');
and the function refresh_chart from the example:
function refresh_chart(){
chart_2.clearAll();
chart_2.parse(grid_2,“dhtmlxgrid”);
};
When i have filtered the data in the grid and klick on the header of the grid, the chart_ 2 is cleared and i get a line from the x-axis and a number of colored legend marker which are labelled as undefined.
I don´t know, where the problem is originated.
Perhaps it is because the example uses div-objects in html for showing the grid and and the chart and i am using an dhtmlXLayoutObject or if it is a problem with the parsing of the data from grid to chart.
I guess my problem is within the "chart_2.parse(grid_2,“dhtmlxgrid”); ", but i am not sure
I have to parse an object to the chart, that the chart recognized. When i looked into the objects, which can be parsed to an chart-object, i have not found any examples for parsing data from an grid-object.
Is there anywhere an example like the above docs.dhtmlx.com/doku.php?id=dhtm … ntegration
but only with an json data source instead of an XML-Datasource ?
Thanks for looking at my problem.