using runtime html4,Adding HTML on runtime

My specific task is to be able to dynamically create HTML5 canvas on a TUniHTMLFrame so that I can show multiple TeeChart HTML5 according to user input.

I have seen sample projects such as the High Charts Demo, however since I need many TUniHTMLFrames with unique names as well as unique names for each canvas, I need to be able to programmatically achieve step 6) of Delphi Developer's guide within the High Charts Demo (which has helped a lot thank you).

However using

UniHTMLFrame1.HTML.Add('This browser does not seem to support HTML5 Canvas.' + 'This browser does not seem to support HTML5 Canvas.');

does not load the chart onto the TUniHTMLFrame itself. And for some reason if I try

ShowMessage(UniHTMLFrame1.HTML.Text);

it will load the chart in a new window like so (I am using someone's demo for testing but I cannot find the original source again my apologies) but I want it to load onto the UniHTMLFrame properly:

For reference below is a snippet of the relevant code.

UniHTMLFrame1.HTML.Add('This browser does not seem to support HTML5 Canvas.' +

'This browser does not seem to support HTML5 Canvas.');

ShowMessage(UniHTMLFrame1.HTML.Text);

UniSession.AddJS(

'Chart1=new Tee.Chart("canvas");' +

'Chart1.axes.left.title.text="Axis Y";' +

'Chart1.axes.bottom.title.text="Axis X";' +

'Chart1.title.text="Testing";' +

'var series=Chart1.addSeries(new Tee.Line(Chart1));' +

'series.data.x=[];' +

'Chart1.panel.transparent=true;' +

'Chart1.legend.visible=false;' +

'Chart1.zoom.enabled=false;' +

'Chart1.scroll.mouseButton=0;' +

'Chart1.scroll.direction="horizontal";' +

'Chart1.axes.bottom.setMinMax(200,499);' +

'scroller=new Tee.Scroller("canvas2", Chart1);'

);

UniSession.AddJS(

'for (var t=0; t<1000; t++) {' +

'series.data.values[t]=Math.random()*1000;' +

'series.data.x[t]=t;' +

'}' +

'Chart1.applyTheme("minimal");' +

'Chart1.applyPalette("lookout");' +

'Chart1.title.format.font.shadow.visible=false;' +

'Chart1.footer.format.font.shadow.visible=false;' +

'Chart1.panel.format.shadow.visible=false;' +

'for (var i=0; i < Chart1.series.items.length; i++)' +

'{' +

' Chart1.series.items[i].format.shadow.visible=false;' +

'}' +

'Chart1.applyTheme("minimal");' +

'Chart1.draw();'

);

UniSession.AddJS(

'Chart1.draw();'

);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值