Page 1 of 1

TeeSaveToHTML5 Java

Posted: Tue Dec 22, 2015 2:22 pm
by 16573806
Hi,

Q1) how to save the chart to "HTML 5 JavaScript" by VCL pro since 2014 at run time.

I found in TeeHTML5Canvas unit with the function "TeeSaveToHTML5File" but not TeeHTML5Javascript unit .


Q2) do you have experience for integrated result save HTML5 in INTRAWEB ?

Re: TeeSaveToHTML5 Java

Posted: Tue Dec 22, 2015 2:51 pm
by yeray
Hello,
Menant.D wrote:Q1) how to save the chart to "HTML 5 JavaScript" by VCL pro since 2014 at run time.

I found in TeeHTML5Canvas unit with the function "TeeSaveToHTML5File" but not TeeHTML5Javascript unit .
The following two alternatives seem to work fine for me here with v2015.16:

Code: Select all

uses TeeHTML5Canvas;
//...
TeeSaveToHTML5File(Chart1, 'C:\tmp\VCL2HTML5Canvas_test.html');

Code: Select all

uses TeeJavascript;
//...
TeeSaveToJavascriptFile(Chart1, 'C:\tmp\VCL2JS_test.html');
Menant.D wrote:Q2) do you have experience for integrated result save HTML5 in INTRAWEB ?
I'm afraid we haven't tested that.

Re: TeeSaveToHTML5 Java

Posted: Wed Dec 23, 2015 8:21 am
by 16573806
Thank you,
Another question about the tools in the chart .
Can we force recording ( serialization ) in Javasript example:
Rectangle, near point ,color line , Band, etc. in VCL2014 ? or in VCL2015 new version?

or it can be encoded directly into the HTML file ?
if yes, do you have exemple of potential add a tools directly in a javascript?

Re: TeeSaveToHTML5 Java

Posted: Thu Dec 24, 2015 10:07 am
by yeray
Hello,
Menant.D wrote:Another question about the tools in the chart .
Can we force recording ( serialization ) in Javasript example:
Rectangle, near point ,color line , Band, etc. in VCL2014 ? or in VCL2015 new version?

or it can be encoded directly into the HTML file ?
if yes, do you have exemple of potential add a tools directly in a javascript?
TeeSaveToHTML5File creates an html page that contains the VCL chart directly drawn using javascript functions. This is a static chart, similar to an exportation to an image.
TeeSaveToJavascriptFile creates an html page that contains TeeChart HTML5/Javascript objects (TChart, Series, Tools,...). This means the chart is "alive", supporting zoom, scroll, etc.
Also some tools are translated from TeeChart VCL to TeeChart HTML5, but I'm afraid not all, and some of them still with some limitations.
I've tested the TRectangleTool, the TColorLineTool and the TColorBandTool with the actual version (v2015.16) but only the TRectangleTool seems to be translated into a Tee.Annotation tool in TeeChart HTML5, and without respecting the position (I've corrected it for the next maintenance release). The other tools aren't translated because they don't exist in TeeChart HTML5 (see the reference demo here).
I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1400

Here it is the code I've used to test it:

Code: Select all

uses Series, TeeTools, TeeJavascript;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;
  Chart1.AddSeries(TPointSeries).FillSampleValues(10);

  with Chart1.Tools.Add(TRectangleTool) as TRectangleTool do
  begin
    AutoSize:=true;
    Text:='My Rectangle Tool';
    Shape.Transparency:=20;

    Chart1.Draw;

    Left:=Chart1[0].CalcXPos(6) + 5;
    Top:=Chart1[0].CalcYPos(6) - Shape.Height - 10;
  end;

  with Chart1.Tools.Add(TColorLineTool) as TColorLineTool do
  begin
    Axis:=Chart1.Axes.Bottom;
    Value:=6;
    Pen.Color:=clRed;
  end;

  with Chart1.Tools.Add(TColorBandTool) as TColorBandTool do
  begin
    Axis:=Chart1.Axes.Bottom;
    StartValue:=1;
    EndValue:=4;
    Transparency:=50;
    Color:=clRed;
  end;

  TeeSaveToJavascriptFile(Chart1, 'C:\tmp\VCL2JS_test.html');
end;
Regarding the "near point", could you please detail what exact tool do you have in TeeChart VCL that you want in TeeChart HTML5?