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

Incorrected calculate numeric scale #2970

Open
stakahito opened this issue Oct 2, 2020 · 6 comments
Open

Incorrected calculate numeric scale #2970

stakahito opened this issue Oct 2, 2020 · 6 comments
Labels

Comments

@stakahito
Copy link

stakahito commented Oct 2, 2020

Bug description

ValueAxis incorrectly calculates the numeric scale if it contains more than three stacked ColumnSeries.

const data = [{
  category: 'category',
  value1: 0,
  value2: 0,
  value3: 0,
}];

// Drawing chart with ValueAxis.min = 0 ...
// numeric scale is 0 ~ 1.0

// Update values.
data[0].value1 = 1;
data[0].value2 = 1;
data[0].value3 = 1;

// Transition to new values of existing data items.
chart.invalidateRawData(); // Oops, numeric scale is 0 - 2.5. expected numeric scale is 0 - (3~).

See jsfiddle https://jsfiddle.net/g23adn1t/ for more details.
(Click the "change" button.)

Environment

  • amCharts version
    4.10.4
  • Browser and its version
    • Google Chrome
      85.0.4183.121
    • Mozilla Firefox
      81.0.1
    • Microsoft Edge
      85.0.564.68
@martynasma martynasma added the bug label Oct 2, 2020
@martynasma
Copy link
Collaborator

While there's admittedly an issue, we might not be able to solve it soon. We might come back to this, but for now I suggest you do not use invalidateRawData() but rather replace the whole data set.

Should you need animations played on series, you can call chart.reinit().

@stakahito
Copy link
Author

Thank you for your suggestion.
For now I'm replacing the whole data set.

Should you need animations played on series, you can call chart.reinit().

Yes, I want animations, but chart.reinit() is animations from 0 value every time. 😢

When calculating the range, I think we need to add some logic around here to determine if the series is a stack.
I'll try to resolve this problem and make a pull request this weekend.

// check max
let seriesMax: number = series.max(this);
if ($type.isNumber(seriesMax) && (seriesMax > max)) {
max = seriesMax;
}

@martynasma
Copy link
Collaborator

I'll try to resolve this problem and make a pull request this weekend.

Thank you for the effort. Unfortunately, we do not accept PR due to a number of reasons :(

@stakahito
Copy link
Author

I understand, but I'm hoping that this issue will be resolved early, so is there any way I can contribute?

@martynasma
Copy link
Collaborator

If you manage to solve this, do a PR. While we won't be able to merge it (this repo is just for distribution, it's not actual dev repo), we might review what you did and whether it makes sense / is safe to include into main code base.

@stakahito
Copy link
Author

Sorry for the delayed response.

This issue was related to the part near the ValueAxis base and seemed to be difficult to solve.
I changed it to give up the animation and call chart.validateData() as a workaround.

I hope this problem will be resolved someday...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants