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

Null values in Aggregate results

5 Answers 110 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Vijay
Top achievements
Rank 1
Vijay asked on 15 Jun 2011, 09:27 PM
I am trying to chart with aggregate values as my Y axis and i have NULL values in the data when there is a null value i want to use
EmptyPointBehavior.Gap property of the radchart but when creating DataPoint YValue is in double so i am unable to put NULL values into YValue

But to use EmptyPointBehavior.Gap property the value need to be null but default value of the Yvalue is 0.0 so it is treating it as zero is there any way to bypass this situation.

i want to make something like this http://demos.telerik.com/silverlight/#Chart/EmptyValues with aggregate results.

Please help me if any one knows how to do this .
 Thank you in advance

5 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 20 Jun 2011, 11:35 AM
Hi Vijay,

Which aggregate function are you using? Are you using Sampling or grouping?

Best wishes,
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
Vijay
Top achievements
Rank 1
answered on 20 Jun 2011, 04:03 PM
I am using grouping aggregate function

so i am grouping by month for example if i don't have data for any month i am inserting a dummy
 row in the data base to show all the months in the chart and for the dummy data i want to leave a space
 in the chart.

and on Y axis i am charting with aggregate calculated values here is my custom aggregate function.
So when i have some dummy data i will check some condition and return NULL from this code i need a way to store
that NULL value in the aggregate result so that i can use EmptyPointBehavior and tell my graph to leave a gap if i
have null value.

i am using DataPoint to generate chart in that class YValue is   public double YValue { get; set; }  so i am unable to
null value into it to create datapoint. by default it is taking 0.0 so chart is considering it as zero.



namespace
UtilityInsight.DashboardViewModel.Model
{
    public class TotalCostByOccupancyAggregateFunction : EnumerableAggregateFunction
    {
          protected override string AggregateMethodName
        {
            get
            {
                return "TotalCostByOccupancyAggregateMethod";
            }
        }
        protected override Type ExtensionMethodsType
        {
            get
            {
                return typeof(TotalCostByOccupancyAggregates);
            }
        }
    }
    public class TotalCostByOccupancyAggregates
    {
        public static double TotalCostByOccupancyAggregateMethod<TSource>(IEnumerable<BillingView2> source)
        {
            double sum1 = 0;
            double sum2 = 0;     
            foreach (var item in source)
            {
                sum1 += Convert.ToDouble(item.Occupancy);
                sum2 += Convert.ToDouble(item.Amount);
            }
            if(sum1==0)
                 return sum2;
            return (sum2)/(sum1);
        }
    }
    }

0
Vladimir Milev
Telerik team
answered on 21 Jun 2011, 09:08 AM
Hello Vijay,

Check this forum post which deals with the same issue. Hope this helps.

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
Vijay
Top achievements
Rank 1
answered on 13 Jul 2011, 11:17 PM
Hi
I see as fix for this issue in Q2 Release

Empty Values Support – RadChart for Silverlight now supports empty/null values. There are three ways in which these values can be handled: Zero, Drop and Gap. See demo

http://www.telerik.com/products/silverlight/whats-new-full-story.aspx

I saw the demo but when creating a Datapoint in the code behind and adding it to the series mappings how to give NULL values into the Yvalue .
In the datapoint class in Telerik.Windows.Controls.Charting Yvalue is still double so i really cannot assign null value to it when creating datapoint .

so can you please tell me what is that you changed in Q2 release for this problem.

Thank you
0
Vladimir Milev
Telerik team
answered on 14 Jul 2011, 08:36 AM
Hi Vijay,

Instead of passing null, simply pass any value and set IsEmpty=true for the DataPoint.

Greetings,
Vladimir Milev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Chart
Asked by
Vijay
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Vijay
Top achievements
Rank 1
Share this question
or