You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @JohnCoene ,
How are you doing?
We've been getting more into the inner workings of echarts4r and are attempting to make a custom toolbox feature that saves the image with a watermark.
I feel like we're getting close but not quite there.
Do you have any tips for how to move forward from here?
Using an old example from my maximize question from a while back:
Here's the onclick function with syntax highlighting:
function(){varecModel=this.ecModel;// from https://echarts.apache.org/examples/en/editor.html?c=line-graphic&edit=1&reset=1ecModel.setOption({graphic : [{type: 'group',rotation: Math.PI/4,bounding: 'raw',right: '10%',bottom: '10%',z: 100,children: [{type: 'rect',left: 'center',top: 'center',z: 100,shape: {width: 400,height: 50},style: {fill: 'rgba(0,0,0,0.3)'}},{type: 'text',left: 'center',top: 'center',z: 100,style: {fill: '#fff',text: 'ECHARTS LINE CHART',font: 'bold 26px sans-serif'}}]}]});debugger;// from https://github.com/apache/echarts/blob/dfa1f0732972e358a3711c75b5f41db741e986b6/src/component/toolbox/feature/SaveAsImage.ts#L50constmodel=this.model;constapi=this.api;consttitle=model.get('name')||ecModel.get('title.0.text')||'echarts';constisSvg=api.getZr().painter.getType()==='svg';consttype=isSvg ? 'svg' : model.get('type',true)||'png';consturl=api.getDataURL({type: type,backgroundColor: model.get('backgroundColor',true)||ecModel.get('backgroundColor')||'#fff',connectedBackgroundColor: model.get('connectedBackgroundColor'),excludeComponents: model.get('excludeComponents'),pixelRatio: model.get('pixelRatio')});constbrowser=env.browser;// Chrome, Firefox, New Edgeif(isFunction(MouseEvent)&&(browser.newEdge||(!browser.ie&&!browser.edge))){const$a=document.createElement('a');$a.download=title+'.'+type;$a.target='_blank';$a.href=url;constevt=newMouseEvent('click',{// some micro front-end framework, window maybe is a Proxyview: document.defaultView,bubbles: true,cancelable: false});$a.dispatchEvent(evt);}}
I'm getting the error : echarts-en.min.js:45 Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
From this bit:
An aside, it appears that echarts4r::e_toolbox_feature only allows for overwrite of the entire toolbox option. Maybe a merge argument would be helpful here if folks want to add to rather than replace existing toolbox features?
Any ideas will be appreciated!
The text was updated successfully, but these errors were encountered:
Hi @JohnCoene ,
How are you doing?
We've been getting more into the inner workings of
echarts4r
and are attempting to make a custom toolbox feature that saves the image with a watermark.I feel like we're getting close but not quite there.
Do you have any tips for how to move forward from here?
Using an old example from my maximize question from a while back:
Here's the onclick function with syntax highlighting:
I'm getting the error :
echarts-en.min.js:45 Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
From this bit:
An aside, it appears that
echarts4r::e_toolbox_feature
only allows for overwrite of the entire toolbox option. Maybe amerge
argument would be helpful here if folks want to add to rather than replace existing toolbox features?Any ideas will be appreciated!
The text was updated successfully, but these errors were encountered: