hyperprop-charting-library 0.1.4 → 0.1.5
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/index.cjs +3 -7
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -7
- package/docs/API.md +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -100,6 +100,7 @@ var DEFAULT_OPTIONS = {
|
|
|
100
100
|
backgroundColor: "#101114",
|
|
101
101
|
axisColor: "#7f8289",
|
|
102
102
|
axis: DEFAULT_AXIS_OPTIONS,
|
|
103
|
+
priceDecimals: 2,
|
|
103
104
|
upColor: "#2fb171",
|
|
104
105
|
downColor: "#d35a5a",
|
|
105
106
|
gridColor: "#252932",
|
|
@@ -266,13 +267,8 @@ function createChart(element, options = {}) {
|
|
|
266
267
|
return { min: nextMin, max: nextMax };
|
|
267
268
|
};
|
|
268
269
|
const formatPrice = (price) => {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
if (price >= 100) {
|
|
273
|
-
return price.toFixed(1);
|
|
274
|
-
}
|
|
275
|
-
return price.toFixed(2);
|
|
270
|
+
const decimals = clamp(Math.round(mergedOptions.priceDecimals), 0, 8);
|
|
271
|
+
return price.toFixed(decimals);
|
|
276
272
|
};
|
|
277
273
|
const parseData = (nextData) => {
|
|
278
274
|
return nextData.map((point) => ({
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ var DEFAULT_OPTIONS = {
|
|
|
76
76
|
backgroundColor: "#101114",
|
|
77
77
|
axisColor: "#7f8289",
|
|
78
78
|
axis: DEFAULT_AXIS_OPTIONS,
|
|
79
|
+
priceDecimals: 2,
|
|
79
80
|
upColor: "#2fb171",
|
|
80
81
|
downColor: "#d35a5a",
|
|
81
82
|
gridColor: "#252932",
|
|
@@ -242,13 +243,8 @@ function createChart(element, options = {}) {
|
|
|
242
243
|
return { min: nextMin, max: nextMax };
|
|
243
244
|
};
|
|
244
245
|
const formatPrice = (price) => {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
if (price >= 100) {
|
|
249
|
-
return price.toFixed(1);
|
|
250
|
-
}
|
|
251
|
-
return price.toFixed(2);
|
|
246
|
+
const decimals = clamp(Math.round(mergedOptions.priceDecimals), 0, 8);
|
|
247
|
+
return price.toFixed(decimals);
|
|
252
248
|
};
|
|
253
249
|
const parseData = (nextData) => {
|
|
254
250
|
return nextData.map((point) => ({
|
package/docs/API.md
CHANGED
|
@@ -32,6 +32,7 @@ Top-level options:
|
|
|
32
32
|
- `backgroundColor` (default `#ffffff`)
|
|
33
33
|
- `axisColor` (legacy shorthand for axis line/text color)
|
|
34
34
|
- `axis?: AxisOptions`
|
|
35
|
+
- `priceDecimals` (default `2`, used for axis/ticker/line price labels)
|
|
35
36
|
- `upColor` (default `#16a34a`)
|
|
36
37
|
- `downColor` (default `#dc2626`)
|
|
37
38
|
- `gridColor` (default `#e2e8f0`)
|