hyperprop-charting-library 0.1.29 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2669,7 +2669,6 @@ function createChart(element, options = {}) {
|
|
|
2669
2669
|
const previousCenterRounded = hadData ? Math.round(xCenter) : 0;
|
|
2670
2670
|
const previousCenterFraction = hadData ? xCenter - previousCenterRounded : 0;
|
|
2671
2671
|
const previousCenterTimeMs = hadData && previousCenterRounded >= 0 && previousCenterRounded < data.length ? data[previousCenterRounded]?.time.getTime() ?? null : null;
|
|
2672
|
-
const wasAtRightEdge = hadData && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2673
2672
|
data = parseData(nextData);
|
|
2674
2673
|
if (data.length === 0) {
|
|
2675
2674
|
xCenter = 0;
|
|
@@ -2683,6 +2682,8 @@ function createChart(element, options = {}) {
|
|
|
2683
2682
|
resetYViewport();
|
|
2684
2683
|
} else {
|
|
2685
2684
|
if (mergedOptions.preserveViewportOnDataUpdate) {
|
|
2685
|
+
const hasNewBars = data.length > previousCount;
|
|
2686
|
+
const wasAtRightEdge = hasNewBars && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2686
2687
|
if (wasAtRightEdge) {
|
|
2687
2688
|
xCenter = data.length - xSpan / 2 + rightEdgePaddingBars;
|
|
2688
2689
|
} else if (previousCenterTimeMs !== null) {
|
|
@@ -2645,7 +2645,6 @@ function createChart(element, options = {}) {
|
|
|
2645
2645
|
const previousCenterRounded = hadData ? Math.round(xCenter) : 0;
|
|
2646
2646
|
const previousCenterFraction = hadData ? xCenter - previousCenterRounded : 0;
|
|
2647
2647
|
const previousCenterTimeMs = hadData && previousCenterRounded >= 0 && previousCenterRounded < data.length ? data[previousCenterRounded]?.time.getTime() ?? null : null;
|
|
2648
|
-
const wasAtRightEdge = hadData && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2649
2648
|
data = parseData(nextData);
|
|
2650
2649
|
if (data.length === 0) {
|
|
2651
2650
|
xCenter = 0;
|
|
@@ -2659,6 +2658,8 @@ function createChart(element, options = {}) {
|
|
|
2659
2658
|
resetYViewport();
|
|
2660
2659
|
} else {
|
|
2661
2660
|
if (mergedOptions.preserveViewportOnDataUpdate) {
|
|
2661
|
+
const hasNewBars = data.length > previousCount;
|
|
2662
|
+
const wasAtRightEdge = hasNewBars && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2662
2663
|
if (wasAtRightEdge) {
|
|
2663
2664
|
xCenter = data.length - xSpan / 2 + rightEdgePaddingBars;
|
|
2664
2665
|
} else if (previousCenterTimeMs !== null) {
|
package/dist/index.cjs
CHANGED
|
@@ -2669,7 +2669,6 @@ function createChart(element, options = {}) {
|
|
|
2669
2669
|
const previousCenterRounded = hadData ? Math.round(xCenter) : 0;
|
|
2670
2670
|
const previousCenterFraction = hadData ? xCenter - previousCenterRounded : 0;
|
|
2671
2671
|
const previousCenterTimeMs = hadData && previousCenterRounded >= 0 && previousCenterRounded < data.length ? data[previousCenterRounded]?.time.getTime() ?? null : null;
|
|
2672
|
-
const wasAtRightEdge = hadData && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2673
2672
|
data = parseData(nextData);
|
|
2674
2673
|
if (data.length === 0) {
|
|
2675
2674
|
xCenter = 0;
|
|
@@ -2683,6 +2682,8 @@ function createChart(element, options = {}) {
|
|
|
2683
2682
|
resetYViewport();
|
|
2684
2683
|
} else {
|
|
2685
2684
|
if (mergedOptions.preserveViewportOnDataUpdate) {
|
|
2685
|
+
const hasNewBars = data.length > previousCount;
|
|
2686
|
+
const wasAtRightEdge = hasNewBars && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2686
2687
|
if (wasAtRightEdge) {
|
|
2687
2688
|
xCenter = data.length - xSpan / 2 + rightEdgePaddingBars;
|
|
2688
2689
|
} else if (previousCenterTimeMs !== null) {
|
package/dist/index.js
CHANGED
|
@@ -2645,7 +2645,6 @@ function createChart(element, options = {}) {
|
|
|
2645
2645
|
const previousCenterRounded = hadData ? Math.round(xCenter) : 0;
|
|
2646
2646
|
const previousCenterFraction = hadData ? xCenter - previousCenterRounded : 0;
|
|
2647
2647
|
const previousCenterTimeMs = hadData && previousCenterRounded >= 0 && previousCenterRounded < data.length ? data[previousCenterRounded]?.time.getTime() ?? null : null;
|
|
2648
|
-
const wasAtRightEdge = hadData && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2649
2648
|
data = parseData(nextData);
|
|
2650
2649
|
if (data.length === 0) {
|
|
2651
2650
|
xCenter = 0;
|
|
@@ -2659,6 +2658,8 @@ function createChart(element, options = {}) {
|
|
|
2659
2658
|
resetYViewport();
|
|
2660
2659
|
} else {
|
|
2661
2660
|
if (mergedOptions.preserveViewportOnDataUpdate) {
|
|
2661
|
+
const hasNewBars = data.length > previousCount;
|
|
2662
|
+
const wasAtRightEdge = hasNewBars && xCenter + xSpan / 2 >= previousCount - 1;
|
|
2662
2663
|
if (wasAtRightEdge) {
|
|
2663
2664
|
xCenter = data.length - xSpan / 2 + rightEdgePaddingBars;
|
|
2664
2665
|
} else if (previousCenterTimeMs !== null) {
|