I would imagine there is a generalized solution for conditionalformatting, but I am particularly interested in the candlestick chart.
Is there a way to present the data such that a datapointwith a gain (close higher than open) is rendered in green, where a loss (closelower than open) is rendered in red.
Thanks,
Mike
5 Answers, 1 is accepted
0
Accepted
Hello Mike,
The general approach to this task is shown in this example. However, it seems more likely that such request is placed for candlestick series, so with Q2 release (which should be available for download in your account by now) we have exposed a public API. You can create a style with two setters for Fill and EmptyFill properties with the desired colors:
Then set the CandleStickSeriesDefinition.ItemStyle property with that style:
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.
The general approach to this task is shown in this example. However, it seems more likely that such request is placed for candlestick series, so with Q2 release (which should be available for download in your account by now) we have exposed a public API. You can create a style with two setters for Fill and EmptyFill properties with the desired colors:
<Style x:Key="MyStyle" TargetType="chart:CandleStick"> |
<Setter Property="EmptyFill" Value="Green" > |
</Setter> |
<Setter Property="Fill" Value="Red" > |
</Setter> |
</Style> |
Then set the CandleStickSeriesDefinition.ItemStyle property with that style:
CandleStickSeriesDefinition def = new CandleStickSeriesDefinition(); |
def.ItemStyle = LayoutRoot.Resources["MyStyle"] as Style; |
RadChart1.DefaultView.ChartArea.DataSeries[0].Definition = def; |
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
Mike
Top achievements
Rank 1
answered on 06 Jul 2009, 06:07 PM
I wonder if I have missed something simple. I am getting an error "invalid attribute value Chart:CandleStick for property TargetType" on the line <Style x:Key="MyStyle" TargetType="chart:CandleStick">
I did install the Q2 release.
0
Hi Mike,
You need references to Telerik.Windows.Controls.dll, Telerik.Windows.Controls.Charting.dll and Telerik.Windows.Data.dll. In addition, you need to register the chart xml namespace as shown in this help topic, namely:
xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
Best 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 need references to Telerik.Windows.Controls.dll, Telerik.Windows.Controls.Charting.dll and Telerik.Windows.Data.dll. In addition, you need to register the chart xml namespace as shown in this help topic, namely:
xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
Best 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
Mike
Top achievements
Rank 1
answered on 08 Jul 2009, 03:14 PM
That was it.
I wasn't sure what namespace the "chart" was set to in XAML as different examples available on your website use different namespaces.
As a followup question - is there a way to replace the programatic setting of the style definition you have shown with a declarative assignment in XAML?
Thanks,
Mike
0
Hi Mike,
Unfortunately, there is no way to declaratively set the style.
Best wishes,
Evtim
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.
Unfortunately, there is no way to declaratively set the style.
Best wishes,
Evtim
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.