actually my requirement is to save the charts as images and saved it in server while loading the page.. I'm using amcharts so is there any possible way to do this.. thanks in advance.
Since amcharts appears to use SVG to display the graph, you could try the technique in this answer (use a library called canvg to save to a canvas, then send the image data from the canvas to the server).
Related
I want to convert an SVG to PDF file on the frontend. I am using React and drawing a chart using d3 and I want to be to print the chart as a PDF. However, all of the solutions I have tried dont work for some reason. Mostly due to the fact that my chart includes foreignObjects as nodes.
The only working solution I have is through html2canvas and jsPDF. I convert the svg to canvas and then png and later print it using jspdf this solution prints the graph correctly but as it prints as an image the text is pixelated as I zoom in. I am looking for a solution that allows me to zoom in without breaking quality ( I dont know if thats even possible, even if it is upto 200% it should work)
I would like to know any suggestions you may have
I need to create a couple of graphs (barchart, line chart and pie chart) to insert as an image in a word file. My application is running in the browser (react).
What would be the easiest way to accomplish this?
(I haven't found an answer to similar questions, to my surprise)
Ok, I found an answer myself: I can use plotly to create the graph and export it to image directly (https://community.plotly.com/t/export-image-without-plotting/8507)
Is it possible to capture a canvas that has chart on it to phpword file? I just read this Add chart on phpoffice/phpword and it said it still not possible. even it's possible like this https://github.com/PHPOffice/PHPWord/blob/master/samples/Sample_32_Chart.php , it's still limited and I need my chart that has generated by my javascript and chart.js. I tried use filesaver.js but it just saved canvas to image, not pass it to controller (I'm using codeigniter). Any idea how to do it? Or is it still not possible?
I'm working on product where I generated C3 chart successfully. But problem is that I'm not able to download these graph as pdf or png. Even I don't know C3 libraries are providing this features.
Please suggest me if there is any way to download c3 chart as pdf or png. I want to download particular graph by clicking on button as d3 graph. Thanks in advance.
The problem is that those libraries are rendering your graphs as SVG, inline in the page. What you need is a way to get the rendered SVG (plus styles), and then if necessary to convert it to a PNG / PDF.
If you only want to do it every once in a while, this is something you can do by hand. There is [a bit of semi-official documentation from D3's creator on the subject. You can also have a look at the answers to these other questions.
If you want to do it programmaticaly, as a "Download this chart" feature on your site, there are multiple ways to go:
You can use jsdom to render your graph server-side, save the SVG and then use a tool like ImageMagick to convert it to PNG.
PhantomJS can render your page and take a screenshot of the chart. Here is very similar StackOverflow question with a good answer using PhantomJS.
Note: If the chart looks correct on canvas, I assume the following would work with C3 or any other chart:
I found that since I have to support IE 11 I instead went with canvas to blob to PNG using "canvas-toBlob.js" and "FileSaver.js"
$("#save-btn").click(function()
{
$("#myChart").get(0).toBlob(function(blob)
{
saveAs(blob, "chart_1.png");
});
});
https://jsfiddle.net/mfvmoy64/155
I'm trying to find a graphing tool that runs clients side that will allow me to plot some data and then save the grpah. I have Tried FLOT http://code.google.com/p/flot/ but it does not support saving of the graph. I have tried gChart http://keith-wood.name/gChart.html but it does not support x/y plotting in a date format (and is not as interactive as FLOT).
I need to plot X (date or date time) to Y (some number). and be able to save the graph when done.
Any other charting / graphing tools out there? I like FLOT, but I just can't find a way to save the graph. (Something interactive and that works with dates along the X axis)
I highly recommend RGraph:
http://www.rgraph.net/
I ended up using HighCharts, check it out at http://www.highcharts.com/
If you don't mind using Flash I've had a lot of luck with XML/SWF Charts. It's not Open Source, but a license was only about $50 USD. You can right click and save the charts as JPEGs, BMPs, or PNGs.
I'm guessing that what you mean by save is to save it as an image. If so, then that is pretty simple to do with canvas. If you use a library like flot, you should be able to save the canvas image it draws on with a library like Canvas2Image. The only problem is that it won't work with IE earlier than 9, because previous versions use VML and don't actually support the canvas tag.
Not strictly a client side graphing tool as you asked for, because the graphs are rendered to images by Google's servers, but if you were looking for a client side solution just to save yourself from having to do image processing on your server, then I'd recommend the Google Chart API
(or Google Chart Tools / Image Charts (aka Chart API) as it now seems to be called)
save
save
save
Renders directly to PNG, so you don't have to do anything clever to be able to save the graph.
Downside is that the graphs are not interactive, so if you really need that, this simple solution wouldn't be for you.