asp.net - Chart.js . ASP . Legend Template -
i have looked everywhere answer this. more likely, simple , stupid people wouldn't run it. new using javascript/jquery, , work in .net ... c# , web apps.
my question follows.
i using chart.js draw donut chart in asp web application. works fine. when go set options legend, not recognize few values, i'm assuming defined in chart.js file.
name.tolowercase()
segements.length.. ect. . . states "unknown entity"
here line:
legendtemplate: <%=name.tolowercase()%>-legend\"><% (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillcolor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
note : when use standard html file, works fine.
i'm assuming it's because of '<%' need escaped or something, due them being used in server-side code-behind.
any appreciated.
try
legendtemplate: '<%="<:=name.tolowercase():>-legend\"><: (var i=0; i<segments.length; i++){:><li><span style=\"background-color:<:=segments[i].fillcolor:>\"></span><:if(segments[i].label){:><:=segments[i].label:><:}:></li><:}:></ul>".replace(":", "%")%>'
Comments
Post a Comment