本文介绍了如何更改图表中特定数据点的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

            Chart chart1 = new Chart();
           chart1.Width = 1600;
           chart1.Height = 900;
          
           Series Series1 = new Series();
           Series Series2 = new Series();
            Series1.Name = "Series1";
           

           Series1.ChartType = SeriesChartType.Line;
           Series1.BorderDashStyle = ChartDashStyle.Solid;
           Series1.BorderWidth = 1;
           Series1.ShadowColor = Color.FromArgb(128, 128, 128);
        


            chart1.Series.Add(Series1);

          
  //create chartareas...
            ChartArea ca = new ChartArea();
            ca.Name = "ChartArea1";
            ca.BackColor = Color.White;
            ca.BorderDashStyle = ChartDashStyle.Solid;
            ca.AxisX = new Axis();
            ca.AxisY = new Axis();


             chart1.ChartAreas.Add(ca);
     
   chart1.Series["Series1"].Points.DataBindXY(ds.Tables[0].DefaultView,table8.Columns[0].ColumnName, ds.Tables[0].DefaultView, "plot");

  chart1.ChartAreas[0].AxisY.Minimum = 0;
  chart1.ChartAreas[0].AxisY.Maximum = 1;
  ca.AxisY.IntervalOffset = 0.1;

  chart1.Series(1).Points(0).Color = Color.Red;

//Error
/*
Non-invocable member 'System.Windows.Forms.DataVisualization.Charting.Chart.Series' cannot be used like a method.	
*/

推荐答案

chart1.Series["Series1"].Points[10].Color = System.Drawing.Color.Black;


这篇关于如何更改图表中特定数据点的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 20:49