Razor中带有图表控件/助手的背景图像 [英] Background image with chart control / helper in Razor
本文介绍了Razor中带有图表控件/助手的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MVC5中使用图表助手时,如何为图表设置背景图像?
原始图表控件中有一个Chart.BackImage属性。
帮助程序只是一个很小的子集,还是可以用主题分配它?
when using the chart helper in MVC5, how can I set a background image to the chart? There is a Chart.BackImage Property in the "original" Chart control. Is the helper only a small subset or is there a way to assign it with themes?
推荐答案
使用模板,如下所示:
string template = @"<Chart>
<ChartAreas>
<ChartArea Name=""Default"" BackImage=""/Content/Images/chart.jpg"">
</ChartArea>
</ChartAreas>
</Chart>";
var myChart = new Chart(width: 600, height: 400, theme: template)
.AddTitle("Title")
.AddSeries(
name: "Values",
xValue: new[] { "A", "B", "C", "D", "E" },
yValues: new[] { "1", "2", "3", "4", "5" })
.Write();
您还可以在 BackImage
属性中放置图表
标签:
You can also place the BackImage
attribute in the Chart
tag:
<Chart BackImage=\"/Content/Images/chart.jpg\">...</Chart>
这篇关于Razor中带有图表控件/助手的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文