Create stacked bar chart with TextValueDataItem

20 views
Skip to first unread message

newbie

unread,
Jul 29, 2013, 4:16:36 AM7/29/13
to tapestry...@googlegroups.com
Hi,
I can create a stacked bar chart using XYDataItem. However, I need the x-axis to be labels, such as Agent A, Agent S etc. I have tried using TextValueDataItem but the bar chart is not showing. How can I create a stacked bar chart with string labels on the x-axis?

newbie

unread,
Jul 29, 2013, 4:47:03 AM7/29/13
to tapestry...@googlegroups.com
Hi,
I forgot to mention that I am using JqPlotBar.

newbie

unread,
Jul 30, 2013, 5:46:06 AM7/30/13
to tapestry...@googlegroups.com
Hi,

I found the solution. I continue using XYDataItem. I then use params parameter to include the option ticks, which would show the label on x-axis.
Here is the code fragment.

JSONObject axes= new JSONObject();
JSONObject xaxis= new JSONObject();
xaxis.put("renderer", new JSONLiteral("jQuery.jqplot.CategoryAxisRenderer"));

JSONArray ticksArray = new JSONArray();
ticksArray.put("Test1");
ticksArray.put("Test2");
xaxis.put("ticks", ticksArray);
axes.put("xaxis", xaxis);
json.put("axes", axes);

options.put("options", json);
return options;

 
 
Reply all
Reply to author
Forward
0 new messages