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

YAxisName property on CustomLine

5 Answers 35 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 09 Sep 2011, 04:05 PM
I have a graph with 2 Y axis'.  I am adding custom lines relative to the second Y axis but the line is always relative to the first Y axis.  I am setting the name of my second Y axis and in the custom line I am setting the YAxisName property to the second Y axis.  I am assuming this would make the line relative to the 2nd Y axis but that is not the case. 

What am I doing wrong?
Tks.

5 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 14 Sep 2011, 09:17 AM
Hello Brian,

Have you seen our help topic as well as our demo where it is shown how to create RadChart with multiple y axes? Also by saying "custom line" I hope you mean Line Series and not an annotation line, right?

Best wishes,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Brian
Top achievements
Rank 1
answered on 14 Sep 2011, 02:12 PM
I am not having issues creating multiple Y axis'.  When I say custom line, I mean a CustomLine, as in, Telerik.Windows.Controls.Charting.CustomLine.
0
Evgenia
Telerik team
answered on 17 Sep 2011, 02:58 PM
Hello Brian,

I'm not sure what you mean by "in the custom line I am setting the YAxisName property to the second Y axis". In order to define the custom line you have to set the Slope and/or the YIntercept properties and the Line will be drawn according to the function y = mx + b, where 'm' is the Slope and 'b' is YIntercept. You may find more information on creating Custom Line in this help topic. 

Best wishes,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Brian
Top achievements
Rank 1
answered on 19 Sep 2011, 02:58 PM
That help topic doesn't even mention the 'YAxisName' property of a CustomLine control.  I want my custom line drawn in relation to a second Y axis. 
I have 2 Y axis on my graph.  One on the left, one on the right.  I want the CustomLine drawn in relation to the Y axis on the right.  I assumed I could do this by setting the 'YAxisName' property but it is not working.  Should it?
0
Ves
Telerik team
answered on 22 Sep 2011, 04:55 PM
Hello Brian,

This works fine for me. Please, find below my test xaml. Note, that the secondary AxisY in question should have its AxisName property set:

<telerik:RadChart x:Name="RadChart1">
<telerik:RadChart.DefaultView>
    <telerik:ChartDefaultView>
        <telerik:ChartDefaultView.ChartArea>
            <telerik:ChartArea>
                <telerik:ChartArea.AdditionalYAxes>
                    <telerik:AxisY AxisName="Secondary" />
                </telerik:ChartArea.AdditionalYAxes>
                <telerik:ChartArea.DataSeries>
                    <telerik:DataSeries>
                        <telerik:DataSeries.Definition>
                            <telerik:LineSeriesDefinition></telerik:LineSeriesDefinition>
                        </telerik:DataSeries.Definition>
                        <telerik:DataPoint XValue="-2" YValue="5" />
                        <telerik:DataPoint XValue="-1" YValue="87" />
                        <telerik:DataPoint XValue="0" YValue="45" />
                        <telerik:DataPoint XValue="1" YValue="34" />
                        <telerik:DataPoint XValue="2" YValue="65" />
                    </telerik:DataSeries>
                    <telerik:DataSeries>
                        <telerik:DataSeries.Definition>
                            <telerik:LineSeriesDefinition AxisName="Secondary"></telerik:LineSeriesDefinition>
                        </telerik:DataSeries.Definition>
                        <telerik:DataPoint XValue="-2" YValue="1" />
                        <telerik:DataPoint XValue="-1" YValue="4" />
                        <telerik:DataPoint XValue="0" YValue="3" />
                        <telerik:DataPoint XValue="1" YValue="1" />
                        <telerik:DataPoint XValue="2" YValue="2" />
                    </telerik:DataSeries>
                </telerik:ChartArea.DataSeries>
                <telerik:ChartArea.Annotations>
                    <telerik:CustomLine
                                YAxisName="Secondary"
                                Slope="1"
                                YIntercept="2"
                                Stroke="Red"
                                StrokeThickness="3" />
                </telerik:ChartArea.Annotations>
            </telerik:ChartArea>
        </telerik:ChartDefaultView.ChartArea>
    </telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>
</telerik:RadChart>


Best regards,
Ves
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
Brian
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Brian
Top achievements
Rank 1
Brian
Top achievements
Rank 1
Ves
Telerik team
Share this question
or