By using struts 2 jQuery plugin ....
I am trying to create a Pie Chart which gets its data dynamically via json.
Is it possible?
All samples mentioned in http://struts.jgeppert.com/struts2-jquery-showcase/index.action and as long as I searched, are using s:iterator
or static data.
Here is my codes:
@Action(value = "json-chart-data", results = {
@Result(name = "success", type = "json")
})
public String execute()
{
myData = new TreeMap<>();
myData.put("a", 11);
myData.put("b", 12);
myData.put("b", 13);
return SUCCESS;
}
And the jsp:
<s:url id="chartDataUrl" action="json-chart-data" />
<sjc:chart id="chartAjax"
pie="true"
pieLabel="true"
cssStyle="width: 600px; height: 400px;" >
<sjc:chartData
id="chartAjaxData"
href="%{chartDataUrl}"
//Here we need to set list,data and label!
/>
</sjc:chart>
The tag is working and an json result is turned back. But the pie is not displayed.
The cjc:chartData
has list
, data
, and label
properties which needs to be set. I try different values but no luck.