+ Start a Discussion
Radhika pawar 5Radhika pawar 5 

convert google chart to image in VF page

  I have one Requirement to convert google chart(graph) to image.i m using in VF Page
<!--- Bar Char Code -->
<script type="text/javascript">
      var functionname ="reading_report";
      functionname = functionname.replace(/[^A-Z0-9]+/ig, "_");
      //functionname = functionname.replace(/./g, '_');
      window[functionname] = function() {
  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable([
    ['Metrics', 'Beginner', 'Letter', 'Word', 'Para', 'Story'],
      <apex:repeat value="{!lstReport}" var="report">
         ["{!report[0]}", {!report[1]}, {!report[2]}, {!report[3]}, {!report[4]}, {!report[5]}], 
  // Create and draw the visualization.
  new google.visualization.ColumnChart(document.getElementById("reading_report")).
           {title:"Reading Baseline Trends - National",
            width:600, height:400,isStacked:true,
            hAxis: {title: ""},
            vAxis: {minValue: 0},
            vAxis: {maxValue: 100}}
<div id="reading_report" class="googlechart"></div> </center>
<!--​ End of Bar Chart -->
Gaurav NirwalGaurav Nirwal
<apex:page controller="GoogleDataEncoding">
    <apex:form >
               title="Create a Google Chart for Time and Distance">
               value="Enter data set, separated by commas: " 
               id="dataInput" title="First Data Point" 
               value="{!dataSet}" rows="3" cols="50"/><br/>
            <apex:selectRadio value="{!graph}" 
                <apex:selectOption itemValue="barChart" 
               itemLabel="Horizontal Bar Chart"/>
                <apex:selectOption itemValue="lineChart" 
               itemLabel="Line Chart"/>
            <apex:commandButton action="{!create}" 
    <apex:image url="{!chartURL}" alt="Sample chart"