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

Styling RadChart for CandleStick data

4 Answers 164 Views
Chart
This is a migrated thread and some comments may be shown as answers.
ChrisM
Top achievements
Rank 1
ChrisM asked on 28 Jun 2011, 10:22 AM
Hi, I have some questions about how to style RadChart when it's displaying data in candlestick format.

As you can see from this image, some of our charts are quite small. There's a very significant chunk of the chart area, which I've outlined in red, that isn't currently being used. I'd like to reduce this as much as possible, ideally so that the chart fills the entire area. Could you please advise me on how to do this? The ranges of both chart axes seem to extend past the min and max values of the source data, even when I specify those values explicitly. I have tried adding ExtendDirection="None" to the my chart's AxisY, but this hasn't had an effect on the range. I have also tried specifying the DateTime values along my chart's AxisX as OLE Automation values and setting IsDateTime to true, to no avail.

Also, while I've managed to change the fill colours of the bars from their defaults to red and green (thanks to another helpful forum post), I haven't managed to find a way to change the colour of the candlestick outlines. They're currently light blue, and I'd like them to be black.

Any help with either of these issues would be much appreciated.

Thanks,
- Chris M.

4 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 30 Jun 2011, 10:40 AM
Hello Chrism,

Can you please send us a sample project with the described "extra margin" problem so we can have a look of all used settings and give you an appropriate approach for your scenario?
 
Regarding your second question - you can use the exposed Appearance API as shown below:
series.Definition.Appearance.Stroke = new SolidColorBrush(Colors.Black);

Regards,
Sia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
ChrisM
Top achievements
Rank 1
answered on 30 Jun 2011, 11:03 AM
Hi Sia,

Thanks for the reply. A bit of work over the past day or so has resolved the issues in my post (I'd come to exactly the same solution for the changing the Stroke on the Appearance after a bit of digging in the source code :)

Thanks,
- Chris M.
0
Mitchell
Top achievements
Rank 1
answered on 22 Aug 2011, 02:27 PM
I am wondering if the borders and be different colors? It seems that the Stroke property applies to all in the candlestick series.
Mitchell M.
0
Evgenia
Telerik team
answered on 25 Aug 2011, 09:09 AM
Hello Mitchell,

I assume that you want the Center Rectangle of the CandleStick to be different color than the Doji Line. This can be achieved by retemplating the default Style of the CandleStick. Note the Stroke and the StrokeThickness added in the Style:
<Style x:Key="myCandleStick"
         TargetType="telerik:CandleStick">
         <Setter Property="RadiusX" Value="{StaticResource CandleRadiusX}" />
         <Setter Property="RadiusY" Value="{StaticResource CandleRadiusY}" />
         <Setter Property="LineThickness" Value="{StaticResource CandleStickLineStrokeThickness}" />
         <Setter Property="Template" >
             <Setter.Value>
                 <ControlTemplate TargetType="telerik:CandleStick">
                     <Canvas x:Name="PART_MainContainer">
                         <telerik:ParametricLine x:Name="PART_UpperLine" LineStyle="{TemplateBinding ItemStyle}"
                         StrokeThickness="{TemplateBinding LineThickness}">
                         </telerik:ParametricLine>
                         <telerik:ParametricLine x:Name="PART_LowerLine" LineStyle="{TemplateBinding ItemStyle}"
                           StrokeThickness="{TemplateBinding LineThickness}"/>
                         <Rectangle x:Name="PART_CenterRectangle" 
                                Height="{TemplateBinding CandleHeight}" 
                                Canvas.Top="{TemplateBinding MinYValue}"
                                Stroke="Red"
                                StrokeThickness="2"
                                RadiusX="{TemplateBinding RadiusX}"
                                RadiusY="{TemplateBinding RadiusY}"/>
                         <telerik:ParametricLine x:Name="PART_DojiLine"
                                   Visibility="{TemplateBinding DojiLineVisibility}"
                                   LineStyle="{TemplateBinding ItemStyle}"
                                   StrokeThickness="{TemplateBinding LineThickness}"/>
                     </Canvas>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
     </Style>

Kind regards,
Evgenia
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

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