我使用C#製圖,X軸爲日期,Y軸爲雙精度。即使Y軸沒有點,我也希望X軸仍然有一個日期。現在我正在使用:DataVisualization.Charting空的點
series.Points.Add(new DataPoint(0, 0) { IsEmpty = true });
我也設置間隔和數字顯示間隔有多遠,但我需要它顯示日期。
我使用C#製圖,X軸爲日期,Y軸爲雙精度。即使Y軸沒有點,我也希望X軸仍然有一個日期。現在我正在使用:DataVisualization.Charting空的點
series.Points.Add(new DataPoint(0, 0) { IsEmpty = true });
我也設置間隔和數字顯示間隔有多遠,但我需要它顯示日期。
無需與0
其添加值的點。您可以將DataPoints
加上您想要的日期作爲X-Values
。該IsEmpty屬性將做您分配它在Custom Properties ...做的事:
更改空點外觀
變化繪製空點的使用適用的系列圖表 類型的可視化表示。 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」;
「C#圖表」究竟是什麼?你的意思是「.NET Charting」嗎? C#沒有圖表功能,但.NET有幾個。你指哪一個? –
我編輯過你的標題。請參閱:「[應該在其標題中包含」標籤「](http://meta.stackexchange.com/questions/19190/)」,其中的共識是「不,他們不應該」。 –