
import * as main from 'src/assets/highcharts/main.js';

export var pie = {
  tooltip: {
      pointFormat: '{series.name}: <b>{point.percentage:.2f}%</b>'
  },
  plotOptions: {
          series: {
              dataLabels: {
                  enabled: true,
                  formatter: function() {
                      return this.y + '%';
                  },
                  distance: 30,
                  color:'black'
              }
          }
  },
  series: [{
    name: 'Brands',
    colorByPoint: true,
    data: [{
        color: main.t,
        name: 'Equipo k',
        y: main.randomNumber(100,1),
        sliced: true,
        selected: true
    }, {
      color: main.g,
        name: 'Equipo L',
        y: main.randomNumber(100,1)
    }, {
      color: main.m,
        name: 'Equipo M',
        y: main.randomNumber(100,1)
    }, {
      color: main.y,
        name: 'Equipo N',
        y: main.randomNumber(100,1)
    }, {
      color: main.m,
        name: 'Equipo O',
        y: main.randomNumber(100,1)
    }, {
      color: main.c,
        name: 'Equipo P',
        y: main.randomNumber(100,1)
    }]
  }]
}

export var linecol = {

  tooltip: {
    shared: true,
    enabled: true,
    crosshairs: true
  },
  legend: {
    borderWidth: 2,
    borderRadius: 3
  },
  yAxis: [{
    title: {
      text: 'KUSD',
    },
    gridLineColor: '#8AB8E6',
    alternateGridColor: {
    linearGradient: {
    x1: 0, y1: 1,
    x2: 1, y2: 1
    },
    stops: [ [0, '#FAFCFF' ],
    [0.5, '#F5FAFF'] ,
    [0.8, '#E0F0FF'] ,
    [1, '#D6EBFF'] ]
    },
    min:0,
    max:2000
  }, {
    title: { text: 'KUSD' },
    min:0,
    max:5000,
    opposite: true
  }],
  xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec','YTD']
  },
  exporting: {
    enabled: false
  },
  credits: {
      enabled: false
  },
  series: [{
      color: main.t,
      type: 'spline',
      name: 'Real',
      data: main.randomData(12,1000,1),
      yAxis: 0
  }, {
      color: main.g,
      type: 'spline',
      name: 'Presupuesto',
      data: main.randomData(12,1000,700),
      yAxis: 0
  }, {
      yAxis: 1,
      type: 'column',
      pointStart: 12,
      color: main.p,
      name: 'Real YTD',
      dataLabels : {
        enabled: false
      },
      data: [
          [3604]
      ]
      },   {
        yAxis: 1,
        type: 'column',
        pointStart: 12,
        color: main.g,
        name: 'Presupuesto YTD',
        dataLabels : {
          enabled: false
        },
        data: [
            [4098]
        ]
      },    {
        yAxis: 1,
        type: 'column',
        pointStart: 12,
        color: main.c,
        name: 'Presupuesto anual',
        dataLabels : {
          enabled: false
        },
        data: [
            [2478]
        ]
      }
    ]
}

export var column = {
   // series: [{
  xAxis: {
    categories: ['A','B','C','D','E','F']
  },
  series: [{
      name: "Data 1",
      data: main.randomData(6,50,1,false),
      color: main.m
  }, {
      name: "Data 2",
      data: main.randomData(6,30,1,false),
      color: main.t
  }]
}

export var stack = {

  xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec','Acumulado']
  },
  yAxis: {
      min: 0,
      title: {
          text: '%'
      }
  },
  tooltip: {
      pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y:.2f}</b> ({point.percentage:.2f}%)<br/>',
      shared: true
  },
  plotOptions: {
      column: {
          stacking: 'percent'
      }
  },
  series: [{

      name: 'MP',
      data: main.randomData(12,15,1,false)
  }, {

      name: 'MC',
      data: main.randomData(12,15,1,false)
  }, {
      name: 'DCE',
      data: main.randomData(12,15,1,false)
  },
  {
      name: 'DDL',
      data: main.randomData(12,15,1,false)
  }]
}

