Labels in between points in line chart
Labels in between points in line chart
I need to get two things in my Line graph. Attached is a sample to show what I am looking for.
1. Is it possible to have label in between the points? In my eg:- lables like "AAA","BBB" etc.
2. To have labels in my X-axis (I need to put text as labels). In my eg: - "Start","Point1","Point2" etc.
If I add using Chart.Series(0).Add 20, "AAA", RGB(0, 64, 128) Then "AAA" comes near the point.
I was able to do the 2nd requirement using .Axis.Bottom.labels.Style = talMark.
I need a combination of points 1 and 2.
Can you tell me what settings I need to do to set this.
Any help on this will be really helpfull.
Thanks
CS
1. Is it possible to have label in between the points? In my eg:- lables like "AAA","BBB" etc.
2. To have labels in my X-axis (I need to put text as labels). In my eg: - "Start","Point1","Point2" etc.
If I add using Chart.Series(0).Add 20, "AAA", RGB(0, 64, 128) Then "AAA" comes near the point.
I was able to do the 2nd requirement using .Axis.Bottom.labels.Style = talMark.
I need a combination of points 1 and 2.
Can you tell me what settings I need to do to set this.
Any help on this will be really helpfull.
Thanks
CS
- Attachments
-
- This is what I am looking for.
- DifferentLabelsInAxis.JPG (24.9 KiB) Viewed 14531 times
Re: Labels in between points in line chart
Hi CS,
You could use the points labels for the bottom axis labels (Start, Point 1,...) and annotation tools (or custom drawing techniques) for the labels between the points (AAA, BBB,...). For example:
You could use the points labels for the bottom axis labels (Start, Point 1,...) and annotation tools (or custom drawing techniques) for the labels between the points (AAA, BBB,...). For example:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scLine
TChart1.Series(0).asLine.Pointer.Visible = True
Dim i As Integer
TChart1.Series(0).Add Rnd * 100, "Open", clTeeColor
For i = 1 To 3
TChart1.Series(0).Add TChart1.Series(0).YValues.Value(i - 1) + Rnd * 10 - 5, "Point " + Str$(i), clTeeColor
Next i
TChart1.Series(0).Add TChart1.Series(0).YValues.Value(i - 1) + Rnd * 10 - 5, "Close", clTeeColor
TChart1.Environment.InternalRepaint
For i = 0 To TChart1.Series(0).Count - 2
TChart1.Tools.Add tcAnnotate
With TChart1.Tools.Items(i).asAnnotation
.Text = Chr(65 + i) + Chr(65 + i) + Chr(65 + i)
.Left = ((TChart1.Series(0).CalcXPos(i + 1) - TChart1.Series(0).CalcXPos(i)) / 2) + TChart1.Series(0).CalcXPos(i) - (TChart1.Canvas.TextWidth(.Text) / 2)
.Top = ((TChart1.Series(0).CalcYPos(i + 1) - TChart1.Series(0).CalcYPos(i)) / 2) + TChart1.Series(0).CalcYPos(i) - (TChart1.Canvas.TextHeight(.Text) / 2)
.Shape.Transparent = True
End With
Next i
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Labels in between points in line chart
Hi Yeray,
In my version I am not getting ".Left " and ".Top " With TChart1.Tools.Items(i).asAnnotation
Various property I can see are ".Position", ".Text", ".Shape". Is there any other way to set the position.
Thanks
CS
In my version I am not getting ".Left " and ".Top " With TChart1.Tools.Items(i).asAnnotation
Various property I can see are ".Position", ".Text", ".Shape". Is there any other way to set the position.
Thanks
CS
Re: Labels in between points in line chart
Hi CS,
What TeeChart version are you using? Here is works with both v7 and v8.
What TeeChart version are you using? Here is works with both v7 and v8.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Labels in between points in line chart
Hi Yeray,
version 5.
used "TeeChart5Activex.exe" for installation. We are calling the tchart componets from VB 6.
Thanks
CS
version 5.
used "TeeChart5Activex.exe" for installation. We are calling the tchart componets from VB 6.
Thanks
CS
Re: Labels in between points in line chart
Hi CS,
In TeeChart v5 you can do it with .asAnnotation.Shape.Left and .asAnnotation.Shape.Top instead of .asAnnotation.Left and .asAnnotation.Top.
In TeeChart v5 you can do it with .asAnnotation.Shape.Left and .asAnnotation.Shape.Top instead of .asAnnotation.Left and .asAnnotation.Top.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Labels in between points in line chart
Hi,
With the Code you provided I can plot the text in between the points.
Can I cange the Font of the Text which I am plotting.
Also I want to draw a rectangle or square around this label and need an ability to set the color of the Border.
Thanks CS
With the Code you provided I can plot the text in between the points.
Can I cange the Font of the Text which I am plotting.
Also I want to draw a rectangle or square around this label and need an ability to set the color of the Border.
Thanks CS
Re: Labels in between points in line chart
Hi CS,
In the example above, with annotation tools, you can set their font and other settings, for example, as follows:
However, the following property in VCL seems not to be implemented in ActiveX. I've adde it to the wish list to be implemented in future releases (TA05015185):
In the example above, with annotation tools, you can set their font and other settings, for example, as follows:
Code: Select all
For i = 0 To TChart1.Series(0).Count - 2
TChart1.Tools.Add tcAnnotate
With TChart1.Tools.Items(i).asAnnotation
.Text = Chr(65 + i) + Chr(65 + i) + Chr(65 + i)
.Left = ((TChart1.Series(0).CalcXPos(i + 1) - TChart1.Series(0).CalcXPos(i)) / 2) + TChart1.Series(0).CalcXPos(i) - (TChart1.Canvas.TextWidth(.Text) / 2)
.Top = ((TChart1.Series(0).CalcYPos(i + 1) - TChart1.Series(0).CalcYPos(i)) / 2) + TChart1.Series(0).CalcYPos(i) - (TChart1.Canvas.TextHeight(.Text) / 2)
.Shape.Shadow.Visible = False
If (i = 2) Then
.Shape.Font.Color = vbRed
.Shape.Font.Size = 12
.Shape.Font.Bold = True
.Shape.Font.Name = "Comic Sans MS"
End If
End With
Next i
Code: Select all
ChartTool1.Shape.Brush.Style:=bsClear;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Labels in between points in line chart
I tried to use Annotation but I am not able to plot Annotation in the middle of the points.
It works fine when I run the cod eand view the output but when I Export that image to jpeg the points are not on the same Location.
Also I have attached both the screenshot.
Following is Code whcih I am using for Graph generation :
Private Sub Command1_Click()
With TChart1.Export.asGIF
.Width = 850
.Height = 300
.SaveToFile ("C:\Test.gif")
End With
End Sub
Private Sub Form_Load()
TChart1.ClearChart
With TChart1
.AddSeries (scLine)
.Series(0).Clear
'.Series(0).Marks.Visible = True
.Panel.Color = vbWhite
.Panel.BevelOuter = bvNone
.Panel.Gradient.Visible = False
.Header.Text.Clear
'.Header.Text.Add m_sHeader
.Header.Font.Color = vbRed
.Header.Font.Bold = False
.Header.Font.Name = "Verdana"
.Header.Font.Size = 8
.Tools.Clear
.Footer.Text.Clear
.Footer.Text.Add m_sFooter
.Legend.Visible = False
.Legend.TextStyle = ltsLeftValue
.Legend.Font.Color = vbBlack
.Legend.Font.Name = "Verdana"
.Legend.Font.Size = 8
.Legend.ShapeStyle = fosRoundRectangle
.Legend.ShadowSize = 0
.Walls.Visible = False
.Aspect.View3D = False
.Axis.Left.Title.Caption = "Bps from Arrival Price"
.Axis.Left.Title.Font.Bold = True
.Axis.Left.Title.Font.Name = "Verdana"
.Axis.Left.Title.Font.Size = 10
.Axis.Left.Title.Font.Color = vbBlack
.Axis.Left.AxisPen.Color = RGB(51, 51, 51)
.Axis.Left.labels.Font.Color = vbBlack
.Axis.Left.labels.Font.Name = "Verdana"
.Axis.Left.labels.Font.Size = 8
.Axis.Left.labels.Font.Bold = False
.Axis.Left.GridPen.Visible = False
.Axis.Bottom.AxisPen.Color = RGB(77, 77, 77)
.Axis.Bottom.labels.Font.Name = "Verdana"
.Axis.Bottom.labels.Font.Size = 8
.Axis.Bottom.labels.Font.Color = vbWhite
.Axis.Bottom.labels.OnAxis = False
.Axis.Bottom.Title.Caption = m_sXAxisTitle
.Axis.Bottom.Title.Font.Bold = False
.Axis.Bottom.Title.Font.Color = vbBlack
.Axis.Bottom.GridPen.Visible = True
.Axis.Bottom.GridPen.Style = psSolid
.Axis.Bottom.GridPen.Color = RGB(143, 143, 143)
.Axis.Right.Visible = True
.Axis.Right.AxisPen.Color = RGB(77, 77, 77)
.Axis.Right.labels.Font.Name = "Verdana"
.Axis.Right.labels.Font.Size = 8
.Axis.Right.Title.Caption = m_sXAxisTitle
.Axis.Right.Title.Font.Bold = False
.Axis.Right.Title.Font.Color = vbBlack
.Axis.Right.GridPen.Visible = False
.Axis.Top.Visible = False
.Axis.Top.AxisPen.Color = RGB(77, 77, 77)
.Axis.Top.labels.Visible = False
End With
'TChart1.Aspect.View3D = False
'TChart1.ClearChart
TChart1.AddSeries scLine
TChart1.Series(0).asLine.Pointer.Visible = True
m_lMinLeftAxis = 0
m_lMaxLeftAxis = 0
Dim Point1, Point2, Point3, Point4, Point4TPlusOne, Point4TPlusFive
Dim zeroCorrectingFigure, tmpNumber
tmpNumber = 0
zeroCorrectingFigure = 0
With TChart1
Dim points, labels, i, calcMethodType, CalcCol
.Series(0).asLine.LinePen.Width = 1
.Series(0).asLine.LinePen.Style = psSolid
.Series(0).asLine.LinePen.EndStyle = esFlat
.Axis.Bottom.labels.Visible = True
.Axis.Bottom.labels.Font.Name = "Arial"
.Axis.Bottom.labels.Font.Size = 8
.Axis.Bottom.labels.OnAxis = True
.Axis.Bottom.labels.Font.Color = vbBlack
.Axis.Bottom.labels.Style = talText
.Axis.Bottom.MinorTicks.Visible = False
Point1 = -81.11
Point2 = -90.45
Point3 = 23.9
Point4 = 57.87
Point4TPlusOne = 22.88
Point4TPlusFive = -15.23
.Series(0).Add Round(Point1, 2), "P1", RGB(0, 64, 128)
If m_lMinLeftAxis > Point1 Then m_lMinLeftAxis = Point1
If m_lMaxLeftAxis < Point1 Then m_lMaxLeftAxis = Point1
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point2, 2), "P2", RGB(0, 64, 128)
If m_lMinLeftAxis > Point2 Then m_lMinLeftAxis = Point2
If m_lMaxLeftAxis < Point2 Then m_lMaxLeftAxis = Point2
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add 0, "P3", RGB(0, 64, 128)
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point3, 2), "P4", RGB(0, 64, 128)
If m_lMinLeftAxis > Point3 Then m_lMinLeftAxis = Point3
If m_lMaxLeftAxis < Point3 Then m_lMaxLeftAxis = Point3
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point4, 2), "P5", RGB(0, 64, 128)
If m_lMinLeftAxis > Point4 Then m_lMinLeftAxis = Point4
If m_lMaxLeftAxis < Point4 Then m_lMaxLeftAxis = Point4
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point4TPlusOne, 2), "P6", RGB(0, 64, 128)
If m_lMinLeftAxis > Point4TPlusOne Then m_lMinLeftAxis = Point4TPlusOne
If m_lMaxLeftAxis < Point4TPlusOne Then m_lMaxLeftAxis = Point4TPlusOne
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point4TPlusFive, 2), "P7", RGB(0, 64, 128)
If m_lMinLeftAxis > Point4TPlusFive Then m_lMinLeftAxis = Point4TPlusFive
If m_lMaxLeftAxis < Point4TPlusFive Then m_lMaxLeftAxis = Point4TPlusFive
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).VerticalAxis = aBothVertAxis
.Series(0).asLine.Pointer.Visible = True
.Series(0).asLine.Pointer.Style = psCircle
With .Axis.Left
.SetMinMax m_lMinLeftAxis, m_lMaxLeftAxis + 20
If (((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6) > 0 Then
.Increment = Int(((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6)
End If
End With
With .Axis.Bottom
.labels.Visible = True
.labels.OnAxis = True
.SetMinMax 0, m_lMaxBottomAxis
End With
With .Axis.Right
.SetMinMax m_lMinLeftAxis, m_lMaxLeftAxis + 20
If (((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6) > 0 Then
.Increment = Int(((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6)
End If
End With
End With
TChart1.Environment.InternalRepaint
For i = 0 To TChart1.Series(0).Count - 2
TChart1.Tools.Add tcAnnotate
With TChart1.Tools.Items(i).asAnnotation
.Text = "Test"
.Shape.Left = ((TChart1.Series(0).CalcXPos(i + 1) - TChart1.Series(0).CalcXPos(i)) / 2) + TChart1.Series(0).CalcXPos(i) - (TChart1.Canvas.TextWidth(.Text) / 2)
.Shape.Top = ((TChart1.Series(0).CalcYPos(i + 1) - TChart1.Series(0).CalcYPos(i)) / 2) + TChart1.Series(0).CalcYPos(i) - (TChart1.Canvas.TextHeight(.Text) / 2)
.Shape.Transparent = False
End With
Next i
End Sub
It works fine when I run the cod eand view the output but when I Export that image to jpeg the points are not on the same Location.
Also I have attached both the screenshot.
Following is Code whcih I am using for Graph generation :
Private Sub Command1_Click()
With TChart1.Export.asGIF
.Width = 850
.Height = 300
.SaveToFile ("C:\Test.gif")
End With
End Sub
Private Sub Form_Load()
TChart1.ClearChart
With TChart1
.AddSeries (scLine)
.Series(0).Clear
'.Series(0).Marks.Visible = True
.Panel.Color = vbWhite
.Panel.BevelOuter = bvNone
.Panel.Gradient.Visible = False
.Header.Text.Clear
'.Header.Text.Add m_sHeader
.Header.Font.Color = vbRed
.Header.Font.Bold = False
.Header.Font.Name = "Verdana"
.Header.Font.Size = 8
.Tools.Clear
.Footer.Text.Clear
.Footer.Text.Add m_sFooter
.Legend.Visible = False
.Legend.TextStyle = ltsLeftValue
.Legend.Font.Color = vbBlack
.Legend.Font.Name = "Verdana"
.Legend.Font.Size = 8
.Legend.ShapeStyle = fosRoundRectangle
.Legend.ShadowSize = 0
.Walls.Visible = False
.Aspect.View3D = False
.Axis.Left.Title.Caption = "Bps from Arrival Price"
.Axis.Left.Title.Font.Bold = True
.Axis.Left.Title.Font.Name = "Verdana"
.Axis.Left.Title.Font.Size = 10
.Axis.Left.Title.Font.Color = vbBlack
.Axis.Left.AxisPen.Color = RGB(51, 51, 51)
.Axis.Left.labels.Font.Color = vbBlack
.Axis.Left.labels.Font.Name = "Verdana"
.Axis.Left.labels.Font.Size = 8
.Axis.Left.labels.Font.Bold = False
.Axis.Left.GridPen.Visible = False
.Axis.Bottom.AxisPen.Color = RGB(77, 77, 77)
.Axis.Bottom.labels.Font.Name = "Verdana"
.Axis.Bottom.labels.Font.Size = 8
.Axis.Bottom.labels.Font.Color = vbWhite
.Axis.Bottom.labels.OnAxis = False
.Axis.Bottom.Title.Caption = m_sXAxisTitle
.Axis.Bottom.Title.Font.Bold = False
.Axis.Bottom.Title.Font.Color = vbBlack
.Axis.Bottom.GridPen.Visible = True
.Axis.Bottom.GridPen.Style = psSolid
.Axis.Bottom.GridPen.Color = RGB(143, 143, 143)
.Axis.Right.Visible = True
.Axis.Right.AxisPen.Color = RGB(77, 77, 77)
.Axis.Right.labels.Font.Name = "Verdana"
.Axis.Right.labels.Font.Size = 8
.Axis.Right.Title.Caption = m_sXAxisTitle
.Axis.Right.Title.Font.Bold = False
.Axis.Right.Title.Font.Color = vbBlack
.Axis.Right.GridPen.Visible = False
.Axis.Top.Visible = False
.Axis.Top.AxisPen.Color = RGB(77, 77, 77)
.Axis.Top.labels.Visible = False
End With
'TChart1.Aspect.View3D = False
'TChart1.ClearChart
TChart1.AddSeries scLine
TChart1.Series(0).asLine.Pointer.Visible = True
m_lMinLeftAxis = 0
m_lMaxLeftAxis = 0
Dim Point1, Point2, Point3, Point4, Point4TPlusOne, Point4TPlusFive
Dim zeroCorrectingFigure, tmpNumber
tmpNumber = 0
zeroCorrectingFigure = 0
With TChart1
Dim points, labels, i, calcMethodType, CalcCol
.Series(0).asLine.LinePen.Width = 1
.Series(0).asLine.LinePen.Style = psSolid
.Series(0).asLine.LinePen.EndStyle = esFlat
.Axis.Bottom.labels.Visible = True
.Axis.Bottom.labels.Font.Name = "Arial"
.Axis.Bottom.labels.Font.Size = 8
.Axis.Bottom.labels.OnAxis = True
.Axis.Bottom.labels.Font.Color = vbBlack
.Axis.Bottom.labels.Style = talText
.Axis.Bottom.MinorTicks.Visible = False
Point1 = -81.11
Point2 = -90.45
Point3 = 23.9
Point4 = 57.87
Point4TPlusOne = 22.88
Point4TPlusFive = -15.23
.Series(0).Add Round(Point1, 2), "P1", RGB(0, 64, 128)
If m_lMinLeftAxis > Point1 Then m_lMinLeftAxis = Point1
If m_lMaxLeftAxis < Point1 Then m_lMaxLeftAxis = Point1
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point2, 2), "P2", RGB(0, 64, 128)
If m_lMinLeftAxis > Point2 Then m_lMinLeftAxis = Point2
If m_lMaxLeftAxis < Point2 Then m_lMaxLeftAxis = Point2
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add 0, "P3", RGB(0, 64, 128)
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point3, 2), "P4", RGB(0, 64, 128)
If m_lMinLeftAxis > Point3 Then m_lMinLeftAxis = Point3
If m_lMaxLeftAxis < Point3 Then m_lMaxLeftAxis = Point3
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point4, 2), "P5", RGB(0, 64, 128)
If m_lMinLeftAxis > Point4 Then m_lMinLeftAxis = Point4
If m_lMaxLeftAxis < Point4 Then m_lMaxLeftAxis = Point4
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point4TPlusOne, 2), "P6", RGB(0, 64, 128)
If m_lMinLeftAxis > Point4TPlusOne Then m_lMinLeftAxis = Point4TPlusOne
If m_lMaxLeftAxis < Point4TPlusOne Then m_lMaxLeftAxis = Point4TPlusOne
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).Add Round(Point4TPlusFive, 2), "P7", RGB(0, 64, 128)
If m_lMinLeftAxis > Point4TPlusFive Then m_lMinLeftAxis = Point4TPlusFive
If m_lMaxLeftAxis < Point4TPlusFive Then m_lMaxLeftAxis = Point4TPlusFive
m_lMaxBottomAxis = m_lMaxBottomAxis + 1
.Series(0).VerticalAxis = aBothVertAxis
.Series(0).asLine.Pointer.Visible = True
.Series(0).asLine.Pointer.Style = psCircle
With .Axis.Left
.SetMinMax m_lMinLeftAxis, m_lMaxLeftAxis + 20
If (((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6) > 0 Then
.Increment = Int(((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6)
End If
End With
With .Axis.Bottom
.labels.Visible = True
.labels.OnAxis = True
.SetMinMax 0, m_lMaxBottomAxis
End With
With .Axis.Right
.SetMinMax m_lMinLeftAxis, m_lMaxLeftAxis + 20
If (((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6) > 0 Then
.Increment = Int(((m_lMaxLeftAxis + 20) - (m_lMinLeftAxis - 5)) / 6)
End If
End With
End With
TChart1.Environment.InternalRepaint
For i = 0 To TChart1.Series(0).Count - 2
TChart1.Tools.Add tcAnnotate
With TChart1.Tools.Items(i).asAnnotation
.Text = "Test"
.Shape.Left = ((TChart1.Series(0).CalcXPos(i + 1) - TChart1.Series(0).CalcXPos(i)) / 2) + TChart1.Series(0).CalcXPos(i) - (TChart1.Canvas.TextWidth(.Text) / 2)
.Shape.Top = ((TChart1.Series(0).CalcYPos(i + 1) - TChart1.Series(0).CalcYPos(i)) / 2) + TChart1.Series(0).CalcYPos(i) - (TChart1.Canvas.TextHeight(.Text) / 2)
.Shape.Transparent = False
End With
Next i
End Sub
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Labels in between points in line chart
Hi CS,
You could try exporting the chart to an image using TChart1.Canvas.StretchDraw method.
You could try exporting the chart to an image using TChart1.Canvas.StretchDraw method.
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 |
Re: Labels in between points in line chart
Hi,
I am using TChart Version 5 in Visual Basis.
I can't find StretchDraw Method in this version.
Can you give me some other solution to fix this.
CS
I am using TChart Version 5 in Visual Basis.
I can't find StretchDraw Method in this version.
Can you give me some other solution to fix this.
CS
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Labels in between points in line chart
Hi CS,
StretchDraw is available in v2010 (aka v9). Many new features and enhancements have been added since v5 was released. We strongly recommend you to have a look at v2010's fully functional evaluation version available at http://www.steema.com/evaluation/ax.
An alternative to StretchDraw, which can be done in v5 too is positioning object in the OnBeforeDrawSeries event. Doing so exports tools correctly. You should remove the code where you add tools and do something like this:
StretchDraw is available in v2010 (aka v9). Many new features and enhancements have been added since v5 was released. We strongly recommend you to have a look at v2010's fully functional evaluation version available at http://www.steema.com/evaluation/ax.
An alternative to StretchDraw, which can be done in v5 too is positioning object in the OnBeforeDrawSeries event. Doing so exports tools correctly. You should remove the code where you add tools and do something like this:
Code: Select all
Private Sub TChart1_OnBeforeDrawSeries()
TChart1.Tools.Clear
For i = 0 To TChart1.Series(0).Count - 2
TChart1.Tools.Add tcAnnotate
With TChart1.Tools.Items(i).asAnnotation
.Text = "Test"
.Shape.CustomPosition = True
.Shape.Left = ((TChart1.Series(0).CalcXPos(i + 1) - TChart1.Series(0).CalcXPos(i)) / 2) + TChart1.Series(0).CalcXPos(i) - (TChart1.Canvas.TextWidth(.Text) / 2)
.Shape.Top = ((TChart1.Series(0).CalcYPos(i + 1) - TChart1.Series(0).CalcYPos(i)) / 2) + TChart1.Series(0).CalcYPos(i) - (TChart1.Canvas.TextHeight(.Text) / 2)
.Shape.Transparent = False
End With
Next i
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 |