Page 1 of 1
how to Change Bar to Bubble?
Posted: Fri Apr 14, 2006 9:22 am
by 9638303
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
Posted: Mon Apr 17, 2006 1:17 pm
by 9638303
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
Posted: Wed Apr 19, 2006 10:26 am
by narcis
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
Posted: Thu Apr 20, 2006 2:19 am
by 9638303
Dear Narcís
Your code not work for me. chart still doesn't show anything.
So any ideas?
Eric
Posted: Thu Apr 20, 2006 8:08 am
by narcis
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.
Posted: Thu Apr 20, 2006 4:57 pm
by 9638303
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
Posted: Fri Apr 21, 2006 2:12 pm
by narcis
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:
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
Posted: Fri Apr 21, 2006 5:15 pm
by 9638303
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
Posted: Mon Apr 24, 2006 9:20 am
by narcis
Hi Eric,
This is because each bubble has a different color. To display the color on the legend you need to use:
or
Code: Select all
TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Values
Posted: Mon Apr 24, 2006 3:08 pm
by narcis
Hi Eric,
I've splitted your last reply into
another topic as it doesn't have much to do this thread.