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

Double Nan in a Line Serie

9 Answers 98 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ilyasse Setti
Top achievements
Rank 1
Ilyasse Setti asked on 27 Apr 2010, 03:57 PM
I saw in somewhere in this forum that the RadChart Control doesn't manage the Double Nan for a point in a Line Chart Serie.
I would like to know if there is any workaround for this.
It's extremly important for us to manage this case...in a Chart.

Thanks in advance.

9 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 30 Apr 2010, 10:21 AM
Hi Ilyasse Setti,

We will do our best to fix this problem for Service Pack 2 release due in the beginning of June.

Kind regards,
Vladimir Milev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jonas
Top achievements
Rank 1
answered on 10 Mar 2011, 12:28 PM
Was this feature ever implemented? I tried in 2010.3.1314, but as far as I can see, NaN-values are still rendered as 0 instead of as gaps in the line.

/Jonas Högström
0
Vladimir Milev
Telerik team
answered on 15 Mar 2011, 10:15 AM
Hello Jonas,

We will ship Q1 2011 this week and it has empty values support out of the box!

Greetings,
Vladimir Milev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
DAN
Top achievements
Rank 1
answered on 03 Aug 2011, 07:50 PM
Is the double.NaN/Empty Point feature working in Line charts now? I download the demo and I get zero anywhere that I have double.NaN. I can work around by manually setting the IsEmpty property on each point...which is ok for my prototype but once I start databinding its not a good solution. Hopefully I am just doing something stupid.

Thanks,

Dan
0
Giuseppe
Telerik team
answered on 08 Aug 2011, 09:34 AM
Hello Dan,

RadChart recognizes null values as "empty" and not double.NaNs.

In unbound scenarios, you need to explicitly set the DataPoint.IsEmpty property to true as the YValue property is of type double (and not nullable double) for backwards compatibility reasons.

In bound scenarios you need to use nullable double type to achieve the desired functionality like this:
List<ChartData> data = new List<ChartData>();
data.Add(new ChartData() { YValue = 10 });
data.Add(new ChartData() { YValue = 20 });
data.Add(new ChartData() { YValue = null });
data.Add(new ChartData() { YValue = null });
data.Add(new ChartData() { YValue = 5 });
data.Add(new ChartData() { YValue = 7 });
data.Add(new ChartData() { YValue = 11 });
data.Add(new ChartData() { YValue = 13 });
 
SeriesMapping sm = new SeriesMapping();
sm.SeriesDefinition = new LineSeriesDefinition();
sm.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
sm.ItemsSource = data;
 
RadChart1.SeriesMappings.Add(sm);
 
//..........
 
public class ChartData
{
    public double? YValue
    {
        get;
        set;
    }
}

More information on empty values can be found here. Hope this helps.


Regards,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
DAN
Top achievements
Rank 1
answered on 08 Aug 2011, 02:11 PM
Giuseppe,

Thank you very much for the feedback. 

Is there any chance you are considering an option to treat double.NaN as empty? I work with large arrays of doubles that are returned from various pieces of high speed HW monitoring systems and cannot repeatedly copy the data to double?[]. I need to visually represent these points as gaps so simply removing them is not an option. I was hoping to replace my current charting package, NI Measurement Studio, with the Telerik controls but perhaps the slant of my applications toward working with HW leads to too much friction.

To me at least, treating NaN as empty seems more logical than zero. Thank you again for your reply.
0
Giuseppe
Telerik team
answered on 11 Aug 2011, 05:24 PM
Hello Dan,

We will forward your feedback to our developers but currently we have no concrete plans about changing the handling of Double.NaN values in this way. We have previously discussed this internally and it is a bit of undefined case (handling it as null / zero, or possibly handling it as error as NaN stands for not a number?).

Unfortunately for the time being you will still need to use nullable double value to visualize the empty gap.


Best wishes,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Giuseppe
Telerik team
answered on 11 Aug 2011, 06:22 PM
Hi Dan,

Just a quick follow-up -- it is possible to keep the double.NaN values in your data and still visualize them as "empty" by handling the RadChart.ItemDataBound event like this:
private void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
{
    if (double.IsNaN(e.DataPoint.YValue))
        e.DataPoint.IsEmpty = true;
}

Hope this helps.

 

Regards,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
DAN
Top achievements
Rank 1
answered on 11 Aug 2011, 08:04 PM
Giuseppe,

Thanks for the feedback. That is a great idea of a work around.

I love the nullable types in .Net but unfortunately not everything that we interact with is .Net...and I wish that the IEEE specification for double precision had a better alternative to representing a number that is "empty". In our test systems we often have an array of sensors and we store data at timestamped intervals...and any sensor not readable is recorded as NaN because it is a standard double precision number.

Thanks again for all of the help.

DG
Tags
Chart
Asked by
Ilyasse Setti
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Jonas
Top achievements
Rank 1
DAN
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or