export var gauge = {
  chart: {
    type: 'solidgauge'
  },

  title: null,

  pane: {
      center: ['50%', '85%'],
      size: '140%',
      startAngle: -90,
      endAngle: 90,
      background: {
          backgroundColor:  '#EEE',
          innerRadius: '60%',
          outerRadius: '100%',
          shape: 'arc'
      }
  },

  tooltip: {
      enabled: false
  },

  // the value axis
  yAxis: {
      stops: [
          [0.1, '#55BF3B'], // green
          [0.5, '#DDDF0D'], // yellow
          [0.9, '#DF5353'] // red
      ],
      lineWidth: 0,
      minorTickInterval: null,
      tickAmount: 2,
      title: {
          y: -70,
          text: 'Speed'
      },
      labels: {
          y: 16
      },
      min: 0,
      max: 100
  },

  plotOptions: {
      solidgauge: {
          dataLabels: {
              y: 5,
              borderWidth: 0,
              useHTML: true
          }
      }
  },

  credits: {
      enabled: false
  },

  series: [{
      name: 'Speed',
      data: [80],
      dataLabels: {
         format: '<div style="text-align:center"><span style="font-size:25px;color: black' +
                  '">{y}</span><br/>' +
                 '<span style="font-size:12px;color:silver">km/h</span></div>'
      },
      tooltip: {
          valueSuffix: ' km/h'
      }
  }]

}

export var waterfall = {
        chart: {
            type: 'waterfall'
        },
        xAxis: {
            type: 'category'
        },
        credits: false,
        yAxis: [{
            title: {
                text: '1'
            }
        }, {
            title: {
              text: '2'
            },
            opposite: true
        }],
        legend: {
            enabled: false
        },
        tooltip: {
            pointFormat: '<b>${point.y:.2f}</b> USD'
        },
        series: [{
            upColor: main.c,
            color: main.m,
            data: [{
                name: 'Mantenimiento Operaciones PPTO',
                color: main.g,
                y: 50
            }, {
                name: 'Insumos',
                y: 89
            }, {
                name: 'Materiales y repuestos',
                y: 36
            }, {
                name: 'Balance positivo',
                y: 65
            }, {
                name: 'PCC',
                y: 54
            }, {
                name: 'RR HH',
                y: 12
            }, {
                name: 'Secundarias',
                y: 23
            }, {
                name: 'Servicios de terceros',
                y: 123
            }, {
                name: 'Bono Neg. EE',
                y: 34
            }, {
                name: 'Mantenimiento Operaciones REAL',
                color: main.g,
                isSum: true
            }],
            dataLabels: {
                enabled: false, // SIN QUE MUESTRE DATOS
                style: {
                    fontWeight: 'bold'
                }
            },
            pointPadding: 0
          }]
}

export var gm_0_mtd_ytd = {
  chart: {
      height: 250
  },
  plotOptions: {
    column: {
      colorByPoint: true,
      zones: {
        value: 90
      }
    }
  },
  xAxis: {
      type: 'category',
      labels: {
          style: {
              fontSize: '10px',
              fontFamily: 'Verdana, sans-serif'
          }
      }
  },
  yAxis: {
    labels: {
        formatter: function() {
            return this.value+"%";
        }
      },
    min: 50,
    max: 100
  },
  plotOptions: {
    column: {

        grouping: false,
        shadow: false,
        borderWidth: 1
    }
  },
  legend: {
      enabled: false
  },
  tooltip: {
      pointFormat: '<b>{point.y:.2f}%</b>'
  },
  credits: {
      enabled: false
  }
}

export var gm_1 = {

  tooltip: {
    shared: true,
    enabled: true,
    crosshairs: true
  },
  legend: {
    borderWidth: 2,
    borderRadius: 3
  },
  xAxis: {
    categories: ['Ene','Feb','Mar','Abr','May','Acumulado']
  },
  yAxis: [{
    title: {
      text: '%',
    },
    gridLineColor: '#8AB8E6',
    alternateGridColor: {
    linearGradient: {
      x1: 0, y1: 1,
      x2: 1, y2: 1
    },
    stops: [ [0, '#FAFCFF' ],
    [0.5, '#F5FAFF'] ,
    [0.8, '#E0F0FF'] ,
    [1, '#D6EBFF'] ]
    },
    min:0,
    max:2000
  }, {
    title: { text: null },
    min:0,
    max:5000,
    opposite: true
  }],
  exporting: {
    enabled: false
  },
  credits: {
      enabled: false
  },
}

export var gc_0_mtd_ytd = {
  chart: {
      height: 250
  },
  plotOptions: {
    column: {
      colorByPoint: true,
      zones: {
        value: 90
      }
    }
  },
  xAxis: {
      type: 'category',
      labels: {
          style: {
              fontSize: '10px',
              fontFamily: 'Verdana, sans-serif'
          }
      }
  },
  yAxis: {
    labels: {
        formatter: function() {
            return this.value+"%";
        }
      },
    min: 50,
    max: 100
  },
  plotOptions: {
    column: {

        grouping: false,
        shadow: false,
        borderWidth: 1
    }
  },
  legend: {
      enabled: false
  },
  tooltip: {
      pointFormat: '<b>{point.y:.2f}%</b>'
  },
  credits: {
      enabled: false
  }
}
