【问题标题】:How to chart multiple Y using html chart helper in Asp.net MVC如何在 Asp.net MVC 中使用 html 图表助手绘制多个 Y
【发布时间】:2015-09-14 12:08:11
【问题描述】:

大家好:我想选择将两个数据库字段绘制在一起。现在这个图表只是现金多年。我还想在同一张图表上绘制“OfficeSupplies”图表。有谁知道这是怎么做到的吗?我试过了: yValues:chartData,yFields:“现金”,“办公用品”); ......但这不起作用。我收到消息:“命名参数规范必须在指定所有固定参数后出现。”关于一次绘制多个事物的任何想法?

谢谢,

鲁本

var chartData = db.FinancialPeriods.SqlQuery("SELECT * FROM FinancialPeriods");

var myChart = new Chart(width: 600, height: 400)
              .AddTitle("Cash Chart")
              .AddSeries(
                  chartType: "Line",
                  //chartType: "Bubble",
                  //name: "Employee",
                  xValue: chartData, xField: "Year",
                  yValues: chartData, yFields: "Cash",
              );

【问题讨论】:

    标签: asp.net-mvc razor


    【解决方案1】:

    你可以这样做

    var myChart = new Chart(width: 600, height: 400)

              .AddTitle("Cash Chart")
              .AddSeries(
                  chartType: "Line",
                  //chartType: "Bubble",
                  //name: "Employee",
                  xValue: chartData, xField: "Year",
                  yValues: chartData, yFields: "Cash",
              );
    
              .AddSeries(
                  chartType: "Line",
                  //chartType: "Bubble",
                  //name: "Employee",
                  xValue: chartData, xField: "Year",
                  yValues: chartData, yFields: "OfficeSupplies",
              );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-05
      • 1970-01-01
      • 2014-12-04
      • 1970-01-01
      • 2011-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多