RichardC
Posts: 5
Joined: Mon Oct 25, 2021 7:10 pm

Converting from hardcoded Data to reading from Sheets

I created a radar chart in jsfiddle with my data hardcoded as:

Code: Select all

  series: [{
        color: '#FF0000',
 	showInLegend: false,            
	data: [4, 6, 4, 3, 2, 4, 5, 1, 1]
  }]
https://jsfiddle.net/RichardU/32bwc0kf/76/

That works perfectly, but now I want to grab my 9 data points from a google sheets document. I created a document and API as recommended and I can connect to my sheets document, but I'm not sure how to format the data. i.e. using the example spreadsheet:

Code: Select all

  data: {
        googleAPIKey: 'AIzaSyCQ0Jh8OFRShXam8adBbBcctlbeeA-qJOk',
        googleSpreadsheetKey: '0AoIaUO7wH1HwdENPcGVEVkxfUDJkMmFBcXMzOVVPdHc',
        error: console.error
   }
  series: [{
        color: '#FF0000',
        showInLegend: false   
  }]
Assume my spreadsheet is a blank document and I can put the 9 datapoints anywhere (e.g. in a row, or column, etc). I've tried dozens of combinations including with using googleSpreadsheetRange: 'A1:A9' etc. I usually pull in a few datapoints, but I can't figure out the pattern.

What am I missing?
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Converting from hardcoded Data to reading from Sheets

Hello,

Welcome to our forum and thanks for contacting us with your question!

The pattern looks like the first column is the x-axis and the next one is the y-axis of the series, the next columns are the next series.
pattern.png
pattern.png (10.3 KiB) Viewed 117 times

Demo: https://jsfiddle.net/BlackLabel/9gms8rw4/

Let me know if you have any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Usage”