hyperprop-charting-library 0.1.3 → 0.1.4
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 +23 -23
- package/dist/index.js +23 -23
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -24,15 +24,15 @@ __export(index_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
var DEFAULT_GRID_OPTIONS = {
|
|
27
|
-
color: "#
|
|
28
|
-
opacity: 0.
|
|
27
|
+
color: "#2b2f38",
|
|
28
|
+
opacity: 0.38,
|
|
29
29
|
horizontalLines: true,
|
|
30
30
|
verticalLines: true,
|
|
31
31
|
horizontalTickCount: 5
|
|
32
32
|
};
|
|
33
33
|
var DEFAULT_AXIS_OPTIONS = {
|
|
34
|
-
lineColor: "#
|
|
35
|
-
textColor: "#
|
|
34
|
+
lineColor: "#3b3f47",
|
|
35
|
+
textColor: "#a9adb6",
|
|
36
36
|
fontSize: 12,
|
|
37
37
|
lineWidth: 1
|
|
38
38
|
};
|
|
@@ -47,8 +47,8 @@ var DEFAULT_CROSSHAIR_OPTIONS = {
|
|
|
47
47
|
var DEFAULT_WATERMARK_OPTIONS = {
|
|
48
48
|
visible: false,
|
|
49
49
|
text: "",
|
|
50
|
-
color: "#
|
|
51
|
-
opacity: 0.
|
|
50
|
+
color: "#81858d",
|
|
51
|
+
opacity: 0.14,
|
|
52
52
|
fontSize: 92,
|
|
53
53
|
fontWeight: 700,
|
|
54
54
|
thickness: 0
|
|
@@ -57,9 +57,9 @@ var DEFAULT_PRICE_LINE_OPTIONS = {
|
|
|
57
57
|
visible: true,
|
|
58
58
|
style: "solid",
|
|
59
59
|
thickness: 1,
|
|
60
|
-
color: "#
|
|
61
|
-
labelBackgroundColor: "#
|
|
62
|
-
labelTextColor: "#
|
|
60
|
+
color: "#38bdf8",
|
|
61
|
+
labelBackgroundColor: "#0b1220",
|
|
62
|
+
labelTextColor: "#60a5fa",
|
|
63
63
|
labelBorderRadius: 3,
|
|
64
64
|
showLabel: true
|
|
65
65
|
};
|
|
@@ -68,9 +68,9 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
|
|
|
68
68
|
behavior: "static",
|
|
69
69
|
style: "solid",
|
|
70
70
|
thickness: 1,
|
|
71
|
-
color: "
|
|
72
|
-
labelBackgroundColor: "#
|
|
73
|
-
labelTextColor: "#
|
|
71
|
+
color: "rgba(59,130,246,0.8)",
|
|
72
|
+
labelBackgroundColor: "#0b1220",
|
|
73
|
+
labelTextColor: "#60a5fa",
|
|
74
74
|
labelBorderRadius: 3,
|
|
75
75
|
showCloseButton: true,
|
|
76
76
|
widgetPosition: "left",
|
|
@@ -97,12 +97,12 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
|
|
|
97
97
|
var DEFAULT_OPTIONS = {
|
|
98
98
|
width: 720,
|
|
99
99
|
height: 360,
|
|
100
|
-
backgroundColor: "#
|
|
101
|
-
axisColor: "#
|
|
100
|
+
backgroundColor: "#101114",
|
|
101
|
+
axisColor: "#7f8289",
|
|
102
102
|
axis: DEFAULT_AXIS_OPTIONS,
|
|
103
|
-
upColor: "#
|
|
104
|
-
downColor: "#
|
|
105
|
-
gridColor: "#
|
|
103
|
+
upColor: "#2fb171",
|
|
104
|
+
downColor: "#d35a5a",
|
|
105
|
+
gridColor: "#252932",
|
|
106
106
|
fontFamily: "Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
|
|
107
107
|
candleBodyWidthRatio: 0.7,
|
|
108
108
|
candleMinWidth: 0.5,
|
|
@@ -118,12 +118,12 @@ var DEFAULT_OPTIONS = {
|
|
|
118
118
|
orderLines: [],
|
|
119
119
|
tickerLine: {
|
|
120
120
|
visible: true,
|
|
121
|
-
style: "
|
|
121
|
+
style: "dotted",
|
|
122
122
|
thickness: 1,
|
|
123
|
-
color: "#
|
|
124
|
-
labelBackgroundColor: "#
|
|
123
|
+
color: "#38bdf8",
|
|
124
|
+
labelBackgroundColor: "#38bdf8",
|
|
125
125
|
labelTextColor: "#0b1220",
|
|
126
|
-
labelBorderRadius:
|
|
126
|
+
labelBorderRadius: 3
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
function createChart(element, options = {}) {
|
|
@@ -389,7 +389,7 @@ function createChart(element, options = {}) {
|
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
391
|
const lineY = clamp(yFromPrice(renderPrice), chartTop + 1, chartBottom - 1);
|
|
392
|
-
const color =
|
|
392
|
+
const color = line.color ?? (mergedLine.type === "takeProfit" ? "rgba(45,212,191,0.86)" : mergedLine.type === "stop" ? "rgba(245,158,11,0.86)" : "rgba(59,130,246,0.8)");
|
|
393
393
|
if (Number.isFinite(mergedLine.fillToPrice)) {
|
|
394
394
|
const fillY = clamp(yFromPrice(mergedLine.fillToPrice), chartTop + 1, chartBottom - 1);
|
|
395
395
|
const topY = Math.min(lineY, fillY);
|
|
@@ -500,7 +500,7 @@ function createChart(element, options = {}) {
|
|
|
500
500
|
const borderRadius = Math.max(0, mergedLine.labelBorderRadius);
|
|
501
501
|
const widgetBackground = mergedOptions.backgroundColor;
|
|
502
502
|
const widgetBorder = color;
|
|
503
|
-
const textColor = mergedLine.labelTextColor;
|
|
503
|
+
const textColor = line.labelTextColor ?? (mergedLine.type === "takeProfit" ? "#5eead4" : mergedLine.type === "stop" ? "#fbbf24" : mergedLine.labelTextColor);
|
|
504
504
|
const mainWidgetX = leftWidgetX + actionButtonsTotalWidth + actionButtonsGap;
|
|
505
505
|
ctx.fillStyle = widgetBackground;
|
|
506
506
|
fillRoundedRect(Math.round(mainWidgetX), Math.round(labelY), mainWidgetWidth, labelHeight, borderRadius);
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var DEFAULT_GRID_OPTIONS = {
|
|
3
|
-
color: "#
|
|
4
|
-
opacity: 0.
|
|
3
|
+
color: "#2b2f38",
|
|
4
|
+
opacity: 0.38,
|
|
5
5
|
horizontalLines: true,
|
|
6
6
|
verticalLines: true,
|
|
7
7
|
horizontalTickCount: 5
|
|
8
8
|
};
|
|
9
9
|
var DEFAULT_AXIS_OPTIONS = {
|
|
10
|
-
lineColor: "#
|
|
11
|
-
textColor: "#
|
|
10
|
+
lineColor: "#3b3f47",
|
|
11
|
+
textColor: "#a9adb6",
|
|
12
12
|
fontSize: 12,
|
|
13
13
|
lineWidth: 1
|
|
14
14
|
};
|
|
@@ -23,8 +23,8 @@ var DEFAULT_CROSSHAIR_OPTIONS = {
|
|
|
23
23
|
var DEFAULT_WATERMARK_OPTIONS = {
|
|
24
24
|
visible: false,
|
|
25
25
|
text: "",
|
|
26
|
-
color: "#
|
|
27
|
-
opacity: 0.
|
|
26
|
+
color: "#81858d",
|
|
27
|
+
opacity: 0.14,
|
|
28
28
|
fontSize: 92,
|
|
29
29
|
fontWeight: 700,
|
|
30
30
|
thickness: 0
|
|
@@ -33,9 +33,9 @@ var DEFAULT_PRICE_LINE_OPTIONS = {
|
|
|
33
33
|
visible: true,
|
|
34
34
|
style: "solid",
|
|
35
35
|
thickness: 1,
|
|
36
|
-
color: "#
|
|
37
|
-
labelBackgroundColor: "#
|
|
38
|
-
labelTextColor: "#
|
|
36
|
+
color: "#38bdf8",
|
|
37
|
+
labelBackgroundColor: "#0b1220",
|
|
38
|
+
labelTextColor: "#60a5fa",
|
|
39
39
|
labelBorderRadius: 3,
|
|
40
40
|
showLabel: true
|
|
41
41
|
};
|
|
@@ -44,9 +44,9 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
|
|
|
44
44
|
behavior: "static",
|
|
45
45
|
style: "solid",
|
|
46
46
|
thickness: 1,
|
|
47
|
-
color: "
|
|
48
|
-
labelBackgroundColor: "#
|
|
49
|
-
labelTextColor: "#
|
|
47
|
+
color: "rgba(59,130,246,0.8)",
|
|
48
|
+
labelBackgroundColor: "#0b1220",
|
|
49
|
+
labelTextColor: "#60a5fa",
|
|
50
50
|
labelBorderRadius: 3,
|
|
51
51
|
showCloseButton: true,
|
|
52
52
|
widgetPosition: "left",
|
|
@@ -73,12 +73,12 @@ var DEFAULT_ORDER_LINE_OPTIONS = {
|
|
|
73
73
|
var DEFAULT_OPTIONS = {
|
|
74
74
|
width: 720,
|
|
75
75
|
height: 360,
|
|
76
|
-
backgroundColor: "#
|
|
77
|
-
axisColor: "#
|
|
76
|
+
backgroundColor: "#101114",
|
|
77
|
+
axisColor: "#7f8289",
|
|
78
78
|
axis: DEFAULT_AXIS_OPTIONS,
|
|
79
|
-
upColor: "#
|
|
80
|
-
downColor: "#
|
|
81
|
-
gridColor: "#
|
|
79
|
+
upColor: "#2fb171",
|
|
80
|
+
downColor: "#d35a5a",
|
|
81
|
+
gridColor: "#252932",
|
|
82
82
|
fontFamily: "Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
|
|
83
83
|
candleBodyWidthRatio: 0.7,
|
|
84
84
|
candleMinWidth: 0.5,
|
|
@@ -94,12 +94,12 @@ var DEFAULT_OPTIONS = {
|
|
|
94
94
|
orderLines: [],
|
|
95
95
|
tickerLine: {
|
|
96
96
|
visible: true,
|
|
97
|
-
style: "
|
|
97
|
+
style: "dotted",
|
|
98
98
|
thickness: 1,
|
|
99
|
-
color: "#
|
|
100
|
-
labelBackgroundColor: "#
|
|
99
|
+
color: "#38bdf8",
|
|
100
|
+
labelBackgroundColor: "#38bdf8",
|
|
101
101
|
labelTextColor: "#0b1220",
|
|
102
|
-
labelBorderRadius:
|
|
102
|
+
labelBorderRadius: 3
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
function createChart(element, options = {}) {
|
|
@@ -365,7 +365,7 @@ function createChart(element, options = {}) {
|
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
367
|
const lineY = clamp(yFromPrice(renderPrice), chartTop + 1, chartBottom - 1);
|
|
368
|
-
const color =
|
|
368
|
+
const color = line.color ?? (mergedLine.type === "takeProfit" ? "rgba(45,212,191,0.86)" : mergedLine.type === "stop" ? "rgba(245,158,11,0.86)" : "rgba(59,130,246,0.8)");
|
|
369
369
|
if (Number.isFinite(mergedLine.fillToPrice)) {
|
|
370
370
|
const fillY = clamp(yFromPrice(mergedLine.fillToPrice), chartTop + 1, chartBottom - 1);
|
|
371
371
|
const topY = Math.min(lineY, fillY);
|
|
@@ -476,7 +476,7 @@ function createChart(element, options = {}) {
|
|
|
476
476
|
const borderRadius = Math.max(0, mergedLine.labelBorderRadius);
|
|
477
477
|
const widgetBackground = mergedOptions.backgroundColor;
|
|
478
478
|
const widgetBorder = color;
|
|
479
|
-
const textColor = mergedLine.labelTextColor;
|
|
479
|
+
const textColor = line.labelTextColor ?? (mergedLine.type === "takeProfit" ? "#5eead4" : mergedLine.type === "stop" ? "#fbbf24" : mergedLine.labelTextColor);
|
|
480
480
|
const mainWidgetX = leftWidgetX + actionButtonsTotalWidth + actionButtonsGap;
|
|
481
481
|
ctx.fillStyle = widgetBackground;
|
|
482
482
|
fillRoundedRect(Math.round(mainWidgetX), Math.round(labelY), mainWidgetWidth, labelHeight, borderRadius);
|