格式化Razor网页折线图

时间:2019-05-24 00:57:05

标签: asp.net razor charts asp.net-webpages

我正在测试如何在ASP.NET中使用Razor填充折线图。该图是准确的,但格式并不是我真正想要的。这些特定图形的主要问题是它们的绘制线确实很细。如何设置此图形的格式,特别是绘图线的权重?

这对我不起作用,因为Series不是System.Web.Helpers.Chart类的属性:

chart1.Series["Default"].BorderWidth = 2;

ContentPage.cshtml:

@{
    var myChart = new Chart(width: 1000, height: 1000, theme: ChartTheme.Vanilla)
        .AddTitle(typeof(Chart).ToString())
        .AddSeries(
            name: "Employee", chartType: "Area",
            xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave" },
            yValues: new[] { "2", "6", "4", "5", "3" }
            )
        .AddSeries(
            name: "Employee2", chartType: "Area",
            yValues: new[] { "7", "4", "10", "10", "1" })
        .Write();
}

html文件:

<!DOCTYPE html>
<html>
<head>
    <title>Chart Example</title>
</head>
<style>
    img {
        width: 100%;
        height: 100%;
        position: center;
    }
</style>
<body>
    <p><img src="ContentPage.cshtml" /> </p>
</body>
</html>

0 个答案:

没有答案