score:0

you can build the legendtemplate first in your server side script block

string serversidelegendtemplate = "<ul class=\"";
serversidelegendtemplate += name.tolowercase();
serversidelegendtemplate += "-legend\" style=\"list-style:none;font-family:hp simplified;\">";

for (var i=0; i<segments.length; i++) {
...

and then simply print out the legendtemplate

mydoughnutchart = new chart(ctx).doughnut(data, {
     legendtemplate: "<%=serversidelegendtemplate%>"
});

this will make it clearer and easier to figure out why the variable can't be resolved (you could have defined it in a separate scope).


Related Query

More Query from same tag