Hi,
I am using Teechart Pro V6.0. In a graph I am drawing three curves. But the grid lines ad bottom axis labels are displaying only at Series0 points. But not at all the series points. Please provide a sample.
Thanks & Regards,
Rama
Displaying the grid lines at the graph points
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Rama,
To achieve what you request you have two options:
1) Setting label style to "talText" and add labels as text (event they are numeric) when using AddXY. This way you'll have all labels displayed.
2) Using an axis for each series adding as many custom axes as necessary.
To achieve what you request you have two options:
1) Setting label style to "talText" and add labels as text (event they are numeric) when using AddXY. This way you'll have all labels displayed.
2) Using an axis for each series adding as many custom axes as necessary.
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 |
Hi Narcis,
I tried the option 1. But it did not solved the problem. Please find a sample code below.
Private Sub Form_Load()
Dim i As Integer
Dim j As Double
With TChart1
.Aspect.View3D = False
.AddSeries scLine
For i = 0 To 9
j = i + 0.5
.Series(0).AddXY j, j * j, Str(j), vbRed
Next i
.AddSeries scLine
.Series(1).SetFunction tfSmoothing
.Series(1).DataSource = "Series0"
.Series(0).asLine.LinePen.Visible = False
.Series(0).ShowInLegend = False
.Series(0).asLine.Pointer.Visible = True
.Series(0).asLine.Pointer.Style = psStar
.AddSeries scLine
For i = 0 To 9
j = i + 0.75
.Series(2).AddXY j, j * j, Str(j), vbRed
Next i
.AddSeries scLine
.Series(3).SetFunction tfSmoothing
.Series(3).DataSource = "Series2"
.Series(2).asLine.LinePen.Visible = False
.Series(2).ShowInLegend = False
.Series(2).asLine.Pointer.Visible = True
.Series(2).asLine.Pointer.Style = psStar
.Axis.Bottom.Labels.Style = talText
End With
End Sub
I am seeing the grid lines and labels at the "Series0". But I want to show the grid lines and lables at "Series2" also. It is not displaying.
Could you please provide a sample which displays the grid lines at "series2" points also.
Thanks & Regards,
Rama
I tried the option 1. But it did not solved the problem. Please find a sample code below.
Private Sub Form_Load()
Dim i As Integer
Dim j As Double
With TChart1
.Aspect.View3D = False
.AddSeries scLine
For i = 0 To 9
j = i + 0.5
.Series(0).AddXY j, j * j, Str(j), vbRed
Next i
.AddSeries scLine
.Series(1).SetFunction tfSmoothing
.Series(1).DataSource = "Series0"
.Series(0).asLine.LinePen.Visible = False
.Series(0).ShowInLegend = False
.Series(0).asLine.Pointer.Visible = True
.Series(0).asLine.Pointer.Style = psStar
.AddSeries scLine
For i = 0 To 9
j = i + 0.75
.Series(2).AddXY j, j * j, Str(j), vbRed
Next i
.AddSeries scLine
.Series(3).SetFunction tfSmoothing
.Series(3).DataSource = "Series2"
.Series(2).asLine.LinePen.Visible = False
.Series(2).ShowInLegend = False
.Series(2).asLine.Pointer.Visible = True
.Series(2).asLine.Pointer.Style = psStar
.Axis.Bottom.Labels.Style = talText
End With
End Sub
I am seeing the grid lines and labels at the "Series0". But I want to show the grid lines and lables at "Series2" also. It is not displaying.
Could you please provide a sample which displays the grid lines at "series2" points also.
Thanks & Regards,
Rama
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi rama,
That's because you haven't added labels for those series. However you can add them by implementing something like the code below in the OnGetAxisLabel event.
That's because you haven't added labels for those series. However you can add them by implementing something like the code below in the OnGetAxisLabel event.
Code: Select all
Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
If ((Axis = 3) And (SeriesIndex = 3)) Then
LabelText = CStr(TChart1.Series(SeriesIndex).XValues.Value(ValueIndex))
End If
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 |
Hi narcis,
Thank you for your example. In your example the condition is
If ((Axis = 3) And (SeriesIndex = 3)) Then
I want to draw the grid lines and the lables for the "Series2" not for the "Series3".
So I changed the condition to SeriesIndex = 2. But it is not entering into the if condition at all. I do not know the reason. Even in my application also happening the same.
I debugged and saw. It is started the SeriesIndex at -1. Then SeriesIndex to 0,1 and 3. I do not know why SeriesIndex 2 did not come.
Could you please verify with this sample it self and let me know the workaround.
Thanks & Regards,
Rama
Thank you for your example. In your example the condition is
If ((Axis = 3) And (SeriesIndex = 3)) Then
I want to draw the grid lines and the lables for the "Series2" not for the "Series3".
So I changed the condition to SeriesIndex = 2. But it is not entering into the if condition at all. I do not know the reason. Even in my application also happening the same.
I debugged and saw. It is started the SeriesIndex at -1. Then SeriesIndex to 0,1 and 3. I do not know why SeriesIndex 2 did not come.
Could you please verify with this sample it self and let me know the workaround.
Thanks & Regards,
Rama
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Rama,
Sorry, I think I was wrong with what I told you. To show all labels in the same axis you should set style as:
Using this code you get the same as what I told you before:
If then you want to show all series labels you should use more than one axis as shown in the code below. This example shows all series labels at the same axis (but they are different axes):
Then you can make visible or invisible the labels you using:
Sorry, I think I was wrong with what I told you. To show all labels in the same axis you should set style as:
Code: Select all
.Axis.Bottom.Labels.Style = talMark
Using this code you get the same as what I told you before:
Code: Select all
Private Sub Form_Load()
Dim i As Integer
Dim j As Double
With TChart1
.Aspect.View3D = False
.AddSeries scLine
For i = 0 To 9
j = i + 0.5
.Series(0).AddXY j, j * j, Str(j), vbRed
Next i
.AddSeries scLine
.Series(1).SetFunction tfSmoothing
.Series(1).DataSource = "Series0"
.Series(0).asLine.LinePen.Visible = False
.Series(0).ShowInLegend = False
.Series(0).asLine.Pointer.Visible = True
.Series(0).asLine.Pointer.Style = psStar
.AddSeries scLine
For i = 0 To 9
j = i + 0.75
.Series(2).AddXY j, j * j, Str(j), vbRed
Next i
.AddSeries scLine
.Series(3).SetFunction tfSmoothing
.Series(3).DataSource = "Series2"
.Series(2).asLine.LinePen.Visible = False
.Series(2).ShowInLegend = False
.Series(2).asLine.Pointer.Visible = True
.Series(2).asLine.Pointer.Style = psStar
.Axis.Bottom.Labels.Style = talMark
End With
End Sub
If then you want to show all series labels you should use more than one axis as shown in the code below. This example shows all series labels at the same axis (but they are different axes):
Code: Select all
Private Sub Form_Load()
Dim i As Integer
Dim j As Double
With TChart1
.Aspect.View3D = False
.AddSeries scLine
'black labels
For i = 0 To 9
j = i + 0.5
.Series(0).AddXY j, j * j, Str(j), vbRed
Next i
'red labels
.AddSeries scLine
.Series(1).SetFunction tfSmoothing
.Series(1).DataSource = "Series0"
axis1 = .Axis.AddCustom(True)
.Axis.Custom(axis1).Labels.Font.Color = vbRed
.Series(1).HorizontalAxisCustom = axis1
.Series(0).asLine.LinePen.Visible = False
.Series(0).ShowInLegend = False
.Series(0).asLine.Pointer.Visible = True
.Series(0).asLine.Pointer.Style = psStar
.AddSeries scLine
' green labels
For i = 0 To 9
j = i + 0.75
.Series(2).AddXY j, j * j, Str(j), vbRed
Next i
axis2 = .Axis.AddCustom(True)
.Axis.Custom(axis2).Labels.Font.Color = vbGreen
.Series(2).HorizontalAxisCustom = axis2
.AddSeries scLine
'yellow labels
.Series(3).SetFunction tfSmoothing
.Series(3).DataSource = "Series2"
axis3 = .Axis.AddCustom(True)
.Axis.Custom(axis3).Labels.Font.Color = vbYellow
.Series(3).HorizontalAxisCustom = axis3
.Series(2).asLine.LinePen.Visible = False
.Series(2).ShowInLegend = False
.Series(2).asLine.Pointer.Visible = True
.Series(2).asLine.Pointer.Style = psStar
.Axis.Bottom.Labels.Style = talAuto
End With
End Sub
Code: Select all
TChart1.Axis.Custom(axis2).Visible = False
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 |