DataVisualization.Charting空点

时间:2013-11-24 10:57:25

标签: c# charts

我使用C#Charting,X轴为日期,Y轴为双打。我希望即使Y轴没有一个点,X轴仍然有一个日期。现在我正在使用:

series.Points.Add(new DataPoint(0, 0) { IsEmpty = true });

我也设置间隔,数字显示间隔有多远,但我需要它来显示日期。

Charts

1 个答案:

答案 0 :(得分:0)

无需添加0作为其值的那些点。您可以将DataPoints与所需日期添加为X-ValuesIsEmpty属性仍会执行您在Custom Properties中指定要执行的操作..:

  

更改空点外观

     

更改适用的绘制空点的直观表示   使用Series.EmptyPointStyle属性的图表类型。该   EmptyPointValue自定义属性可用于将空点视为   零,或者作为它们左右两点的平均值。   有关自定义属性的详细信息,请参阅自定义属性。

     

以下代码演示了如何使用Series.EmptyPointStyle   属性。

     

//显示标记(红叉)而不是第一个系列的行。   Chart1.Series [" Series1"]。EmptyPointStyle.BorderWidth = 1;   Chart1.Series [" Series1"]。EmptyPointStyle.BorderColor = Color.Black;   Chart1.Series [" Series1"]。EmptyPointStyle.MarkerColor = Color.Red;   Chart1.Series [" Series1"]。EmptyPointStyle.MarkerSize = 15;   Chart1.Series [" Series1"]。EmptyPointStyle.MarkerStyle =   MarkerStyle.Cross;

     

//将第二个系列的空点显示为细虚线(视为   平均)。 Chart1.Series [" Series2"]。EmptyPointStyle.BorderStyle =   ChartDashStyle.DashDotDot;   Chart1.Series [" Series2"]。EmptyPointStyle.MarkerColor =   Color.FromArgb(64,64,64);

     

//使用。将第三个系列的空点视为零   EmptyPointValue自定义属性。   Chart1.Series [" Series3"]。EmptyPointStyle.BorderWidth = 1;   Chart1.Series [" Series3"]。EmptyPointStyle.MarkerColor =   Color.FromArgb(0,192,0);   Chart1.Series [" Series3"]。EmptyPointStyle.CustomProperties =   " EmptyPointValue = Zero&#34 ;;