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

Use a LinearGradient with a AreaSeries?

1 Answer 150 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Thorsten
Top achievements
Rank 1
Thorsten asked on 19 May 2011, 04:28 PM
Hi,

I'm trying to give my price charts a 'Bloomberg' like look, i.e. I want to fill the area beneath the data series with a LinearGradientBrush.

I tried several options:
a) setting the PaletteBrushes like this:
           
<telerik:RadChart.PaletteBrushes>
  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
    <GradientStop Color="Red" Offset="0" />
    <GradientStop Color="BlueViolet" Offset="1" />
  </LinearGradientBrush>
</telerik:RadChart.PaletteBrushes>


b) setting Appearance.Fill on the AreaSeriesDefinition like this:
Appearance = new SeriesAppearanceSettings
         {
             Fill = new LinearGradientBrush(Colors.OrangeRed, Colors.Blue, 90)
         }

c) finally by creating a new style for the SelfDrawingSeries object and setting the BackgroundStyle:
<Setter Property="BackgroundStyle">
    <Setter.Value>
        <Style TargetType="Shape">
            <Setter Property="Fill">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="OrangeRed" Offset="0"/>
                        <GradientStop Color="Blue" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Opacity" Value="0.5" />
        </Style>
    </Setter.Value>
</Setter>

All three approaches produced a visible effect (wow!) but it appears as if only the start color is used to fill the area of the series.

Is there something I'm getting or doing wrong or is this a bug?

Thanks,
Thorsten

1 Answer, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 24 May 2011, 11:23 AM
Hi Thorsten,

It seems there is a bug in the control -- the fill is not applied correctly when AxisY.IsZeroBased is set to false (which is the default value). If setting IsZeroBased to true is not acceptable, as a temparary workaround you can provide a different EndPoint for the LinearGradientBrush. Basically, this will "artificially" move the last gradient stop upwards. Ex. if your AxisY display values from 9000 to 10000, this is a range of 1000 over a max value of 10000, so you need only one tenth -- use this EndPoint="0, 0.1"

I have updated your Telerik points for bringing this to our attention.

Best regards,
Ves
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
Tags
Chart
Asked by
Thorsten
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or