我想在mvc3 .net c#中将我的图表上的间隔设置为1(使用System.Web.Helpers).
我无法找到图表属性来设置间隔,以便x / yValues显示所有标签.
这里的代码:
我无法找到图表属性来设置间隔,以便x / yValues显示所有标签.
这里的代码:
Chart key = new Chart(width: 600,height: 400) .AddSeries( chartType: "bar",legend: "Rainfall",xValue: xVal,//new[] { "Jan","Feb","Mar","Apr","May" },yValues: yVal ) //new[] { "20","20","40","30","10" }) .AddTitle("Chart Success Rate") .Write("png");
任何帮助都会非常感激.
谢谢.
解决方法
你可以用“主题”字符串来完成它.我已用它测试过了.
看这篇文章:http://forums.asp.net/t/1807781.aspx/1见6楼回复(2012年5月27日上午11:23)
我的测试代码:
public ActionResult GetChartCategoryCountList1() { string temp = @"<Chart> <ChartAreas> <ChartArea Name=""Default"" _Template_=""All""> <AxisY> <LabelStyle Font=""Verdana,12px"" /> </AxisY> <AxisX LineColor=""64,64,64"" Interval=""1""> <LabelStyle Font=""Verdana,12px"" /> </AxisX> </ChartArea> </ChartAreas> </Chart>"; using (var context = new EdiBlogEntities()) { var catCountList = context.GetCategoryCountList().ToList(); var bytes = new Chart(width: 850,height: 400,theme: temp) .AddSeries( xValue: catCountList.Select(p => p.displayName).ToArray(),yValues: catCountList.Select(p => p.PostCount).ToArray() ) .GetBytes("png"); return File(bytes,"image/png"); } }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。