Is everything in the editing panel able to be scripted?

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
shoey
Newbie
Newbie
Posts: 9
Joined: Mon Aug 27, 2007 12:00 am

Is everything in the editing panel able to be scripted?

Post by shoey » Wed Sep 05, 2007 6:11 am

Hi,

When I purchased this product I was under the impression that it was fully scriptable.

So far I have been unable to locate very much supporting documentation for this capability and have had only minimal success in getting the functions that seem to be available in the editing panel to work.

e.g.

Code: Select all

tChart1.getPrinter().preview();
returns
"Object doesn't support this property or method."
Is this behaviour expected ?? Or is something wrong with the way I am using the product?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 05, 2007 8:47 am

Hi shoey,

Yes, you should be able to access programatically all properties available at the chart editor.

You could try doing as in the Printing\Print Preview example at TeeChart.Features.jar. Please notice the source code tab in the examples.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

shoey
Newbie
Newbie
Posts: 9
Joined: Mon Aug 27, 2007 12:00 am

Post by shoey » Wed Sep 05, 2007 11:12 pm

Hi Narcis,

The examples in teechart.features.jar are java examples. I am not writing a java application. The only way I have access to the applet is via scripting in my webpages. i.e JavaScript.

We are using a product from SAP called xMII to build a data access framework for our business's MES layer of systems. This provides all the data that we need to visualise. This is where we are evaluating your product to provide the charting capability as on the surface it looks to be far more advanced then the xMII charting capability.

We need to use the applet because the next version of XMII will run within SAP's Netweaver environment. If this were not the case we could have used the activeX control but this will not be an option for us longer term

The best option for us would be to have the import function working because xMII provides data output via XML for which we could then just apply an xsl transformation before loading into your applet.

But for options like printing we need this to be able to be called from the webpage. i.e. As in the tutorials:
Print Preview
The PrintPreview window will show you how the Chart will appear when printed. You may modify print parameters in the Print Preview window. To call PrintPreview run:

tChart1.getPrinter().preview();
So my question remains is the result I am receiving calling the above function in JavaScript expected or is there potentially something else wrong?

tom
Advanced
Posts: 211
Joined: Mon Dec 01, 2003 5:00 am
Contact:

Post by tom » Sun Sep 09, 2007 6:12 pm

I'm not sure if I can follow you here. Are you trying to use the component with JavaScript or as an applet?

In case of JavaScript, I'm not sure how you mean to use the component. If so, please provide me with more information. We haven't tested the component in a JavaScript environment, so you probably will find some issues. However, we are interested to see if we can make the component useable in such an environment.

In case of an applet. It should be possible to use it as such (with it's limitations concerning applets, eg security, ...) Some issues might appear, but we will do our best to fix those or to provide a workaround

regards,
tom.

shoey
Newbie
Newbie
Posts: 9
Joined: Mon Aug 27, 2007 12:00 am

Post by shoey » Sun Sep 09, 2007 11:45 pm

Hi Tom,

A slight modification to the example provided by Steema.

Have added some comments throughout the code to explain what I am trying to achieve.

Code: Select all

<html>

<head>
<title>Applet for Java Test Page
</title>

<SCRIPT type="text/javascript" language="JavaScript">
function initChart() {
    
    /* This represents data that is being retrieved via SAP XMII ICommand Applet */
  var values = new Array(200,800,1200);
  var dates = new Array("Monday","Tuesday","Wednesday");
   
   /* Now I want to take the data retrieved from the XMII Applet and put it into the TCHART Applet for visualisation
   ** The data from xMII comes in via xml so ultimately would prefer to format it 
   ** in the correct way via an xslt and load it directly using:
   ** tChart.setChart(tChart.getImport().getTemplate().fromXML("blah.xml"); 
   ** Failing this I wish to add data and format the applet using Javascript */
  tChart.getChart().getTitle().setText("Test Header Text"); 
  tChart.getChart().getTitle().getFont().setBold(true);
  // tChart.getChart().getTitle().getFont().setColor(tChart.createColor(255,0,0)) Cannot use Color.Red as Color is undefined
  
  var chartBarSeries = tChart.addSeries(5);
  for(i=0; i<values.length; i++){
    chartBarSeries.add(values[i].valueOf(), dates[i].valueOf());
    // tChart.getSeries(i).getMarks().setStyle(MarksStyle.VALUE);  Error: MarksStyle is undefined
  }
  tChart.getAxes().getBottom().getLabels().setAngle(65);
}

function editChart() {
  tChart.showEditor();
}
</SCRIPT>
</head>
<BODY onload=initChart() >
<H1>TeeChart for Java</H1>
<H2>Applet Test</H2><A onmousedown=editChart() href="">Edit Chart...</A>

<APPLET id=tChart  height=500 hspace="10" archive="../../TeeChart.Swing.jar" width="600" align="middle" code="com.steema.teechart.TChartApplet.class" vspace="10" name="tChart">
	<PARAM NAME="___XMLSOURCE" VALUE="SampleData.xml">
	</APPLET>
</BODY>
</html>
Hope this helps you understand what I am trying to achieve.

Geoff

bugpuzz
Newbie
Newbie
Posts: 2
Joined: Thu Sep 02, 2004 4:00 am

Post by bugpuzz » Tue Oct 09, 2007 1:41 pm

Hi Geoff,

I have not tested my answer but......

we are too using TeeChart for Applet purpose and trigging JS from within the applet and from JS back to the Applet.

There is a known issues about liveconnect and calling functions in an Applet. The call is not having the same access rights as when calling directly from within the Applet itself. We started doing a http call - that was triggered from JavaScript - it failed. Calling the same function from the Applets init function works fine. This behaviour will not be fixed in liveconnect.

Another thing - my favorite browser FireFox is not capable of handling Applets correct. I and som others have reported this to BugZilla. The applet is reinitialilzed every time it comes out of sight - using TeeChart or any other Applet (in fact also Flash objects also a posted bug). Opera and IE works as expected.

It is fairly simple to make an applet yourself and attach JButtons etc. to call the functions - that can not be called directly from JS.

Post Reply