Styling RadChart for CandleStick data

5 posts, 0 answers
  1. ChrisM
    ChrisM avatar
    12 posts
    Member since:
    Apr 2011

    Posted 28 Jun 2011 Link to this post

    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.
  2. Sia
    Admin
    Sia avatar
    667 posts

    Posted 30 Jun 2011 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. ChrisM
    ChrisM avatar
    12 posts
    Member since:
    Apr 2011

    Posted 30 Jun 2011 Link to this post

    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.
  5. Mitchell
    Mitchell avatar
    1 posts
    Member since:
    Jul 2010

    Posted 22 Aug 2011 Link to this post

    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.
  6. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 25 Aug 2011 Link to this post

    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 >>

Back to Top
UI for WPF is Visual Studio 2017 Ready