I have created a MS Chart control on my page and added 2 series (combo bar and line graph) bound to a DataView. My DataView has a third metric (Items) which I would like to show as a label on the bars of the Bar graph. Is there a way to assign this third value from the DataView as the label for the first series?
Thanks in advance for any replies.
Here is a snippet of what I have so far;
DataView DV = new DataView(source, exp, sortorder, DataViewRowState.CurrentRows);
Chart1.Series.Add("Traffic");
Chart1.Series["Traffic"].Points.DataBindXY(DV, "Date", DV, "Traffic");
Chart1.Series["Traffic"].ChartType = SeriesChartType.Column;
Chart1.Series["Traffic"].YAxisType = AxisType.Primary;
Chart1.Series.Add("Sales");
Chart1.Series["Sales"].Points.DataBindXY(DV, "Date", DV, "Sales");
Chart1.Series["Sales"].ChartType = SeriesChartType.Line;
Chart1.Series["Sales"].YAxisType = AxisType.Secondary;
Chart1.Series["Sales"].BorderWidth = 4;
Chart1.Series["Sales"].Color = System.Drawing.Color.Crimson;
Chart1.ChartAreas["ChartArea1"].AxisY2.Title = "Sales";
you can achieve that part by using DataBind
Chart1.Series[0].Points.DataBind(data, "Date", "Sales", "Label=yourfieldhere");
Now this should plot for Date
and Sales
with the labels as represented by the field you assign (should be part of data or in your case DV
)