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

Changing colorIndex doesn't update styles if called through Point#update #8791

Closed
DiegoCardoso opened this Issue Aug 16, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@DiegoCardoso

DiegoCardoso commented Aug 16, 2018

This is probably a follow-up to #6660

Expected behaviour

I want to reproduce the Solid Gauge demo for styled mode, but using colorIndex instead of yAxis.stops.
So, when I call point.update({colorIndex: newIndex, y: newVal}), I want both color and value to be updated.

(I know that I could set stops and use a non styled colorIndex, like 99 to reproduce it, but I don't know if it's hacky or the proper way of doing that for styled mode)

Actual behaviour

Only value is updated and color keeps the same as before.

Live demo with steps to reproduce

https://jsfiddle.net/hvcw9p02/

Product version

Tested with lastest HC version (6.1.1)

Affected browser(s)

Tested on Chrome

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Aug 16, 2018

Contributor

Hi @DiegoCardoso

Thank you for reporting this issue. It's a bug, colorIndex is not updated, even though it should be. colorIndex defines highcharts-color-colorIndex class. Workaround is to manually change this class after update: https://jsfiddle.net/BlackLabel/hvcw9p02/3/

Snippet:

  const point = chartSpeed.series[0].points[0];
  point.update({
    y: 120,
    colorIndex: 8
  });
  point.colorIndex = 8;
  point.graphic.addClass('highcharts-color-8');
  point.graphic.removeClass('highcharts-color-3');

If you don't need an animation, you can destroy previous graphic element: https://jsfiddle.net/BlackLabel/hvcw9p02/6/

  const point = chartSpeed.series[0].points[0];
  point.graphic = point.graphic.destroy();
  point.update({
    y: 120,
    colorIndex: 8
  });
Contributor

pawelfus commented Aug 16, 2018

Hi @DiegoCardoso

Thank you for reporting this issue. It's a bug, colorIndex is not updated, even though it should be. colorIndex defines highcharts-color-colorIndex class. Workaround is to manually change this class after update: https://jsfiddle.net/BlackLabel/hvcw9p02/3/

Snippet:

  const point = chartSpeed.series[0].points[0];
  point.update({
    y: 120,
    colorIndex: 8
  });
  point.colorIndex = 8;
  point.graphic.addClass('highcharts-color-8');
  point.graphic.removeClass('highcharts-color-3');

If you don't need an animation, you can destroy previous graphic element: https://jsfiddle.net/BlackLabel/hvcw9p02/6/

  const point = chartSpeed.series[0].points[0];
  point.graphic = point.graphic.destroy();
  point.update({
    y: 120,
    colorIndex: 8
  });

@pawelfus pawelfus added the Bug label Aug 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment