Skip to content

双折线图的图标上面的折线图数值不正确 #16233

@xiaohh-me

Description

@xiaohh-me

Version

5.2.1

Link to Minimal Reproduction

No response

Steps to Reproduce

1.创建echarts:
image
2.bug截图(上面那一串数字与Y轴的数值对应不上):
image

Current Behavior

创建echarts的代码:

recordApi.getMonthRecordStatistics(this.monthRecordStatistics).then(res => {
        const data = res.data
        if (data.code === 200) {
          if (data.total > 0) {
            this.hasMonthStatistics = true
          } else {
            this.hasMonthStatistics = false
            return
          }
          let dates = []
          let spendings = []
          let incomes = []
          for (let i = 0; i < data.rows.length; i++) {
            const monthCalc = data.rows[i]
            dates.push(monthCalc.year + '-' + monthCalc.month)
            spendings.push(monthCalc.spending)
            incomes.push(monthCalc.income)
          }
          this.monthStatistics.setOption({
            title: {
              text: '月支出收入统计'
            },
            xAxis: {
              data: dates
            },
            yAxis: {},
            series: [
              {
                data: spendings,
                type: 'line',
                stack: 'x',
                areaStyle: {},
                label: {
                  show: true
                }
              },
              {
                data: incomes,
                type: 'line',
                stack: 'x',
                areaStyle: {},
                label: {
                  show: true
                }
              }
            ]
          })
        } else {
          this.$message.error(data.message)
          this.hasMonthStatistics = false
        }
      })

服务器返回的数据的示例(顶部的res):

{"total":2,"rows":[{"monthStatisticsId":1,"userId":1,"year":2021,"month":10,"spending":"1694.38","income":"11915.97","createTime":"2021-11-01T09:00:00"},{"monthStatisticsId":2,"userId":1,"year":2021,"month":11,"spending":"3448.61","income":"12087.58","createTime":"2021-12-01T01:00:00"}],"code":200,"message":"查询成功"}

Expected Behavior

希望显示的图表上面的数字与Y轴坐标上的数字保持一致

Environment

- OS:服务器:Linux7.9+nginx1.20.1,客户端:Windows10
- Browser:chrome
- Framework:vue2+elementui+echarts

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions