Options for CharEditor

29 views
Skip to first unread message

samuel.ma...@bbva.com

unread,
Sep 17, 2015, 5:16:59 PM9/17/15
to Google Visualization API
Is any way to pass Options to google.visualization.events.addListener(chartEditor, 'ok', redrawChart); to indicate the options I want?

I have the function below. By default when the Chart Editor pulls up, the default chart which is a Pie Chart as I indicated in the CharType: PieChart has the colors I passed through the options: 'colors': ['#094FA4', '#006EC1', '#009EE5', '#52BCEC', '#89D1F3','#B5E5F9']

However, If I select a different type of chart the colors for the chart change to the Default one and I was wondering If I can pass the colors to       google.visualization.events.addListener(chartEditor, 'ok', redrawChart);

so no matter what Chart I pick, it will have the same colors.

Thank you very much



    function loadEditor(querySelector) {
      // Create the chart to edit.
      var wrapper = new google.visualization.ChartWrapper({
         //Set up the default Chart Selected
         'chartType':'PieChart',
         'dataSourceUrl':dataSourceUrl + magicIncantation,
         'query':querySelector,
         'options': {'title':'Title of Pie Chart', 'legend':'none', 'colors': ['#094FA4', '#006EC1', '#009EE5', '#52BCEC', '#89D1F3','#B5E5F9']}
      });

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

    // On "OK" save the chart to a <div> on the page.
    function redrawChart(){
      chartEditor.getChartWrapper().draw(document.getElementById('Piechart_div'));
    }
Reply all
Reply to author
Forward
0 new messages