C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト


■86344 / )  Re[1]: ChartのX軸のタイトル表示
□投稿者/ shu (1077回)-(2018/01/22(Mon) 10:22:23)
No86333 (mako さん) に返信

サンプルです。

        _tbl = New DataTable()
        With _tbl.Columns
            .Add("t", GetType(DateTime))
            .Add("y", GetType(Integer))
        End With

        With _tbl.Rows
            .Add(Date.Today.AddHours(10).AddMinutes(15), 1)
            .Add(Date.Today.AddHours(10).AddMinutes(20), 2)
            .Add(Date.Today.AddHours(11).AddMinutes(15), 3)
            .Add(Date.Today.AddHours(13).AddMinutes(15), 4)
            .Add(Date.Today.AddHours(13).AddMinutes(20), 5)
        End With

        Chart1.DataSource = _tbl
        With Chart1.ChartAreas(0)
            With .AxisX
                .Minimum = Date.Today.ToOADate
                .Maximum = Date.Today.AddDays(1).ToOADate
                .IntervalType = DataVisualization.Charting.DateTimeIntervalType.Minutes
                .Interval = 30
                With .LabelStyle
                    .IntervalType = DataVisualization.Charting.DateTimeIntervalType.Minutes
                    .Interval = 30
                    .Format = "HH:mm"
                End With
            End With
        End With
        With Chart1.Series(0)
            .XValueMember = "t"
            .YValueMembers = "y"
        End With

返信 編集キー/


管理者用

- Child Tree -