-1

How can we use chart control in MVC, I need sample code with little coding, just to understand the approach of creating chart controls in MVC, like how to bind data etc.

Tried few samples but not able to understand the approach.

I just tried to use @Html.Chart() in my view but I'm unable to use it.

NOTE: I don't want to use any 3rd party controls.

4

1 回答 1

1

这是我的剃刀视图代码,非常适合我。

@{
        var key = new Chart(width: 300, height: 300)
          .AddTitle("Employee Chart")
          .AddSeries(
              chartType: "Bubble",
              name: "Employee",
              xValue: new[] { "Peter", "Andrew", "Julie", "Dave" },
              yValues: new[] { "2", "7", "5", "3" });     
    }
    <!DOCTYPE html>
    <html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <div> 
            <div>
                @key.Write()
            </div>
        </div>
    </body>
    </html>

注意:此渲染以图像格式响应。

于 2012-09-04T09:18:13.537 回答