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

CustomAggregateFunction or formula

3 Answers 51 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Dario
Top achievements
Rank 2
Dario asked on 05 Jul 2011, 04:22 PM
Hi,
I need to create formula that do this:
CustomersVisited / MyCustomers

In my collection I have: Date, Agent, CustomersVisited and MyCustomersCount. I would another value that I can aggregate it, but this value is formula CustomersVisited / MyCustomers.
I would Sum(CustomersVisited / MyCustomers)

Can I do this? And if yes, how can I?

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Jul 2011, 08:36 AM
Hi Dario,

Please, consider using a custom sampling function for this scenario. You can find information on how to create such functions in this help topic.

Greetings,
Nikolay
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!

0
Dario
Top achievements
Rank 2
answered on 07 Jul 2011, 08:47 AM
Thank you for support,
but it's not clear one things, I read Custom Sampling but in that examples keep one property of my list.
If I whant use two proprties of my list both in Statistics class (of example Custom Sampling)?
0
Nikolay
Telerik team
answered on 11 Jul 2011, 08:10 AM
Hello Dario,

In case you only need to create another property as a ratio between two of the other properties, you can do this in the following manner :
public class MyClass
    {
        public int MyCustomers { get; set; }
        public int CustomersVisited { get; set; }
        public double CustomProp 
        
            get
            {
                return this.CustomersVisited / this.MyCustomers;        
            }
        }
        public DateTime Date { get; set; }
    }

The CustomProp property would return the ratio between CustomersVisited and MyCustomers, which can then be mapped to the YValue and you can apply sum or another aggregate function :
...
<telerik:RadChart.SeriesMappings>
                <telerik:SeriesMapping>
                    <telerik:ItemMapping DataPointMember="YValue" FieldName="CustomProp" />
                    <telerik:ItemMapping DataPointMember="XCategory" FieldName="Date" />
                </telerik:SeriesMapping>
</telerik:RadChart.SeriesMappings>
...

Hope this helps.

Kind regards,
Nikolay
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
Dario
Top achievements
Rank 2
Answers by
Nikolay
Telerik team
Dario
Top achievements
Rank 2
Share this question
or