Dear Sir
How to i re-position the series items?
for example the bar chart contain a few bar item. i write a code to remove those item value = 0. after removed those 0 value bar item. the tchart still remand the space. how to I call tchart to draw the series correctly?
eric
Reposition series
Hi Eric
We can't reproduce the problem here with the latest version available at the client area. Which teeChart version are you using ?
If the problem persist, could you please send us a simple example project we can run "as-is" or some code so that we can reproduce the problem here?
You can post your files at news://steema.public.attachments newsgroup
Thanks in advance
We can't reproduce the problem here with the latest version available at the client area. Which teeChart version are you using ?
If the problem persist, could you please send us a simple example project we can run "as-is" or some code so that we can reproduce the problem here?
You can post your files at news://steema.public.attachments newsgroup
Thanks in advance
Dear Sir
Below is the sample code. click the button 1 then only click the button 2.
you can see the bar 3 and 4 is stick together already. how do make tchart draw collectly the position? or any method to so suppress zero?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TChart1.Series.Add(New Steema.TeeChart.Styles.Bar3D)
TChart1.Series(0).Add(23, "1", TChart1.Series(0).Color)
TChart1.Series(0).Add(0, "2", TChart1.Series(0).Color)
TChart1.Series(0).Add(453, "3", TChart1.Series(0).Color)
TChart1.Series(0).Add(2343, "4", TChart1.Series(0).Color)
TChart1.Series(0).Add(0, "5", TChart1.Series(0).Color)
TChart1.Series(0).Add(53, "6", TChart1.Series(0).Color)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SuppressSeriesZero()
End Sub
Public Sub SuppressSeriesZero()
If TChart1.Series.Count <> 0 Then
Dim i, ii As Integer
Dim Total As Double = 0
For i = 0 To TChart1.Series(0).Count - 1
For ii = 0 To TChart1.Series.Count - 1
If InStr(TChart1.Series(ii).GetType.Name, "Horiz") = 0 Then
Total = Total + TChart1.Series(ii).YValues.Value(i)
Else
Total = Total + TChart1.Series(ii).XValues.Value(i)
End If
If Total <> 0 Then
Exit For
End If
Next
If Total = 0 Then
For ii = 0 To TChart1.Series.Count - 1
TChart1.Series(ii).Delete(i)
Next
i = i - 1
End If
Total = 0
Next
TChart1.Refresh()
End If
End Sub
thank
Below is the sample code. click the button 1 then only click the button 2.
you can see the bar 3 and 4 is stick together already. how do make tchart draw collectly the position? or any method to so suppress zero?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TChart1.Series.Add(New Steema.TeeChart.Styles.Bar3D)
TChart1.Series(0).Add(23, "1", TChart1.Series(0).Color)
TChart1.Series(0).Add(0, "2", TChart1.Series(0).Color)
TChart1.Series(0).Add(453, "3", TChart1.Series(0).Color)
TChart1.Series(0).Add(2343, "4", TChart1.Series(0).Color)
TChart1.Series(0).Add(0, "5", TChart1.Series(0).Color)
TChart1.Series(0).Add(53, "6", TChart1.Series(0).Color)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SuppressSeriesZero()
End Sub
Public Sub SuppressSeriesZero()
If TChart1.Series.Count <> 0 Then
Dim i, ii As Integer
Dim Total As Double = 0
For i = 0 To TChart1.Series(0).Count - 1
For ii = 0 To TChart1.Series.Count - 1
If InStr(TChart1.Series(ii).GetType.Name, "Horiz") = 0 Then
Total = Total + TChart1.Series(ii).YValues.Value(i)
Else
Total = Total + TChart1.Series(ii).XValues.Value(i)
End If
If Total <> 0 Then
Exit For
End If
Next
If Total = 0 Then
For ii = 0 To TChart1.Series.Count - 1
TChart1.Series(ii).Delete(i)
Next
i = i - 1
End If
Total = 0
Next
TChart1.Refresh()
End If
End Sub
thank
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Eric,
The chart is not drawn incorrectly. When you populate one series without specifing the X values they are automatically added an range from 0 to Series.Count-1.
When you remove the series points which have a 0 value, the other points X values are not modified. Therefore the series is not drawn incorrectly as the bottom axis respects the series X values.
To achieve what you request you can use XValues.FillSequence() method or implement something like RemoveEmptySpaces:
The chart is not drawn incorrectly. When you populate one series without specifing the X values they are automatically added an range from 0 to Series.Count-1.
When you remove the series points which have a 0 value, the other points X values are not modified. Therefore the series is not drawn incorrectly as the bottom axis respects the series X values.
To achieve what you request you can use XValues.FillSequence() method or implement something like RemoveEmptySpaces:
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TChart1.Series.Add(New Steema.TeeChart.Styles.Bar3D)
TChart1.Series(0).Add(23, "1", TChart1.Series(0).Color)
TChart1.Series(0).Add(0, "2", TChart1.Series(0).Color)
TChart1.Series(0).Add(453, "3", TChart1.Series(0).Color)
TChart1.Series(0).Add(2343, "4", TChart1.Series(0).Color)
TChart1.Series(0).Add(0, "5", TChart1.Series(0).Color)
TChart1.Series(0).Add(53, "6", TChart1.Series(0).Color)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SuppressZeroValues()
TChart1(0).XValues.FillSequence()
'or
'RemoveEmptySpaces()
End Sub
Public Sub SuppressZeroValues()
If TChart1.Series.Count <> 0 Then
Dim i As Integer
For i = 0 To TChart1(0).Count - 1
If (TChart1(0).YValues(i) = 0) Then
TChart1(0).Delete(i)
End If
Next
End If
End Sub
Public Sub RemoveEmptySpaces()
Dim i As Integer
For i = 0 To TChart1(0).Count - 1
TChart1(0).XValues(i) = i
Next
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 |
Instructions - How to post in this forum |