Skip to main content

Microsoft Silverlight

Answered Question Chart: Bubble Data Point Scale?RSS Feed

(0)

cyrix
cyrix

Member

Member

3 points

15 Posts

Chart: Bubble Data Point Scale?

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

 

cyrix
cyrix

Member

Member

3 points

15 Posts

Re: Chart: Bubble Data Point Scale?

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 Liang - MSFT
Mog Lian...

All-Star

All-Star

15884 points

1,541 Posts

Answered Question

Re: Chart: Bubble Data Point Scale?

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();
        }
    }
 Usage xaml 
    <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.

 

Mog Liang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities