typpo / google-charts-node

Render Google Charts to image
GNU Affero General Public License v3.0
35 stars 10 forks source link

REQUEST: Geochart Example #24

Open lastcoolnameleft opened 3 months ago

lastcoolnameleft commented 3 months ago

Thanks for this project. I've gotten so close and have gotten the base chart working; however, there appears to be an issue when using a geochart as the results always turn out blank for me.

Source inspired by: https://developers.google.com/chart/interactive/docs/gallery/geochart

Using your example, I replaced it with this and start getting a blank screen:

    var data = google.visualization.arrayToDataTable([
      ['Country', 'Popularity'],
      ['Germany', 200],
      ['United States', 300],
      ['Brazil', 400],
      ['Canada', 500],
      ['France', 600],
      ['RU', 700]
    ]);

    var options = {};

    const chart = new google.visualization.GeoChart(container);
    chart.draw(data, options);
  }

  // Render the chart to image
  const image = await GoogleChartsNode.render(drawChart, {
    width: 400,
    height: 300,
    mapsApiKey: '<REMOVED KEY>',
    packages: ['geochart', 'corechart'],
  });