Radchart with Multipleserieses

Thread is closed for posting
2 posts, 0 answers
  1. Satish
    Satish avatar
    10 posts
    Member since:
    Apr 2012

    Posted 11 Sep 2012 Link to this post

    I would like bind a rad chart with multiple serieses with different datasets (dtDev,dtProd, dtQA), Could tell me how to the coding?  

    Just take blind examples as we have three dates dtDev,dtProd, dtQA.

    Please healp, Thank You in Advance!

        Dim dtDev as dataset = nothing
        dtDev = obj.datareturn(parameters)
        monthlyradchartcontrole.DataSource = dtDev
        monthlyradchartcontrole.Series(0).DataXColumn = "ScheduledStartDate"
        monthlyradchartcontrole.Series(0).DataYColumn = "ChamberUtilization"
        monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Text = monthlyXaxislableName
        monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.Visible = True
                        monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
        monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True
        monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.Visible = True
        monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Text = monthlyYaxislableName
                        monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
        monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True
        monthlyradchartcontrole.Legend.Visible = False

    Thank You,

  2. Evgenia
    Evgenia avatar
    1396 posts

    Posted 12 Sep 2012 Link to this post

    Hello Satish,

    Thanks for contacting us. 
     The following sample code snippet demonstrates how you can create a DataSet with two DataTables and bind the Chart to them so that you get two Line series as result:

    protected void Page_Load(object sender, EventArgs e)
           DataTable tbl = new DataTable();
           DataColumn col = new DataColumn("Value");
           col.DataType = typeof(double);
           col = new DataColumn("XValue");
           col.DataType = typeof(double);
           DataTable tbl1 = new DataTable();
           DataColumn col1 = new DataColumn("Value1");
           col1.DataType = typeof(double);
           col1 = new DataColumn("XValue1");
           col1.DataType = typeof(double);
           int size = 15;
           int maxLen = size.ToString().Length;
           for (int i = 1; i <= size; i++)
               tbl.Rows.Add(new object[] { i * 2, i });
               tbl1.Rows.Add(new object[] { i * 3, i });
           DataSet dsNew = new DataSet();
           ChartSeries series1 = new ChartSeries("Series 1");
           series1.Type = ChartSeriesType.Line;
           foreach (DataRow dr in dsNew.Tables[0].Rows)
               ChartSeriesItem item = new ChartSeriesItem();
               item.XValue = Convert.ToDouble(dr["XValue"].ToString());
               item.YValue = Convert.ToDouble(dr["Value"].ToString());
           ChartSeries series2 = new ChartSeries("Series 2");
           series2.Type = ChartSeriesType.Line;
           foreach (DataRow dr in dsNew.Tables[1].Rows)
               ChartSeriesItem item = new ChartSeriesItem();
               item.XValue = Convert.ToDouble(dr["XValue1"].ToString());
               item.YValue = Convert.ToDouble(dr["Value1"].ToString());
           RadChart1.PlotArea.XAxis.DataLabelsColumn = "Day";

    Please note that there is no need to set the DataSet as DataSource for the RadChart since the Series Items are bound directly to the DataTables.

    the Telerik team

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top