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

Axis color

5 Answers 165 Views
Chart
This is a migrated thread and some comments may be shown as answers.
zai yunfeng
Top achievements
Rank 2
zai yunfeng asked on 18 Nov 2009, 07:24 AM
Hello,
  I want to set the color of the axis to black for print and I got styling axis infomation from the online help:
http://www.telerik.com/help/wpf/chart-customize-axis-appearance-through-style.html,
but it doesn't work when I put it in my code
and the application can't find Axis2D
from chart (xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting").
  Any response as soon as possible is appreciated!

5 Answers, 1 is accepted

Sort by
0
zai yunfeng
Top achievements
Rank 2
answered on 18 Nov 2009, 12:59 PM
Is there anybody who can help me?
0
zai yunfeng
Top achievements
Rank 2
answered on 19 Nov 2009, 10:26 AM
Can anyone give me a solution?
0
Dwight
Telerik team
answered on 20 Nov 2009, 11:56 AM
Hello zai,

I must apologize for the inconsistencies in our online help. It seems that this topic is not synchronized with our latest styling changes in the RadChart.

Here is a sample code snippet:
<chart:RadChart x:Name="radChart1">
    <chart:RadChart.Resources>
        <Style x:Key="AxisLineStyleResource" TargetType="Line">
            <Setter Property="Stroke" Value="Red" />
            <Setter Property="StrokeThickness" Value="5" />
        </Style>
 
        <Style x:Key="AxisXStyle" TargetType="chart:AxisX2D">
            <Setter Property="AxisLineStyle" Value="{StaticResource AxisLineStyleResource}" />
        </Style>
         
        <Style x:Key="AxisYStyle" TargetType="chart:AxisY2D">
            <Setter Property="AxisLineStyle" Value="{StaticResource AxisLineStyleResource}" />
        </Style>
    </chart:RadChart.Resources>
</chart:RadChart>

And the code-behind:
public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();
 
        this.radChart1.DefaultView.ChartArea.AxisXStyle = this.radChart1.Resources["AxisXStyle"] as Style;
        this.radChart1.DefaultView.ChartArea.AxisYStyle = this.radChart1.Resources["AxisYStyle"] as Style;
    }
}

Kind regards,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
zai yunfeng
Top achievements
Rank 2
answered on 23 Nov 2009, 02:05 AM
Thanks a lot!
The last question, how to set the ticklinestyle?
0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 24 Nov 2009, 05:16 PM
Hello there,

Probably this help article will get you started: http://www.telerik.com/help/silverlight/radchart-styling-and-appearance-styling-axis-tick.html.


Greetings,
Bart.
Tags
Chart
Asked by
zai yunfeng
Top achievements
Rank 2
Answers by
zai yunfeng
Top achievements
Rank 2
Dwight
Telerik team
Bartholomeo Rocca
Top achievements
Rank 1
Share this question
or