1

Microsoft Chart Controlsを使用して株式の進化チャートを作成しています。AxisX ラベルに最初と最後の日付を表示する必要がありますが、表示できません。

私はグーグルで、プロパティを設定するような多くの解決策を見つけました:

Chart1.ChartAreas[0].AxisX.Minimum = InitialDate.ToOADate();
Chart1.ChartAreas[0].AxisX.Maximum = FinalDate.ToOADate();
Chart1.ChartAreas[0].AxisX.LabelStyle.IsEndLabelVisible = true;

同じ違いはありませんでした。助けが必要です!

以下のサンプルでは、​​最初の日付は 2007 年 7 月 26 日で、最後の日付は 2010 年 7 月 26 日でした。これをチャート ラベルに表示する必要があります。他の日付は違いはなく、任意の間隔で表示できます。

代替テキスト http://img826.imageshack.us/img826/6518/evolucaoinvestimento.png

4

2 に答える 2

3
LCharts(iChart).Chart.ChartAreas(0).AxisX.Minimum = MinDate.ToOADate

LCharts(iChart).Chart.ChartAreas(0).AxisX.Maximum = MaxDate.ToOADate

LCharts(iChart).Chart.ChartAreas(0).AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount

'LCharts(iChart).Chart.ChartAreas(0).AxisX.IsMarginVisible = True

LCharts(iChart).Chart.ChartAreas(0).AxisX.LabelStyle.IsEndLabelVisible = True
于 2011-04-19T13:38:12.797 に答える
2

私は方法を得る:

// get the interval in days
double days = (double)((TimeSpan)(FinalDate - InitialDate)).Days;

// the number os labels
double labels = 10.0;

// check if the number of days is bigger than labels
if (days > labels)
{
    // calculate the interval
    double interval = days / labels;
    Chart1.ChartAreas[0].AxisX.Interval = interval;
}
else
{
    // set the interval of 1 day
    Chart1.ChartAreas[0].AxisX.Interval = 1;
}

結果は次のとおりです。

チャート http://img691.imageshack.us/img691/7796/chartimgca42ufcm.png

于 2010-08-02T17:43:43.060 に答える