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

Scroll bar slider Color of Additional Y-Axis

6 Answers 119 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sanjay
Top achievements
Rank 1
Sanjay asked on 05 Apr 2012, 07:13 PM
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


 

6 Answers, 1 is accepted

Sort by
0
Sanjay
Top achievements
Rank 1
answered on 06 Apr 2012, 08:20 AM
Is there a way to change the slider color of Additional Y-Axis? I have to implement this on urgent basis.
0
Sanjay
Top achievements
Rank 1
answered on 09 Apr 2012, 07:26 AM
Is it possible to change the slider color of Additional Y-Axis?
0
Sia
Telerik team
answered on 10 Apr 2012, 03:35 PM
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 >>

0
Sanjay
Top achievements
Rank 1
answered on 10 Apr 2012, 03:53 PM
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
0
Sanjay
Top achievements
Rank 1
answered on 12 Apr 2012, 05:13 PM
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
0
Accepted
Sia
Telerik team
answered on 13 Apr 2012, 01:47 PM
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 >>

Tags
Chart
Asked by
Sanjay
Top achievements
Rank 1
Answers by
Sanjay
Top achievements
Rank 1
Sia
Telerik team
Share this question
or