After receiving a helpful suggestion from Gthompson83 about using jqPlot, I am facing a new issue...
The current javascript code on my page (the data is just temporary):
function CreatePie(div) {
var data = [
['Heavy Industry', 12], ['Retail', 9], ['Light Industry', 14],
['Out of home', 16], ['Commuting', 7], ['Orientation', 9]
];
var plot2 = jQuery.jqplot(div, [data],
{
seriesDefaults: {
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Turn off filling of slices.
fill: false,
showDataLabels: true,
// Add a margin to seperate the slices.
sliceMargin: 4,
// stroke the slices with a little thicker line.
lineWidth: 5
}
},
legend: { show: true, location: 'e' }
}
);
}
I trigger the function from the asp.net code-behind page as a startup script, in this manner:
string script = string.Format("CreatePie('{0}')", "chartDiv" + k,);
ClientScript.RegisterStartupScript(GetType(), "pieChart"+k,
"<script>" + script + "</script>");
The single argument passed is the div where the chart will be placed. Now my question is, how can I pass the data variables so they can be inserted into the
data = [[var1, value1], [var2, value2]...]
part of the Javascript code?