Holy cow data binding is freakn'' hard

Evaluation copy of 5.1 - I am trying to bind data from a dataset and its freakn' confusing the hell out of me.

I am following this sample to a "T"
http://websamples.syncfusion.com/docs/chart/ug/DataBinding.html

WHAT IS THE "TRICK" to get this to work!?!?!

DataSet set = new DataSet();

SqlDataAdapter sa = new SqlDataAdapter(cmd);
sa.Fill(set, "Projects");

ChartDataBindModel model = null;

ChartDataBindAxisLabelModel xAxisLabelModel = null;

model = new ChartDataBindModel(set, "Projects");

// The column that contains the X values.

model.XName = "ID";

// The columns that contain the Y values.

model.YNames = new string[] { "Population" };

ChartSeries series = this.ChartWebControl1.Model.NewSeries("Data Bound Series");
series.Text = series.Name;
series.SeriesModelImpl = model;

series.Style.TextColor = System.Drawing.Color.White;
series.Style.Font.Bold = true;

this.ChartWebControl1.Series.Add(series);

xAxisLabelModel = new ChartDataBindAxisLabelModel(set, "Projects");

// The columns that has the label values for the corresponding X values.

xAxisLabelModel.LabelName = "City";

ChartWebControl1.PrimaryXAxis.LabelsImpl = xAxisLabelModel;
ChartWebControl1.PrimaryXAxis.ValueType = ChartValueType.Custom;

wtf.zip

1 Reply

SS Suresh Sekarean Syncfusion Team September 25, 2007 04:44 PM UTC

Hi Rudy,

Based on the screenshot, Please check the LabelName property of ChartDataBindModel. This property should be set with the column name of the DataTable.

Please refer our Browser sample which illustrates the Microsoft Access Databinding in the below location,

Essential Chart -> Importing ->Data From DataBase

Online -http://www2.syncfusion.com//syncfusion/infrastructure/samplebrowserasp/samples.aspx?version=2_0

Kindly provide us with the sample project if you still facing this issue.

Thanks for using Syncfusion products.

Thanks,
Sureshsekaran.

Loader.
Up arrow icon