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

How to define candlestick template?

3 Answers 129 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shantimohan
Top achievements
Rank 1
Shantimohan asked on 30 Oct 2012, 02:55 AM
For the candlestick being displayed, I want to:
  1. Thicken the lines.
  2. Fill the rectangle with red or green colors.
  3. Change the color of the lines.

How to get it?

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 01 Nov 2012, 12:33 PM
Hello Shantimohan,

Currently the CandlestickSeries class does not support  dynamic choice of styles. You can only set the DefaultVisualStyle property to specify the visual style of the candle sticks. For example:

<chart:CandlestickSeries.DefaultVisualStyle>
    <Style TargetType="chart:Candlestick">
        <Setter Property="StrokeThickness" Value="2" />
        <Setter Property="UpStroke" Value="{StaticResource PhoneForegroundBrush}" />
        <Setter Property="DownStroke" Value="{StaticResource PhoneForegroundBrush}" />
        <Setter Property="UpFill" Value="Green" />
        <Setter Property="DownFill" Value="Transparent"/>
    </Style>
</chart:CandlestickSeries.DefaultVisualStyle>

This XAML snippet assumes that this namespace is declared:
xmlns:chart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"

Please write again if you have other questions.

Regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Shantimohan
Top achievements
Rank 1
answered on 01 Nov 2012, 05:35 PM
Yes, I was looking for this. But unfortunately, none of the properties have any effect on rendering of CandleStick except for the "StrokeThickness".  What am I missing?
0
Victor
Telerik team
answered on 06 Nov 2012, 09:44 AM
Hello Shantimohan,

Thanks for writing.
I am afraid that I can not tell what is missing in your XAML since I haven't seen it. However, here is another XAML snippet that you can use to figure out what is different in your project.

<chart:RadCartesianChart x:Name="chart">
    <chart:RadCartesianChart.Grid>
        <chart:CartesianChartGrid MajorLinesVisibility="XY" MajorXLineDashArray="5, 5" MajorYLineDashArray="5, 5">
            <chart:CartesianChartGrid.MajorXLineStyle>
                <Style TargetType="Line">
                    <Setter Property="Shape.Stroke" Value="Gray" />
                </Style>
            </chart:CartesianChartGrid.MajorXLineStyle>
            <chart:CartesianChartGrid.MajorYLineStyle>
                <Style TargetType="Line">
                    <Setter Property="Shape.Stroke" Value="Gray" />
                </Style>
            </chart:CartesianChartGrid.MajorYLineStyle>
        </chart:CartesianChartGrid>
    </chart:RadCartesianChart.Grid>
    <chart:RadCartesianChart.VerticalAxis>
        <chart:LinearAxis LineStroke="{StaticResource PhoneDisabledBrush}" LineThickness="2" Maximum="10" />
    </chart:RadCartesianChart.VerticalAxis>
    <chart:RadCartesianChart.HorizontalAxis>
        <chart:CategoricalAxis LineStroke="{StaticResource PhoneDisabledBrush}" LineThickness="2" />
    </chart:RadCartesianChart.HorizontalAxis>
    <chart:CandlestickSeries>
        <chart:CandlestickSeries.DefaultVisualStyle>
            <Style TargetType="chart:Candlestick">
                <Setter Property="StrokeThickness" Value="2" />
                <Setter Property="UpStroke" Value="Yellow" />
                <Setter Property="DownStroke" Value="Cyan" />
                <Setter Property="UpFill" Value="Green" />
                <Setter Property="DownFill" Value="Red"/>
            </Style>
        </chart:CandlestickSeries.DefaultVisualStyle>
         
        <my:OhlcDataPoint Category="Mon" Close="5" High="6" Low="3" Open="3.5" />
        <my:OhlcDataPoint Category="Tue" Close="5" High="8" Low="4" Open="6" />
        <my:OhlcDataPoint Category="Wed" Close="2.5" High="4" Low="2" Open="3.7" />
        <my:OhlcDataPoint Category="Thu" Close="7" High="9" Low="6" Open="8.8" />
        <my:OhlcDataPoint Category="Fri" Close="6" High="7" Low="2" Open="3" />
    </chart:CandlestickSeries>
</chart:RadCartesianChart>

Please write again if you have other questions.

Regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
Shantimohan
Top achievements
Rank 1
Answers by
Victor
Telerik team
Shantimohan
Top achievements
Rank 1
Share this question
or