Determining actual visual size for bubble on bubble chart

9 posts, 0 answers
  1. Allen
    Allen avatar
    18 posts
    Member since:
    Apr 2013

    Posted 28 Nov 2013 Link to this post

    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.
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 29 Nov 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Allen
    Allen avatar
    18 posts
    Member since:
    Apr 2013

    Posted 29 Nov 2013 Link to this post

    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
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 02 Dec 2013 Link to this post

    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 >>
  6. Allen
    Allen avatar
    18 posts
    Member since:
    Apr 2013

    Posted 02 Dec 2013 Link to this post

    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
  7. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 02 Dec 2013 Link to this post

    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 >>
  8. Allen
    Allen avatar
    18 posts
    Member since:
    Apr 2013

    Posted 03 Dec 2013 Link to this post

    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..

  9. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 03 Dec 2013 Link to this post

    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 >>
  10. Allen
    Allen avatar
    18 posts
    Member since:
    Apr 2013

    Posted 09 Dec 2013 Link to this post

    Thanks a lot for that Petar, was helpful
Back to Top
DevCraft banner