hyperprop-charting-library 0.1.50 → 0.1.51
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 +11 -4
- package/dist/hyperprop-charting-library.d.ts +1 -0
- package/dist/hyperprop-charting-library.js +11 -4
- package/dist/index.cjs +11 -4
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11 -4
- package/docs/API.md +2 -0
- package/docs/RECIPES.md +12 -0
- package/package.json +1 -1
|
@@ -98,6 +98,7 @@ var DEFAULT_LABELS_OPTIONS = {
|
|
|
98
98
|
askPrice: Number.NaN,
|
|
99
99
|
showIndicatorNames: false,
|
|
100
100
|
showIndicatorValues: false,
|
|
101
|
+
showIndicatorValueLabels: true,
|
|
101
102
|
indicatorLegendPosition: "top-left",
|
|
102
103
|
indicatorLegendOffsetX: 10,
|
|
103
104
|
indicatorLegendOffsetY: 10,
|
|
@@ -629,9 +630,9 @@ var drawSeparateSeries = (ctx, renderContext, values, color, width, minOverride,
|
|
|
629
630
|
{
|
|
630
631
|
value: latestValue,
|
|
631
632
|
text: formatValue(latestValue),
|
|
632
|
-
color,
|
|
633
|
-
backgroundColor: color,
|
|
634
|
-
textColor: "#0f172a"
|
|
633
|
+
color: options.valueLabelColor ?? color,
|
|
634
|
+
backgroundColor: options.valueLabelBackgroundColor ?? options.valueLabelColor ?? color,
|
|
635
|
+
textColor: options.valueLabelTextColor ?? "#0f172a"
|
|
635
636
|
}
|
|
636
637
|
];
|
|
637
638
|
}
|
|
@@ -850,7 +851,10 @@ var BUILTIN_RSI_INDICATOR = {
|
|
|
850
851
|
{
|
|
851
852
|
title: `RSI ${length}`,
|
|
852
853
|
axisTicks: [0, 30, 50, 70, 100],
|
|
853
|
-
decimals: 2
|
|
854
|
+
decimals: 2,
|
|
855
|
+
valueLabelColor: "#9E9E9E",
|
|
856
|
+
valueLabelBackgroundColor: "#9E9E9E",
|
|
857
|
+
valueLabelTextColor: "#0f172a"
|
|
854
858
|
}
|
|
855
859
|
);
|
|
856
860
|
}
|
|
@@ -2243,6 +2247,9 @@ function createChart(element, options = {}) {
|
|
|
2243
2247
|
drawText(legendParts.join(" "), chartLeft + 10, paneTop + 8, "left", "top", labels.indicatorTextColor);
|
|
2244
2248
|
}
|
|
2245
2249
|
for (const label of paneInfo.valueLabels ?? []) {
|
|
2250
|
+
if (!labels.showIndicatorValueLabels) {
|
|
2251
|
+
continue;
|
|
2252
|
+
}
|
|
2246
2253
|
if (!Number.isFinite(label.value) || label.value < axisInfo.min || label.value > axisInfo.max) {
|
|
2247
2254
|
continue;
|
|
2248
2255
|
}
|
|
@@ -315,6 +315,7 @@ interface LabelsOptions {
|
|
|
315
315
|
askPrice?: number;
|
|
316
316
|
showIndicatorNames?: boolean;
|
|
317
317
|
showIndicatorValues?: boolean;
|
|
318
|
+
showIndicatorValueLabels?: boolean;
|
|
318
319
|
indicatorLegendPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
319
320
|
indicatorLegendOffsetX?: number;
|
|
320
321
|
indicatorLegendOffsetY?: number;
|
|
@@ -74,6 +74,7 @@ var DEFAULT_LABELS_OPTIONS = {
|
|
|
74
74
|
askPrice: Number.NaN,
|
|
75
75
|
showIndicatorNames: false,
|
|
76
76
|
showIndicatorValues: false,
|
|
77
|
+
showIndicatorValueLabels: true,
|
|
77
78
|
indicatorLegendPosition: "top-left",
|
|
78
79
|
indicatorLegendOffsetX: 10,
|
|
79
80
|
indicatorLegendOffsetY: 10,
|
|
@@ -605,9 +606,9 @@ var drawSeparateSeries = (ctx, renderContext, values, color, width, minOverride,
|
|
|
605
606
|
{
|
|
606
607
|
value: latestValue,
|
|
607
608
|
text: formatValue(latestValue),
|
|
608
|
-
color,
|
|
609
|
-
backgroundColor: color,
|
|
610
|
-
textColor: "#0f172a"
|
|
609
|
+
color: options.valueLabelColor ?? color,
|
|
610
|
+
backgroundColor: options.valueLabelBackgroundColor ?? options.valueLabelColor ?? color,
|
|
611
|
+
textColor: options.valueLabelTextColor ?? "#0f172a"
|
|
611
612
|
}
|
|
612
613
|
];
|
|
613
614
|
}
|
|
@@ -826,7 +827,10 @@ var BUILTIN_RSI_INDICATOR = {
|
|
|
826
827
|
{
|
|
827
828
|
title: `RSI ${length}`,
|
|
828
829
|
axisTicks: [0, 30, 50, 70, 100],
|
|
829
|
-
decimals: 2
|
|
830
|
+
decimals: 2,
|
|
831
|
+
valueLabelColor: "#9E9E9E",
|
|
832
|
+
valueLabelBackgroundColor: "#9E9E9E",
|
|
833
|
+
valueLabelTextColor: "#0f172a"
|
|
830
834
|
}
|
|
831
835
|
);
|
|
832
836
|
}
|
|
@@ -2219,6 +2223,9 @@ function createChart(element, options = {}) {
|
|
|
2219
2223
|
drawText(legendParts.join(" "), chartLeft + 10, paneTop + 8, "left", "top", labels.indicatorTextColor);
|
|
2220
2224
|
}
|
|
2221
2225
|
for (const label of paneInfo.valueLabels ?? []) {
|
|
2226
|
+
if (!labels.showIndicatorValueLabels) {
|
|
2227
|
+
continue;
|
|
2228
|
+
}
|
|
2222
2229
|
if (!Number.isFinite(label.value) || label.value < axisInfo.min || label.value > axisInfo.max) {
|
|
2223
2230
|
continue;
|
|
2224
2231
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -98,6 +98,7 @@ var DEFAULT_LABELS_OPTIONS = {
|
|
|
98
98
|
askPrice: Number.NaN,
|
|
99
99
|
showIndicatorNames: false,
|
|
100
100
|
showIndicatorValues: false,
|
|
101
|
+
showIndicatorValueLabels: true,
|
|
101
102
|
indicatorLegendPosition: "top-left",
|
|
102
103
|
indicatorLegendOffsetX: 10,
|
|
103
104
|
indicatorLegendOffsetY: 10,
|
|
@@ -629,9 +630,9 @@ var drawSeparateSeries = (ctx, renderContext, values, color, width, minOverride,
|
|
|
629
630
|
{
|
|
630
631
|
value: latestValue,
|
|
631
632
|
text: formatValue(latestValue),
|
|
632
|
-
color,
|
|
633
|
-
backgroundColor: color,
|
|
634
|
-
textColor: "#0f172a"
|
|
633
|
+
color: options.valueLabelColor ?? color,
|
|
634
|
+
backgroundColor: options.valueLabelBackgroundColor ?? options.valueLabelColor ?? color,
|
|
635
|
+
textColor: options.valueLabelTextColor ?? "#0f172a"
|
|
635
636
|
}
|
|
636
637
|
];
|
|
637
638
|
}
|
|
@@ -850,7 +851,10 @@ var BUILTIN_RSI_INDICATOR = {
|
|
|
850
851
|
{
|
|
851
852
|
title: `RSI ${length}`,
|
|
852
853
|
axisTicks: [0, 30, 50, 70, 100],
|
|
853
|
-
decimals: 2
|
|
854
|
+
decimals: 2,
|
|
855
|
+
valueLabelColor: "#9E9E9E",
|
|
856
|
+
valueLabelBackgroundColor: "#9E9E9E",
|
|
857
|
+
valueLabelTextColor: "#0f172a"
|
|
854
858
|
}
|
|
855
859
|
);
|
|
856
860
|
}
|
|
@@ -2243,6 +2247,9 @@ function createChart(element, options = {}) {
|
|
|
2243
2247
|
drawText(legendParts.join(" "), chartLeft + 10, paneTop + 8, "left", "top", labels.indicatorTextColor);
|
|
2244
2248
|
}
|
|
2245
2249
|
for (const label of paneInfo.valueLabels ?? []) {
|
|
2250
|
+
if (!labels.showIndicatorValueLabels) {
|
|
2251
|
+
continue;
|
|
2252
|
+
}
|
|
2246
2253
|
if (!Number.isFinite(label.value) || label.value < axisInfo.min || label.value > axisInfo.max) {
|
|
2247
2254
|
continue;
|
|
2248
2255
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -315,6 +315,7 @@ interface LabelsOptions {
|
|
|
315
315
|
askPrice?: number;
|
|
316
316
|
showIndicatorNames?: boolean;
|
|
317
317
|
showIndicatorValues?: boolean;
|
|
318
|
+
showIndicatorValueLabels?: boolean;
|
|
318
319
|
indicatorLegendPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
319
320
|
indicatorLegendOffsetX?: number;
|
|
320
321
|
indicatorLegendOffsetY?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -315,6 +315,7 @@ interface LabelsOptions {
|
|
|
315
315
|
askPrice?: number;
|
|
316
316
|
showIndicatorNames?: boolean;
|
|
317
317
|
showIndicatorValues?: boolean;
|
|
318
|
+
showIndicatorValueLabels?: boolean;
|
|
318
319
|
indicatorLegendPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
319
320
|
indicatorLegendOffsetX?: number;
|
|
320
321
|
indicatorLegendOffsetY?: number;
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,7 @@ var DEFAULT_LABELS_OPTIONS = {
|
|
|
74
74
|
askPrice: Number.NaN,
|
|
75
75
|
showIndicatorNames: false,
|
|
76
76
|
showIndicatorValues: false,
|
|
77
|
+
showIndicatorValueLabels: true,
|
|
77
78
|
indicatorLegendPosition: "top-left",
|
|
78
79
|
indicatorLegendOffsetX: 10,
|
|
79
80
|
indicatorLegendOffsetY: 10,
|
|
@@ -605,9 +606,9 @@ var drawSeparateSeries = (ctx, renderContext, values, color, width, minOverride,
|
|
|
605
606
|
{
|
|
606
607
|
value: latestValue,
|
|
607
608
|
text: formatValue(latestValue),
|
|
608
|
-
color,
|
|
609
|
-
backgroundColor: color,
|
|
610
|
-
textColor: "#0f172a"
|
|
609
|
+
color: options.valueLabelColor ?? color,
|
|
610
|
+
backgroundColor: options.valueLabelBackgroundColor ?? options.valueLabelColor ?? color,
|
|
611
|
+
textColor: options.valueLabelTextColor ?? "#0f172a"
|
|
611
612
|
}
|
|
612
613
|
];
|
|
613
614
|
}
|
|
@@ -826,7 +827,10 @@ var BUILTIN_RSI_INDICATOR = {
|
|
|
826
827
|
{
|
|
827
828
|
title: `RSI ${length}`,
|
|
828
829
|
axisTicks: [0, 30, 50, 70, 100],
|
|
829
|
-
decimals: 2
|
|
830
|
+
decimals: 2,
|
|
831
|
+
valueLabelColor: "#9E9E9E",
|
|
832
|
+
valueLabelBackgroundColor: "#9E9E9E",
|
|
833
|
+
valueLabelTextColor: "#0f172a"
|
|
830
834
|
}
|
|
831
835
|
);
|
|
832
836
|
}
|
|
@@ -2219,6 +2223,9 @@ function createChart(element, options = {}) {
|
|
|
2219
2223
|
drawText(legendParts.join(" "), chartLeft + 10, paneTop + 8, "left", "top", labels.indicatorTextColor);
|
|
2220
2224
|
}
|
|
2221
2225
|
for (const label of paneInfo.valueLabels ?? []) {
|
|
2226
|
+
if (!labels.showIndicatorValueLabels) {
|
|
2227
|
+
continue;
|
|
2228
|
+
}
|
|
2222
2229
|
if (!Number.isFinite(label.value) || label.value < axisInfo.min || label.value > axisInfo.max) {
|
|
2223
2230
|
continue;
|
|
2224
2231
|
}
|
package/docs/API.md
CHANGED
|
@@ -171,6 +171,7 @@ TradingView-style labels can be controlled from a single top-level object:
|
|
|
171
171
|
- `bidPrice`, `askPrice` (optional market data values for bid/ask labels)
|
|
172
172
|
- `showIndicatorNames` (default `false`; draws active indicator names in the chart)
|
|
173
173
|
- `showIndicatorValues` (default `false`; appends simple indicator input values)
|
|
174
|
+
- `showIndicatorValueLabels` (default `true`; controls separate-pane right-side indicator value tags, such as RSI's latest-value label)
|
|
174
175
|
- `indicatorLegendPosition` (`"top-left" | "top-right" | "bottom-left" | "bottom-right"`, default `"top-left"`)
|
|
175
176
|
- `indicatorLegendOffsetX` (default `10`)
|
|
176
177
|
- `indicatorLegendOffsetY` (default `10`; increase this if your frontend overlays a symbol/OHLC HUD in the top-left)
|
|
@@ -193,6 +194,7 @@ createChart(root, {
|
|
|
193
194
|
askPrice: 5235.0,
|
|
194
195
|
showIndicatorNames: true,
|
|
195
196
|
showIndicatorValues: true,
|
|
197
|
+
showIndicatorValueLabels: true,
|
|
196
198
|
indicatorLegendPosition: "top-left",
|
|
197
199
|
indicatorLegendOffsetY: 34,
|
|
198
200
|
showCountdownToBarClose: true,
|
package/docs/RECIPES.md
CHANGED
|
@@ -174,6 +174,18 @@ chart.updateOptions({
|
|
|
174
174
|
});
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
## Hide separate-pane indicator value tags
|
|
178
|
+
|
|
179
|
+
RSI and other separate-pane indicators can draw a latest-value tag on the right axis. Hide those tags while keeping the pane scale and legend:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
chart.updateOptions({
|
|
183
|
+
labels: {
|
|
184
|
+
showIndicatorValueLabels: false
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
177
189
|
## Prevent one volume spike from crushing all bars
|
|
178
190
|
|
|
179
191
|
```ts
|