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

Need an example with AdditionalYAxes + MVVM

9 Answers 120 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Nuno
Top achievements
Rank 1
Nuno asked on 11 Jul 2011, 05:01 PM

Hi All,

Can anyone provide me with a C# example on how to implement Multi Y Axis using the MVVM pattern ?

Thank a lot!

Nuno

9 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 12 Jul 2011, 08:37 AM
Hello Nuno,

Since Q2 2011 all our demos were MVVM-ized. To create a Multiple Y Axes Chart using MVVM just follow our demo with full source code.

Best wishes,
Evgenia
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
Nuno
Top achievements
Rank 1
answered on 12 Jul 2011, 01:18 PM

Hi Evgenia,

Before posting I already tried to learn from that demo. My point is that demo make use of XAML declaration of the AdditionalYAxes property and I need that done via MVVM binding.

I need:
AdditionalYAxes="{Binding AdditionalYAxes}"

Demo:

<telerik:ChartArea.AdditionalYAxes>
    <telerik:AxisY x:Name="secondaxis" AxisName="Secondary">
        <telerik:AxisY.AxisStyles>
            <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStyle2}"
                                TickLineStyle="{StaticResource MajorTickLineStyle2}"
                                MinorTickLineStyle="{StaticResource MinorTickLineStyle2}"
                                ItemLabelStyle="{StaticResource CustomLabel2}"/>
        </telerik:AxisY.AxisStyles>
    </telerik:AxisY>
    <telerik:AxisY AxisName="Tertiary">
        <telerik:AxisY.AxisStyles>
            <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStyle3}"
                                TickLineStyle="{StaticResource MajorTickLineStyle3}"
                                MinorTickLineStyle="{StaticResource MinorTickLineStyle3}"
                                ItemLabelStyle="{StaticResource CustomLabel3}"/>
        </telerik:AxisY.AxisStyles>
    </telerik:AxisY>
</telerik:ChartArea.AdditionalYAxes>

And for some reason I'm getting an exception when I make use of

AdditionalYAxes

 

 

="{Binding AdditionalYAxes}" in the ChartArea section of the RadChart.

That exception is of type System.NullReferenceException, related to the Zoomscrollsettings property.

I reasearched on the RadChart forum and found:
http://www.telerik.com/community/forums/silverlight/chart/2010-q1-nullreferenceexception-in-databindinghelper.aspx
http://www.telerik.com/community/forums/silverlight/chart/binding-exception.aspx
BUT none of those links helped me.

I'm using assemblies version 2011.1.419.1040

I'm sure it will be very easy for you to reproduce this issue but let me know if you need additional info.

Can you help me?

Thanks,
Nuno

0
Evgenia
Telerik team
answered on 15 Jul 2011, 01:48 PM
Hello Nuno,

Our developers are known of this issue. You may follow it's status under "Your Account" - the "Your Tracked Issues" tab.
Meanwhile there is something you should have in mind - since AdditionalYAxes are visual elements, you should bind to them in the View (i.e. the XAML) and not in the ViewModel.

Regards,
Evgenia
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
Dennis Perlot
Top achievements
Rank 1
answered on 15 Jul 2011, 02:13 PM
Hi Evgenia,

Thanks for your reply.

My scenario is very dynamic, it's all database driven, I don't know how many dataseries I'm dealing with until data is retrieved from db.
So, how do I know in advance how many AdditionalYAxes should specify in the XAML/View ??

Regards,
Nuno

0
Evgenia
Telerik team
answered on 20 Jul 2011, 03:35 PM
Hi Dennis,

Why do you need to plot each of your series on a different YAxis? Furthermore if you have 10 Series for example with 10 YAxes - there will be very small area for the Chart itself. I suggest that you reconsider your scenario or get to know your Chart Series number so that you will know how many Additional YAxes you will need.

Regards,
Evgenia
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
Dennis Perlot
Top achievements
Rank 1
answered on 20 Jul 2011, 06:41 PM

Hi Evgenia,

Consider this scenario, I'm loading a random number of charts (DB driven). When they have more than three dataseries I just don't set the Multi Y axis.
According to what you suggest I would need to declare two AdditionalYAxes in the XAML to make it ready to work for three dataseries. But what if a given chart only has one or two dataseries? How do I solve/remove the not needed Y axis using the MVVM pattern?

Thanks,
Nuno
0
Evgenia
Telerik team
answered on 26 Jul 2011, 08:04 AM
Hello Dennis,

This is to let you know that I'll need some more time to create a sample project that will fit your requirement. I'll contact you as soon as possible. Thanks for your patience!

Regards,
Evgenia
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
Senthil kumar
Top achievements
Rank 1
answered on 18 Sep 2013, 11:08 AM
Hi Evgenia,

could you post the example of Additional Y-axis implementation with MVVM.. i am working on the same type of requirement what  Dennis was suggesteded.

currently, iam working on 2013.1.220.40 version.

0
Evgenia
Telerik team
answered on 23 Sep 2013, 08:28 AM
Hi Senthil,

 We highly reccomend that you use our newest charting control RadChartView for such scenario. It offers unmatched performance regarding loading time compared to the RadChart and real-time updates. Also it addresses some of the limitations and deficiencies that we have identified in the RadChart implementation over the years. To get to know the RadChartView, please refer to this comparing help topic with highlights for the two controls.

Onto your specific scenario:
1. You can easily create a dynamic number of series depending on the data (collection of collections). To take advantage of this feautre, you need to use our ChartSeriesProvider feature as described here.
2. Note that for each series being added I associate one and the same instance of CartesianAxis (Linear, DateTime, etc.). Whether you need additional axis, just add new instance of CartesianAxis.


The attached project demonstrates what I ment. Feel free to modify it per you scenario needs.

Regards,
Evgenia
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Chart
Asked by
Nuno
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Nuno
Top achievements
Rank 1
Dennis Perlot
Top achievements
Rank 1
Senthil kumar
Top achievements
Rank 1
Share this question
or