Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Datasource for a Column / Line Chart
posted

I am trying to setup the Datasource for a Column / Line Chart so I can show monthly quantities as columns, and a trend line.  Here is my data:

Month Quantity 3moAvg
J 03 1208 1208
F 03 1156 1182
M 03 1277 1214
A 03 1253 1229
M 03 1246 1259
J 03 1160 1220
J 03 1227 1211
A 03 1184 1190
S 03 1209 1207
O 03 1232 1208
N 03 1146 1196
D 03 1213 1197
 

Unfortunately, the Column / Line sample code is incomprehensible to me.  I am able to create a Column chart with the following code. How do I change this code for a Column / Line chart where Quantity is the columns & ThreeMoAvg is the line?  Thanks!

     public struct Hist
     {
           public string Month;
           public float Quantity;
           public float ThreeMoAvg;
     }

      private Hist[ arrHist;

      private void buttonDmdHist_Click(object sender, EventArgs e)
      {
         // hide the chart
         this.ultraChartResults.Visible = false;

         //attach the history to the chart
         this.ultraChartResults.DataSource = this.GetHistDataTable();
         this.ultraChartResults.DataBind();

         // setup X labels
         this.ultraChartResults.Axis.X.Labels.Visible = false;
         this.ultraChartResults.Axis.X.Labels.SeriesLabels.Visible = true;
         this.ultraChartResults.Axis.X.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing;

         // show the chart
         this.ultraChartResults.Visible = true;
      }

      private DataTable GetHistDataTable()
      {
         // Turn the array into a datatable
         DataTable retDT = new DataTable();
         retDT.Columns.Add("Month", typeof(String));
         retDT.Columns.Add("Quantity", typeof(Single));
         for (int index = 0; index < this.arrHist.Length; index++)
            retDT.Rows.Add(new Object[ { this.arrHist[index].Month, this.arrHist[index].Quantity });
         return retDT;
      }