YAxisName property on CustomLine

6 posts, 0 answers
  1. Brian
    Brian avatar
    10 posts
    Member since:
    Apr 2011

    Posted 09 Sep 2011 Link to this post

    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.
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 14 Sep 2011 Link to this post

    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 >>
  3. Brian
    Brian avatar
    10 posts
    Member since:
    Apr 2011

    Posted 14 Sep 2011 Link to this post

    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.
  4. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 17 Sep 2011 Link to this post

    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 >>
  5. Brian
    Brian avatar
    73 posts
    Member since:
    Sep 2010

    Posted 19 Sep 2011 Link to this post

    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?
  6. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 22 Sep 2011 Link to this post

    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 >>

Back to Top