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

[Solved] Style depending on bubble value

2 Answers 69 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.
Simon
Top achievements
Rank 1
Simon asked on 21 Jun 2013, 01:20 PM
Hello,

I have a bubble chart with positive and negative value for the same series. Would it be possible to give a different style for a negative value bubble ? Since my bubbles are blue, the negative ones could be red. If it is possible, what are the style changes that I can apply to a bubble (dotted perimeter, filled with a texture etc.) 

Thank you in advance for your help!

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar Marchev
Telerik team
answered on 26 Jun 2013, 07:39 AM
Hi,

One option you have is to use the CreateItemStyleDelegate property of the RadChart (help topic here). The code below should also be helpful:
public Style chart1_CreateItemStyle_RedIfNegative(Control c, Style s, DataPoint dp, DataSeries ds)
{
 Style resultStyle = new Style(s.TargetType);
 resultStyle.BasedOn = s;
 
 var chartItem = c as BaseChartItem;
 var lineSeries = c as LineSeries;
 
 if (chartItem != null && ds[chartItem.CurrentIndex].YValue < 0)
 {
  Brush redBrush = new SolidColorBrush(new Color() { R = 200, G = 20, B = 20, A = 55 });
  resultStyle.Setters.Add(new Setter(Shape.FillProperty, redBrush));
 }
 
 return resultStyle;
}


Regards,
Petar Marchev
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Simon
Top achievements
Rank 1
answered on 26 Jun 2013, 01:14 PM
Works perfectly, thank you!
Tags
Chart
Asked by
Simon
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Simon
Top achievements
Rank 1
Share this question
or