This question is a little long-winded, but essentially I want to modify a pie chart in jquery that was created using the struts jquery plugin.
I have a pie chart that i created using the struts jquery plugin chart module –>> http://code.google.com/p/struts2-jquery/wiki/ChartTag
This module is not as robust as the pure jquery implementation. What i want to do is add a threshold and maybe the hover/click events. There does not seem to be a way to add these to the struts jquery module. Is there a way to use jquery to update the chart after it’s already been created?
Here’s my code:
<sjc:chart
id="chartPie2"
cssStyle="width: 100%; height: 400px;"
legendShow="true"
pie="true"
pieLabel="true"
>
<s:iterator value="%{mapFromStrutsAction}">
<sjc:chartData
label="%{key} - %{formatCurrency(value)}"
data="%{value}"
/>
</s:iterator>
</sjc:chart>
What i want to do is somehow take this chart that’s created and modify it. As I mentioned, there are things in the jquery implementation that don’t seem to be available in the struts jquery plugin, like thresholds, combining slices, and hover/click effects (as found here –> http://people.iola.dk/olau/flot/examples/pie.html).
Here is my attempt, placed after the code above inside a block, which does not seem to really seem to change anything:
// INTERACTIVE
$.plot($("#chartPie2"),
{
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
},
threshold: 0.1
}
}
},
legend: {
show: false
}
});
});
Is it possible to modify the chart in this way after it was created?
What happens if you try setting just the stuff you want via raw jQuery after the custom tag does its work?
If that doesn’t work, then probably not. IMO the tags are for the simplest use-cases only; anything going beyond that you’re better off just coding JavaScript/jQuery.
Another option is to just branch the plugin or individual tag, patch it to do what you want, then offer the patch back to the community so others can benefit.