Scroll bar slider Color of Additional Y-Axis

7 posts, 1 answers
  1. Sanjay
    Sanjay avatar
    9 posts
    Member since:
    Jul 2011

    Posted 05 Apr 2012 Link to this post

    Hi,

    I have multiple Y-Axis displayed on my chart. I want to change the color of  zooming and scroll bar slider of additional Y-Axis . By default it is yellow and I want to change its color according to the color of data series to which it is attached.
    Any help would be appreciated.

    Thanks,
    Sanjay


     
  2. Sanjay
    Sanjay avatar
    9 posts
    Member since:
    Jul 2011

    Posted 06 Apr 2012 Link to this post

    Is there a way to change the slider color of Additional Y-Axis? I have to implement this on urgent basis.
  3. DevCraft banner
  4. Sanjay
    Sanjay avatar
    9 posts
    Member since:
    Jul 2011

    Posted 09 Apr 2012 Link to this post

    Is it possible to change the slider color of Additional Y-Axis?
  5. Sia
    Admin
    Sia avatar
    667 posts

    Posted 10 Apr 2012 Link to this post

    Hello Sanjay,

    Please check the solution from the attached files. The same approach should be applicable for the additional axes as well. I hope this helps.

    Greetings,
    Sia
    the Telerik team

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

  6. Sanjay
    Sanjay avatar
    9 posts
    Member since:
    Jul 2011

    Posted 10 Apr 2012 Link to this post

    Hi Sia

    Thanks for your solution.

    <Grid x:Name="LayoutRoot"
            <telerik:RadChart x:Name="RadChart1">
                <telerik:RadChart.DefaultView>
                    <telerikCharting:ChartDefaultView>
                        <telerikCharting:ChartDefaultView.ChartArea>
                            <telerikCharting:ChartArea AxisXStyle="{StaticResource CustomAxisX}"
                                                       AxisYStyle="{StaticResource CustomAxisY}"/>
                        </telerikCharting:ChartDefaultView.ChartArea>
                    </telerikCharting:ChartDefaultView>
                </telerik:RadChart.DefaultView>
            </telerik:RadChart>
        </Grid>

    But How can i set the style for Additional Y-Axis Like you did for AxisYStyle. Is there anything like Additional Y-Axis Style.

    Regards,
    Sanjay
  7. Sanjay
    Sanjay avatar
    9 posts
    Member since:
    Jul 2011

    Posted 12 Apr 2012 Link to this post

    Hi Sia,

    By using your solution i can set the default Y- Axis Style, but not the Additional Y-Axis Style and CharArea does not have anything for additional Y-Axis like it has for default Y-Axis (e.g. AxisYStyle).
    I tried using AxisStyles property of AxisY but it is having AxisLineStyle, GridLineStyle, TitleStyle but not anything for Silder style, so that i can change the color of it.

    So I am stuck right now. Further help would be appreciated.


    Thanks,
    Sanjay Singh
  8. Answer
    Sia
    Admin
    Sia avatar
    667 posts

    Posted 13 Apr 2012 Link to this post

    Hi Sanjay,

    Unfortunately I misled you with my first post, please excuse me for that.
    The only possible solution to apply custom style to RadSlider attached to additional Y axis is to walk the visual tree, find the panel where the additional vertical axes are and apply the needed style to their sliders. Here is the code for that:
    bool onlyTheFirstTime = false;
    private void UserControl_LayoutUpdated(object sender, EventArgs e)
    {
        if (onlyTheFirstTime)
            return;
     
        onlyTheFirstTime = true;
     
        var axisContainer = this.ChildrenOfType<Telerik.Windows.Controls.Charting.AdditionalAxes2DContainer>()
            .Where(container => container.Name == "PART_AdditionalVerticalAxesPanel")
            .First();
     
        foreach (RadSlider item in axisContainer.ChildrenOfType<RadSlider>())
            item.Style = this.Resources["CustomSlider"] as Style;
    }

    You need a flag to make sure it is not done on each layout.

    Kind regards,
    Sia
    the Telerik team

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

Back to Top
DevCraft banner