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

Determining actual visual size for bubble on bubble chart

8 Answers 132 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Allen
Top achievements
Rank 1
Allen asked on 28 Nov 2013, 10:34 PM
Hi,

I am creating a bubble chart and have a BubbleSeriesDefinition declared below as follows

var bubbleDefinition = new BubbleSeriesDefinition() { BubbleSizeRelative = false};

bubbleDefinition.BubbleSizeRelative = true;

bubbleDefinition.BubbleSizeRepresents = BubbleSizeRepresentation.Diameter;



I noticed that even when I set the size of my bubble to a value of say15 (Set BubbleSize=15 ), the actual diameter of the bubble is not 15 on the X or Y Axis.

Is there away I can get the actual size of the bubble relative to the X or Y axis. That is the bubble of  size 15 is actually 3 units on the X Axis.

I want to calculate this even when the definition is set up to be

bubbleDefinition.BubbleSizeRepresents = BubbleSizeRepresentation.Area;

Any help in this area is appreciated.

The primary reason why I need to know this is because my start and end bubble tend to get curtailed from the chart and I need to specify a Min and Max vale for the X and Y axis so all bubbles are visible.

Hence I need to know the bubble size relative to the axis.

8 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 29 Nov 2013, 08:28 AM
Hello Allen,

When set to absolute (BubbleSizeRelative = false) the chart handles the size of the bubble in absolute units. So, if you have a bubble with a bubble size of 30 and BubbleSizeRepresents Diameter - this means that the diameter of the bubble will be 30 units.

There is no out-of-the-box way to get the chart not to clip the bubble if it is larger. So you will need to handle this manually. However, there is no out-of-the-box mean that lets you know the bubble size relative to the axis.

One option is to calculate this with the conversion api (chart1.DefaultView.ChartArea.AxisX.ConvertPhysicalUnitsToData method). You can use it to determine the x-axis-range to which the size of the bubble scales (x-axis-range = ConvertPhysicalUnitsToData(30) - (ConvertPhysicalUnitsToData(0)) and then you can apply your custom logic on setting the manual range. 

Let us know if this helps.

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
Allen
Top achievements
Rank 1
answered on 29 Nov 2013, 12:02 PM
Thanks for that...im under the impression thay my company prefers to leave
BubbleSizeRelative  = true.

Because they do want the bubble to autosize when the chart changes size.

Would your suggestion still work if that were the case?

Or can you suggest a way to ascertain the nunber of units relative to the x and y axis when
BubbleSizeRelative = true?

Thanks
0
Petar Marchev
Telerik team
answered on 02 Dec 2013, 09:06 AM
Hello Allen,

When BubbleSizeRelative is, this issue should not arise - the chart will determine the maximum size of the bubble (from the max value and chose the largest size that fits in the plot area) and will relatively size the rest of the bubbles. As a result - all bubbles should fit the plot area.

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
Allen
Top achievements
Rank 1
answered on 02 Dec 2013, 10:13 AM
Thanks Petar,

I will experiment as I am seeing the bubnle clipped do must be some property or code I sm overllooking.

Iassume doing tthings like setting maxvalue on one of the axis will affect this so will look out for thibgs like that.

If you have any other ideas on what to look out for as to what would cause this that would be great.
Thanks
0
Petar Marchev
Telerik team
answered on 02 Dec 2013, 11:47 AM
Hi Allen,

When the bubble size is relative - the largest bubble has the same size as a categorical slot - this is one slot of the X-Axis. Say that the chart is 700 pixels wide and you have 7 categories. The largest bubble will be about 100 pixels wide. If you have not changed the plot mode of the axis - the bubble should not overflow for the horizontal categorical axis.

If you are using the horizontal axis in value regime and not in categorical regime, then it is possible for the bubble not to be positioned in the center of the axis slot, which could lead to clipping.

Now that I double checked - it is possible for the vertical axis to calculate an auto range that could lead to this truncating. In both cases you can try to apply the work around at hand. Let us know if you need further help.

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
Allen
Top achievements
Rank 1
answered on 03 Dec 2013, 11:27 AM
Thanks Petar,

So I guess the best workaround is to calculate the x axis which is done by value,
How many extra pixels the bubble may take using the option convertphysicalunitstodata?

It clips both y and x axis, and from there I can set the x max range and y range .... Could be a bit tough..

0
Petar Marchev
Telerik team
answered on 03 Dec 2013, 06:27 PM
Hi Allen,

I have attached a demo project which contains a UpdateAxisRange method that expands the axis range when needed. Note that this is code is for guiding purposes and you should carefully update it and test if you decide to use it in your actual app. I hope it is of help.

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
Allen
Top achievements
Rank 1
answered on 09 Dec 2013, 11:25 PM
Thanks a lot for that Petar, was helpful
Tags
Chart
Asked by
Allen
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Allen
Top achievements
Rank 1
Share this question
or