Page 1 of 1
Enable Point Style in Graph on Specific Point
Posted: Wed Jun 17, 2009 3:26 pm
by 15046673
Hello,
I'm Working with Teechart and i need to do one thing.
I'm working with marks to post comments on my Graph, when the user click in one point i enable a TextBox and write some values to the mark, this thing is working OK.
But i want to enable a point style in that mark and not in the entire line...
i used this code but this enable the point in all line
document.getElementById("axChart").Series(0).asLine.Pointer.Visible = True
I Have the X and Y coordinates from the point, i wrote the mark on this:
document.getElementById("axChart").Canvas.TextOut X, Y , "Text"
Now i want to enable a POINT Style on this MArk, it's possible?
thanks
Thiago,
Re: Enable Point Style in Graph on Specific Point
Posted: Thu Jun 18, 2009 11:52 am
by yeray
Hi
Yes, you could activate the line's pointers and then use OnGetPointerStyle to hide or show the one you would like. Something like this:
Code: Select all
Private Sub Form_Load()
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues 25
TChart1.Series(0).asLine.Pointer.Visible = True
End Sub
Private Sub TChart1_OnGetSeriesPointerStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, AStyle As TeeChart.EPointerStyle)
If ValueIndex = 5 Then
AStyle = psRectangle
Else
AStyle = psNothing
End If
End Sub
Re: Enable Point Style in Graph on Specific Point
Posted: Thu Jun 18, 2009 2:16 pm
by 15046673
Hi, when i insert this code i having this error:
Code: Select all
private sub axChart_OnGetSeriesPointerStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, AStyle As TeeChart.EPointerStyle)
If ValueIndex = 5 Then
AStyle = psRectangle
Else
AStyle = psNothing
End If
End Sub
Error: Expected ')'
Error: Object Expected
Re: Enable Point Style in Graph on Specific Point
Posted: Thu Jun 18, 2009 2:57 pm
by 15046673
Strange..
I used other sub to test and return the same error.
Without this code return no errors.
Code: Select all
Public Sub axChart_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
MsgBox SeriesIndex
End Sub
And there is another example with a sub, this is working OK
Code: Select all
Private Sub axChart_OnMouseDown(ByVal Button, ByVal Shift, ByVal CordX, ByVal CordY)
grf_X0 = CordX
grf_Y0 = CordY
End Sub
Here is my Object:
Code: Select all
<object id="axChart" style="font-weight: 700; z-index: 101; left: 40px; float: left;
width: 984px; top: 224px; height: 401px;" codebase="components/Teechart8.cab#version=8,0,0,1" type="application/x-oleobject" border="1" classid="clsid:B6C10489-FB89-11D4-93C9-006008A7EED4"
name="axChart" viewastext>
<param name="Base64" value="VFBGMAtUQ2hhcnRDaGFydAAETGVmdAIAA1RvcAIABVdpZHRoA9gDBkhlaWdodAPCARFHcmFkaWVu dC5FbmRDb2xvcgT6+voAE0dyYWRpZW50LlN0YXJ0Q29sb3IE2+bwABBHcmFkaWVudC5WaXNpYmxl CQxNYXJnaW5Cb3R0b20CBQpNYXJnaW5MZWZ0AgELTWFyZ2luUmlnaHQCAQlNYXJnaW5Ub3ACAhFU aXRsZS5Gb250LkhlaWdodALwEFRpdGxlLkZvbnQuU3R5bGULBmZzQm9sZAASVGl0bGUuVGV4dC5T dHJpbmdzAQYKR3LhZmljbyBwSAAVQm90dG9tQXhpcy5BeGlzLldpZHRoAgEZQm90dG9tQXhpcy5E YXRlVGltZUZvcm1hdAYQZGQvTU0veXl5eSBISDptbRdCb3R0b21BeGlzLkdyaWQuVmlzaWJsZQga Qm90dG9tQXhpcy5MYWJlbHNNdWx0aUxpbmUJE0xlZnRBeGlzLkF4aXMuV2lkdGgCARBMZWdlbmQu QWxpZ25tZW50BwhsYUJvdHRvbRFMZWdlbmQuQ2hlY2tCb3hlcwkWTGVnZW5kLkZvbnRTZXJpZXND b2xvcgkSTGVnZW5kLkZyYW1lLkNvbG9yBwZjbEdyYXkZTGVnZW5kLkdyYWRpZW50LkRpcmVjdGlv bgcLZ2RUb3BCb3R0b20YTGVnZW5kLkdyYWRpZW50LkVuZENvbG9yBMbG/wAaTGVnZW5kLkdyYWRp ZW50LlN0YXJ0Q29sb3IHB2NsV2hpdGUXTGVnZW5kLkdyYWRpZW50LlZpc2libGUJEExlZ2VuZC5U ZXh0U3R5bG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1Nlcmllc0NvbG9yBwZjbEdyYXkFVGl0bGUG FXBIIGRhIMFndWEgUHV2aWFsIE1TRwtWYWx1ZUZvcm1hdAYJIy4jIzAsIyMjEUF1dG9TY2FsZVZl cnRBeGlzCA1MaW5lUGVuLkNvbG9yBwZjbEdyYXkQWFZhbHVlcy5EYXRlVGltZQkMWFZhbHVlcy5O YW1lBgFYDVhWYWx1ZXMuT3JkZXIHBmxvTm9uZRBZVmFsdWVzLkRhdGVUaW1lCAxZVmFsdWVzLk5h bWUGAVkNWVZhbHVlcy5PcmRlcgcGbG9Ob25lAAALVEN1cnNvclRvb2wAC0ZvbGxvd01vdXNlCQVT dHlsZQcLY3NzVmVydGljYWwAAA1UTWFya3NUaXBUb29sCkNoYXJ0VG9vbDALTW91c2VBY3Rpb24H CG10bUNsaWNrAAAAAAAAAAIAAAAA/////w==">
</object>
Re: Enable Point Style in Graph on Specific Point
Posted: Fri Jun 19, 2009 4:28 pm
by Pep
Hello Lopes,
would you be so kind to let us know which environment and language ( vbscript, javascript, etc.. ) are you using ?
Re: Enable Point Style in Graph on Specific Point
Posted: Mon Jun 22, 2009 3:26 pm
by 15046673
vbscript!
regards,
Re: Enable Point Style in Graph on Specific Point
Posted: Tue Jun 23, 2009 4:33 pm
by Pep
Hi Lopes,
you could use the following code (tested here and works fine) :
Code: Select all
Sub TChart1_OnGetSeriesPointerStyle(SeriesIndex, ValueIndex, AStyle)
if ValueIndex = 4 then ' Will change the next pointer 5 due to the vbscript
TChart1.Series(0).asPoint.Pointer.Style = 1 ' circle
else
TChart1.Series(0).asPoint.Pointer.Style = 0
end if
End Sub
Another way would be to draw your own symbols (or anything else) onto the TeeChart canvas using TeeChart's Canvas drawing methods (into the OnAfterDraw event) exposed in Tutorial 13 - Custom drawing on the Chart Panel.
Re: Enable Point Style in Graph on Specific Point
Posted: Thu Jul 02, 2009 2:05 pm
by 15046673
Alright PEP, the code worked (with no errors)
But nothing happened..
example:
i write a text in a Point:
Code: Select all
document.getElementById("axChart").Canvas.TextOut X, Y , "Text"
I want to enable to enable the point style circle on this point with X and Y coordinates.. is possible?
What means ValueIndex in this context?
Code: Select all
Sub TChart1_OnGetSeriesPointerStyle(SeriesIndex, ValueIndex, AStyle)
I put this Sub on my application but doesn´t being called (i put a MsgBox do test) like this:
Code: Select all
Sub TChart1_OnGetSeriesPointerStyle(SeriesIndex, ValueIndex, AStyle)
if ValueIndex = 4 then ' Will change the next pointer 5 due to the vbscript
MsgBox "Test"
TChart1.Series(0).asPoint.Pointer.Style = 1 ' circle
else
TChart1.Series(0).asPoint.Pointer.Style = 0
end if
End Sub
Re: Enable Point Style in Graph on Specific Point
Posted: Mon Jul 06, 2009 9:35 am
by Pep
Hi Lopes,
strange, here the event is called, could you please check if the attached example works fine for you ?