Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 ASP MVC3图表(向后退一步)?_Asp.net Mvc 3_Charts - Fatal编程技术网

Asp.net mvc 3 ASP MVC3图表(向后退一步)?

Asp.net mvc 3 ASP MVC3图表(向后退一步)?,asp.net-mvc-3,charts,Asp.net Mvc 3,Charts,我试图在MVC 3中使用图表,并从默认的图表主题中进行辅助,前提是指定主题似乎更难。不再有办法编辑图表区域或访问许多强类型属性(图表区域的参数类型只是一个字符串) 以前,您可以这样做: 老路 ChartArea area = new ChartArea { BackColor = Color.Transparent, AxisX = new Axis { Interval = 7, IntervalType = Da

我试图在MVC 3中使用图表,并从默认的图表主题中进行辅助,前提是指定主题似乎更难。不再有办法编辑图表区域或访问许多强类型属性(图表区域的参数类型只是一个字符串)

以前,您可以这样做:

老路

    ChartArea area = new ChartArea {
        BackColor = Color.Transparent,
        AxisX = new Axis {
          Interval = 7,
          IntervalType = DateTimeIntervalType.Days,
          IsMarginVisible = false,
          LabelStyle = new LabelStyle { ForeColor = Color.FromArgb(255, 128, 128, 128), Font = new Font("Arial", 10, FontStyle.Regular), Format = "MMM dd" },
          LineColor = Color.FromArgb(255, 208, 208, 208),
          MajorGrid = new Grid { LineColor = Color.FromArgb(255, 242, 242, 242), LineDashStyle = ChartDashStyle.Solid },
          MajorTickMark = new TickMark { LineColor = Color.Transparent, Size = 4.8f }
        },
        AxisY = new Axis {
          IntervalAutoMode = IntervalAutoMode.VariableCount,
          LabelStyle = new LabelStyle { ForeColor = Color.FromArgb(255, 128, 128, 128), Font = new Font("Arial", 10, FontStyle.Regular) },
          LineColor = Color.Transparent,
          MajorGrid = new Grid { LineColor = Color.FromArgb(255, 242, 242, 242), LineDashStyle = ChartDashStyle.Solid },
          MajorTickMark = new TickMark { LineColor = Color.Transparent, Size = 0.8f }
        },
        Position = new ElementPosition { Height = 90, Width = 99, X = 0, Y = 10 }
      };
Chart chart = new Chart(width: 400, height: 200, theme: ChartTheme.Yellow)
                .AddSeries(
                    chartType: "line",
                    xValue: dates.ToArray(),
                    yValues: data.ToArray(),
                    chartArea: someString)
新方式

    ChartArea area = new ChartArea {
        BackColor = Color.Transparent,
        AxisX = new Axis {
          Interval = 7,
          IntervalType = DateTimeIntervalType.Days,
          IsMarginVisible = false,
          LabelStyle = new LabelStyle { ForeColor = Color.FromArgb(255, 128, 128, 128), Font = new Font("Arial", 10, FontStyle.Regular), Format = "MMM dd" },
          LineColor = Color.FromArgb(255, 208, 208, 208),
          MajorGrid = new Grid { LineColor = Color.FromArgb(255, 242, 242, 242), LineDashStyle = ChartDashStyle.Solid },
          MajorTickMark = new TickMark { LineColor = Color.Transparent, Size = 4.8f }
        },
        AxisY = new Axis {
          IntervalAutoMode = IntervalAutoMode.VariableCount,
          LabelStyle = new LabelStyle { ForeColor = Color.FromArgb(255, 128, 128, 128), Font = new Font("Arial", 10, FontStyle.Regular) },
          LineColor = Color.Transparent,
          MajorGrid = new Grid { LineColor = Color.FromArgb(255, 242, 242, 242), LineDashStyle = ChartDashStyle.Solid },
          MajorTickMark = new TickMark { LineColor = Color.Transparent, Size = 0.8f }
        },
        Position = new ElementPosition { Height = 90, Width = 99, X = 0, Y = 10 }
      };
Chart chart = new Chart(width: 400, height: 200, theme: ChartTheme.Yellow)
                .AddSeries(
                    chartType: "line",
                    xValue: dates.ToArray(),
                    yValues: data.ToArray(),
                    chartArea: someString)
图表区域数据现在只是一个字符串,图表主题是一个字符串,并且有一些默认值


这似乎是一个巨大的倒退?我遗漏了一些基本的东西吗?

不,图表助手非常弱。但是,您仍然可以使用数据可视化包以旧的方式进行操作。当然,这个包的文档记录非常糟糕

我同意图表助手是非常基本的。 邓达斯图表提供了更好的做事方式

微软于2007年4月收购了Dundas数据可视化知识产权,并从那时起将该技术集成到不同的微软产品中

这些仍然发送图像
更好的选择是基于javascript构建的HighCharts。

我想你会发现默认主题就是这样。您仍然可以通过替换自己的chartarea xml来覆盖样式设置。看看图表主题参考