MicroSoft VBScript and ASP specific
Q: IIS Server locks up when running TeeChart as a server instance with an ASP script.
Q: How do I run a serverside instance of TeeChart in IIS4 or 5? There are several ASP examples of this with source code available at: http://www.steema.com/products/teechart/asp/ASPHome.htm Q: How do I define colours in VBScript?
clTeeColor (EConstants in help) equates to 536870912 Q: Using an ODBC Datasource. How do I get the "myfilename.tee" chart to update with current data when it is loaded into an HTML page?
Sub Window_onload() TChart1.Import.LoadFromFile("c:\temp\dbchart.tee") TChart1.Series(0).DataSource = "DSN=TeeChart Pro Database; sql=SELECT * from employee" TChart1.Series(0).LabelsSource = "LASTNAME" TChart1.Series(0).YValues.ValueSource = "SALARY" TChart1.TimerEnabled = True 'setting up for data refresh TChart1.TimerInterval = 4000 end Sub Sub TChart1_OnTimer() TChart1.Series(0).CheckDatasource End Sub An alternative to this is to make similar changes to the "Return template Chart" ASP example on: http://www.steema.com/products/teechart/asp/ASPHome.htm . In this case the OnTimer() event would run the line: TChart1.Import.LoadFromURL("http://<%=ServerPath%>/TeeChart5/TeeFromWeb.asp") Q:TeeChart EConstants don't work in VBScript.
'The result in this case will be: TChart1.Series(0).asBar.MultiBar = 0This is not true for VBScript in ASP files, where the additional of a MetaData section at the very beginning of the ASP script enables the TeeChart constants to be used: <!--METADATA NAME="TeeChart Pro v5 ActiveX Control" TYPE="TypeLib" UUID="{B6C10482-FB89-11D4-93C9-006008A7EED4}"--> Q:Can I use PARAMS to set TeeChart properties in an HTML page?
Q: If I reload the page before IIS has "released" the image file (about 1 minute (?)), I get the "error '8000ffff' Catastrophic failure". Is there a way I can write the image directly to the browers? e.g. Response.binaryWrite TChart1.?There is no way to write directly to the browser. This is a known issue with IIS and is work aroundable by using a dynamic naming technique with filenames to save. The example of one option below showing its application to tee and jpeg files. <HTML> <% dim filePath dim httpPath dim outputTeefile dim outputJpegfile ' where server filepath locates to the same as URL below filePath = "d:\data\WebTestFiles\" httpPath = "http://128.0.0.55/testfiles/" outputTeefile = "Chart" & Session.Sessionid & Replace(Time, ".", "") & ".tee" outputJpegfile = "Chart" & Session.Sessionid & Replace(Time, ".", "") & ".jpg" Set Chart1 = CreateObject("TeeChart.TChart") Chart1.AddSeries(1) Chart1.Aspect.View3D=False 'use your methods eg via DB to populate Chart or... Chart1.Series(0).FillSampleValues 20 Chart1.Export.SaveToFile filepath & outputTeefile Chart1.Export.SaveToJPEGFile filepath & outputJpegfile, False, jpegBestQuality, 100, 450, 290 %> <HEAD></HEAD><BODY> <p>In the client section of the page you can display JPEG or Live Charts.</p> <SCRIPT LANGUAGE=VBSCRIPT> Sub FillChart() TChart1.Import.LoadFromURL("<%=httpPath%><%=outputTeefile %>") End Sub Sub TChart1_OnAfterDraw() TChart1.Canvas.Font.Color = RGB(240,240,50) TChart1.Canvas.Font.Bold=True If TChart1.SeriesCount > 0 then If TChart1.Series(0).Count > 0 then TChart1.Canvas.TextOut TChart1.Axis.Left.Position, _ TChart1.Axis.Top.Position - 18, _ "Max point: " & TChart1.Series(0).YValues.Maximum End if End if end sub </SCRIPT> <p>Here loading the Chart with a button (or could use IE Window_Onload event):</p> <p><input type="button" value="Populate Chart" onclick="FillChart" name="cdmChart1"></p> <OBJECT ID="TChart1" WIDTH=450 HEIGHT=290 CLASSID="CLSID:008BBE7E-C096-11D0-B4E3-00A0C901D681"> </OBJECT> <IMG SRC=<%=httpPath%><%=outputJpegfile%>> </A> </BODY></HTML> The situation is different in IIS4 and 5, however, where images can be written directly to the browser: <!--METADATA NAME="TeeChart Pro v5 ActiveX Control" TYPE="TypeLib" |