Highcharts.setOptions({lang:{drillUpText:" "}}); var sectorChart = { chart : null, data_length: 0, isMobile: false, init : function(uid,callback){ var self = this; self.isMobile = ($("body").attr("data-broswer-view") == "mobile")?true:false; $.getJSON('/'+lang+'/data/chart/sectorChart/uid/'+uid, function(_data) { var data = self.decode(_data); data2 = _data.subData; /*if(data != null){ for(var i = 0 ; i < data.length; i++){ if(data[i].y > 0){ self.data_length++; } } if(self.data_length == 0){ data = null; } }*/ $('#sectorChartContainer').highcharts(self.getJSON(data), function(chart){ self.chart = chart; //console.log(self.getJSON(data)); // if (callback!==undefined){ // callback(chart,data); // } }); }); }, decode : function(_data){ return _data.mainData; }, drillUp : function(){ if (this.chart.drillUpButton){ $(this.chart.drillUpButton.element).trigger("click"); } }, getJSON : function(data){ //console.log(data2); var self = this; return { chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie', marginTop: (self.isMobile)?15:15, marginBottom: (self.isMobile)?10:15, height: (self.isMobile)?240:289, events: { drilldown: function (e) { setTimeout(function(){ if (self.chart.drillUpButton){ self.chart.drillUpButton.hide(); } $(".charts .upper_btn").show(); },50); }, drillup: function () { if (self.hisMode && typeof showSectorTable == "function"){ //showSectorTable(); } $(".charts .upper_btn").hide(); //this.setTitle({ text: null }); } }, }, title: { text: null }, tooltip: { enabled: false, }, plotOptions: { pie: { center: 0, allowPointSelect: true, cursor: 'pointer', events:{ click: function (event) { var subID=event.point.subID*1; var mainID=event.point.mainID*1; if(subID>0){ updateSectorTable(mainID,subID); } } }, states: { inactive:{ opacity:100, } } } }, legend: { enabled: false, }, series: [{ colorByPoint: false, data: data, }], drilldown: { series: data2, drillUpButton: { theme: { fill: '#fff', stroke: '#fff', width: 1, height: 1, } }, activeDataLabelStyle: { //textDecoration: 'none', //fontStyle: 'italic', color: '#000' }, }, exporting : { enabled: false }, }; }, }