javascript - getImageURI() not work from orgchart by google -
i created fiddle when try getimageuri()
chart (orgchart google charts) 1 error generated.
error: "uncaught typeerror: chart.getimageuri not function"
i need generate image or pdf orgchart created. possible?
google.charts.load('current', {packages:["corechart","orgchart"]}); google.charts.setonloadcallback(drawchart); function drawchart() { var data = new google.visualization.datatable(); data.addcolumn('string', 'name'); data.addcolumn('string', 'manager'); data.addcolumn('string', 'tooltip'); // each orgchart box, provide name, manager, , tooltip show. data.addrows([ [{v:'mike', f:'mike<div style="color:red; font-style:italic">president</div>'}, '', 'the president'], [{v:'jim', f:'jim<div style="color:red; font-style:italic">vice president</div>'}, 'mike', 'vp'], ['alice', 'mike', ''], ['bob', 'jim', 'bob sponge'], ['carol', 'bob', ''] ]); // create chart. var chart = new google.visualization.orgchart(document.getelementbyid('chart_div')); google.visualization.events.addlistener(chart, 'ready', function () { $( "#chart_div2" ).append( '<img src="' + chart.getimageuri() + '">' ); }); // draw chart, setting allowhtml option true tooltips. chart.draw(data, {allowhtml:true}); }
similar table charts, org charts produce html <table>
elements, rather svg
which why getimageuri
isn't listed in methods section either chart
recommend using library convert html canvas (html2canvas.js
),
can saved base64 string,
similar getimageuri
see answer, little more info on topic...
rendering html elements canvas
Comments
Post a Comment