RuneS
Posts: 6
Joined: Tue Nov 28, 2017 3:24 pm

Pie-chart problem

So, I seem to have gotten the hang of it, having my line, spline and column charts looking and behaving as I want them to. We use SAS for all our data processing, and I get SAS to output code I can paste into the custom code-section in Cloud. It works well.

I thus didn't expect any problems in making a simple pie-chart, but I can't for the life of me get it to work (ie. to show a chart at all). I stripped the code down to the bare essentials:

Code: Select all

var minserie=[{
name: "Sektor", 
data:[
     { name: "Administrasjon",
      y:      7.6 },
     { name: "Annet",
      y:      3.8 },
     { name: "Barnehager",
      y:     10.9 },
     { name: "Helse/pleie/omsorg",
      y:     38.3 },
     { name: "Samferdsel og teknikk",
      y:      4.9 },
     { name: "Undervisning",
      y:     34.5 }
]
}];

Highcharts.merge(true, options, {
     chart: {
          type: 'pie'
     },
     title: {text:"Andel årsverk i ulike sektorer"},
     subtitle: {text: "Tall per 1.12.2016"},
     plotOptions: {
          series: {
               animation:true,
          }
     },
     series: minserie,
     credits: {
          enabled: true,
          text: 'Our site',
          href: 'www.oururl.no/'
     }
});


I can't get this to produce a chart i Highcharts Cloud. If i use the export code to html function in Cloud and export the code to jsfiddle, it works fine: https://jsfiddle.net/RuneS/797rcLxn/1/
ppotaczek
Posts: 751
Joined: Mon Oct 02, 2017 3:12 pm

Re: Pie-chart problem

Hi RuneS,

You have to add:

Code: Select all

options.data = null;
before Highcharts.merge method. It seems that series which you want to show are overwritten by empty CSV.

Best regards!
Paweł Potaczek,
Highcharts Developer
RuneS
Posts: 6
Joined: Tue Nov 28, 2017 3:24 pm

Re: Pie-chart problem

I just realized I never said thanks for help on this. But the solution worked perfectly, and the help was greatly appreciated.

Return to “Highcharts Cloud”