c# - MVC System.Web.Helpers Doughnut chart label positioning -
i have mvc app i'm trying display doughnut chart on. working using below code, except cannot find way chart labels display outside of chart
private static void createchart(int width, int height, arraylist xdata, arraylist ydata, string title = "") { string mytheme = @"<chart backcolor=""transparent"" antialiasing=""all"" > <chartareas> <chartarea name=""default"" backcolor=""transparent""> <axisy> <labelstyle forecolor=""#ffffff"" font=""helvetica neue, 20 px"" /> </axisy> </chartarea> </chartareas> <legends> <legend _template_=""all"" backcolor=""transparent"" font=""trebuchet ms, 18.25pt, style=bold"" istextautofit=""false"" /> </legends> </chart>"; new system.web.helpers.chart(width: width, height: height, theme: mytheme) .addseries("default", charttype: "doughnut", xvalue: xdata, yvalues: ydata) .addtitle(title) .write("png"); }
as can see code, theming chart using xml, have not found looks might positioning of labels.
it's not of issue on above chart, when displaying more 2 fields, labels overlap:
does know how change position of labels? bonus points why chart titles appearing fuzzy? :)
use custom property pielabelstyle
avoid overlapping. fuzzy title, there's garbage in theme. clean up. see below:
string mytheme = @"<chart> <chartareas> <chartarea name=""default""> </chartarea> </chartareas> <series> <series name=""default"" customproperties=""pielabelstyle = outside"" label=""very long label (#val)""></series> </series> <titles> <title name=""default""></title> </titles> </chart>";
Comments
Post a Comment