Highcharts.setOptions({lang:{drillUpText:" "}});
var hstechSectorChart = {
chart : null,
data_length: 0,
isMobile: false,
init : function(callback){
var self = this;
self.isMobile = ($("body").attr("data-broswer-view") == "mobile")?true:false;
$.getJSON('/'+lang+'/data/chart/hstechSectorChart', function(_data) {
var data = self.decode(_data);
$('#hstechSectorChartContainer').highcharts(self.getJSON(data), function(chart){
self.chart = chart;
});
});
},
decode : function(_data){
return _data.mainData;
},
getJSON : function(data){
//console.log(data2);
var self = this;
return {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
marginTop: (self.isMobile)?0:15,
marginBottom: (self.isMobile)?0:15,
height: (self.isMobile)?240:280,
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',
size: (self.isMobile)?((lang == "en")?"50%":"60%"):null,
dataLabels: {
formatter: function(){
var key = this.key;
if (self.isMobile && lang == "en"){
key = key.replace(" ","
");
}else if (self.isMobile ){
if (key.length >= 6){
key = key.substr(0, 3)+"
"+key.substr(3);
}else if (key.length == 5){
key = key.substr(0, 2)+"
"+key.substr(2);
}
}
return key;
},
style : {
fontSize : (lang == "en")?"9px!important":"11px!important",
},
},
events:{
click: function (event) {
/*var subID=event.point.subID*1;
var mainID=event.point.mainID*1;
if(subID>0){
updateSectorTable(mainID,subID);
}*/
updateSectorTable(event.point.id);
}
},
states: {
inactive:{
opacity:100,
}
}
}
},
legend: {
enabled: false,
},
series: [{
colorByPoint: false,
data: data,
}],
drilldown: {
enabled: false,
},
exporting : {
enabled: false
},
};
},
}