Iurie Coroban
Top achievements
Rank 1
Iurie Coroban
asked on 29 Apr 2009, 04:10 PM
By default foreground is White, I want to set it to Black color. How can I do this?
for BarSeris I found
for BarSeris I found
barSeries.Definition.Appearance.Foreground= new SolidColorBrush(Colors.Black);
8 Answers, 1 is accepted
0
Accepted
Hi Iurie,
You can take advantage of the AxisXStyle property of the ChartArea. Define your own style in XAML and populate this property, here is an example:
and in code-behind:
Hope this helps.
Regards,
Ves
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
You can take advantage of the AxisXStyle property of the ChartArea. Define your own style in XAML and populate this property, here is an example:
<UserControl x:Class="SilverlightApplication1.Page" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
Width="400" Height="300" |
xmlns:control="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting" |
xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"> |
<Grid x:Name="LayoutRoot"> |
<Grid.Resources> |
<Style x:Name="MyAxisXStyle" TargetType="chart:AxisX2D"> |
<Setter Property="Foreground" Value="Red" /> |
<Setter Property="LineStroke" Value="Green" /> |
</Style> |
</Grid.Resources> |
<control:RadChart x:Name="RadChart1" > |
</control:RadChart> |
</Grid> |
</UserControl> |
and in code-behind:
using System.Windows; |
using System.Windows.Controls; |
namespace SilverlightApplication1 |
{ |
public partial class Page : UserControl |
{ |
public Page() |
{ |
InitializeComponent(); |
this.Loaded += new RoutedEventHandler(Page_Loaded); |
} |
void Page_Loaded(object sender, RoutedEventArgs e) |
{ |
RadChart1.ItemsSource = new double[] { 1, 2, 3, 4 }; |
RadChart1.DefaultView.ChartArea.AxisXStyle = this.MyAxisXStyle; |
} |
} |
} |
Hope this helps.
Regards,
Ves
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Iurie Coroban
Top achievements
Rank 1
answered on 30 Apr 2009, 11:59 AM
Thanks for example, it helps me.
0
Ian
Top achievements
Rank 1
answered on 29 May 2009, 08:02 AM
The code sample shows the TargetType of the style being AxisX2D but there is no such target in the Charting namespace and the code shown gives a XAML error that the target source cannot be found
What am I missing here?
Ian
What am I missing here?
Ian
0
Hello Ian,
Here is the list of references you need:
As soon as you have these in place, you should not get such error.
Sincerely,
Ves
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Here is the list of references you need:
- Telerik.Windows.Data
- Telerik.Windows.Controls
- Telerik.Windows.Controls.Charting
- xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
- xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
As soon as you have these in place, you should not get such error.
Sincerely,
Ves
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ian
Top achievements
Rank 1
answered on 01 Jun 2009, 04:51 PM
Thanks Ves. That's got me sorted :-) I had the references and the declarations in the XAML but since the Knowledgebase article made no mention of the Telerik.Windows.Data component being needed in the code behind to resolve the reference in the XAML I was missing the required using statement for Telerik.Windows.Data
It's probably worth updating the Knowledgebase article here: http://www.telerik.com/support/kb/silverlight/chart/customize-the-axis-appearance.aspx so that others don't fall foul of the same problem.
Thanks again.
It's probably worth updating the Knowledgebase article here: http://www.telerik.com/support/kb/silverlight/chart/customize-the-axis-appearance.aspx so that others don't fall foul of the same problem.
Thanks again.
0
Hello Ian,
Sorry for the confusion and thanks for the note. We'll have our KB articles updated.
Regards,
Ves
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Sorry for the confusion and thanks for the note. We'll have our KB articles updated.
Regards,
Ves
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ken
Top achievements
Rank 1
answered on 28 Aug 2009, 02:54 PM
I'm using the telerik controls for Silvelight 3.0. I'm finding this example - I get a runtime xaml parse exception with the message "Invalid "attribute value LineStroke for property Property." Inspecting the Axis2D class, I find no LineStroke property, but do find Stroke. This works for me:
<Setter Property="Stroke" Value="Black"/>
Another issue on the knowledge base page - the "If you'd like to comment on this KB article, please, send us a Support Ticket." - the "Support Ticket" link is broken.
Thanks!
0
Hi Ken,
Thanks for the note. Indeed, it is the Stroke property that should be used. We have updated the article.
As for the "Support Ticket" link - it is expected to point to this location and it appears to work fine for me now.The link you have copied here also seems to work. Please, give it another try and let us know if the problem remains.
I have updated your Telerik points.
Sincerely,
Ves
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.
Thanks for the note. Indeed, it is the Stroke property that should be used. We have updated the article.
As for the "Support Ticket" link - it is expected to point to this location and it appears to work fine for me now.The link you have copied here also seems to work. Please, give it another try and let us know if the problem remains.
I have updated your Telerik points.
Sincerely,
Ves
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.