Multiple Grouping for a bar chart


I am trying to sum sales by 2 different fields without any success. Can someone guide me how this is done?

I have attached my sample code that I have tried to achieve this:

salesChart= myTabbar.tabs(“t2”).attachChart({
view: “bar”,
value: “#amt#”,
border: true,
if (obj.amt >300) return “#ff9933”;
return “#ff3333”;
title: “Service Type”,
template:“#id#” // have to set it to #id# if using a grouped field here.
title: “Total Amount ($)”,
start: 0,


Could you provide some static data you use to test chart with it?

Hi Darya,

This is the test data that I used to test my chart.

<?xml version='1.0' encoding='iso-8859-1'?> IBM Software 10/11/2014 400.00 IBM PC 10/31/2014 250.00 IBM Servers 10/31/2014 150.00 IBM Tablets 11/11/2014 500.00 IBM Tablets 02/08/2014 100.00 Microsoft Software 10/02/2014 40.00

It seems like locally works fine: you have only 2 IBM/Tablets items to summ, and the are in one bar

Thanks Darya.

I am trying to get a chart that looks like the attached image. How would i do that?

It seems like you need stacked baк chart: … chart.html

Hi Darya,

Yes, it does looks like a stacked bar. But the problem that I am facing is that in the XML data file, I would have to get all the corresponding data and tabulate them before displaying them in a chart. For example, in the 1st bar, it displays that for software, Microsoft sales is $400 and IBM sales is $40. This is stored as such in the xml file.

IBM Software 10/11/2014 400.00 .... .... .... Microsoft Software 10/02/2014 40.00

Can i somehow display them all in the stacked chart?


There are 2 ways in your case:

  1. load data in correct format (to get chart parce or load data its dhx methods)
  2. load data in your format, but then build json, which is correct for parsing chart