quanyawei
2024-03-14 6343fe4c609b57002d84b83b502899d63dd53727
src/components/Echarts/LineChartSpe.vue
@@ -70,13 +70,16 @@
    initChart () {
      this.chart = echarts.init(this.$el, 'macarons')
      this.chart.clear()
      this.setOptions(this.chartData)
      // this.setOptions(this.chartData)
    },
    setOptions (val) {
      console.log('val,val', val)
      // val.series.forEach(element => {
      //   element.data = element.data.map(item => item === 0 ? 0.1 : item)
      // })
      if (this.chart) {
        this.chart.clear()
      }
      let that = this
      function fontSize (res) {
        let clientWidth =
@@ -152,30 +155,9 @@
              color: 'rgb(255, 255, 255);',
              fontSize: fontSize(0.117), // 字体大小
              lineHeight: 0
            },
            formatter: function (params) {
              console.log('params', params)
              let html = params[0].name
              params.forEach((item, index) => {
                html += (`<br/>${item.marker + item.seriesName}: ${item.value === undefined ? 0 : item.value}`)
              })
              return html
            }
          },
          yAxis: {
            type: 'log',
            axisTick: {
              show: true, // 轴线刻度
            },
            axisLine: {
              show: true, // 不显示坐标轴线
            },
            // axisLabel: {
            //   formatter: function (value) {
            //     return value === 0.1 ? 0 : value
            //   }
            // },
          },
          yAxis: val.yAxis,
          legend: {
            data: val.title,
            tooltip: {