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

Panning after loading data while zoomed breaks zoom level #3422

Closed
ebencollins opened this issue Sep 12, 2023 · 5 comments
Closed

Panning after loading data while zoomed breaks zoom level #3422

ebencollins opened this issue Sep 12, 2023 · 5 comments
Labels

Comments

@ebencollins
Copy link
Contributor

Description

When zoom is enabled, appending new data to the chart while zoomed causes an unexpected zoom increase after panning.

Steps to check or reproduce

  1. Zoom in with wheel zoom (either via API or manually)
  2. Append new data with chart.load
  3. Pan chart left/right
  4. Observe the zoom level is significantly increased, despite no further zoom input

https://stackblitz.com/edit/y1jre1-jkmebv?file=index.ts

import 'billboard.js/dist/billboard.css';
import bb from 'billboard.js';

var chart = bb.generate({
    data: {
        columns: [
            [
                'sample', 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 150, 250, 150, 200, 170, 240, 100, 150, 250, 150, 200, 170, 240, 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 350, 220, 250, 300, 270, 140, 150, 90, 150, 50, 120, 70, 40,],
        ],
        type: 'line',
    },
    zoom: {
        enabled: true,
    },
    bindto: '#zoom',
});

setTimeout(function () {
    console.log('zoom');
    chart.zoom([30, 40]);
}, 1000);

setTimeout(function () {
    console.log('load');
    chart.load({
        columns: [['sample', 130, 150, 200, 300, 200, 100]],
        append: true,
    });
}, 2000);
@netil netil added the bug label Sep 13, 2023
@ebencollins
Copy link
Contributor Author

Possibly related: the same thing seems to happen after toggling a legend while zoomed.

  1. Zoom in
  2. Toggle a legend off and on
  3. Pan or zoom-in one wheel tick

import 'billboard.js/dist/billboard.css';
import bb from 'billboard.js';

var chart = bb.generate({
    data: {
        columns: [
            [
                'sample', 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 150, 250, 150, 200, 170, 240, 100, 150, 250, 150, 200, 170, 240, 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 350, 220, 250, 300, 270, 140, 150, 90, 150, 50, 120, 70, 40,],
        ],
        type: 'line',
    },
    zoom: {
        enabled: true,
    },
    bindto: '#zoom',
});

setTimeout(() => {
  chart.zoom([30, 40]);
}, 1000);

setTimeout(() => {
  chart.hide('sample');
}, 2000);

setTimeout(() => {
  chart.show('sample');
}, 3000);

@kisyov21
Copy link

@netil did you have the chance to look into it? In our team, we are also facing the described issue and it is affecting our users.
image

I saw in the past same issue was resolved for older versions but it looks like now is back..

@netil
Copy link
Member

netil commented Dec 13, 2023

@kisyov21, will try prioritize on this.

netil pushed a commit to netil/billboard.js that referenced this issue Dec 18, 2023
Fix dynamic data loading when zoom-in state,
to keep currrent zoom-in state and update scale according new
data range

Ref naver#3422
netil pushed a commit to netil/billboard.js that referenced this issue Dec 18, 2023
Fix dynamic data loading when zoom-in state,
to keep current zoom-in state and update scale according new
data range

Ref naver#3422
netil pushed a commit to netil/billboard.js that referenced this issue Dec 19, 2023
Fix dynamic data loading when zoom-in state,
to keep current zoom-in state and update scale according new
data range

Ref naver#3422
@netil netil closed this as completed in 967207b Dec 19, 2023
@kisyov21
Copy link

@netil looks like you resolved it, thank you! However when should I expect the new version of the package with the fix?

github-actions bot pushed a commit that referenced this issue Jan 19, 2024
# [3.11.0-next.1](3.10.3...3.11.0-next.1) (2024-01-19)

### Bug Fixes

* **api:** Fix to return indexed categories ([55c17c6](55c17c6)), closes [#3365](#3365)
* **Axis:** Correct x axis height calculation for autorotated x axis tick texts ([d5b5d09](d5b5d09)), closes [#3584](#3584) [#3585](#3585)
* **axis:** Fixed x axis tick texts rotation when legend is positioned right ([ed4703e](ed4703e)), closes [#3570](#3570) [#3571](#3571)
* **bar:** Fix stacking bar position on multiple xs ([216da62](216da62)), closes [#3372](#3372)
* **candlestick:** Fix rendering on rotated axis ([17f5058](17f5058)), closes [#3387](#3387)
* **clip:** Fix x axis hide on title.bottom ([beec1bb](beec1bb)), closes [#3364](#3364)
* **option:** Fix inconsistency of padding ([0c1ce81](0c1ce81)), closes [#3426](#3426)
* **packages:** Fix build error with moduleResolution:bundler ([9c17eea](9c17eea)), closes [#3541](#3541)
* **radar:** Fix axes texts exclusion on resize ([3a814a5](3a814a5)), closes [#3126](#3126)
* **shape:** Fix circleY() undefined error ([f4ac3f1](f4ac3f1)), closes [#3388](#3388)
* **subchart, zoom:** Fix returning domain value ([90338ec](90338ec)), closes [#3347](#3347)
* **subchart:** Fix handlebar position ([b897cbb](b897cbb)), closes [#3358](#3358)
* **title:** fix title text center align ([b254a61](b254a61)), closes [#3363](#3363)
* **tooltip:** Fix tooltip position from interference ([9d28cbb](9d28cbb)), closes [#3575](#3575)
* **tooltip:** Fix tooltip.format.value call ([f7d587d](f7d587d)), closes [#3371](#3371)
* **tooltip:** Fix tootip display on tooltip.init ([98e6f8b](98e6f8b)), closes [#3369](#3369)
* **tooltip:** Fix wrong tooltip selection on browser scroll change ([#3593](#3593)) ([8f80637](8f80637)), closes [#3592](#3592)
* **zoom:** Fix zoom state on data load ([967207b](967207b)), closes [#3422](#3422)

### Features

* **api:** Intent to ship subchart method ([976f04a](976f04a)), closes [#3342](#3342)
* **axis:** Add x.tick.text.inner option ([cfc856c](cfc856c)), closes [#3552](#3552)
* **legend:** Itent to ship legend.format, legend.tooltip ([aecff2f](aecff2f)), closes [#3533](#3533)
* **module:** Support dual CJS/ESM package ([437c007](437c007)), closes [#2202](#2202)
* **plugin:** Intent to ship TableView plugin ([215b611](215b611)), closes [#1873](#1873)
* **regions:** Intent to ship regions.label ([b4e3bc2](b4e3bc2)), closes [#3319](#3319)
@netil
Copy link
Member

netil commented Feb 14, 2024

@kisyov21, will out within this month.

github-actions bot pushed a commit that referenced this issue Feb 15, 2024
# [3.11.0](3.10.3...3.11.0) (2024-02-15)

### Bug Fixes

* **Axis:** Correct x axis height calculation for autorotated x axis tick texts ([d5b5d09](d5b5d09)), closes [#3584](#3584) [#3585](#3585)
* **axis:** Fix x Axis tick height calculation ([ac26f11](ac26f11)), closes [#3643](#3643)
* **axis:** Fixed x axis tick texts rotation when legend is positioned right ([ed4703e](ed4703e)), closes [#3570](#3570) [#3571](#3571)
* **packages:** Fix build error with moduleResolution:bundler ([9c17eea](9c17eea)), closes [#3541](#3541)
* **radar:** Fix axes texts exclusion on resize ([3a814a5](3a814a5)), closes [#3126](#3126)
* **regions:** Fix applying regions class ([7e4fa71](7e4fa71)), closes [#3611](#3611)
* **tooltip:** Fix tooltip position from interference ([9d28cbb](9d28cbb)), closes [#3575](#3575)
* **tooltip:** Fix wrong tooltip selection on browser scroll change ([#3593](#3593)) ([8f80637](8f80637)), closes [#3592](#3592)
* **zoom:** Fix zoom state on data load ([967207b](967207b)), closes [#3422](#3422)

### Features

* **arc:** Intent to ship arc.rangeText ([e887baf](e887baf)), closes [#2120](#2120)
* **axis:** Add x.tick.text.inner option ([cfc856c](cfc856c)), closes [#3552](#3552)
* **gauge:** Intent to ship gauge.enforceMinMax ([c277201](c277201)), closes [#2125](#2125)
* **gauge:** Intent to ship gauge.label.ratio ([d4e49ba](d4e49ba)), closes [#3633](#3633)
* **legend:** Itent to ship legend.format, legend.tooltip ([aecff2f](aecff2f)), closes [#3533](#3533)
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

3 participants