How Can I Create Dynamically Client-Side TeeChart Object?
How Can I Create Dynamically Client-Side TeeChart Object?
I want to create TeeChart object dynamically with VbScript (Client-Side) I use that "Set Chart1 = CreateObject("AxTeeChart.AxTChart")" but I get an error message as "ActiveX Component Can't Create Object" I try that instancing(Dim mChart As New AxTeeChart.AxTChart) within Vb.Net and works. Where Can I find the right interface list? My base requirement is a code routin that creates lay-down multiple chart with data of selected categories on multiple checkboxes on the client-side of IE. There is no ASP, no server-side, nothing like that. My requirement is totally client-side. Is there anybody who can give any idea? Thanks...
Hi,
how about using :
how about using :
Code: Select all
<script LANGUAGE="VBScript">
Sub FillChart()
set newTeeChart = document.createElement("<OBJECT ID='TChart1' WIDTH='450' HEIGHT='290'
CLASSID='CLSID:FAB9B41C-87D6-474D-AB7E-F07D78F2422E'></OBJECT>")
document.body.insertBefore newTeeChart
End Sub
Sub Window_Onload()
FillChart
End Sub
</script>
Pep Jorge
http://support.steema.com
http://support.steema.com
AddSeries and other methods
Thanks Pep... Your CLSID is correct, but I have a few problems about that. I create the chart object with this class-id, but I can't add any series to that. The code is like that;
or I try that
Both of them don't work! I receive an error message tells "Object doesn't support this property or method: newTeeChart.AddSeries" or "Tchart2.AddSeries"
So, "AddSeries" works with created object as drag&drop the teechart object to my htm page.
How can I add the series to my dynamic TeeChart object, so I need to use additional chart methods after that. Shortly, how can use the chart object after created with code.
Thanks for all...
Code: Select all
set newTeeChart = document.createElement("<OBJECT ID='Tchart2' WIDTH='450' HEIGHT='290' CLASSID='CLSID:FAB9B41C-87D6-474D-AB7E-F07D78F2422E'></OBJECT>")
document.body.insertBefore newTeeChart
newTeeChart.AddSeries 6
or I try that
Code: Select all
Tchart2.AddSeries 6
So, "AddSeries" works with created object as drag&drop the teechart object to my htm page.
How can I add the series to my dynamic TeeChart object, so I need to use additional chart methods after that. Shortly, how can use the chart object after created with code.
Thanks for all...
Try using setTimeout to call another function that will call AddSeries (or call AddSeries in a separate button click event) in order to delay that action a little bit. I think the issue is that IE is multithreaded and the chart is not ready for use immediately after creating it.
Maybe Steema can provide a better explaination of this problem (and it might actually be an issue with the chart control).
Maybe Steema can provide a better explaination of this problem (and it might actually be an issue with the chart control).
Yes, It works, thanks again for that Walt... However, I can't set the chart properties with code. I have found a newmethod of DOM, "cloneNode"... First I drag a TeeChart object to design view and I format in base of my requirements. Last, I clone that;
I should specify that you cannot change the id property of the clonned object. Even if you code "myClonnedChart.id = 'newChart'" you cannot reach the clonned object through this way. You should use TChart1(index) - 0 is original, and 1,2,3...n is the clonned... After all, we have another serious problem, the printing. Yes, I need regular printing with clonned Charts and when I come to print preview screen I see the screen as "<OBJECT>blablaba". I think I will be canceled the "select and see the chart" feature of my product.
Code: Select all
Set myClonnedChart = TChart1.cloneNode(true)
Hi,
check with the following code (better that one I posted days ago) which allow you to create and fill the Series at the same time, and also allow you to print correctly.
check with the following code (better that one I posted days ago) which allow you to create and fill the Series at the same time, and also allow you to print correctly.
Code: Select all
<!-- saved from url=(0022)http://internet.e-mail -->
<html>
<META HTTP-EQUIV="Expires" CONTENT="0">
<script LANGUAGE="VBScript">
Sub FillChart()
set myObject = document.createElement("object")
document.body.appendChild(myObject)
myObject.width = "400"
myObject.height = "300"
myObject.id = "TChart1"
myObject.classid= "clsid:FAB9B41C-87D6-474D-AB7E-F07D78F2422E"
' myObject.object.Header.Caption = "dynocreate TeeChart"
' or....
TChart1.object.Header.Caption = "dynocreate TeeChart"
TChart1.object.AddSeries 1
TChart1.object.Series(0).FillSampleValues 20
TChart1.Environment.IEPrintWithPage
End Sub
Sub Window_Onload()
FillChart
End Sub
</script>
<BODY>
</BODY>
</html>
Pep Jorge
http://support.steema.com
http://support.steema.com