how to Change Bar to Bubble?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

how to Change Bar to Bubble?

Post by Eric » Fri Apr 14, 2006 9:22 am

Dear Sir

How to change the Bar chart to bubble chart?
Im able to change the bar chart to bubble without error.
but all the bubble is not showing in the chart and only legend showing the bubble style

Can you give me vb.net sample code?

thank & best regard
Eric

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Mon Apr 17, 2006 1:17 pm

It since like no answer....
Can you please let me know whether that is possible to chnage the chart type from bar to bubble ?

Thank & Best Regard
Eric

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 19, 2006 10:26 am

Hi Eric,

This can not be automatically done because bar series doesn't have RadiusValues valuelist. However you can do it manually doing something like this:

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Bubble1 As Steema.TeeChart.Styles.Bubble = New Steema.TeeChart.Styles.Bubble(TChart1.Chart)
        Dim i As Integer

        For i = 0 To Bar1.Count - 1
            Bubble1.Add(Bar1.XValues(i), Bar1.YValues(i), 10)
        Next i

        TChart1.Series.Remove(Bar1)
    End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Thu Apr 20, 2006 2:19 am

Dear Narcís

Your code not work for me. chart still doesn't show anything.
So any ideas?

Eric

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Apr 20, 2006 8:08 am

Hi Eric,

It works fine for me here. Could you please send us an example we can run "as-is" to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Thu Apr 20, 2006 4:57 pm

Dear

I'm not able to post the sample test program. error message "No sender was specified, Please check your news account configuration"

Anyway below is the code that can not change bar to bubble.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i, b As Integer
For i = 0 To 0
AddSeries("Yong " & i)
For b = 0 To 80
AddSeriesItem(i, Rnd(999) * 100000, "Eric " & b)
Next
Next
Dim objChartStyle As New Steema.TeeChart.Styles.Bar3D
Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(0), objChartStyle.GetType)
objChartStyle = Nothing
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Bubble1 As Steema.TeeChart.Styles.Bubble = New Steema.TeeChart.Styles.Bubble(TChart.Chart)
Dim i As Integer
For i = 0 To TChart.Series(0).Count - 1
Bubble1.Add(TChart.Series(0).XValues(i), TChart.Series(0).YValues(i), 10)
Next i
TChart.Series.Remove(TChart.Series(0))
End Sub
Public Sub AddSeriesItem(ByVal SeriesIndex As Long, ByVal value As Double, ByVal DisplayName As String)
Call TChart.Series(SeriesIndex).Add(value, DisplayName, TChart.Series(SeriesIndex).Color)
End Sub
Public Sub AddSeries(ByVal SeriesTitle As String)
TChart.Series.Add(New Steema.TeeChart.Styles.Bar)
TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
TChart.Series(TChart.Series.Count - 1).Title = SeriesTitle
TChart.Series(TChart.Series.Count - 1).Color = Color.Red
End Sub

Thank
Eric

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 21, 2006 2:12 pm

Hi Eric,

You can not see the bubbles because they are to small compared to the left axis scale which has a very wide range. One easy way to see that is setting bubble marks visible:

Code: Select all

        Bubble1.Marks.Visible = True
Then you just have to zoom around a mark and after a few zooms done you'll see a small bubble appearing.

You'll solve that adding smaller values to the original series or setting a bigger radius for the bubbles. The code below works:

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i, b As Integer
        For i = 0 To 0
            AddSeries("Yong " & i)
            For b = 0 To 80
                AddSeriesItem(i, Rnd(999) * 100000, "Eric " & b)
            Next
        Next

        Dim objChartStyle As New Steema.TeeChart.Styles.Bar3D
        Steema.TeeChart.Styles.Series.ChangeType(TChart(0), objChartStyle.GetType)
        objChartStyle = Nothing
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim Bubble1 As Steema.TeeChart.Styles.Bubble = New Steema.TeeChart.Styles.Bubble(TChart.Chart)
        Dim i As Integer

        For i = 0 To TChart(0).Count - 1
            Bubble1.Add(TChart(0).XValues(i), TChart(0).YValues(i), 1000)
        Next i

        TChart.Series.Remove(TChart(0))

    End Sub

    Public Sub AddSeriesItem(ByVal SeriesIndex As Long, ByVal value As Double, ByVal DisplayName As String)
        Call TChart(SeriesIndex).Add(value, DisplayName, TChart(SeriesIndex).Color)
    End Sub

    Public Sub AddSeries(ByVal SeriesTitle As String)
        TChart.Series.Add(New Steema.TeeChart.Styles.Bar)
        TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
        TChart(TChart.Series.Count - 1).Title = SeriesTitle
        TChart(TChart.Series.Count - 1).Color = Color.Red
    End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Fri Apr 21, 2006 5:15 pm

Dear Narcís

Yes! It work! but why the legend don't not show the bubble color?
TChart.Legend.Symbol.Visible = True.

What can I do to let the legend show the symbol color?

Thank & Best Regard

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 24, 2006 9:20 am

Hi Eric,

This is because each bubble has a different color. To display the color on the legend you need to use:

Code: Select all

        Bubble1.ColorEach = False
or

Code: Select all

        TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Values
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 24, 2006 3:08 pm

Hi Eric,

I've splitted your last reply into another topic as it doesn't have much to do this thread.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply