9 Answers, 1 is accepted
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!
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
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!
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
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!
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
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!
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.
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.
Evgenia
Telerik
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 >>