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

Marked zones annotations

5 Answers 113 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Clement Gram Christensen
Top achievements
Rank 1
Clement Gram Christensen asked on 05 Aug 2010, 11:04 AM
Hi,

I've just recently started using the Telerik tools and I'm rapidly becoming a fan.

I have one feature request though;

I have a chart which can be seen in the attached file, currentgraph.png. As you can see, I'm using the Marked Zones feature - which is great - but what I would really like to see, is the option of doing what I've done in the other attached file, newgraph.png (made in Paint, but I'm sure you get the idea).

This way, I don't have to stare at the ugly red block of background all the time, and when something red appears on my chart, I know it needs my attention.

Is there a feature that I don't know or is there any hope of seeing this feature in a future release?

5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 10 Aug 2010, 09:46 AM
Hello Clement,

One possible option in this case would be to use a gradient brush for the series. You can find additional information on the subject in the following article:

http://www.telerik.com/help/wpf/radchart-styling-and-appearance-styling-chart-series.html

The code may look something like this:

public MainPage()
       {
           InitializeComponent();            
           List<Manufacturer> data = new List<Manufacturer>();            
             
           data.Add(new Manufacturer("Monday", "Dave", 14, 111));           
           data.Add(new Manufacturer("Tuesday", "Dave", 1, 122));           
           data.Add(new Manufacturer("Wednesday", "Dave", 3, 155));
           this.telerikChart.ItemsSource = data;
           
           LinearGradientBrush brush1 = new LinearGradientBrush();
           GradientStop stop1 = new GradientStop();
           stop1.Offset = 0.2;
           stop1.Color = Colors.Red;
           GradientStop stop2 = new GradientStop();
           stop2.Offset = 0.5;
           stop2.Color = Colors.Blue;
           brush1.GradientStops.Add(stop1);
           brush1.GradientStops.Add(stop2);
           brush1.StartPoint = new Point(0.5, 0);
           brush1.EndPoint = new Point(0.5,1);
             
           telerikChart.DefaultView.ChartArea.PaletteBrushes.Add(brush1);
             
       }

This would allow you to not use the marked zones, and achieve an effect which is less obtrusive.
I hope this information helps.

Greetings,
Yavor
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
Clement Gram Christensen
Top achievements
Rank 1
answered on 25 Aug 2010, 01:23 PM
Hi Yavor,

Thanks for the reply. It certainly is a possible way of achieving what I want.

Now I'm just having trouble figuring out how to set the split values as absolutes. I.e. I want everything above 200 on the y-axis to be red, everything in between 100 and 200 to be yellow and so forth. In the sample you offered, I'm only able to get the colors relative to the max value of my graph.

Thanks,
Clement
0
Yavor
Telerik team
answered on 27 Aug 2010, 07:47 AM
Hi Clement,

Basically, there is no straightforward way to handle this. This would require some custom logic - to map the values from the data to which the chart binds, to the values of the offsets. Nevertheless, this is not difficult to achieve, and should meet your requirements well. Let me know how it goes.

Greetings,
Yavor
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
Clement Gram Christensen
Top achievements
Rank 1
answered on 09 Nov 2010, 11:56 AM
Hi Yavor,

Thanks for the reply. I've only just now gotten time to look at this issue again.

I'm now calculating the correct offset-values based on my desired limits and the max-value of my ever-changing datacollection.

My problem is now that because my collection is changing, my max-value is changing and therefore I need my offsets to change as well. I was certain this could be handled by some simple binding, but I just can't get it to work. My RadChart looks like this:

<telerik:RadChart x:Name="waitChartC" BorderBrush="Transparent" UseDefaultLayout="True" telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"
                                  ItemsSource="{Binding WaitingTimeDevelopmentC}">
                    <telerik:RadChart.DefaultView>
 
                        <telerik:ChartDefaultView >
                            <telerik:ChartDefaultView.ChartArea>
                                <telerik:ChartArea>
                                    <telerik:ChartArea.PaletteBrushes>
                                        <LinearGradientBrush StartPoint="0.5, 1" EndPoint="0.5, 0">
                                            <GradientStop Color="Red" Offset="{Binding RedOffset}"/>
                                            <GradientStop Color="Yellow" Offset="0.5"/>
                                            <GradientStop Color="Green" Offset="0"/>
                                        </LinearGradientBrush>
                                    </telerik:ChartArea.PaletteBrushes>                                   
                                </telerik:ChartArea>
                            </telerik:ChartDefaultView.ChartArea>
                        </telerik:ChartDefaultView>
                    </telerik:RadChart.DefaultView>
                </telerik:RadChart>

At first I thought it was simply because my RedOffset value wasn't being updated, but after adding a TextBlock elsewhere displaying this value, I could see that this was not the case.

Is it not possible to bind to the Offset values or am I missing something blatantly wrong here?

Regards,
Clement
0
Yavor
Telerik team
answered on 11 Nov 2010, 08:59 AM
Hello Clement,

In this case, you can consider using MVVM. More details on this option are available in the following article:

http://www.telerik.com/help/wpf/radchart-how-to-mvvm-support.html

I hope this gets you started properly.

Best wishes,
Yavor
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
Clement Gram Christensen
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Clement Gram Christensen
Top achievements
Rank 1
Share this question
or