SOURCE

console 命令行工具 X clear

                    
>
console
<html>
    <body>
        <div id="chart" style="height:360px">
        </div>
    </body>
    <script>
        var myChart = echarts.init($("#chart")[0]);
        var data = [
  {
    station: 'L01-S1-AUTA01',
    eqpId: 'AutoTape000001',
    errorInfo:
      '2001-Loop_20/Axis_ErrorCode:IO检测超时-编号:2001//Timeout: 除尘02_PCB吸真空',
    duration: '0.22',
    times: '1',
    percentage: '0.00',
    errorCode: '2001',
    errorMessage:
      'Loop_20/Axis_ErrorCode:IO检测超时-编号:2001//Timeout: 除尘02_PCB吸真空'
  },
  {
    station: 'L01-S3-FLXP01',
    eqpId: 'Flux3',
    errorInfo: '0x12050101-Top safety door Error',
    duration: '1310.75',
    times: '1',
    percentage: '13.67',
    errorCode: '0x12050101',
    errorMessage: 'Top safety door Error'
  },
  {
    station: 'L01-S2-OP2501',
    eqpId: 'AOI000019',
    errorInfo: '29060.16-[W0755] L#1_Lane1 Please take out the PCB',
    duration: '32.98',
    times: '1',
    percentage: '0.34',
    errorCode: '29060.16',
    errorMessage: '[W0755] L#1_Lane1 Please take out the PCB'
  },
  {
    station: 'L01-S2-OP2501',
    eqpId: 'AOI000019',
    errorInfo: '29080.06-[A09B6] L#1_Lane1 bypass mode direction error.',
    duration: '0.20',
    times: '1',
    percentage: '0.00',
    errorCode: '29080.06',
    errorMessage: '[A09B6] L#1_Lane1 bypass mode direction error.'
  },
  {
    station: 'L01-S3-OP2501',
    eqpId: 'AOI000020',
    errorInfo: '29080.06-[A09B6] L#1_Lane1 bypass mode direction error.',
    duration: '1317.07',
    times: '1',
    percentage: '13.74',
    errorCode: '29080.06',
    errorMessage: '[A09B6] L#1_Lane1 bypass mode direction error.'
  },
  {
    station: 'L01-S1-LEDP02',
    eqpId: 'M88151',
    errorInfo: '16309-BTR ERR SKIPPED BOARD IN RUNOUT',
    duration: '12.28',
    times: '6',
    percentage: '0.13',
    errorCode: '16309',
    errorMessage: 'BTR ERR SKIPPED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S1-LEDP03',
    eqpId: 'M88147',
    errorInfo: '16309-BTR ERR SKIPPED BOARD IN RUNOUT',
    duration: '5.25',
    times: '6',
    percentage: '0.05',
    errorCode: '16309',
    errorMessage: 'BTR ERR SKIPPED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S2-LEDP01',
    eqpId: 'M88154',
    errorInfo: '16309-BTR ERR SKIPPED BOARD IN RUNOUT',
    duration: '3.11',
    times: '4',
    percentage: '0.03',
    errorCode: '16309',
    errorMessage: 'BTR ERR SKIPPED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S2-LEDP02',
    eqpId: 'M88153',
    errorInfo: '16309-BTR ERR SKIPPED BOARD IN RUNOUT',
    duration: '7.38',
    times: '5',
    percentage: '0.08',
    errorCode: '16309',
    errorMessage: 'BTR ERR SKIPPED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S2-LEDP03',
    eqpId: 'M88156',
    errorInfo: '16309-BTR ERR SKIPPED BOARD IN RUNOUT',
    duration: '34.04',
    times: '18',
    percentage: '0.36',
    errorCode: '16309',
    errorMessage: 'BTR ERR SKIPPED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S2-LEDP04',
    eqpId: 'M88155',
    errorInfo: '10007-SPPC ERR MEASUREFIDUCIAL ACTION FAILED',
    duration: '2.30',
    times: '9',
    percentage: '0.02',
    errorCode: '10007',
    errorMessage: 'SPPC ERR MEASUREFIDUCIAL ACTION FAILED'
  },
  {
    station: 'L01-S3-LEDP01',
    eqpId: 'M88209',
    errorInfo: '15011-null',
    duration: '1303.96',
    times: '2',
    percentage: '13.60',
    errorCode: '15011',
    errorMessage: 'null'
  },
  {
    station: 'L01-S3-LEDP01',
    eqpId: 'M88209',
    errorInfo: '10007-SPPC ERR MEASUREFIDUCIAL ACTION FAILED',
    duration: '32.34',
    times: '1',
    percentage: '0.34',
    errorCode: '10007',
    errorMessage: 'SPPC ERR MEASUREFIDUCIAL ACTION FAILED'
  },
  {
    station: 'L01-S3-LEDP01',
    eqpId: 'M88209',
    errorInfo: '15004-SIO ERR SGNL HOOD FRONT',
    duration: '0.37',
    times: '2',
    percentage: '0.00',
    errorCode: '15004',
    errorMessage: 'SIO ERR SGNL HOOD FRONT'
  },
  {
    station: 'L01-S3-LEDP01',
    eqpId: 'M88209',
    errorInfo: '15014-null',
    duration: '0.01',
    times: '2',
    percentage: '0.00',
    errorCode: '15014',
    errorMessage: 'null'
  },
  {
    station: 'L01-S3-LEDP01',
    eqpId: 'M88209',
    errorInfo: '11005-ROBOT ERR ROBOT DISABLED',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '11005',
    errorMessage: 'ROBOT ERR ROBOT DISABLED'
  },
  {
    station: 'L01-S3-LEDP01',
    eqpId: 'M88209',
    errorInfo: '10293-SPPC ERR MOVE TO SAFE POSITION FAILED',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '10293',
    errorMessage: 'SPPC ERR MOVE TO SAFE POSITION FAILED'
  },
  {
    station: 'L01-S3-LEDP01',
    eqpId: 'M88209',
    errorInfo: '15015-null',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '15015',
    errorMessage: 'null'
  },
  {
    station: 'L01-S3-LEDP02',
    eqpId: 'M88211',
    errorInfo: '10007-SPPC ERR MEASUREFIDUCIAL ACTION FAILED',
    duration: '2.76',
    times: '1',
    percentage: '0.03',
    errorCode: '10007',
    errorMessage: 'SPPC ERR MEASUREFIDUCIAL ACTION FAILED'
  },
  {
    station: 'L01-S3-LEDP02',
    eqpId: 'M88211',
    errorInfo: '12003-VISION ERR SIZE INSPECTION FAILED',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '12003',
    errorMessage: 'VISION ERR SIZE INSPECTION FAILED'
  },
  {
    station: 'L01-S3-LEDP02',
    eqpId: 'M88211',
    errorInfo: '10518-SPPC ERR MEASUREMENT ILLUMINATION TEACH',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '10518',
    errorMessage: 'SPPC ERR MEASUREMENT ILLUMINATION TEACH'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '16300-BTR ERR BOARD ERROR',
    duration: '1303.06',
    times: '28',
    percentage: '13.59',
    errorCode: '16300',
    errorMessage: 'BTR ERR BOARD ERROR'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '16313-BTR ERR ABORTED BOARD IN RUNOUT',
    duration: '2.40',
    times: '6',
    percentage: '0.03',
    errorCode: '16313',
    errorMessage: 'BTR ERR ABORTED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '10007-SPPC ERR MEASUREFIDUCIAL ACTION FAILED',
    duration: '1.60',
    times: '1',
    percentage: '0.02',
    errorCode: '10007',
    errorMessage: 'SPPC ERR MEASUREFIDUCIAL ACTION FAILED'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '15011-null',
    duration: '0.49',
    times: '4',
    percentage: '0.01',
    errorCode: '15011',
    errorMessage: 'null'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '15004-SIO ERR SGNL HOOD FRONT',
    duration: '0.17',
    times: '4',
    percentage: '0.00',
    errorCode: '15004',
    errorMessage: 'SIO ERR SGNL HOOD FRONT'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '16309-BTR ERR SKIPPED BOARD IN RUNOUT',
    duration: '0.15',
    times: '1',
    percentage: '0.00',
    errorCode: '16309',
    errorMessage: 'BTR ERR SKIPPED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '16307-BTR ERR SUSPECTED BOARD IN RUNOUT',
    duration: '0.04',
    times: '1',
    percentage: '0.00',
    errorCode: '16307',
    errorMessage: 'BTR ERR SUSPECTED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '10033-SPPC ERR MACHINE ERROR',
    duration: '0.03',
    times: '2',
    percentage: '0.00',
    errorCode: '10033',
    errorMessage: 'SPPC ERR MACHINE ERROR'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '10250-SPPC ERR PREPARE FAILED',
    duration: '0.01',
    times: '2',
    percentage: '0.00',
    errorCode: '10250',
    errorMessage: 'SPPC ERR PREPARE FAILED'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '9080-FEEDING ERR TROLLEY ACTIVATION FAILED',
    duration: '0.01',
    times: '2',
    percentage: '0.00',
    errorCode: '9080',
    errorMessage: 'FEEDING ERR TROLLEY ACTIVATION FAILED'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '15014-null',
    duration: '0.01',
    times: '4',
    percentage: '0.00',
    errorCode: '15014',
    errorMessage: 'null'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '16109-BTR ERR SECTION BOARD SLIP ERROR',
    duration: '0.00',
    times: '4',
    percentage: '0.00',
    errorCode: '16109',
    errorMessage: 'BTR ERR SECTION BOARD SLIP ERROR'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '12001-VISION ERR MEASURABLE NOT FOUND',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '12001',
    errorMessage: 'VISION ERR MEASURABLE NOT FOUND'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '9526-A3T WAIT TIMEOUT ENABLE AXIS Y ACTIVATE Y Z HOMED',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '9526',
    errorMessage: 'A3T WAIT TIMEOUT ENABLE AXIS Y ACTIVATE Y Z HOMED'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '9500-A3T GENERIC ERROR',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '9500',
    errorMessage: 'A3T GENERIC ERROR'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '15016-null',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '15016',
    errorMessage: 'null'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '9538-A3T Z MOVE BLOCKED CHECK PRECONDITIONS',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '9538',
    errorMessage: 'A3T Z MOVE BLOCKED CHECK PRECONDITIONS'
  },
  {
    station: 'L01-S3-LEDP03',
    eqpId: 'M88208',
    errorInfo: '16420-BTR ERR FIXATION SUBSTRATE VACUUM BUILDUP',
    duration: '0.00',
    times: '6',
    percentage: '0.00',
    errorCode: '16420',
    errorMessage: 'BTR ERR FIXATION SUBSTRATE VACUUM BUILDUP'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '16300-BTR ERR BOARD ERROR',
    duration: '1319.57',
    times: '14',
    percentage: '13.76',
    errorCode: '16300',
    errorMessage: 'BTR ERR BOARD ERROR'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '16307-BTR ERR SUSPECTED BOARD IN RUNOUT',
    duration: '7.86',
    times: '1',
    percentage: '0.08',
    errorCode: '16307',
    errorMessage: 'BTR ERR SUSPECTED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '10007-SPPC ERR MEASUREFIDUCIAL ACTION FAILED',
    duration: '4.63',
    times: '4',
    percentage: '0.05',
    errorCode: '10007',
    errorMessage: 'SPPC ERR MEASUREFIDUCIAL ACTION FAILED'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '15004-SIO ERR SGNL HOOD FRONT',
    duration: '0.32',
    times: '3',
    percentage: '0.00',
    errorCode: '15004',
    errorMessage: 'SIO ERR SGNL HOOD FRONT'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '10293-SPPC ERR MOVE TO SAFE POSITION FAILED',
    duration: '0.21',
    times: '2',
    percentage: '0.00',
    errorCode: '10293',
    errorMessage: 'SPPC ERR MOVE TO SAFE POSITION FAILED'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '16309-BTR ERR SKIPPED BOARD IN RUNOUT',
    duration: '0.15',
    times: '3',
    percentage: '0.00',
    errorCode: '16309',
    errorMessage: 'BTR ERR SKIPPED BOARD IN RUNOUT'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '10250-SPPC ERR PREPARE FAILED',
    duration: '0.07',
    times: '2',
    percentage: '0.00',
    errorCode: '10250',
    errorMessage: 'SPPC ERR PREPARE FAILED'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '12003-VISION ERR SIZE INSPECTION FAILED',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '12003',
    errorMessage: 'VISION ERR SIZE INSPECTION FAILED'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '10518-SPPC ERR MEASUREMENT ILLUMINATION TEACH',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '10518',
    errorMessage: 'SPPC ERR MEASUREMENT ILLUMINATION TEACH'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '12001-VISION ERR MEASURABLE NOT FOUND',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '12001',
    errorMessage: 'VISION ERR MEASURABLE NOT FOUND'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '16420-BTR ERR FIXATION SUBSTRATE VACUUM BUILDUP',
    duration: '0.00',
    times: '8',
    percentage: '0.00',
    errorCode: '16420',
    errorMessage: 'BTR ERR FIXATION SUBSTRATE VACUUM BUILDUP'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '16418-BTR ERR FIXATION CARRIER VACUUM BUILDUP',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '16418',
    errorMessage: 'BTR ERR FIXATION CARRIER VACUUM BUILDUP'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '11008-ROBOT ERR AXIS MOVEMENT FAILED',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '11008',
    errorMessage: 'ROBOT ERR AXIS MOVEMENT FAILED'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '16004-BTR ERR E STOP ACTIVATED',
    duration: '0.00',
    times: '2',
    percentage: '0.00',
    errorCode: '16004',
    errorMessage: 'BTR ERR E STOP ACTIVATED'
  },
  {
    station: 'L01-S3-LEDP04',
    eqpId: 'M88200',
    errorInfo: '9538-A3T Z MOVE BLOCKED CHECK PRECONDITIONS',
    duration: '0.00',
    times: '1',
    percentage: '0.00',
    errorCode: '9538',
    errorMessage: 'A3T Z MOVE BLOCKED CHECK PRECONDITIONS'
  },
  {
    station: 'L01-S1-EEPP01',
    eqpId: 'EEPnP000001',
    errorInfo: '50003-Skipped work instructions',
    duration: '1440.00',
    times: '1',
    percentage: '15.02',
    errorCode: '50003',
    errorMessage: 'Skipped work instructions'
  },
  {
    station: 'L01-S2-EEPP01',
    eqpId: 'EEPnP000002',
    errorInfo: '50003-Skipped work instructions',
    duration: '1440.00',
    times: '1',
    percentage: '15.02',
    errorCode: '50003',
    errorMessage: 'Skipped work instructions'
  },
  {
    station: 'L01-S1-REFL01',
    eqpId: 'Reflow000001',
    errorInfo:
      '9117.7100.0306.7851-传输轨道 1.感应PCB传感器.ISAL传感器_信号太长',
    duration: '0.13',
    times: '1',
    percentage: '0.00',
    errorCode: '9117.7100.0306.7851',
    errorMessage: '传输轨道 1.感应PCB传感器.ISAL传感器_信号太长'
  },
  {
    station: 'L01-S1-REFL02',
    eqpId: 'Reflow000002',
    errorInfo:
      '9117.7100.0306.7851-传输轨道 1.感应PCB传感器.ISAL传感器_信号太长',
    duration: '0.95',
    times: '1',
    percentage: '0.01',
    errorCode: '9117.7100.0306.7851',
    errorMessage: '传输轨道 1.感应PCB传感器.ISAL传感器_信号太长'
  },
  {
    station: 'L01-S3-OP4001',
    eqpId: 'AOI000006',
    errorInfo:
      '29080.26-[A09CB] L#1_Lane1 S1 SENSOR is abnormal. Please check SENSOR sensibility.',
    duration: '1.02',
    times: '2',
    percentage: '0.01',
    errorCode: '29080.26',
    errorMessage:
      '[A09CB] L#1_Lane1 S1 SENSOR is abnormal. Please check SENSOR sensibility.'
  },
  {
    station: 'L01-S3-OP4001',
    eqpId: 'AOI000006',
    errorInfo:
      '29081.02-[A09D2] L#1_Lane1 Support Pin error. Please check sensor and pneumatic cylinder.',
    duration: '0.52',
    times: '3',
    percentage: '0.01',
    errorCode: '29081.02',
    errorMessage:
      '[A09D2] L#1_Lane1 Support Pin error. Please check sensor and pneumatic cylinder.'
  },
  {
    station: 'L01-S3-OP4001',
    eqpId: 'AOI000006',
    errorInfo: '29060.16-[W0755] L#1_Lane1 Please take out the PCB',
    duration: '0.08',
    times: '1',
    percentage: '0.00',
    errorCode: '29060.16',
    errorMessage: '[W0755] L#1_Lane1 Please take out the PCB'
  }
];

