using ChartDataBindModel

Hello!

I don't understand some features of ChartDataBindModel.

I have a datasource with two value columns ("value1" and "value2"). When I use the code shown below (with the column type chart):

ChartDataBindModel modelTotal = new ChartDataBindModel(chartData, "ReportData");
modelTotal.XName = "index";
modelTotal.YNames = new string[] { "value1", "value2" };

I see on the chart control that values of columns "value1" and "value2" are collided. That's what I want. But as they have the same color I see the maximum value of "value1" and "value2". Can I set separate colors to this two values???

3 Replies

RR Ramya R Syncfusion Team January 24, 2007 02:42 PM UTC

Hi Alexander,

If your intention is to display two columns on the ChartControl using ChartDataBindModel then it can be done by adding another series to the ChartControl and binding the another value(value 2) to YAxis of another instance of ChartDataBindModel.

Kindly take a look at the attached sample.

Let me know if I am wrong in getting your requirement.

Thanks & Regards,
Ramya.


ChartBinding.zip


AL Alexander January 31, 2007 03:44 PM UTC

Thanx you for answer.

But I need the same behaviour as in the attached file.
When two series is placed in the same point on th X axis

untitled33.zip


AD Administrator Syncfusion Team February 2, 2007 01:45 PM UTC

Hi Alexander,

Thank You for the update.

You can display the column charts as in image sent by you by creating series with multiple Y-Values and setting the ColumnWidthMode of ChartControl to FixedWidthMode as shown in the code snippet below,

ChartSeries series = this.chartControl1.Model.NewSeries("Products");
for(int i=0;i {
double x=Convert.ToDouble(dataSet.Tables[0].Rows[i]["ID"].ToString());
double y=Convert.ToDouble(dataSet.Tables[0].Rows[i]["ID"].ToString());

series.Points.Add(x,new double[]{y,10});
}


//Adds the series to the ChartSeriesCollection.
this.chartControl1.Series.Add(series);

ChartSeries series1 = this.chartControl1.Model.NewSeries("Products");
for(int i=0;i {
double x=Convert.ToDouble(dataSet.Tables[0].Rows[i]["ID"].ToString());
double y=Convert.ToDouble(dataSet.Tables[0].Rows[i]["Population"].ToString());

series1.Points.Add(x,new double[]{y,12});

}

//Adds the series to the ChartSeriesCollection.
this.chartControl1.Series.Add(series1);
series1.Style.Interior=new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.ForwardDiagonal,Color.Orange,Color.White);
this.chartControl1.PrimaryXAxis.AutoValueType = true;
this.chartControl1.ColumnWidthMode=ChartColumnWidthMode.FixedWidthMode;

Also kindly take a look at the attached sample.

Let me know whether this helps you.

Thanks & Regards,
Ramya.

ChartBinding0.zip

Loader.
Up arrow icon