TeeChart Pro v20120.0.9.120901
windows 8
is it possible to draw arrows with text at the top of the chart (see attachment)
the arrows en text must scroll horizontaly with chart
arrows should not scroll vertically if the chart scroll verticallypoints in the chart are drawn in real time, a point every 30 seconds
Is it possible to delete the first "POINTER" each part of "scline" (see attachment °
thks
[CLOSED] arrows and text at the top of a chart
[CLOSED] arrows and text at the top of a chart
- Attachments
-
- Scan.jpg (296.33 KiB) Viewed 6698 times
Last edited by jika on Fri Apr 12, 2013 11:41 am, edited 1 time in total.
Re: arrows and text at the top of a chart
Hi,
Let me start from the second part:
Let me start from the second part:
This can be achieved using the OnGetPointerStyle. Of course you have to know the index of both the SeriesIndex and the ValueIndex to hide, or how to calculate them:jika wrote:Is it possible to delete the first "POINTER" each part of "scline" (see attachment °
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues 10
TChart1.Series(0).asLine.Pointer.Visible = True
TChart1.Series(0).SetNull 5
End Sub
Private Sub TChart1_OnGetSeriesPointerStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, AStyle As TeeChart.EPointerStyle)
If SeriesIndex = 0 Then
If ValueIndex = 0 Or ValueIndex = 6 Then
AStyle = psNothing
Else
AStyle = psDownTriangle
End If
End If
End Sub
This is a bit more tricky. I'd draw both the arrows and the texts manually. Here it is an example:jika wrote:is it possible to draw arrows with text at the top of the chart (see attachment)
the arrows en text must scroll horizontaly with chart
arrows should not scroll vertically if the chart scroll vertically
points in the chart are drawn in real time, a point every 30 seconds
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.Header.Visible = False
TChart1.Walls.Visible = False
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues 25
TChart1.Series(0).asLine.Pointer.Visible = True
Dim i As Integer
For i = 0 To TChart1.Series(0).Count - 1
If (i Mod 8 = 0) Then
TChart1.Series(0).SetNull i
End If
Next i
End Sub
Private Sub TChart1_OnGetSeriesPointerStyle(ByVal SeriesIndex As Long, ByVal valueIndex As Long, AStyle As TeeChart.EPointerStyle)
If SeriesIndex = 0 Then
If ((valueIndex - 1) Mod 8 = 0) Then
AStyle = psNothing
Else
AStyle = psDownTriangle
End If
End If
End Sub
Private Sub TChart1_OnAfterDraw()
Dim valueIndex As Integer
Dim startXPos, YPos As Integer
Dim textXPos As Integer
Dim textString As String
YPos = TChart1.GetChartRect.Top
With TChart1.Series(0)
valueIndex = .FirstValueIndex
startXPos = -1
Do While valueIndex <= .LastValueIndex
If valueIndex > 0 And .IsNull(valueIndex - 1) Then
startXPos = .CalcXPos(valueIndex)
TChart1.Canvas.Pen.Color = .Color
TChart1.Canvas.Pen.Width = 2
TChart1.Canvas.DrawLine startXPos, YPos, startXPos + 5, YPos - 5
TChart1.Canvas.DrawLine startXPos, YPos, startXPos + 5, YPos + 5
End If
If valueIndex < .Count - 1 And .IsNull(valueIndex + 1) Then
TChart1.Canvas.Pen.Color = .Color
TChart1.Canvas.Pen.Width = 2
If startXPos = -1 Then
TChart1.Canvas.DrawLine TChart1.GetChartRect.Left, YPos, .CalcXPos(valueIndex), YPos
TChart1.Canvas.DrawLine .CalcXPos(valueIndex), YPos, .CalcXPos(valueIndex) - 5, YPos - 5
TChart1.Canvas.DrawLine .CalcXPos(valueIndex), YPos, .CalcXPos(valueIndex) - 5, YPos + 5
textString = "Some text"
textXPos = (TChart1.GetChartRect.Left + (.CalcXPos(valueIndex) - TChart1.GetChartRect.Left) / 2) - TChart1.Canvas.TextWidth(textString) / 2
TChart1.Canvas.TextOut textXPos, YPos - 15, textString
Else
TChart1.Canvas.DrawLine startXPos, YPos, .CalcXPos(valueIndex), YPos
TChart1.Canvas.DrawLine .CalcXPos(valueIndex), YPos, .CalcXPos(valueIndex) - 5, YPos - 5
TChart1.Canvas.DrawLine .CalcXPos(valueIndex), YPos, .CalcXPos(valueIndex) - 5, YPos + 5
textString = "Some text"
textXPos = (startXPos + (.CalcXPos(valueIndex) - startXPos) / 2) - TChart1.Canvas.TextWidth(textString) / 2
TChart1.Canvas.TextOut textXPos, YPos - 15, textString
End If
startXPos = -1
Else
If valueIndex = .LastValueIndex Then
If startXPos > -1 Then
TChart1.Canvas.DrawLine startXPos, YPos, TChart1.GetChartRect.Right, YPos
textString = "Some text"
textXPos = (startXPos + (TChart1.GetChartRect.Right - startXPos) / 2) - TChart1.Canvas.TextWidth(textString) / 2
TChart1.Canvas.TextOut textXPos, YPos - 15, textString
End If
End If
End If
valueIndex = valueIndex + 1
Loop
End With
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |