Two series with different number of values.

Thread is closed for posting
4 posts, 1 answers
  1. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 19 Apr 2013 Link to this post

    I want to use RadChart to show the evolution of an indicator value compared to an objective value along a configurable period.

    A database query returns the list of values, however maybe there is no values for all the periods.

    01/01/2013 47,32
    01/02/2013 35,36
    01/03/2013 60,53
    01/04/2013 82,75

    I made the DataBind from a SqlDataReader.

    On the other hand i know the objective value at the begining of the period and at the end of the period, for example:

    01/01/2013
    20           //This is the objective value in the first period
    01/12/2013 120 //This is the objective value in the last period


    ChartSeries serieObjective = new ChartSeries("Objective") { Type = ChartSeriesType.Line };
    serieObjective.Items.Add(new ChartSeriesItem(1, 20));

    int
    periods = NumberOfPeriods(firstPeriod, lastPeriod);  //Returns the number of periods (in this example 12)
    serieObjective.Items.Add(new ChartSeriesItem(periods, 120));
    chart.Series.Add(serieObjective);

    In my chart I only can see the first 4 periods as the first serie only has 4 values.
    Therefore I cannot see the value of the second serie at the end of the period.

    Any suggestion.
    Thank you in advance.
  2. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 23 Apr 2013 Link to this post

    Please help.
    Anybody knows how to achieve that?

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 24 Apr 2013 Link to this post

    Hello Sonia,

    I am not quite sure I understand your scenario completely. That is why, in case the information below does not help you, please open a new support ticket and send me a simple running project, demonstrating the problem that you have.

    I created a simple test page to test your scenario but I was unable to reproduce the problem with the second line series not being fully visible. Here is the code of my test page for your reference:

    <telerik:RadChart ID="RadChart1" runat="server">
    </telerik:RadChart>

    ChartSeries serieIndicator = new ChartSeries("Indicator") { Type = ChartSeriesType.Line };
     
    serieIndicator.Items.Add(new ChartSeriesItem(1, 47));
    serieIndicator.Items.Add(new ChartSeriesItem(2, 35));
    serieIndicator.Items.Add(new ChartSeriesItem(3, 60));
    serieIndicator.Items.Add(new ChartSeriesItem(4, 82));
    RadChart1.Series.Add(serieIndicator);
     
    ChartSeries serieObjective = new ChartSeries("Objective") { Type = ChartSeriesType.Line };
     
    serieObjective.Items.Add(new ChartSeriesItem(1, 20));
    serieObjective.Items.Add(new ChartSeriesItem(12, 120));
    RadChart1.Series.Add(serieObjective);

    You can review our online demos and documentation for additional information on RadChart for ASP.NET
    AJAX.

    All the best,
    Tsvetie
    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.
  5. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 26 Apr 2013 Link to this post

    Thank you Tsvetie. Your sample has helped me to find the problem.
Back to Top