Page 1 of 1
Bubble chart
Posted: Mon Nov 22, 2004 9:50 pm
by 9082734
Hi,
I would really like to use the Bubble series as this is perfect for a project I am working on. I am using TeeChart version 6 of the ASP plug-in. Please can you show me a short code snippet that will generate a simple bubble chart, and also let me know what each option is. I believe it is something like:
Code: Select all
Do Until END_OF_RECORDSET
With CHARTNAME.Series(1).asBubble
.AddBubble OPTION1, OPTION2, OPTION3, i, COLOR
i = i + 1
adoRs.MoveNext
End With
Loop
but I am not sure. Thanks!
Posted: Tue Nov 23, 2004 2:56 pm
by Pep
Hi,
yes, you must use the AddBubble method, from the help :
function AddBubble(AX, AY, ARadius: Double; Const AXLabel: WideString; Value: OLE_COLOR): Integer;
Type Library
TeeChartX
Description
The AddBubble method appends a new Bubble point to the Series Points List. The Bubble point is assigned to be at AX,AY coordinates and have ARadius, Label and Color parameters. The Label parameter is used to draw Axis Labels, Bubble Marks and Legend.
Example
This example randomly creates bubble values.
Example [Visual Basic]:
Dim t As Integer
With TChart1
.Series(0).Clear
For t = 1 To 10
.Series(0).asBubble.AddBubble t, Rnd(2), Rnd(5), "", _
RGB(255 * Rnd, 128 * Rnd, 255 * Rnd)
Next t
End With
Posted: Tue Nov 23, 2004 8:26 pm
by 9082734
Hi Josep,
Thanks for this. I did get the example to work.
I have a 2D table of values that I'd like to display is a bubble chart, where the size of the bubble is represented by the value in the cell. I would therefore get a chart with 'bubbles' replacing the table 'cells'. Is this possible? The chart would look like columns of bubbles of different sizes, with the table top/left titles becoming the chart axes.
2 3 1 ---> |O 0 o
1 2 3 ---> |o O 0
3 3 2 ---> |0 o O
1 1 2 ---> |o o O
----------> ---------> etc.
Thanks again,
Terry
Posted: Wed Nov 24, 2004 11:38 am
by narcis
Hi Terry,
To have your chart like a bubble table you can do something like:
Code: Select all
Private Sub Form_Load()
Dim x, y, FMin, FMax As Integer
FMin = 1
FMax = 5
TChart1.Axis.Bottom.SetMinMax FMin - 1, FMax + 1
TChart1.Axis.Left.SetMinMax FMin - 1, FMax + 1
With TChart1.Series(0)
For x = FMin To FMax
For y = FMin To FMax
.asBubble.AddBubble x, y, Rnd(5), "", clTeeColor
Next y
Next x
End With
End Sub
Setting Axis Min. and Max. values you will have a better aproach to a "table-like" appearence, then you will have to add the bubbles with your table source values.