The newer version of Chartkick has a download option that displays a button over the javascript chart, when clicked will open a new browser window and render the chart as an image. This is great. However, that method does not seem to help render an image to use as an email attachment. Unless there is a way to call/render the chart using a chartkick method inside the mailer, grab the image and attach it...As far as I can tell, this functionality does not exist.
Anyone know of a way to attach a chartkick chart as an image email attachment?
Natively? No. Chartkick performs a download using their script chartkick.js and chart.bundle.js. It happens entirely client-side, not server-side. And it should not be opening a new window. It should just download the file directly onto the client's machine. Example here: https://chartkick.com/react
Related
I am working on blog like web project using lexical editor in nextjs.
I am trying to implement image plugin in lexical editor. For now it coverts to base64 format which will be expensive for storing in database. Instead of storing base64 I want to store the image link along with other text inside database. Also I am facing issue to implement image plugin of lexical editor in nextjs.
steps I want to follow
I want to upload image in aws s3 and then want to show in editor as image.
Another way I am trying to implement like a modal will open where image can be selected
and it uploads to aws s3 and gets image url, then want to show image url in editor.
Is there any solution for it?
Thanks in advance for any suggestion
I have a Rails application where I am storing image in the model using
has_one_attached: logo
However, when I check in the AWS console, I see that the file is saved as a text file with the contents of SVG in it. When I try to retrieve the image using a signed URL, it gives me back the content of the text file.
I want to display this image in my HTML. How can I render this SVG in my application?
because svg is text ,it will be saved as text.
for displaying it in rails app this answer should work
I have to create a print preview page where I have to show some information and a highchart of the original page. Is there a way to export the highchart graph from one page to another?
There are probably many ways to accomplish this.
What language are you working in?
I would try it this way:
set the chart options in an external js file
include that js file in both the original page, and the 'preview' page
I assume the user will click on a link or button to open the preview page...?
send the data via POST to the new page, and instantiate the chart on the new page on page load
You could also look into using the Export package to
on link/button click, export the chart as an image, to the server
pass the url of the saved image to the new page, and load the image there
I have not worked with exporting to the server, and wouldn't bother with the set up for this when you can just pass the data and build the chart on the new page, but it's an option.
I am using HighChart in my application.
I want to export chart image on a button click like http://jsfiddle.net/hfrntt/fXHB5/1896/.
but i want to save image in a predefined folder and remove the save dialog pop-up to save image.
On button click image saved on the predefined folder.(No save dialog)
Thanks in advance
You have to setup an exportserver. Upon the client sends the Highcharts SVG file to this service it will be converted to an image. Before the server returns the image to the client you can save it to the predefined filesystem.
Here you can find a php export server and a java based one. https://github.com/highslide-software/highcharts.com/tree/master/exporting-server developed by Highcharts
These exportservers are setup to remove the temporary created files. You have to change the code a bit to prevent this.
read also this article for more background information on Highcharts exportservers
This is going to involve much more than simply using highcharts. You are going to have to use some sort of wrapper that will actually render the chart/page on the server-side and then essentially output it as an image. The following are links taken from a post on the highcharts website.
GWT Highcharts wrapper
Highcharts-server-side-export (with Rhino/Batik)
I'm using carrierwave to upload an image, this works fine up to now.
What i want to do is show the preview of the file to be submitted on the form after having selected the image.
At the moment the code I have is showing the previous image.
<%= image_tag(#book.cover_url(:thumb)) if #book.cover_url %>
how do I show the selected image rather than the image already uploaded?
You don't.
And that has nothing to do with Carrierwave but rather with the fact that the image is not yet sent to the server by your browser so no part of the Rails stack is coming into play here.
What you need is a way to access the image inside the <input type="file"> and display it to the user.
This is possible by using the FileAPI that is part of HTML5, but it's only supported in modern browsers (Webkit/Gecko), and the API is not completely finished yet so it's kind of a changing target.
I would suggest you look into tools like plupload to upload the image to the server without submitting the form and then displaying that through JavaScript.
Try http://jasny.github.io/bootstrap/javascript/#fileinput
It has a nice solution for displaying the image without the upload.