Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.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 ASP.NET MVC+;图表控件_Asp.net Mvc - Fatal编程技术网

Asp.net mvc ASP.NET MVC+;图表控件

Asp.net mvc ASP.NET MVC+;图表控件,asp.net-mvc,Asp.net Mvc,我似乎无法在这张图表中找到传奇人物 public ActionResult ServerityGraphicalSummaryReport() { Chart chart = new Chart(); chart.Height = 296; chart.Width = 412; chart.ImageType = ChartImageType.Png; chart.Palette = ChartColorP

我似乎无法在这张图表中找到传奇人物

 public ActionResult ServerityGraphicalSummaryReport()
    {
        Chart chart = new Chart();
        chart.Height = 296;
        chart.Width = 412;
        chart.ImageType = ChartImageType.Png;
        chart.Palette = ChartColorPalette.Excel;
        chart.BackColor = Color.White;
        chart.RenderType = RenderType.BinaryStreaming;
        chart.AntiAliasing = AntiAliasingStyles.All;
        chart.TextAntiAliasingQuality = TextAntiAliasingQuality.Normal;

        Series series1 = chart.Series.Add("Series1");
        series1.ChartType = SeriesChartType.Column;
        series1.YValueType = ChartValueType.Int32;

        foreach(var item in new DataAccess.MaterialIncidentRepository().GetItems())
        {
            if (item.Incident.Serverities.Count > 0)
            {
                string legendText = item.Incident.Supplier.Name;
                Double dataValue = (double)item.Incident.Serverities[0].Score;
                DataPoint point = new DataPoint();
                point.LegendText = legendText;
                point.SetCustomProperty("LegendText", legendText);
                point.YValues = new double[] { dataValue };
                series1.Points.Add(point);
            };
        }

        ChartArea chartArea = chart.ChartAreas.Add("Default");
        chartArea.BackColor = Color.Transparent;
        chartArea.BorderColor = Color.LightBlue;
        chartArea.AxisX.IsMarginVisible = true;
        chartArea.Area3DStyle.Enable3D = false;

        MemoryStream ms = new MemoryStream();
        chart.SaveImage(ms);
        return File(ms.GetBuffer(), @"image/png");
    }

必须在点上设置AxisLabel