
export class SpeedChart {

constructor() {
    this.height = null;
    this.title = null;
    this.series = [];
    this.size = null;
    this.width = null;
    this.yTitle = '%';
    this.xTitle = '';
    this.subtitle = null;
    this.categories = null;
    this.yMin = 0;
    this.yMax = 100;
    this.type = 'column';
    this.export = false;
    this.drilldown = false;
    this.legend = true;
    this.stacking = null;
    this.stackLabels = false;
    this.grouping = true;
    this.metrica = '%'
    this.pointWidth = undefined;
    this.enableYaxis = true;
    this.configStackLabels = ['white', 'normal'];
    this.headerTooltip = '<span style="font-size:15px">{point.key}</span><br>';
    this.bodyTooltip = '<span class= "uk-center" style="font-size:13px"><span  class=" uk-text-bold" style="color:{point.color};">■ </span><span>{series.name}: </span>{point.y:.2f}'+ this.metrica +'</span><br>';
    this.minRange = 1;
    this.axisType = 'datetime';
}

setMetrica(metrica) {
    this.metrica = metrica;
}

setSeries(series) {
    this.series = series;
};

setHeight(height) {
    this.height = height;
};

setWidth(width) {
    this.width = width;
};

setTitle(title) {
    this.title = title;
};

setYMin(yMin) {
    this.yMin = yMin;
};

setYMax(yMax) {
    this.yMax = yMax;
};

setCategories(categories) {
    this.categories = categories;
};

setYTitle(yTitle){
    this.yTitle = yTitle;
};

setSubtitle(subtitle) {
    this.subtitle = subtitle;
};

setType(type) {
    this.type = type;
};

setExport(exporting) {
    this.export = exporting;
};

setDrilldownEvent(drilldown) {
    this.drilldown = drilldown;
};

setLegend(legend){
    this.legend = legend;
};

setStacking(stacking){
    this.stacking = stacking;
};

setStackLabels(labels){
    this.stackLabels = labels;
};

setGrouping(grouping){
    this.grouping = grouping;
};

setPointWidth(point){
    this.pointWidth = point;
};

setEnabledYAxis(enabled){
    this.enableYaxis = enabled;
};

setConfigStackLabels(enabled){
    this.configStackLabels = enabled;
};

setMinRange(min){
    this.minRange = min;
};

setAxisType(axisType){
    this.axisType = axisType;
};



Draw(){


    var speedDefaultChart = {
        chart: {
           type: 'gauge',
           plotShadow: false,
           height: 250
        },
        tooltip: {
          shared: true,
          hideDelay: 100,
          followPointer: false,
          pointFormat: '<b>{point.y:.2f} Ton/h</b>',
          // valueSuffix: ' kg/m²hr'
        },
        title: {
           text: this.tittle
        },
        subtitle: {
           text: this.subtitle
        },
        lang:{
            noData: "Datos Insuficientes."
        },
        pane: {
           startAngle: -150,
           endAngle: 150,
           background: [{
               backgroundColor: {
                   linearGradient: { x1: 1, y1:1, x2: 1, y2: 1 },
                   stops: [
                       [0, '#FFF'],
                       [1, '#333']
                   ]
               },
               borderWidth: 0,
               outerRadius: '109%'
           }, {
               backgroundColor: {
                   linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                   stops: [
                       [0, '#333'],
                       [1, '#FFF']
                   ]
               },
               borderWidth: 0,
               outerRadius: '100%'
           }, {
               // default background
           }, {
               backgroundColor: '#DDD',
               borderWidth: 0,
               outerRadius: '105%',
               innerRadius: '103%'
           }]
        },
        credits: false,
        // the value axis
        yAxis: {
           min: 0,
           max: this.series[0].data[0]*1.5,
    
           minorTickInterval: 'auto',
           minorTickWidth: 0,
           minorTickLength: 10,
           minorTickPosition: 'inside',
           minorTickColor: '#666',
    
           tickPixelInterval: 30,
           tickWidth: 0,
           tickPosition: 'inside',
           tickLength: 10,
           tickColor: '#666',
           labels: {
               step: 2,
               rotation: 'auto'
           },
           title: {
               text: null,
               y: 20
           },
           plotBands: [{
               from: 0,
               to: this.series[0].data[0]*0.4,
               color: '#dc272d'
               /*color:  '#DF5353'// green*/
           }, {
               from: this.series[0].data[0]*0.4,
               to: this.series[0].data[0]*0.7,
               color: '#f6a800'
              /* color: '#DDDF0D' // yellow*/
           }, {
               from: this.series[0].data[0]*0.7,
               to: this.series[0].data[0]*1.5,
               color:'#00758d'
               /*color: '#55BF3B' // red*/
           }]
        },
        series: this.series 
        
        // [{
        //     name: this.subtitle,
        //     data: [1500]
        // }]
      }
      return speedDefaultChart;



}







}