Scaling a Bubble Chart While Zooming

To scale the Bubble chart while zooming, adjust the scale in the PlotElementLoaded event like the following:

 

var ds = new BubbleSeries()

{

XValuesSource = new double[] { 1, 2, 3, 4 },

ValuesSource = new double[] { 1, 2, 3, 4 },

SizeValuesSource = new double[] { 1, 2, 3, 4 },

};

 

ds.PlotElementLoaded += (s, e) =>

{

var pe = (PlotElement)s;

pe.RenderTransform = new ScaleTransform()

{

ScaleX = 1.0 / chart.View.AxisX.Scale,

ScaleY = 1.0 / chart.View.AxisY.Scale

};

pe.RenderTransformOrigin = new Point(0.5, 0.5);

};

 

chart.Data.Children.Add(ds);

chart.ChartType = ChartType.Bubble;

 

chart.Actions.Add(new TranslateAction());

chart.Actions.Add(new ScaleAction() { Modifiers = ModifierKeys.Control });


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.