Page 1 of 1

OnClickSeries etc. in ASP ?

Posted: Mon Feb 09, 2004 9:58 am
by 9080645
hi,

I want to use series related functions (e.g. TChart1_OnClickSeries, TChart1_OnMouseEnterSeries) but the examples show the VB code for using these.

How can I use these functions in ASP? How can I refer to a certain series (e.g. Series(0))??

Mike

Posted: Mon Feb 09, 2004 11:42 am
by Pep
Hi Mike,
How can I use these functions in ASP?
I'm afraid to tell you that TeeChart's events cannot be easily implemented serverside in ASP scripts. Probably the easiest thing to do is to have the ASP file stream (or save to file) a native TEE file to an HTML page with a TeeChart Object on it and have the events coded clientside in the HTML page.
Please see Tutorial 9 - Internet applications for some examples of this method. Alternatively, if you wanted use of the TeeChart events but didn't want TeeChart Objects on your HTML pages you could create a VBUserControl containing all your TeeChart properties, methods and events and have this produce JPEG images.
How can I refer to a certain series (e.g. Series(0))??
You can use "Series0", for example :
tChart.Series(1).Datasource="Series0"

OnMouseEnterSeries for two series

Posted: Mon Feb 09, 2004 2:11 pm
by 9080645
hi,

I've managed to get the OnMouseEnterSeries to work in my ASP page, but using it for two (or more series) it shows the YValue wrong:

- when using the OnMouseEnterSeries(Series0), I update a textfield to show the value of the nearest point in Series0. However, if I move the mouse over Series1, the textfield is updated with a value of 2.12199579096577E-311, which does not make any sense.

This happens also, if I create a sub for Series1, then moving the mouse over Series0 provides the same data?

Is this a bug or need I consider sg else to show the correct data (in different textfields), when I move the mouse over a certain series?
Additionally, I would like to highlight somehow the point, whose value is currently shown in the textfield...how?

TIA

Mike

Posted: Tue Feb 17, 2004 3:15 pm
by Chris
Hi Mike,

Try an HTML file that looks something like this:

Code: Select all

<HTML>
<SCRIPT language=VBScript>

Dim Last0, Last1

Sub Window_Onload()
 ' Use entire http path with LoadFromURL
 TChart1.Import.LoadFromURL("http://localhost/testscripts/ExportChart.asp")
End sub

Sub TChart1_OnAfterDraw()
End Sub

Private Sub TChart1_OnMouseMove(Shift, X, Y)
Dim Series0
Dim Series1
Dim Caption
With TChart1
Series0 = .Series(0).Clicked(X, Y)
Series1 = .Series(1).Clicked(X, Y)

If Not Series0 = -1 Then
    Caption = "Series0 = " & .Series(0).YValues.Value(Series0)
    .Series(0).PointColor(Last0) = .Series(0).Color
    .Series(0).PointColor(Series0) = vbCyan
    Last0 = Series0
Else
    .Series(0).PointColor(Last0) = .Series(0).Color
End If

If Not Series1 = -1 Then
    Caption = "Series1 = " & .Series(1).YValues.Value(Series1)
    .Series(1).PointColor(Last1) = .Series(1).Color
    .Series(1).PointColor(Series1) = vbCyan
    Last1 = Series1
Else
    .Series(1).PointColor(Last1) = .Series(1).Color
End If
.Header.Text.Clear
.Header.Text.Add(Caption)
End With

End Sub
</SCRIPT>
<BODY>
<OBJECT
   id="TChart1" 
   width="400" 
   height="268" 
   type="application/x-oleobject" 
   hspace="0"
   vspace="0" 
   classid="CLSID:536600D3-70FE-4C50-92FB-640F6BFC49AD"
   codebase="http://locahost/testscripts/Teechart6.cab#version=6,0,0,0">
</OBJECT>
</BODY></HTML>
Together with an ASP file like this:

Code: Select all

<!--METADATA NAME="TeeChart Pro Activex control v6" TYPE="TypeLib" 
UUID="{54294AC6-FA71-4C7F-B67C-6C6405DFFD48}"-->
<%
' Meta data section above to permit use of TeeChart constants in script
Set Chart1 = CreateObject("TeeChart.TChart.6")

Chart1.AddSeries(scPoint)
Chart1.Aspect.View3D=False

Chart1.Series(0).FillSampleValues 9

Chart1.Tools.Add(tcNearest)
Chart1.Tools.Items(0).asNearest.Series = Chart1.Series(0)
Chart1.Tools.Items(0).asNearest.DrawLine = False
Chart1.Tools.Items(0).asNearest.Style = hsNone

Response.BinaryWrite (Chart1.Export.asNative.SaveToStream( True ))
%>

List index out of bounds (1)

Posted: Wed Feb 18, 2004 1:33 pm
by 9080645
hi Christopher,

I tried the code you provided, but it gave an error : "List index out of bounds (1)", when mouse was moved over the chart.

Mike

Solved

Posted: Wed Feb 18, 2004 2:08 pm
by 9080645
hi,

hih, sorry, found the problem and after adding the second dataseries, it works.

This seems to be the thing I've been searching for, so now I just try to implement the necessary functionality to my actual Web site and test it there.

THANKS

Mike