Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaxis labels duplicated with a formatter function #4422

Open
tmac12 opened this issue Apr 22, 2024 · 0 comments
Open

yaxis labels duplicated with a formatter function #4422

tmac12 opened this issue Apr 22, 2024 · 0 comments

Comments

@tmac12
Copy link

tmac12 commented Apr 22, 2024

Description

When yaxis.labels.formatter is provided, in some case it duplicate values on yaxis.
In my example, I receive y-axis data in seconds and need to display it on the chart in hours, so I use a formatter for this conversion. However, this results in some integer values being duplicated.

Steps to Reproduce

  1. codepen link
  chart: {
    height: 380,
    width: "100%",
    type: "bar"
  },
  series: [
    {
      name: 'Incoming',
      data: [
        {
          x: '0-3200 rpm',
          y: 15417,
        },
        {
          x: '3200-6400 rpm',
          y: 1498,
        },
        {
          x: '6400-9600 rpm',
          y: 19038,
        },
        {
          x: '9600-12800 rpm',
          y: 19119,
        },
      ],
    }
  ],
  yaxis:{
    labels:{
      formatter: function(value){
        //console.log(value);
        var d = value;
        var dd = d / 3600;
        var rnd = Math.round(dd);
        return rnd.toString() + ' h';
      }
    }
  }
}

Expected Behavior

The formatter show only unique values on yaxis.

Actual Behavior

On yaxis I see duplicated values only if formatter function is provided.

Screenshots

image

Reproduction Link

https://codepen.io/bortolazzoBreton/pen/qBwLajb

@tmac12 tmac12 added the bug Something isn't working label Apr 22, 2024
@junedchhipa junedchhipa removed the bug Something isn't working label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants