JqPlot作为图像 [英] JqPlot As Image
问题描述
在最新的JqPlot示例中(请参见此处,某些图表下方有按钮可以单击,然后div随图表一起向下滑动,成为图像,允许您右键单击并另存为.
In the latest JqPlot examples (see here, there are buttons underneath some charts that you can click, and a div slides down with the chart as an image, allowing you to right click and save as.
我已经检查了源,但看不到发生这种情况的地方.我已经看到了有关此问题的各种讨论(请参见此处但是我的javascript充其量只是基础知识.这是我想在当前项目中实现的东西.
I've checked the source and I just can't see myself where this is happening. I've seen various discussions about this (see here however my javascript is basic at best. This is however something I would like to implement in my current project.
是否有人知道有关如何执行此操作的完整教程,即从实际的jquery代码一直到以html代码实现.
Is anyone aware of a complete tutorial as to how to do this, i.e. from the actual jquery code right down to implementation in html code.
推荐答案
这是我可以编写的最简单的示例:
Here's the simplest example I can code up:
//after creating your plot do
var imgData = $('#chart1').jqplotToImageStr({}); // given the div id of your plot, get the img data
var imgElem = $('<img/>').attr('src',imgData); // create an img and add the data to it
$('#imgChart1').append(imgElem); // append the img to the DOM
小提琴此处.
这篇关于JqPlot作为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!