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

Issue with marked zone annotation referring to secondary axes

2 Answers 64 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Paolo
Top achievements
Rank 1
Paolo asked on 21 Feb 2013, 01:14 PM
Good morning, in my project I have to refer marked zone annotations to a secondary Y axes, but it does not seem to work.
Project involves complex logic with the MVVM pattern, in order to try to understand what is going on I made up a simple example (below), but still does not work. Marked zone annotation must be referred to secondary Y Axes, called "Height", but still refers to the primary one.
Please tell me what am I missing,
   Paolo



<telerikChart:RadChart x:Name="radChart">
                <telerikChart:RadChart.DefaultView>
                    <telerikCharting:ChartDefaultView>
                        <telerikCharting:ChartDefaultView.ChartLegend>
                            <telerikCharting:ChartLegend x:Name="chartLegend2" Header="Legend" UseAutoGeneratedItems="True" Visibility="Collapsed"/>
                        </telerikCharting:ChartDefaultView.ChartLegend>
                        <telerikCharting:ChartDefaultView.ChartArea>
                            <telerikCharting:ChartArea LegendName="chartLegend">
                                <telerikCharting:ChartArea.AxisX>
                                    <telerikCharting:AxisX
                                        AutoRange="False"
                                        MajorGridLinesVisibility="Visible"
                                        MinValue="0"
                                        MaxValue="20"
                                        Step="2"
                                        ></telerikCharting:AxisX>
                                </telerikCharting:ChartArea.AxisX>
                                <telerikCharting:ChartArea.AxisY>
                                    <telerikCharting:AxisY
                                        AutoRange="False"
                                        MinorGridLinesVisibility="Hidden"
                                        MajorGridLinesVisibility="Visible"
                                        MinorTicksVisibility="Hidden"
                                        StripLinesVisibility="Hidden"
                                        MinValue="0"
                                        MaxValue="1000"
                                        Step="100"
                                        >
                                    </telerikCharting:AxisY>
                                </telerikCharting:ChartArea.AxisY>
                                <telerikCharting:ChartArea.AdditionalYAxes>
                                    <telerikCharting:AxisY x:Name="Height"
                                                                AutoRange="False"
                                                                MinValue="0"
                                                                MaxValue="10"
                                                                Step="1"
                                                                MinorTicksVisibility="Hidden"
                                                                Visibility="Visible"
                                                                >
                                    </telerikCharting:AxisY>
                                </telerikCharting:ChartArea.AdditionalYAxes>
                                
                                <telerikCharting:ChartArea.Annotations>
                                    <telerikCharting:MarkedZone
                                        YAxisName="Height"
                                        StartX="6"
                                        EndX="8"
                                        StartY="3"
                                        EndY="7"
                                        Background="Orange"
                                        >
                                    </telerikCharting:MarkedZone>
                                </telerikCharting:ChartArea.Annotations>
                                
                                <telerikCharting:ChartArea.DataSeries>
                                    <!-- Line Chart -->
                                    <telerikCharting:DataSeries LegendLabel="Product Sales">
                                        <telerikCharting:DataSeries.Definition>
                                            <telerikCharting:LineSeriesDefinition>
                                            </telerikCharting:LineSeriesDefinition>
                                        </telerikCharting:DataSeries.Definition>
                                        <telerikCharting:DataPoint YValue="112" XValue="0"/>
                                        <telerikCharting:DataPoint YValue="257" XValue="2"/>
                                        <telerikCharting:DataPoint YValue="450" XValue="4"/>
                                        <telerikCharting:DataPoint YValue="800" XValue="6"/>
                                        <telerikCharting:DataPoint YValue="467" XValue="8"/>
                                        <telerikCharting:DataPoint YValue="469" XValue="10"/>
                                        <telerikCharting:DataPoint YValue="540" XValue="12"/>
                                        <telerikCharting:DataPoint YValue="560" XValue="14"/>
                                        <telerikCharting:DataPoint YValue="500" XValue="16"/>
                                        <telerikCharting:DataPoint YValue="235" XValue="18"/>
                                        <telerikCharting:DataPoint YValue="76"  XValue="20"/>
                                    </telerikCharting:DataSeries>
                                </telerikCharting:ChartArea.DataSeries>
                            </telerikCharting:ChartArea>
                        </telerikCharting:ChartDefaultView.ChartArea>
                    </telerikCharting:ChartDefaultView>
                </telerikChart:RadChart.DefaultView>
            </telerikChart:RadChart>

2 Answers, 1 is accepted

Sort by
0
Missing User
answered on 26 Feb 2013, 12:27 PM
Hello Paolo,

The MarkedZone YAxisName property doesn't refer to the x:Name of the additional Y-Axis. Rather, it refers to the AxisName property of that axis. You only have to replace
<telerik:AxisY x:Name="Height"/>
with
<telerik:AxisY AxisName="Height"/>

Then, the annotation will appear as expected.

Greetings,
Ivan N.
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Paolo
Top achievements
Rank 1
answered on 06 Mar 2013, 08:06 AM
Thank you so much!
Tags
Chart
Asked by
Paolo
Top achievements
Rank 1
Answers by
Missing User
Paolo
Top achievements
Rank 1
Share this question
or