Hello everyone,

I want to draw more that one ChartEditor on a single HTML page. When the 
dialog box opens for, say, two charts, they do not contain options to edit 
them. Can someone help me with this?

I am using the code attached below:


<body>
<div id="vis_div" style="height: 400px; width: 600px;"></div>
<div id="vis_div2" style="height: 400px; width: 600px;"></div>
<script type="text/javascript">
  google.charts.load('visualization','1.0',{packages: ['charteditor'], 
callback: loadEditorBar});
  var chartEditor = null;

  function loadEditorBar() {
    // Create the chart to edit.
    var wrapperBar = new google.visualization.ChartWrapper({
        chartType: 'BarChart',
        dataTable: [['', 'Germany', 'USA', 'Brazil', 'Canada', 'France', 'RU'],
                    ['', 700, 300, 400, 500, 600, 800]],
        options: {'title': 'Countries'},
        containerId: 'vis_div'
    });

    chartEditor = new google.visualization.ChartEditor();
    google.visualization.events.addListener(chartEditor, 'ok', redrawChartBar);
    chartEditor.openDialog(wrapperBar, {});
  }

  // On "OK" save the chart to a <div> on the page.
  function redrawChartBar(){
    chartEditor.getChartWrapper().draw(document.getElementById('vis_div'));
  }

</script>
<script type="text/javascript">
  google.charts.load('visualization','1.0',{packages: ['charteditor'], 
callback: loadEditor});
  var chartEditor2 = null;

  function loadEditor() {
    // Create the chart to edit.
    var wrapper = new google.visualization.ChartWrapper({
        chartType: 'AreaChart',
        dataTable: [['', 'Germany', 'USA', 'Brazil', 'Canada', 'France', 'RU'],
                    ['', 700, 300, 400, 500, 600, 800]],
        options: {'title': 'Countries'},
        containerId: 'vis_div2'
    });

    chartEditor2 = new google.visualization.ChartEditor();
    google.visualization.events.addListener(chartEditor2, 'ok', 
redrawChartArea);
    chartEditor2.openDialog(wrapper, {});
  }

  // On "OK" save the chart to a <div> on the page.
  function redrawChartArea(){
    chartEditor2.getChartWrapper().draw(document.getElementById('vis_div2'));
  }

</script>
</body>



-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/4aa4fe1c-6b1c-40ac-a2ee-dca6c999109b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to