作成日: 2019/05/24 最終更新日: 2019/05/24
文書種別
使用方法
詳細
C1CompositeChartのデータをVB.NET/C#のコード上で設定および変更する場合のサンプルコードを紹介します。
◎サンプルコード(VB)
◎サンプルコード(C#)
◎サンプルコード(VB)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then Return
'グラフの初期データを設定
C1CompositeChart1.SeriesList.Clear()
Dim series0 As C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries = New C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries
series0.Label = "Product Stock"
series0.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Column
Dim xVal0() As String = New String() {"Wheat", "Rice", "Tea", "Coffee", "Meat"}
Dim yVal0() As Double = New Double() {200, 150, 100, 300, 250}
series0.Data.X.AddRange(xVal0)
series0.Data.Y.AddRange(yVal0)
C1CompositeChart1.SeriesList.Add(series0)
Dim series1 As C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries = New C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries
series1.Label = "Product Sales"
series1.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Line
Dim xVal1() As String = New String() {"Wheat", "Rice", "Tea", "Coffee", "Meat"}
Dim yVal1() As Double = New Double() {1000, 700, 550, 980, 1200}
series1.Data.X.AddRange(xVal1)
series1.Data.Y.AddRange(yVal1)
C1CompositeChart1.SeriesList.Add(series1)
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'グラフのデータを変更する
C1CompositeChart1.SeriesList(0).Data.X.Values(1).StringValue = "Sugar"
C1CompositeChart1.SeriesList(0).Data.Y.Values(1).DoubleValue = 50
C1CompositeChart1.SeriesList(1).Data.X.Values(1).StringValue = "Sugar"
C1CompositeChart1.SeriesList(1).Data.Y.Values(1).DoubleValue = 400
End Sub
If IsPostBack Then Return
'グラフの初期データを設定
C1CompositeChart1.SeriesList.Clear()
Dim series0 As C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries = New C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries
series0.Label = "Product Stock"
series0.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Column
Dim xVal0() As String = New String() {"Wheat", "Rice", "Tea", "Coffee", "Meat"}
Dim yVal0() As Double = New Double() {200, 150, 100, 300, 250}
series0.Data.X.AddRange(xVal0)
series0.Data.Y.AddRange(yVal0)
C1CompositeChart1.SeriesList.Add(series0)
Dim series1 As C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries = New C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries
series1.Label = "Product Sales"
series1.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Line
Dim xVal1() As String = New String() {"Wheat", "Rice", "Tea", "Coffee", "Meat"}
Dim yVal1() As Double = New Double() {1000, 700, 550, 980, 1200}
series1.Data.X.AddRange(xVal1)
series1.Data.Y.AddRange(yVal1)
C1CompositeChart1.SeriesList.Add(series1)
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'グラフのデータを変更する
C1CompositeChart1.SeriesList(0).Data.X.Values(1).StringValue = "Sugar"
C1CompositeChart1.SeriesList(0).Data.Y.Values(1).DoubleValue = 50
C1CompositeChart1.SeriesList(1).Data.X.Values(1).StringValue = "Sugar"
C1CompositeChart1.SeriesList(1).Data.Y.Values(1).DoubleValue = 400
End Sub
◎サンプルコード(C#)
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
// グラフの初期データを設定
C1CompositeChart1.SeriesList.Clear();
C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries series0 = new C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries();
series0.Label = "Product Stock";
series0.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Column;
string[] xVal0 = new string[] { "Wheat", "Rice", "Tea", "Coffee", "Meat" };
double[] yVal0 = new double[] { 200, 150, 100, 300, 250 };
series0.Data.X.AddRange(xVal0);
series0.Data.Y.AddRange(yVal0);
C1CompositeChart1.SeriesList.Add(series0);
C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries series1 = new C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries();
series1.Label = "Product Sales";
series1.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Line;
string[] xVal1 = new string[] { "Wheat", "Rice", "Tea", "Coffee", "Meat" };
double[] yVal1 = new double[] { 1000, 700, 550, 980, 1200 };
series1.Data.X.AddRange(xVal1);
series1.Data.Y.AddRange(yVal1);
C1CompositeChart1.SeriesList.Add(series1);
}
protected void Button1_Click(object sender, EventArgs e)
{
// グラフのデータを変更する
C1CompositeChart1.SeriesList[0].Data.X.Values[1].StringValue = "Sugar";
C1CompositeChart1.SeriesList[0].Data.Y.Values[1].DoubleValue = 50;
C1CompositeChart1.SeriesList[1].Data.X.Values[1].StringValue = "Sugar";
C1CompositeChart1.SeriesList[1].Data.Y.Values[1].DoubleValue = 400;
}
{
if (IsPostBack) return;
// グラフの初期データを設定
C1CompositeChart1.SeriesList.Clear();
C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries series0 = new C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries();
series0.Label = "Product Stock";
series0.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Column;
string[] xVal0 = new string[] { "Wheat", "Rice", "Tea", "Coffee", "Meat" };
double[] yVal0 = new double[] { 200, 150, 100, 300, 250 };
series0.Data.X.AddRange(xVal0);
series0.Data.Y.AddRange(yVal0);
C1CompositeChart1.SeriesList.Add(series0);
C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries series1 = new C1.Web.Wijmo.Controls.C1Chart.CompositeChartSeries();
series1.Label = "Product Sales";
series1.Type = C1.Web.Wijmo.Controls.C1Chart.ChartSeriesType.Line;
string[] xVal1 = new string[] { "Wheat", "Rice", "Tea", "Coffee", "Meat" };
double[] yVal1 = new double[] { 1000, 700, 550, 980, 1200 };
series1.Data.X.AddRange(xVal1);
series1.Data.Y.AddRange(yVal1);
C1CompositeChart1.SeriesList.Add(series1);
}
protected void Button1_Click(object sender, EventArgs e)
{
// グラフのデータを変更する
C1CompositeChart1.SeriesList[0].Data.X.Values[1].StringValue = "Sugar";
C1CompositeChart1.SeriesList[0].Data.Y.Values[1].DoubleValue = 50;
C1CompositeChart1.SeriesList[1].Data.X.Values[1].StringValue = "Sugar";
C1CompositeChart1.SeriesList[1].Data.Y.Values[1].DoubleValue = 400;
}
旧文書番号
83999