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

Bubble Chart: Making All Bubbles the Same Size

3 Answers 83 Views
Chart
This is a migrated thread and some comments may be shown as answers.
David Huxtable
Top achievements
Rank 1
David Huxtable asked on 23 Mar 2009, 06:55 AM
Good Afternoon,

In order to implement a scatter graph I have been trying to use a bubble chart, with the intent of setting them to the same size. At best I was able to set all the bubbles to a size of 2.5 if one bubble was large, whihc was set to size 100. The smaller I make this large bubble, the bigger the other bubbles appear.

Obviously I don't fully understand how the bubble chart works, why do you think this is occurring? I saw the Bubble class has a Radius property, although I couldn't see how to set it. Are you able to give me a little example showing this if the radius property is my answer to the problem?

Otherwise, is it possible to remove the lines for the LineChart?

Thank you for your time,

David

3 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 24 Mar 2009, 09:21 AM
Hi David,

There are two properties specific to the BubbleSeriesDefinition that you will probably find useful:

  • BubbleSizeRelative -- Gets or sets a value indicating whether the bubble size should be relative to the available ChartArea, or should be interpreted as an absolute value in device-independent pixels. The default value is true.
  • BubbleSizeRepresents -- Gets or sets a value indicating whether the bubble size should be interpreted as the bubble diameter (linear dependence) or as the bubble area (quadratic dependence). The default value is BubbleSizeRepresentation.Diameter.

So you will probably need to set the BubbleSeriesDefinition.BubbleSizeRelative property to false like this:

using System.Windows; 
using Telerik.Windows.Controls.Charting; 
 
namespace WpfApplication1 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
 
            DataSeries series = new DataSeries() 
                                    { 
                                        new DataPoint(){YValue = 10BubbleSize = 10},  
                                        new DataPoint(){YValue = 30BubbleSize = 10},  
                                        new DataPoint(){YValue = 20BubbleSize = 10}, 
                                        new DataPoint(){YValue = 15BubbleSize = 10}, 
                                        new DataPoint(){YValue = 17BubbleSize = 10}, 
                                    }; 
 
            series.Definition = new BubbleSeriesDefinition(); 
            (series.Definition as BubbleSeriesDefinition).BubbleSizeRelative = true
             
            RadChart1.DefaultView.ChartArea.DataSeries.Add(series); 
        } 
    } 


Unfortunately the current version of the control does not support strict mode for the horizontal axis (basically the XValue is not respected) so I am not quite sure how useful would be that approach for Scatter at the moment.


Greetings,
Manuel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
David Huxtable
Top achievements
Rank 1
answered on 25 Mar 2009, 05:56 AM
Hello Again Manuel,

I will most likely be using the LineChart but just out of interest, I noticed a Label property for the BubbleChart, along with BubbleSize and YAxis etc. Is this to display a label under the bubble like the LineChart? The reason I ask is I tried to display the Y coordinate under each bubble via the Label but couldn't see anything when running the application. Do I have a completely wrong view of what this label property is for?

Many many thanks Manuel,

David.
0
Giuseppe
Telerik team
answered on 25 Mar 2009, 11:41 AM
Hi David,

We are not sure which Label property you are referring to but series item labels are not applicable for certain series types like Bubble, Stick, CandleStick, etc. We can suggest you to enable the series item tooltips instead if you will be using Bubble to mimic Scatter series type:

using System.Windows; 
using Telerik.Windows.Controls.Charting; 
 
namespace WpfApplication1 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
 
            DataSeries series = new DataSeries() 
                                    { 
                                        new DataPoint(){YValue = 10, BubbleSize = 10},  
                                        new DataPoint(){YValue = 30, BubbleSize = 10},  
                                        new DataPoint(){YValue = 20, BubbleSize = 10}, 
                                        new DataPoint(){YValue = 15, BubbleSize = 10}, 
                                        new DataPoint(){YValue = 17, BubbleSize = 10}, 
                                    }; 
 
            series.Definition = new BubbleSeriesDefinition(); 
            (series.Definition as BubbleSeriesDefinition).BubbleSizeRelative = false
            series.Definition.ShowItemToolTips = true
 
            DataSeries series2 = new DataSeries() 
                                    { 
                                        new DataPoint(){YValue = 20, BubbleSize = 10},  
                                        new DataPoint(){YValue = 40, BubbleSize = 10},  
                                        new DataPoint(){YValue = 10, BubbleSize = 10}, 
                                        new DataPoint(){YValue = 25, BubbleSize = 10}, 
                                        new DataPoint(){YValue = 7, BubbleSize = 10}, 
                                    }; 
 
            series2.Definition = new BubbleSeriesDefinition(); 
            (series2.Definition as BubbleSeriesDefinition).BubbleSizeRelative = false
            series2.Definition.ShowItemToolTips = true
 
            RadChart1.DefaultView.ChartArea.DataSeries.Add(series); 
            RadChart1.DefaultView.ChartArea.DataSeries.Add(series2); 
        } 
    } 
 


Also, Scatter series type is definitely in our TODO list and we will be adding it for one of the future releases later this year (hopefully for the Q2 2009 release around July).


Kind regards,
Manuel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Chart
Asked by
David Huxtable
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
David Huxtable
Top achievements
Rank 1
Share this question
or