Skip to content

[Bug] yAxis设置alignTicks: true,很可能出现数值精度问题 #18063

@SmileStabber

Description

@SmileStabber

Version

5.4.1

Link to Minimal Reproduction

No response

Steps to Reproduce

option = {
  tooltip: {
    trigger: 'axis',
    confine: true,
    enterable: true,
    extraCssText: 'max-height:70%;max-width:70%;overflow:auto;',
    transitionDuration: 0.4,
  },
  grid: { top: 32, left: 32, right: 32, bottom: 32, containLabel: true },
  series: [
    {
      nameProp: 'gbPDefaultRtnCumulative',
      name: 'a收益率(%)',
      type: 'line',
      stack: null,
      max: null,
      tooltipFormat: null,
      noHight: false,
      defaultSelect: null,
      lineHidden: null,
      dataNameProp: null,
      sortOrder: 1,
      seriesConfig: null,
      markLineConfig: null,
      yAxisIndex: 1,
      data: [
        '-1.08',
        '1.07',
        '-0.85',
        '-',
        '-',
        '-0.05',
        '1.75',
        '1.23',
        '0.92',
        '1.40',
        '-',
        '-',
        '1.36',
        '0.56',
        '1.61',
        '-1.33',
        '-1.04',
        '-',
        '-',
        '-',
        '-',
        '-0.33',
        '-0.81',
        '-1.08',
        '-',
        '-',
        '-3.04',
        '-2.41',
        '-4.37',
        '-2.73'
      ],
      connectNulls: true,
      symbol: 'circle',
      symbolSize: 2
    },
    {
      nameProp: 'gbBRtnCumulative',
      name: 'b收益率(%)',
      type: 'line',
      stack: null,
      max: null,
      tooltipFormat: null,
      noHight: false,
      defaultSelect: null,
      lineHidden: null,
      dataNameProp: null,
      sortOrder: 2,
      seriesConfig: null,
      markLineConfig: null,
      yAxisIndex: 1,
      data: [
        '1.33',
        '1.33',
        '0.78',
        '-',
        '-',
        '2.67',
        '3.90',
        '3.47',
        '3.42',
        '4.33',
        '-',
        '-',
        '3.87',
        '2.32',
        '1.28',
        '0.04',
        '1.05',
        '-',
        '-',
        '-',
        '-',
        '0.34',
        '0.99',
        '0.91',
        '-',
        '-',
        '1.49',
        '1.63',
        '0.59',
        '1.26'
      ],
      connectNulls: true,
      symbol: 'circle',
      symbolSize: 2
    },
    {
      nameProp: 'gbPTotalNav',
      name: 'a总净值(亿元)',
      type: 'line',
      stack: null,
      max: null,
      tooltipFormat: null,
      noHight: false,
      defaultSelect: null,
      lineHidden: null,
      dataNameProp: null,
      sortOrder: 3,
      seriesConfig: { area: true },
      markLineConfig: null,
      yAxisIndex: 0,
      data: [
        '0.48',
        '0.49',
        '0.49',
        '0.49',
        '0.49',
        '0.49',
        '0.60',
        '0.60',
        '0.59',
        '0.60',
        '0.60',
        '0.60',
        '0.60',
        '0.63',
        '0.64',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.62',
        '0.61',
        '0.61',
        '0.60',
        '0.61'
      ],
      connectNulls: true,
      symbol: 'none',
      symbolSize: 2,
      areaStyle: { opacity: 0.3 },
      lineStyle: { width: 0 }
    }
  ],
  title: { text: null },
  legend: {
    type: 'scroll',
    top: 'auto',
    bottom: 0,
    left: 'center',
    orient: 'horizontal',
    show: true,
    data: [
      'a收益率(%)',
      'b收益率(%)',
      { name: 'a总净值(亿元)', icon: 'roundRect' }
    ],
    textStyle: { lineHeight: 20 },
    selected: {}
  },
  xAxis: [
    {
      axisStyle: null,
      type: 'category',
      dataProps: 'endDate',
      name: null,
      data: [
        '2021-09-01',
        '2021-09-02',
        '2021-09-03',
        '2021-09-04',
        '2021-09-05',
        '2021-09-06',
        '2021-09-07',
        '2021-09-08',
        '2021-09-09',
        '2021-09-10',
        '2021-09-11',
        '2021-09-12',
        '2021-09-13',
        '2021-09-14',
        '2021-09-15',
        '2021-09-16',
        '2021-09-17',
        '2021-09-18',
        '2021-09-19',
        '2021-09-20',
        '2021-09-21',
        '2021-09-22',
        '2021-09-23',
        '2021-09-24',
        '2021-09-25',
        '2021-09-26',
        '2021-09-27',
        '2021-09-28',
        '2021-09-29',
        '2021-09-30'
      ]
    }
  ],
  yAxis: [
    {
      type: 'value',
      dataProps: null,
      name: 'a总净值(亿元)',
      alignTicks: true,
      scale: true,
      nameTextStyle: { align: 'center' }
    },
    {
      type: 'value',
      dataProps: null,
      name: '收益率(%)',

      scale: true,
      nameTextStyle: { align: 'center' }
    },
    
  ]
};

Current Behavior

image

Expected Behavior

不出现该问题

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    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