TeeChart for ActiveX, COM and ASP
-
Guilz
- Newbie
- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Thu Nov 25, 2010 10:15 am
Hi Teechart support Team,
2 questions:
1 - How can I change Mark text without using _OnGetSeriesMark method (I would like to change mark text for 1 serie not for all my series) ?
Code: Select all
With AxTChart.Series(AxTChart.SeriesCount - 1).Marks.Item(nbMarks)
End With
->but unfortunately the .Text property is readonly...
2 - My need is to display information on my chart (a symbol and a text -> gray circle and Island Reversal text in my example)) like in the chart bellow:
- marks.png (25.63 KiB) Viewed 13332 times
What is the best way to do this ?
Thanks for your help
Guilz
-
Yeray
- Site Admin
- Posts: 9614
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Nov 25, 2010 11:36 am
Hi Guliz,
Guilz wrote:1 - How can I change Mark text without using _OnGetSeriesMark method (I would like to change mark text for 1 serie not for all my series) ?
You can change the label for each point:
Code: Select all
TChart1.Series(i).PointLabel(0) = "my text"
Guilz wrote:2 - My need is to display information on my chart (a symbol and a text -> gray circle and Island Reversal text in my example)) like in the chart bellow:
Here you have a simple example showing how to achieve a chart similar that the picture you've attached:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.Legend.Visible = False
TChart1.AddSeries scFastLine
TChart1.Series(0).FillSampleValues 1000
TChart1.AddSeries scPoint
With TChart1.Series(1)
.Color = RGB(10, 10, 10)
With .Marks
.Visible = True
.Transparent = True
.Font.Color = vbGrayText
.Arrow.Visible = False
.ArrowLength = -15
End With
With .asPoint.Pointer
.Style = psCircle
.Pen.Visible = False
.HorizontalSize = 8
.VerticalSize = 8
.Transparency = 50
End With
End With
Dim i, c As Integer
For i = 0 To TChart1.Series(0).Count - 1
If i Mod 75 = 0 Then
c = Rnd * 255
TChart1.Series(1).AddXY TChart1.Series(0).XValues.Value(i), TChart1.Series(0).YValues.Value(i), "point nº" + Str$(TChart1.Series(1).Count), RGB(c, c, c)
End If
Next i
TChart1.Axis.Bottom.Labels.Style = talValue
End Sub
-
Guilz
- Newbie
- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Thu Nov 25, 2010 12:01 pm
Hi Yeray,
It is working like a charm, as usual
Thanks a lot
Regards,
Guilz
-
Yeray
- Site Admin
- Posts: 9614
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Nov 25, 2010 1:44 pm
Hi Guliz,
Pleased to be helpful!
-
Guilz
- Newbie
- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Thu Nov 25, 2010 2:52 pm
I have an another issue with marks:
We use marks on chart and create function to let space between marks (for readability problem)
- marks00.png (61.5 KiB) Viewed 13298 times
But on Candle Chart we would like to have the same logic with only 1 mark (Open, Close, High, Low and corresponding date) and not one mark for Open one mark for close one mark for High like in the screen shot bellow...
- marks00.png (61.5 KiB) Viewed 13298 times
How can we do that ?
Thanks for your help
Guilz
-
Attachments
-
- Marks01.png (38.16 KiB) Viewed 13295 times
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Thu Nov 25, 2010 4:38 pm
Hello Guilz,
You can use in OnGetSeriesMark event a code as the next:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TeeCommander1.Chart = TChart1
TChart1.AddSeries scCandle
TChart1.Series(0).FillSampleValues (5)
TChart1.Series(0).Marks.Visible = True
End Sub
Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
MarkText = "Data:" & Str$(TChart1.Series(0).asCandle.DateValues.Value(ValueIndex)) & vbCr & "Open" & Str$(TChart1.Series(0).asCandle.OpenValues.Value(ValueIndex)) & vbCr & "Close" & Str$(TChart1.Series(0).asCandle.CloseValues.Value(ValueIndex)) & vbCr & "High" & Str$(TChart1.Series(0).asCandle.HighValues.Value(ValueIndex)) & vbCr & "Low" & Str$(TChart1.Series(0).asCandle.LowValues.Value(ValueIndex))
End Sub
Could you tell us, if code works as you want?
I hope will helps.
Thanks,
-
Guilz
- Newbie
- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Thu Nov 25, 2010 5:19 pm
Hi Sandra,
It is not working fine for me -
For Candle chart type, I would like to have less Marks for readability problem.
In fact .Marks.DrawEvery property does not work fine with candle type (see my picture to understand the problem)
Regards,
Guilz
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Fri Nov 26, 2010 8:56 am
Hello Guilz,
I couldn't reproduce your problem using TeeChartAcitvex2010 and next code:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TeeCommander1.Chart = TChart1
TChart1.AddSeries scCandle
TChart1.Series(0).FillSampleValues (25)
TChart1.Series(0).Marks.Visible = True
TChart1.Series(0).Marks.DrawEvery = 2
End Sub
Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
MarkText = "Data:" & Str$(TChart1.Series(0).asCandle.DateValues.Value(ValueIndex)) & vbCr & "Open" & Str$(TChart1.Series(0).asCandle.OpenValues.Value(ValueIndex)) & vbCr & "Close" & Str$(TChart1.Series(0).asCandle.CloseValues.Value(ValueIndex)) & vbCr & "High" & Str$(TChart1.Series(0).asCandle.HighValues.Value(ValueIndex)) & vbCr & "Low" & Str$(TChart1.Series(0).asCandle.LowValues.Value(ValueIndex))
End Sub
Could you please, send us a simple project or modify previous code? So we can reproduce your problem here. Moreover, you can tell us which version of TeeChart ActiveX are you using now?
Thanks,
-
Petar
- Newbie
- Posts: 40
- Joined: Tue Oct 06, 2009 12:00 am
Post
by Petar » Wed Dec 15, 2010 2:46 pm
Thanks Sandra,
indeed it's working also well with Version 8.
Cheers
Petar