function colorBg(index) {
  const colors = [
    '#4150d8',
    '#28bf7e',
    '#ed7c2f',
    '#f2a93b',
    '#f9cf36',
    '#4a5bdc',
    '#4cd698',
    '#f4914e',
    '#fcb75b',
    '#ffe180',
    '#b6c2ff',
    '#96edc1'
  ];
  return colors[index];
}

let xAxisData = [];
let map = new Map();
$(data).each((i, row) => {
  row['tag'] = row.station + '&' + row.errorCode;
  xAxisData.push(row.station);
  let count = map.get(row.station) || 0;
  map.set(row.station, count + 1);
});
console.log(xAxisData);
console.log(map);
var arr = [],
  arr1 = [],
  arr2 = [];

let data2 = [];
let baseObj = {
  data: [
    {
      name: '',
      value: 1
    }
  ],
  label: {
    show: true,
    animation:false,
    position: 'top',
    rotate: 90,
    formatter: '{b}',
    offset: [60, 10],
    textStyle: {
      color: '#666'
    }
  },
  type: 'bar',
  barGap: 0,
  barWidth: '',
  itemStyle: {
    color: '#ffff',
    opacity: 1,
    borderColor: '#ccc'
  },
  // animationEasing: 'bounceOut',
  zlevel: 2,
  xAxisIndex: 1,
  yAxisIndex: 1
};
var series = [{ type: 'bar', zlevel: 3 }];
map.forEach((index, key) => {
  let obj = $.extend(true, {}, baseObj);
  obj.data[0].name = key;
  obj.barWidth = (map.get(key) * 100) / data.length + '%';
  series.push(obj);
});

