hyperprop-charting-library 0.1.118 → 0.1.119
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.
|
@@ -43,7 +43,10 @@ var DEFAULT_GRID_OPTIONS = {
|
|
|
43
43
|
verticalLines: true,
|
|
44
44
|
xTickCount: 8,
|
|
45
45
|
yTickCount: 6,
|
|
46
|
-
horizontalTickCount: 6
|
|
46
|
+
horizontalTickCount: 6,
|
|
47
|
+
sessionSeparators: false,
|
|
48
|
+
sessionSeparatorColor: "#3b4150",
|
|
49
|
+
sessionSeparatorOpacity: 0.55
|
|
47
50
|
};
|
|
48
51
|
var DEFAULT_AXIS_OPTIONS = {
|
|
49
52
|
lineColor: "#3b3f47",
|
|
@@ -2917,6 +2920,32 @@ function createChart(element, options = {}) {
|
|
|
2917
2920
|
}
|
|
2918
2921
|
ctx.restore();
|
|
2919
2922
|
}
|
|
2923
|
+
if (grid.sessionSeparators && data.length > 1) {
|
|
2924
|
+
const first = Math.max(1, startIndex);
|
|
2925
|
+
const barDeltaMs = data.length > 1 ? Math.abs(data[Math.min(first, data.length - 1)].time.getTime() - data[Math.min(first, data.length - 1) - 1].time.getTime()) : 0;
|
|
2926
|
+
if (barDeltaMs > 0 && barDeltaMs < 0.9 * 864e5) {
|
|
2927
|
+
const SESSION_ANCHOR_MS = 22 * 36e5;
|
|
2928
|
+
const sessionDayOf = (ms) => Math.floor((ms - SESSION_ANCHOR_MS) / 864e5);
|
|
2929
|
+
ctx.save();
|
|
2930
|
+
ctx.globalAlpha = clamp(grid.sessionSeparatorOpacity, 0, 1);
|
|
2931
|
+
ctx.strokeStyle = grid.sessionSeparatorColor;
|
|
2932
|
+
ctx.lineWidth = 1;
|
|
2933
|
+
for (let index = first; index <= endIndex; index += 1) {
|
|
2934
|
+
const point = data[index];
|
|
2935
|
+
const prev = data[index - 1];
|
|
2936
|
+
if (!point || !prev) continue;
|
|
2937
|
+
if (sessionDayOf(point.time.getTime()) === sessionDayOf(prev.time.getTime())) {
|
|
2938
|
+
continue;
|
|
2939
|
+
}
|
|
2940
|
+
const x = chartLeft + (index - xStart) / xSpan * chartWidth;
|
|
2941
|
+
ctx.beginPath();
|
|
2942
|
+
ctx.moveTo(crisp(x), crisp(chartTop));
|
|
2943
|
+
ctx.lineTo(crisp(x), crisp(fullChartBottom));
|
|
2944
|
+
ctx.stroke();
|
|
2945
|
+
}
|
|
2946
|
+
ctx.restore();
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2920
2949
|
const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
|
|
2921
2950
|
const useSmoothedCandle = tickerOpts.smoothing && smoothedTickerPrice !== null;
|
|
2922
2951
|
const lastDataIndex = data.length - 1;
|
|
@@ -215,6 +215,14 @@ interface GridOptions {
|
|
|
215
215
|
xTickCount?: number;
|
|
216
216
|
yTickCount?: number;
|
|
217
217
|
horizontalTickCount?: number;
|
|
218
|
+
/**
|
|
219
|
+
* Vertical separator at every trading-day boundary (a bar whose UTC
|
|
220
|
+
* calendar day differs from the previous bar's). Drawn stronger than the
|
|
221
|
+
* regular grid so intraday charts stay oriented while scrolling history.
|
|
222
|
+
*/
|
|
223
|
+
sessionSeparators?: boolean;
|
|
224
|
+
sessionSeparatorColor?: string;
|
|
225
|
+
sessionSeparatorOpacity?: number;
|
|
218
226
|
}
|
|
219
227
|
interface CrosshairOptions {
|
|
220
228
|
visible?: boolean;
|
|
@@ -17,7 +17,10 @@ var DEFAULT_GRID_OPTIONS = {
|
|
|
17
17
|
verticalLines: true,
|
|
18
18
|
xTickCount: 8,
|
|
19
19
|
yTickCount: 6,
|
|
20
|
-
horizontalTickCount: 6
|
|
20
|
+
horizontalTickCount: 6,
|
|
21
|
+
sessionSeparators: false,
|
|
22
|
+
sessionSeparatorColor: "#3b4150",
|
|
23
|
+
sessionSeparatorOpacity: 0.55
|
|
21
24
|
};
|
|
22
25
|
var DEFAULT_AXIS_OPTIONS = {
|
|
23
26
|
lineColor: "#3b3f47",
|
|
@@ -2891,6 +2894,32 @@ function createChart(element, options = {}) {
|
|
|
2891
2894
|
}
|
|
2892
2895
|
ctx.restore();
|
|
2893
2896
|
}
|
|
2897
|
+
if (grid.sessionSeparators && data.length > 1) {
|
|
2898
|
+
const first = Math.max(1, startIndex);
|
|
2899
|
+
const barDeltaMs = data.length > 1 ? Math.abs(data[Math.min(first, data.length - 1)].time.getTime() - data[Math.min(first, data.length - 1) - 1].time.getTime()) : 0;
|
|
2900
|
+
if (barDeltaMs > 0 && barDeltaMs < 0.9 * 864e5) {
|
|
2901
|
+
const SESSION_ANCHOR_MS = 22 * 36e5;
|
|
2902
|
+
const sessionDayOf = (ms) => Math.floor((ms - SESSION_ANCHOR_MS) / 864e5);
|
|
2903
|
+
ctx.save();
|
|
2904
|
+
ctx.globalAlpha = clamp(grid.sessionSeparatorOpacity, 0, 1);
|
|
2905
|
+
ctx.strokeStyle = grid.sessionSeparatorColor;
|
|
2906
|
+
ctx.lineWidth = 1;
|
|
2907
|
+
for (let index = first; index <= endIndex; index += 1) {
|
|
2908
|
+
const point = data[index];
|
|
2909
|
+
const prev = data[index - 1];
|
|
2910
|
+
if (!point || !prev) continue;
|
|
2911
|
+
if (sessionDayOf(point.time.getTime()) === sessionDayOf(prev.time.getTime())) {
|
|
2912
|
+
continue;
|
|
2913
|
+
}
|
|
2914
|
+
const x = chartLeft + (index - xStart) / xSpan * chartWidth;
|
|
2915
|
+
ctx.beginPath();
|
|
2916
|
+
ctx.moveTo(crisp(x), crisp(chartTop));
|
|
2917
|
+
ctx.lineTo(crisp(x), crisp(fullChartBottom));
|
|
2918
|
+
ctx.stroke();
|
|
2919
|
+
}
|
|
2920
|
+
ctx.restore();
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2894
2923
|
const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
|
|
2895
2924
|
const useSmoothedCandle = tickerOpts.smoothing && smoothedTickerPrice !== null;
|
|
2896
2925
|
const lastDataIndex = data.length - 1;
|
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,10 @@ var DEFAULT_GRID_OPTIONS = {
|
|
|
43
43
|
verticalLines: true,
|
|
44
44
|
xTickCount: 8,
|
|
45
45
|
yTickCount: 6,
|
|
46
|
-
horizontalTickCount: 6
|
|
46
|
+
horizontalTickCount: 6,
|
|
47
|
+
sessionSeparators: false,
|
|
48
|
+
sessionSeparatorColor: "#3b4150",
|
|
49
|
+
sessionSeparatorOpacity: 0.55
|
|
47
50
|
};
|
|
48
51
|
var DEFAULT_AXIS_OPTIONS = {
|
|
49
52
|
lineColor: "#3b3f47",
|
|
@@ -2917,6 +2920,32 @@ function createChart(element, options = {}) {
|
|
|
2917
2920
|
}
|
|
2918
2921
|
ctx.restore();
|
|
2919
2922
|
}
|
|
2923
|
+
if (grid.sessionSeparators && data.length > 1) {
|
|
2924
|
+
const first = Math.max(1, startIndex);
|
|
2925
|
+
const barDeltaMs = data.length > 1 ? Math.abs(data[Math.min(first, data.length - 1)].time.getTime() - data[Math.min(first, data.length - 1) - 1].time.getTime()) : 0;
|
|
2926
|
+
if (barDeltaMs > 0 && barDeltaMs < 0.9 * 864e5) {
|
|
2927
|
+
const SESSION_ANCHOR_MS = 22 * 36e5;
|
|
2928
|
+
const sessionDayOf = (ms) => Math.floor((ms - SESSION_ANCHOR_MS) / 864e5);
|
|
2929
|
+
ctx.save();
|
|
2930
|
+
ctx.globalAlpha = clamp(grid.sessionSeparatorOpacity, 0, 1);
|
|
2931
|
+
ctx.strokeStyle = grid.sessionSeparatorColor;
|
|
2932
|
+
ctx.lineWidth = 1;
|
|
2933
|
+
for (let index = first; index <= endIndex; index += 1) {
|
|
2934
|
+
const point = data[index];
|
|
2935
|
+
const prev = data[index - 1];
|
|
2936
|
+
if (!point || !prev) continue;
|
|
2937
|
+
if (sessionDayOf(point.time.getTime()) === sessionDayOf(prev.time.getTime())) {
|
|
2938
|
+
continue;
|
|
2939
|
+
}
|
|
2940
|
+
const x = chartLeft + (index - xStart) / xSpan * chartWidth;
|
|
2941
|
+
ctx.beginPath();
|
|
2942
|
+
ctx.moveTo(crisp(x), crisp(chartTop));
|
|
2943
|
+
ctx.lineTo(crisp(x), crisp(fullChartBottom));
|
|
2944
|
+
ctx.stroke();
|
|
2945
|
+
}
|
|
2946
|
+
ctx.restore();
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2920
2949
|
const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
|
|
2921
2950
|
const useSmoothedCandle = tickerOpts.smoothing && smoothedTickerPrice !== null;
|
|
2922
2951
|
const lastDataIndex = data.length - 1;
|
package/dist/index.d.cts
CHANGED
|
@@ -215,6 +215,14 @@ interface GridOptions {
|
|
|
215
215
|
xTickCount?: number;
|
|
216
216
|
yTickCount?: number;
|
|
217
217
|
horizontalTickCount?: number;
|
|
218
|
+
/**
|
|
219
|
+
* Vertical separator at every trading-day boundary (a bar whose UTC
|
|
220
|
+
* calendar day differs from the previous bar's). Drawn stronger than the
|
|
221
|
+
* regular grid so intraday charts stay oriented while scrolling history.
|
|
222
|
+
*/
|
|
223
|
+
sessionSeparators?: boolean;
|
|
224
|
+
sessionSeparatorColor?: string;
|
|
225
|
+
sessionSeparatorOpacity?: number;
|
|
218
226
|
}
|
|
219
227
|
interface CrosshairOptions {
|
|
220
228
|
visible?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -215,6 +215,14 @@ interface GridOptions {
|
|
|
215
215
|
xTickCount?: number;
|
|
216
216
|
yTickCount?: number;
|
|
217
217
|
horizontalTickCount?: number;
|
|
218
|
+
/**
|
|
219
|
+
* Vertical separator at every trading-day boundary (a bar whose UTC
|
|
220
|
+
* calendar day differs from the previous bar's). Drawn stronger than the
|
|
221
|
+
* regular grid so intraday charts stay oriented while scrolling history.
|
|
222
|
+
*/
|
|
223
|
+
sessionSeparators?: boolean;
|
|
224
|
+
sessionSeparatorColor?: string;
|
|
225
|
+
sessionSeparatorOpacity?: number;
|
|
218
226
|
}
|
|
219
227
|
interface CrosshairOptions {
|
|
220
228
|
visible?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,10 @@ var DEFAULT_GRID_OPTIONS = {
|
|
|
17
17
|
verticalLines: true,
|
|
18
18
|
xTickCount: 8,
|
|
19
19
|
yTickCount: 6,
|
|
20
|
-
horizontalTickCount: 6
|
|
20
|
+
horizontalTickCount: 6,
|
|
21
|
+
sessionSeparators: false,
|
|
22
|
+
sessionSeparatorColor: "#3b4150",
|
|
23
|
+
sessionSeparatorOpacity: 0.55
|
|
21
24
|
};
|
|
22
25
|
var DEFAULT_AXIS_OPTIONS = {
|
|
23
26
|
lineColor: "#3b3f47",
|
|
@@ -2891,6 +2894,32 @@ function createChart(element, options = {}) {
|
|
|
2891
2894
|
}
|
|
2892
2895
|
ctx.restore();
|
|
2893
2896
|
}
|
|
2897
|
+
if (grid.sessionSeparators && data.length > 1) {
|
|
2898
|
+
const first = Math.max(1, startIndex);
|
|
2899
|
+
const barDeltaMs = data.length > 1 ? Math.abs(data[Math.min(first, data.length - 1)].time.getTime() - data[Math.min(first, data.length - 1) - 1].time.getTime()) : 0;
|
|
2900
|
+
if (barDeltaMs > 0 && barDeltaMs < 0.9 * 864e5) {
|
|
2901
|
+
const SESSION_ANCHOR_MS = 22 * 36e5;
|
|
2902
|
+
const sessionDayOf = (ms) => Math.floor((ms - SESSION_ANCHOR_MS) / 864e5);
|
|
2903
|
+
ctx.save();
|
|
2904
|
+
ctx.globalAlpha = clamp(grid.sessionSeparatorOpacity, 0, 1);
|
|
2905
|
+
ctx.strokeStyle = grid.sessionSeparatorColor;
|
|
2906
|
+
ctx.lineWidth = 1;
|
|
2907
|
+
for (let index = first; index <= endIndex; index += 1) {
|
|
2908
|
+
const point = data[index];
|
|
2909
|
+
const prev = data[index - 1];
|
|
2910
|
+
if (!point || !prev) continue;
|
|
2911
|
+
if (sessionDayOf(point.time.getTime()) === sessionDayOf(prev.time.getTime())) {
|
|
2912
|
+
continue;
|
|
2913
|
+
}
|
|
2914
|
+
const x = chartLeft + (index - xStart) / xSpan * chartWidth;
|
|
2915
|
+
ctx.beginPath();
|
|
2916
|
+
ctx.moveTo(crisp(x), crisp(chartTop));
|
|
2917
|
+
ctx.lineTo(crisp(x), crisp(fullChartBottom));
|
|
2918
|
+
ctx.stroke();
|
|
2919
|
+
}
|
|
2920
|
+
ctx.restore();
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2894
2923
|
const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
|
|
2895
2924
|
const useSmoothedCandle = tickerOpts.smoothing && smoothedTickerPrice !== null;
|
|
2896
2925
|
const lastDataIndex = data.length - 1;
|