0

I displayed a jqPlot bar chart in jsp .Now i have seen an option of button click to view chart as image and save it into image but i dont know how to achieve this .. I have added button code..

Here is my code..

 <script type="text/javascript">
        $(document).ready(function(){
            $.jqplot.config.enablePlugins = true;
            var s1 = [200, 600, 700, 1000,1400];
            var ticks = ['Local', 'STD', 'ISD', 'INET','Incoming'];

            plot1 = $.jqplot('chart1', [s1], {
                // Only animate if we're not using excanvas (not in IE 7 or IE 8)..
                animate: !$.jqplot.use_excanvas,
                seriesDefaults:{
                    renderer:$.jqplot.BarRenderer,
                    pointLabels: { show: true }
                },
                axes: {
                    xaxis: {
                        renderer: $.jqplot.CategoryAxisRenderer,
                        ticks: ticks
                    }
                },
                highlighter: { show: true }
            });

            $('#chart1').bind('jqplotDataClick',
            function (ev, seriesIndex, pointIndex, data) {
                $('#info1').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
            }
        );
        });
    </script>

</head>
<body>
    <br/>
    <br/>
    <input type="submit" name="ViewImage" id="view" value="ViewImage">
    <div name="chart1" id="chart1" value="chart1" style="height: 300px;width: 400px;left: 100px">

</body>

Any help will be appreciated..

Thanks in advance..

vikas
  • 471
  • 3
  • 15
  • 31
  • here is the answer to your question: [http://stackoverflow.com/questions/12182598/jqplot-as-image][1] [1]: http://stackoverflow.com/questions/12182598/jqplot-as-image – Gyandeep Oct 28 '13 at 15:52

1 Answers1

0

Do not use input, use button

and function is:

$("#div_ID').jqplotSaveImage();
Nic Taky Nic
  • 107
  • 8