开发者

Scaling/resizing the diameter of all bubbles on a bubble chart (in WPF or Silverlight)

I have a bubble chart in a WPF application with LOTS of points in a BubbleSeries. The automatically drawn sizes of the bubbles result in so much overlap of the plotted bubbles, that most of the bubble points are obscured. The drawn bubble size does not change if I alter the data reduce the SizeValues of all the plotted points (some sort of hidden logic seems to be determining how to automatically scale the SizeValues when drawing the bubbles).

How can I reduce the diameter of every bubble by 75% (so each bubble's diameter is one fourth the normal automatic size)?

Thanks, Alan

[I am working with the charting/data visulaization controls in the June 2009 WPF control toolkit, but I think the 开发者_开发技巧same question and answer probably applies to Silverlight 3 bubble charts.]


Creating the Style:

    <Style x:Key="BubbleDataPointStyle" TargetType="chartingToolkit:BubbleDataPoint">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="chartingToolkit:BubbleDataPoint">
                    <Grid RenderTransformOrigin=".5,.5">
                        <Grid.RenderTransform>
                            <ScaleTransform ScaleX=".25" ScaleY=".25" />
                        </Grid.RenderTransform>
                        <controlsToolkit:Viewbox x:Name="viewbox">
                            <Ellipse Width="1" Height="1" />
                        </controlsToolkit:Viewbox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Add the Style to your data points:

    <chartingToolkit:Chart>
        <chartingToolkit:Chart.Series>
            <chartingToolkit:BubbleSeries
                ItemsSource="{Binding ObjectCollection}"
                IndependentValuePath="AxisX"
                DependentValuePath="AxisY"
                SizeValuePath="Size"
                DataPointStyle="{StaticResource BubbleDataPointStyle}" />
        </chartingToolkit:Chart.Series>
    </chartingToolkit:Chart>


If I understand the question correctly, you want to be able to scale your content without actually having to redraw it, correct? If so, you should have a look at the Viewbox class.


Not sure if there's something like this in WPF toolkit charts but in amCharts for WPF there are MinBulletSize/MaxBulletSize properties to control scaling of the bubbles. I think there must be something along these lines in WPF/Silverlight toolkit charts too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