4

I need to show the data columns in multiple column chart, I have used single column charts, but I cant find the way to bind another Y-Axis column to the chart

I have data in following format

Name      DataField-1    DataField-2
Emp-a     200               220
Emp-b     150               250 
2
  • what is chtStudentResult here ? Commented Jul 26, 2012 at 9:03
  • It`s <asp:chart id="chtStudentResult" ...> tag. Commented Sep 21, 2012 at 11:50

2 Answers 2

3

I have found the following link useful for the problem.
http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx

If any one have better suggestion than this please post.

Find another solution like following..

double[] array1 = { 2.8, 4.4, 6.5, 8.3, 3.6, 5.6, 7.3 };
double[] array2 = { 2.0, 4.0, 6.1, 7.8, 2.5, 5.0, 6.2 };

chart1.Series.Add("Series1");
chtStudentResult.Series["Series1"].Points.DataBindY(array1);
chtStudentResult.Series.Add("Series2");
chtStudentResult.Series["Series2"].Points.DataBindY(array2);

It will generate the desired multiple column, column chart. enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

It's very easy.

  1. You just go to your properties of Chart control. There is a property called series.

  2. Click on that and give the two series you need to show in the Chart. Eg: DataField-1 , DataField-2 in your case.

  3. Then simply go to the chart and attach Data-Source to your chart control.

  4. Then you will get two XAxis and YAxis.

  5. Then select the correct axis values.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.