Line chart not displaying line when Y values are all equal

Thread is closed for posting
2 posts, 1 answers
  1. Boyan
    Boyan avatar
    17 posts
    Member since:
    Feb 2011

    Posted 04 May 2012 Link to this post

    Hi,

    I am using RadControls Ajax Q3 2010.

    I have a very simple graph 
    <telerik:RadChart ID="chtPrices" runat="server" DefaultType="Line" Width="500px"
                    Height="300px" AutoLayout="true">
                    <ChartTitle Visible="false" />
                    <Legend Visible="false" />
                    <PlotArea>
                        <XAxis Visible="True" />
                        <YAxis ScaleBreaks-Enabled="true" IsZeroBased="false" />
                        <EmptySeriesMessage TextBlock-Text="No Data Selected"/>
                    </PlotArea>
                </telerik:RadChart>

    and I set its data source dynamically
    DataTable prices = PricessManager.GetPrices();
    chtPrices.DataSource = prices;
    chtPrices.DataBind();

    When the data in the data table contains several values (doubles) that are the same (say 91.1, 91.1, 91.1, etc), the graph does not draw the line and instead of centering the graph around 91.1 (since IsZeroBased is set to false), it centers it around 0 which leads me to believe for some reason it's not taking the values at all.

    When the same exact data table but with various numbers (say 91, 92, 84.3, 96.1, etc) is used to set the data source, the graph works fine.

    Any thoughts?
  2. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 09 May 2012 Link to this post

    Hi Boyan,

    Unfortunately, this is a bug in the control. Because all values are equal there is no delta and the axis can't work with the delta being zero.  Fortunately, I can suggest a workaround -- you can set IsZeroBased to false only if there are at least two items with distinct YValues, and leave it with the default value (true) if all items have the same YValue. You can use the DataBound event of RadChart for this.

    Additionaly, you can configure the axis manually in case all items have the same Y values. Just set AutoScale to false and use your own MinValue, MaxValue and Step, which can depend on the YValue of the ChartSeriesItems.

    All the best,
    Petar Marchev
    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top