1

X 軸に DateTime 値 (hh:mm:ss) がある Windows フォームでグラフを作成しました。グラフの特定の値に固定線を追加したいと考えています。たとえば、グリッドに X = 07:00:00 の線を追加します。これは可能ですか?そのような行を複数入れることはできますか?

4

2 に答える 2

0

StripLine適切に構成されたオブジェクトを右軸に追加することで、おそらく目標を達成できます。チャート コントロールのすべての機能の使用方法の詳細について は、MS Chart Winsamplesを参照してください。

于 2012-10-10T15:05:11.533 に答える
0

Dominique のおかげで、私はいくつかの StripLine の例を探し回り、最終的にこれが私が使用したコードです:

StripLine stripLine = new StripLine();
// highlight a strip of 8 hours in the X axis
stripLine.StripWidth = 8;
stripLine.StripWidthType = DateTimeIntervalType.Hours;
stripLine.BackColor = System.Drawing.Color.PapayaWhip;
stripLine.BorderColor = System.Drawing.Color.LightSeaGreen;
stripLine.BorderWidth = 2;
// start the highlighting 7 hours in (from 07:00 to 15:00)
stripLine.IntervalOffset = 7;
stripLine.IntervalOffsetType = DateTimeIntervalType.Hours;
// repeat this strip every 1 day
stripLine.Interval = 1;
stripLine.IntervalType = DateTimeIntervalType.Days;
this.TopOfBookChart.ChartAreas[0].AxisX.StripLines.Add(stripLine);

それを使って、次のグラフを作成しました。

ここで別の (より単純な) 例を見つけることができます: Win Form Charting Question

于 2012-10-11T13:17:03.107 に答える