console.log(data2);
$(xAxisData).each((i, label) => {
  if (arr.indexOf(label) == -1) {
    arr.push(label);
    arr1.push(true);
  } else {
    arr1.push(false);
  }
});
console.log(arr, arr1);
option = {
  dataset: {
    source: data,
    dimensions: ['tag', 'percentage', 'times', 'duration']
  },
  dataZoom: {
    start: 0,
    end: 100
  },
  tooltip: {
    trigger: 'axis',
    formatter: function (params) {
      //console.log(params);
      let data = params[0].data;
      let marker =
        '<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${0};"></span>';
      let str =
        data.station +
        `</br>code:` +
        data.errorCode +
        `</br>${params[0].marker}percentage:` +
        data.percentage +
        `</br>${params[0].marker}times:` +
        data.times +
        `</br>${params[0].marker}duration:` +
        data.duration;
      return str;
    }
  },
  grid: [
    { top: 140, bottom: 80, left:100,containLabel: false },
    { top: 120, bottom: 80,left:100, containLabel: false, tooltip: { show: false } },
    { top: 0, bottom: 0,left:100, containLabel: false, tooltip: { show: false } ,show:true,borderColor:"red"}
  ],
  xAxis: [
    {
      type: 'category',
      axisLabel: {
        rotate: 90,
        formatter: function (param) {
          return param.split('&')[1];
        }
      },
      zlevel: 3
    },
    {
      gridIndex: 1,
      type: 'category',
      axisLine: { show: false },
      axisLabel: { show: false },
      axisTick: { show: false }
    }
  ],
  yAxis: [
    {
      name: 'duration',
      type: 'value',
      nameLocation: 'middle',
      nameTextStyle: {
        fontSize: 18,
        padding: [0, 0, 10, 0],
        color: '#000'
      },
      zlevel: 3
    },
    {
      gridIndex: 1,
      max: 1,
      min: 1,
      axisLabel: { show: false },
      axisLine: { show: false },
      splitLine: { show: false },
      axisTick: { show: false }
    }
  ],
  series: series
};

// dataZoom缩放事件
myChart.on('dataZoom', (params) => {
  const dataZoom = myChart.getModel().option.dataZoom[0];
  const { startValue, endValue } = dataZoom;
  let curXdata = data.slice(startValue, endValue + 1); // 缩放后的子级
  console.log('curXdata', curXdata);
  let curPdata = [...new Set(curXdata.map((item) => item.station))]; // 取出父级去重
  console.log('curPdata', curPdata);
  series.length = 1; //
  curPdata.forEach((item, index) => {
    let length = 0;
    curXdata.forEach((cItem) => {
      if (cItem.station === item) {
        length++;
      }
    });
    let pObj = JSON.parse(JSON.stringify(baseObj));
    pObj.data[0].name = item;
    pObj.barWidth = (length / curXdata.length) * 100 + '%';
    // pObj.itemStyle.color = colorBg(index);
    series.push(pObj);
  });
  myChart.setOption(
    {
      series
    },
    {
      replaceMerge: 'series' // 替换合并series,默认普通合并
    }
  );
});
console.log(option);

        myChart.setOption(option);
    </script>
</html>

本项目引用的自定义外部资源