【发布时间】:2018-01-01 09:52:10
【问题描述】:
我有一个 MVC 应用程序,我试图在其上显示一个圆环图。它使用下面的代码完美地工作,除了我找不到让图表标签显示在图表之外的方法
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");
}
从我的代码中可以看出,我正在使用 XML 对图表进行主题化,但我没有发现任何看起来可能有助于标签定位的东西。
上图问题不大,但是当显示超过2个字段时,标签全部重叠:
有人知道如何更改标签的位置吗?还有为什么图表标题看起来都很模糊的奖励积分? :)
【问题讨论】:
标签: c# asp.net asp.net-mvc model-view-controller charts