This is a migrated thread and some comments may be shown as answers.

Line chart not displaying line when Y values are all equal

1 Answer 66 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Boyan
Top achievements
Rank 1
Boyan asked on 04 May 2012, 07:38 PM
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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar Marchev
Telerik team
answered on 09 May 2012, 07:59 AM
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.
Tags
Chart (Obsolete)
Asked by
Boyan
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or