DHTMLX Charts

Hi,

I am trying the sample application to create a stacked bar chart.

However, I am facing the error "Expected } ".

The same code is as below

I have the javascripts in their respective places. Kindly let me know about the issue.

Many Thanks,
Prashant Shetty

After some properties you’ve set “;”. Therefore, JS error occurs.

For example:

xAxis: {
title: “Sales per year”,
template: “#year#”
},

instead of:

xAxis: {
title: “Sales per year”,
template: “#year#”;
},

Hi Alexendra,

Many Thanks for the response.

I have got it working.

DHTMLX chart functionality is super cool.

I have a query regarding the group functionality dhmlx chart offers.

group by + sum works fine when data is to be shown for column data of type int.

However, i have to group column B, column C (both string) data based on column A. Do we have something similar to group by “count” functionlity available.

timeInQueue:["#data10#",“count”] instead timeInQueue:["#data10#",“sum”] will work ?

Best Regards,
Prashant Shetty

Adding to the above post

PFB the javascript piece I am using

var dhxWinsParams = {image_path: “imgs/”,
wins: [ {id: “w1”, left: 230, top: 230, width: 420, height: 340}]
};
var dhxWins = new dhtmlXWindows(dhxWinsParams);
var barChart=dhxWins.window(“w1”).attachChart({
view:“bar”,
color:"#66ccff",
gradient:“3d”,
value:"#timeInQueue#",
label:"#timeInQueue#",
sort:{
by:"#data7#"
},
group:{
by:"#data7#",
map:{
originator_grp:["#data7#"],
timeInQueue:[barChart.sum("#data8#")]
}
},
radius:3,
width:30,
origin:0,
yAxis:{},
xAxis:{
template:"#originator_grp#"
},
border:false
});
barChart.clearAll();
barChart.parse(mygrid,“dhtmlxgrid”);
var count = barChart.sum("#students#");

};

I need to get the count of column 8 (field type is string) data grouped by column 7 which is also of type string

Hi,

the problem is not clear enough …

Regarding this “I need to get the count of column 8 (field type is string) data grouped by column 7 which is also of type string” - possibly the following can be used:

chart.group({
by:"#data6#",
map:{
result:["#data7#",“sum”]
}
});

Field result will contain sum.

Also you use use custom functors:
docs.dhtmlx.com/doku.php?id=dhtmlxchart:functor

Hi Alexendra,

Many Thanks for the response.

I used grouping functor to achieve the desired output.

Best regards,
Prashant Shetty

Hi

The below code working fine in Firefox, Chrome. But in IE 8 it’s not working it throws System error: -2146697211. Pls reply me if any one knows…

Hi,

locally the same code works correctly. We have tested sample dhtmlxChart/samples/04_pie_chart/01_init.html in the chart package.

Hi Alexendra,

Thanks for the response. That error occurs because of not included the following file
codebase\thirdparty\excanvas\excanvas.js

Can anyone help me this “stupid” problem?
I just tested dhtmlxChart sample code. With either dhtmlxSuit or dhtmlxChart, I couldn’t get the expected pie chart.

My code:

Pie chart with Automatic radius and center position Pie chart with Custom radius and center position

Hi, helloworld
The issue is the next:

<script src="http://www.dhtmlx.com/docs/products/dhtmlxChart/samples/common/testdata.js"></script>

You are trying to load datasouorce from dhx online samples. Please, use your local file from the next path:
j.scripts/dhtmlxChart/samples/common/testdata.js

Hi Darya, thanks for your reply.
Following your instruction, I still couldn’t get through. I even defined the data in script, but not lucky. see the attached picture. the charts were not drawn.

i wonder if it is related to my web server settings.

my code:


Hello,

There is the same issue as in the beginning of this topic - incorrect JS object as chart configuration. You put semicolon (:wink: after the last property in both objects.

You should use shadow: 0 instead of shadow: 0;
and y: 120 instead of y: 120;

Also there is no need to include excanvas.js library in your page. Chart library will do it automatically. All you need to put thirdparty folder into the same folder as dhtmlxchart.js, like in dhtmlxChart package

Thanks, Alexandra. It fixed the problem.
Btw, I just copied the example.

Thank you for the remark. We will correct the sample.