Download Chart.js graph from view - chart.js

I have recently started using Chart.js for data visualization. I am able to do the visualization. My client also want that graph to be downloaded with data information. I know I can do it by giving print button from screen and show relevant data.
But is there a Chart.js feature available which can download this graph as well as the information in actual numbers.

Here is a Stack Overflow answer that points out the way to go: Save the underlying canvas data as Base64 encoded string as image.
Chart.js chart save as image

Related

Export chart to png (Chart.js)

Is there anyway to export the chart to a image without the need to create a canvas and all. This is what I am trying to do, first I want to create a chart with all the necessary data and then I want to export that to png all in the server side, without touching html.
Chart.js is a canvas based library so you always need some sort of canvas, either a normal one, an offscreen one or an equivalant in node. If you dont want to create your own canvas you can use quickChart. Here you can pass your config and you get a png with that chart back

Is there a way to display an imagery timeline in an rmarkdown leaflet html widgit?

I have an R markdown html document with a leaflet map. The base layer for the leaflet map is ESRI.WorldImagery. This base layer doesn't indicate anywhere the date upon which the imagery (e.g. aerial photograph or satellite) was acquired. It's possible that different imagery tiles represent different snap shots in time.
I would like to at least be able to tell my users the date or year in which the imagery they are viewing was acquired. Better yet would be to show an interactive timeline slider, analogous to the historical imagery timeline slider in google earth.
Does anyone know if this is possible in R leaflet?

Using chart.js to output chart as a saved image rather than using canvas

I am chart.js to create a chart and display it on the screen and this is fine.
Is it possible to get chart.js to output the chart as an image that can be saved without using canvas? The reason is that I would like to include the image in a pdf but do not want to have to see it on the screen first.
have you checked out the "dom-to-image" library?
Hope this helps!
Dom-To-Image Library

How to make google chart API responsive?

I am creating two charts Line Chart and Donut Chart on same HTML Page using Google JS API. But these charts are not responsive. How can I make those charts as responsive?
The Google Charts API was probably not designed with responsiveness in mind, specifically. The default size of the chart is to fill the element it's being rendered into, so you can just use CSS and Media Queries like you would normally do to make a responsive design.
The only real problem is that once the chart is drawn, it doesn't change it's size in a desktop window resize-type scenario. In Angular Google Chart we listen for the window's resize event and redraw the chart.
I've seen some of the resize strategy paired with a bit of JavaScript to keep the chart the same aspect ratio no matter how wide it is.
Anything more specific will need a more detailed question. I am intentionally not including any code for this answer, because whatever I write will probably be wrong for your situation.

Google image pie chart labels not working

I am using the old static Google Chart API to generate a pie chart. The URL I am using is
https://chart.googleapis.com/chart?cht=p&chs=150x150&chd=t:1,2,3&chl=a|b|c
This URL contains the required parameter – chl – for labels, specified in the documentation (https://developers.google.com/chart/image/docs/gallery/pie_charts#pie_chart_label)
However, the image comes back with only lines pointing to the slices, not labels. Any help would be appreciated.
Problem solved: the width in the chs parameter was too small for the labels to show up.