0

サーバー側のコードから折れ線グラフを設定すると、グラフは単一の列に表示され、これには適切ではありません。以下のコードを使用します。

Dim chart1 As Highcharts = New Highcharts("chart1")
chart1.InitChart(New Chart() With {
    .PlotShadow = False, 
    .Type = ChartTypes.Spline, 
    .BackgroundColor = New BackColorOrGradient(New Gradient() With { _
        .LinearGradient = {0, 0, 0, 400}, _
        .Stops = New Object(,) {{0, Color.FromArgb(255, 96, 96, 96)}, {1, Color.FromArgb(255, 16, 16, 16)}} _
     })})

chart1.SetTitle(New Title() With {.Text = "<spam style=""color:White;"">Money Utilization Report</spam>"})
Dim series As Series() = New Series(Ds.Tables(0).Rows.Count - 1) {}
Min1 = Ds.Tables(0).Rows(0)(1)
Max1 = Ds.Tables(0).Rows(0)(1)
For i As Integer = 0 To Ds.Tables(0).Rows.Count - 1
    series(i) = New Series() With { _
        .Name = Left(Ds.Tables(0).Rows(i)(0).ToString(), 2), _
        .Data = New Data(New Object() {Ds.Tables(0).Rows(i)(1)})}
    If Min1 > Ds.Tables(0).Rows(i)(1) Then
        Min1 = Ds.Tables(0).Rows(i)(1)
    End If
    If Max1 < Ds.Tables(0).Rows(i)(1) Then
        Max1 = Ds.Tables(0).Rows(i)(1)
    End If
Next
chart1.SetYAxis(New YAxis With {.GridLineWidth = 0, .Title = New YAxisTitle With {.Text = "Percentage"}, .Min = Min1 - 2, .Max = Max1 + 2})
chart1.SetTooltip(New Tooltip() With {.Formatter = "function() { return '<b>'+ this.series.name + ': </b>'+ this.y +' %'; }"})
chart1.SetSeries(series)
ltChart.Text = chart1.ToHtmlString()
4

0 に答える 0