Skip to main content
Home Forums Silverlight Design Designing with Silverlight Chart: Bubble Data Point Scale?
2 replies. Latest Post by Mog Liang - MSFT on July 28, 2009.
(0)
cyrix
Member
3 points
15 Posts
07-21-2009 4:51 PM |
I understand that a third value sets the bubble size in relation to the other points in the series. However what if I want to maintain that relationship while capping the bubble's size to a maximum value?
I've tried using the series.DataPointStyle property to set the MaxHeight and MaxWidth properties of the bubble. However that approach causes all points to be the same size.
Thanks in advance
07-22-2009 3:52 PM |
surely this can't be that uncommon of an issue. Every other chart control I've used gives options to set a bubble's scale.
Mog Lian...
All-Star
15884 points
1,541 Posts
07-28-2009 12:17 AM |
Hi,
We could use ValueConverter to filter MaxValue and translate it to some desire value.
Here is my sample code:
ValueConverter c#
public class MyValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((double)value == double.MaxValue) { return parameter; } return value; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }
<Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <my:MyValueConverter x:Name="vc1"/> </Grid.Resources> <charting:Chart Name="chart1"> <charting:Chart.Series> <charting:BubbleSeries DependentValuePath="Risk" IndependentValuePath="Date" SizeValueBinding="{Binding Cost,Converter={StaticResource vc1},ConverterParameter=5}" > </charting:BubbleSeries> </charting:Chart.Series> </charting:Chart> </Grid>
Please check if it's useful.