jdf
Posts: 3
Joined: Fri Apr 24, 2015 9:55 am

Google Spreadsheets not working with custom code

I’m looking to buy the Advanced plan to get the Real-time data and custom-code features but one thing is holding me back. I can’t seem to be able to use both features together, is that intentional?

Try using the Spreadsheet key 1Fbo-5hjMu0Cr-_H6DURWmwREgJ4Ir7u9zAbao_jKrQ8 and uncomment out the default Custom-Code. They work individually but together they give “no data to display”.
User avatar
KacperMadej
Posts: 4632
Joined: Mon Sep 15, 2014 12:43 pm

Re: Google Spreadsheets not working with custom code

Are you referring to some demo? Could you post live example, like jsFiddle?
What kind of custom code are you using?

Spreadsheet seems to work fine, as you stated: http://jsfiddle.net/9rhq7090/
Kacper Madej
Highcharts Developer
jdf
Posts: 3
Joined: Fri Apr 24, 2015 9:55 am

Re: Google Spreadsheets not working with custom code

KacperMadej wrote:Are you referring to some demo? Could you post live example, like jsFiddle?
What kind of custom code are you using?

Spreadsheet seems to work fine, as you stated: http://jsfiddle.net/9rhq7090/
Hi, sorry if I wasn't clear.

Inside the Highcharts Cloud editor if you click 'open the grid' and then paste in the Spreadsheet code it should load the data. Then if you go to Customize > Code > Custom code and uncomment out the default code then you'll get the error 'No data to display'. Using any custom code with google spreadsheet data gives the same error.
User avatar
KacperMadej
Posts: 4632
Joined: Mon Sep 15, 2014 12:43 pm

Re: Google Spreadsheets not working with custom code

This looks like a bug, so I have reported this issue - https://github.com/highslide-software/h ... ssues/4135

As a workaround:
Custom code doesn't include generated options that are needed to display your chart.
Copy Generated options and add them to Custom code to make the chart work.
Or paste this already tested code:

Code: Select all

// Sample of extending options:
Highcharts.extend(options, Highcharts.merge(options, {
    chart: {
        backgroundColor: "#bada55"
    },
    plotOptions: {
        series: {
            cursor: "pointer",
            events: {
                click: function(event) {
                    alert(this.name + " clicked\n" +
                          "Alt: " + event.altKey + "\n" +
                          "Control: " + event.ctrlKey + "\n" +
                          "Shift: " + event.shiftKey + "\n");
                }
            }
        }
    },
  "xAxis": {
		"type": "category"
	},
	"series": [
		{
			"index": 0,
			"name": "Number of people",
			"data": [
				[
					"Other",
					1620
				],
				[
					"Rent arrears",
					1220
				],
				[
					"Mortgage arrears",
					130
				],
				[
					"Non-violent relationship breakdown",
					335
				],
				[
					"Violent relationship breakdown",
					860
				],
				[
					"Loss of rented/tied accommodation",
					960
				],
				[
					"Parents/relatives/friends no longer able/willing to accommodate",
					1130
				]
			]
		}
	]
}));
Kacper Madej
Highcharts Developer
OysteinMoseng
Posts: 52
Joined: Mon May 19, 2014 8:29 am

Re: Google Spreadsheets not working with custom code

This seems to be an issue in the editor view only. After saving the chart, the spreadsheet works fine in the show/embed pages. We'll be working on figuring out the issue with the editor view.
Øystein Moseng
Head of Accessibility / Core Developer
Highcharts Team
Gert Vaartjes
Posts: 217
Joined: Thu Apr 14, 2011 6:03 am

Re: Google Spreadsheets not working with custom code

Hi,

This is fixed now. Now it's possible to use custom code in combination with google spreadsheets.

Sorry for the inconvenience,

Gert Vaartjes
CTO
Highsoft
jdf
Posts: 3
Joined: Fri Apr 24, 2015 9:55 am

Re: Google Spreadsheets not working with custom code

Thank you, it’s working brilliantly now :)

Return to “Highcharts Cloud”