hyperprop-charting-library 0.1.15 → 0.1.16
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.
- package/dist/hyperprop-charting-library.cjs +12 -4
- package/dist/hyperprop-charting-library.js +12 -4
- package/dist/index.cjs +12 -4
- package/dist/index.js +12 -4
- package/package.json +1 -1
|
@@ -842,10 +842,18 @@ function createChart(element, options = {}) {
|
|
|
842
842
|
const endIndex = Math.min(data.length - 1, Math.ceil(xEnd) - 1);
|
|
843
843
|
const visibleData = data.slice(startIndex, endIndex + 1);
|
|
844
844
|
let priceSource = visibleData.length > 0 ? visibleData : data;
|
|
845
|
-
if (mergedOptions.autoScaleIgnoreLatestCandle &&
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
845
|
+
if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1) {
|
|
846
|
+
const latestIndex = data.length - 1;
|
|
847
|
+
const filtered = priceSource.filter((_, offset) => startIndex + offset !== latestIndex);
|
|
848
|
+
if (filtered.length > 0) {
|
|
849
|
+
priceSource = filtered;
|
|
850
|
+
} else {
|
|
851
|
+
const fallbackWindow = 120;
|
|
852
|
+
const fallbackStart = Math.max(0, latestIndex - fallbackWindow);
|
|
853
|
+
const fallback = data.slice(fallbackStart, latestIndex);
|
|
854
|
+
if (fallback.length > 0) {
|
|
855
|
+
priceSource = fallback;
|
|
856
|
+
}
|
|
849
857
|
}
|
|
850
858
|
}
|
|
851
859
|
const minPrice = Math.min(...priceSource.map((point) => point.l));
|
|
@@ -818,10 +818,18 @@ function createChart(element, options = {}) {
|
|
|
818
818
|
const endIndex = Math.min(data.length - 1, Math.ceil(xEnd) - 1);
|
|
819
819
|
const visibleData = data.slice(startIndex, endIndex + 1);
|
|
820
820
|
let priceSource = visibleData.length > 0 ? visibleData : data;
|
|
821
|
-
if (mergedOptions.autoScaleIgnoreLatestCandle &&
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
821
|
+
if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1) {
|
|
822
|
+
const latestIndex = data.length - 1;
|
|
823
|
+
const filtered = priceSource.filter((_, offset) => startIndex + offset !== latestIndex);
|
|
824
|
+
if (filtered.length > 0) {
|
|
825
|
+
priceSource = filtered;
|
|
826
|
+
} else {
|
|
827
|
+
const fallbackWindow = 120;
|
|
828
|
+
const fallbackStart = Math.max(0, latestIndex - fallbackWindow);
|
|
829
|
+
const fallback = data.slice(fallbackStart, latestIndex);
|
|
830
|
+
if (fallback.length > 0) {
|
|
831
|
+
priceSource = fallback;
|
|
832
|
+
}
|
|
825
833
|
}
|
|
826
834
|
}
|
|
827
835
|
const minPrice = Math.min(...priceSource.map((point) => point.l));
|
package/dist/index.cjs
CHANGED
|
@@ -842,10 +842,18 @@ function createChart(element, options = {}) {
|
|
|
842
842
|
const endIndex = Math.min(data.length - 1, Math.ceil(xEnd) - 1);
|
|
843
843
|
const visibleData = data.slice(startIndex, endIndex + 1);
|
|
844
844
|
let priceSource = visibleData.length > 0 ? visibleData : data;
|
|
845
|
-
if (mergedOptions.autoScaleIgnoreLatestCandle &&
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
845
|
+
if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1) {
|
|
846
|
+
const latestIndex = data.length - 1;
|
|
847
|
+
const filtered = priceSource.filter((_, offset) => startIndex + offset !== latestIndex);
|
|
848
|
+
if (filtered.length > 0) {
|
|
849
|
+
priceSource = filtered;
|
|
850
|
+
} else {
|
|
851
|
+
const fallbackWindow = 120;
|
|
852
|
+
const fallbackStart = Math.max(0, latestIndex - fallbackWindow);
|
|
853
|
+
const fallback = data.slice(fallbackStart, latestIndex);
|
|
854
|
+
if (fallback.length > 0) {
|
|
855
|
+
priceSource = fallback;
|
|
856
|
+
}
|
|
849
857
|
}
|
|
850
858
|
}
|
|
851
859
|
const minPrice = Math.min(...priceSource.map((point) => point.l));
|
package/dist/index.js
CHANGED
|
@@ -818,10 +818,18 @@ function createChart(element, options = {}) {
|
|
|
818
818
|
const endIndex = Math.min(data.length - 1, Math.ceil(xEnd) - 1);
|
|
819
819
|
const visibleData = data.slice(startIndex, endIndex + 1);
|
|
820
820
|
let priceSource = visibleData.length > 0 ? visibleData : data;
|
|
821
|
-
if (mergedOptions.autoScaleIgnoreLatestCandle &&
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
821
|
+
if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1) {
|
|
822
|
+
const latestIndex = data.length - 1;
|
|
823
|
+
const filtered = priceSource.filter((_, offset) => startIndex + offset !== latestIndex);
|
|
824
|
+
if (filtered.length > 0) {
|
|
825
|
+
priceSource = filtered;
|
|
826
|
+
} else {
|
|
827
|
+
const fallbackWindow = 120;
|
|
828
|
+
const fallbackStart = Math.max(0, latestIndex - fallbackWindow);
|
|
829
|
+
const fallback = data.slice(fallbackStart, latestIndex);
|
|
830
|
+
if (fallback.length > 0) {
|
|
831
|
+
priceSource = fallback;
|
|
832
|
+
}
|
|
825
833
|
}
|
|
826
834
|
}
|
|
827
835
|
const minPrice = Math.min(...priceSource.map((point) => point.l));
|