@hpcc-js/chart 3.7.4 → 3.7.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/LICENSE +43 -43
- package/README.md +93 -93
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +5 -5
- package/src/Area.md +176 -176
- package/src/Area.ts +12 -12
- package/src/Axis.css +35 -35
- package/src/Axis.ts +781 -781
- package/src/Bar.md +90 -90
- package/src/Bar.ts +9 -9
- package/src/Bubble.css +16 -16
- package/src/Bubble.md +69 -69
- package/src/Bubble.ts +196 -196
- package/src/BubbleXY.ts +14 -14
- package/src/Bullet.css +59 -59
- package/src/Bullet.md +104 -104
- package/src/Bullet.ts +176 -176
- package/src/Column.css +44 -44
- package/src/Column.md +90 -90
- package/src/Column.ts +684 -684
- package/src/Contour.md +88 -88
- package/src/Contour.ts +97 -97
- package/src/D3Cloud.ts +403 -403
- package/src/Gantt.md +119 -119
- package/src/Gantt.ts +14 -14
- package/src/Gauge.md +148 -148
- package/src/Gauge.ts +368 -368
- package/src/HalfPie.md +62 -62
- package/src/HalfPie.ts +26 -26
- package/src/Heat.md +42 -42
- package/src/Heat.ts +283 -283
- package/src/HexBin.css +8 -8
- package/src/HexBin.md +88 -88
- package/src/HexBin.ts +144 -144
- package/src/Line.css +4 -4
- package/src/Line.md +170 -170
- package/src/Line.ts +14 -14
- package/src/Pie.css +50 -50
- package/src/Pie.md +88 -88
- package/src/Pie.ts +546 -546
- package/src/QuarterPie.md +61 -61
- package/src/QuarterPie.ts +35 -35
- package/src/QuartileCandlestick.md +129 -129
- package/src/QuartileCandlestick.ts +349 -349
- package/src/Radar.css +14 -14
- package/src/Radar.md +104 -104
- package/src/Radar.ts +336 -336
- package/src/RadialBar.css +25 -25
- package/src/RadialBar.md +91 -91
- package/src/RadialBar.ts +217 -217
- package/src/Scatter.css +42 -42
- package/src/Scatter.md +163 -163
- package/src/Scatter.ts +412 -412
- package/src/StatChart.md +117 -117
- package/src/StatChart.ts +261 -261
- package/src/Step.md +163 -163
- package/src/Step.ts +12 -12
- package/src/Summary.css +55 -55
- package/src/Summary.md +219 -219
- package/src/Summary.ts +322 -322
- package/src/SummaryC.md +154 -154
- package/src/SummaryC.ts +240 -240
- package/src/WordCloud.css +2 -2
- package/src/WordCloud.md +144 -144
- package/src/WordCloud.ts +268 -268
- package/src/XYAxis.css +40 -40
- package/src/XYAxis.md +149 -149
- package/src/XYAxis.ts +809 -809
- package/src/__package__.ts +3 -3
- package/src/__tests__/heat.ts +71 -71
- package/src/__tests__/index.ts +3 -3
- package/src/__tests__/pie.ts +20 -20
- package/src/__tests__/stat.ts +16 -16
- package/src/__tests__/test3.ts +68 -68
- package/src/index.ts +28 -28
- package/src/test.ts +70 -70
- package/src/timeFormats.ts +26 -26
package/src/SummaryC.ts
CHANGED
|
@@ -1,240 +1,240 @@
|
|
|
1
|
-
import { I2DChart } from "@hpcc-js/api";
|
|
2
|
-
import { CanvasWidget, Utility } from "@hpcc-js/common";
|
|
3
|
-
|
|
4
|
-
export class SummaryC extends CanvasWidget {
|
|
5
|
-
protected _playIntervalIdx = 0;
|
|
6
|
-
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
I2DChart.call(this);
|
|
10
|
-
this.playInterval(this.playInterval());
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
currentRow() {
|
|
14
|
-
return this.data()[this._playIntervalIdx];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
enter(domNode, element) {
|
|
18
|
-
super.enter.apply(this, arguments);
|
|
19
|
-
const { width, height } = this.size();
|
|
20
|
-
domNode.height = height;
|
|
21
|
-
domNode.width = width;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
update(domNode, element) {
|
|
25
|
-
super.update.apply(this, arguments);
|
|
26
|
-
const context = this;
|
|
27
|
-
if (this._playIntervalIdx >= this.data().length) {
|
|
28
|
-
this._playIntervalIdx = 0;
|
|
29
|
-
}
|
|
30
|
-
const size = this.size();
|
|
31
|
-
const minDimension = Math.min(size.width, size.height);
|
|
32
|
-
const sizeRatio = this.fontSizeRatio();
|
|
33
|
-
const labelIdx = this.columns().indexOf(this.labelColumn());
|
|
34
|
-
const valueIdx = this.columns().indexOf(this.valueColumn());
|
|
35
|
-
const bgColorIdx = this.columns().indexOf(this.colorFillColumn());
|
|
36
|
-
const fontColorIdx = this.columns().indexOf(this.colorStrokeColumn());
|
|
37
|
-
const iconIdx = this.columns().indexOf(this.iconColumn());
|
|
38
|
-
const icon = iconIdx !== -1 ? this.currentRow()[iconIdx] : this.icon();
|
|
39
|
-
const label = labelIdx !== -1 ? this.currentRow()[labelIdx] : "";
|
|
40
|
-
const value = valueIdx !== -1 ? this.currentRow()[valueIdx] : "";
|
|
41
|
-
const bgColor = bgColorIdx !== -1 ? this.currentRow()[bgColorIdx] : this.colorFill();
|
|
42
|
-
const fontColor = fontColorIdx !== -1 ? this.currentRow()[fontColorIdx] : this.colorStroke();
|
|
43
|
-
|
|
44
|
-
let mainFontSize = size.height * (sizeRatio - this.paddingSizeRatio());
|
|
45
|
-
const subFontSize = size.height * (1 - sizeRatio - this.paddingSizeRatio());
|
|
46
|
-
const iconSize = size.height * (this.iconSizeRatio() - this.paddingSizeRatio());
|
|
47
|
-
const p = minDimension * this.paddingSizeRatio();
|
|
48
|
-
const ctx = domNode.getContext("2d");
|
|
49
|
-
|
|
50
|
-
ctx.clearRect(0, 0, size.width, size.height);
|
|
51
|
-
|
|
52
|
-
const fontFamily = context.fontFamily();
|
|
53
|
-
|
|
54
|
-
ctx.fillStyle = bgColor;
|
|
55
|
-
ctx.fillRect(0, 0, size.width, size.height);
|
|
56
|
-
|
|
57
|
-
ctx.globalAlpha = this.iconOpacity();
|
|
58
|
-
drawIcon(Utility.faChar(icon), iconSize, context.iconAnchor());
|
|
59
|
-
|
|
60
|
-
ctx.globalAlpha = this.valueOpacity();
|
|
61
|
-
mainFontSize = drawText(value, p, mainFontSize, context.valueAnchor());
|
|
62
|
-
|
|
63
|
-
ctx.globalAlpha = this.labelOpacity();
|
|
64
|
-
drawText(label, mainFontSize + p, subFontSize, context.labelAnchor());
|
|
65
|
-
|
|
66
|
-
function drawText(text, y, fontSize, anchorMode) {
|
|
67
|
-
ctx.textBaseline = "top";
|
|
68
|
-
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
69
|
-
ctx.fillStyle = fontColor;
|
|
70
|
-
let measurement = ctx.measureText(text);
|
|
71
|
-
if (measurement.width > (size.width - (p * 2))) {
|
|
72
|
-
const fontSizeMult = (size.width - (p * 2)) / measurement.width;
|
|
73
|
-
fontSize = fontSize * fontSizeMult;
|
|
74
|
-
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
75
|
-
measurement = ctx.measureText(text);
|
|
76
|
-
}
|
|
77
|
-
const x = getTextOffsetX(measurement.width, anchorMode);
|
|
78
|
-
ctx.fillText(text, x, y);
|
|
79
|
-
return fontSize;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function drawIcon(text, fontSize, anchorMode) {
|
|
83
|
-
if (typeof text === "undefined") return;
|
|
84
|
-
ctx.textBaseline = context.iconBaseline();
|
|
85
|
-
ctx.font = `${fontSize}px FontAwesome`;
|
|
86
|
-
ctx.fillStyle = fontColor;
|
|
87
|
-
let measurement = ctx.measureText(text);
|
|
88
|
-
if (measurement.width > (size.width - (p * 2))) {
|
|
89
|
-
const fontSizeMult = (size.width - (p * 2)) / measurement.width;
|
|
90
|
-
ctx.font = `${fontSize * fontSizeMult}px FontAwesome`;
|
|
91
|
-
measurement = ctx.measureText(text);
|
|
92
|
-
}
|
|
93
|
-
const x = getTextOffsetX(measurement.width, anchorMode);
|
|
94
|
-
const y = getTextOffsetY(context.iconBaseline());
|
|
95
|
-
ctx.fillText(text, x, y);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function getTextOffsetX(width, anchorMode) {
|
|
99
|
-
switch (anchorMode) {
|
|
100
|
-
case "start":
|
|
101
|
-
return p;
|
|
102
|
-
case "middle":
|
|
103
|
-
return (size.width / 2) - (width / 2);
|
|
104
|
-
case "end":
|
|
105
|
-
return size.width - width - p;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function getTextOffsetY(anchorMode) {
|
|
109
|
-
switch (anchorMode) {
|
|
110
|
-
case "top":
|
|
111
|
-
return p;
|
|
112
|
-
case "middle":
|
|
113
|
-
return size.height / 2;
|
|
114
|
-
case "bottom":
|
|
115
|
-
return size.height - p;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
SummaryC.prototype._class += " chart_SummaryC";
|
|
121
|
-
SummaryC.prototype.implements(I2DChart.prototype);
|
|
122
|
-
|
|
123
|
-
export interface SummaryC {
|
|
124
|
-
iconColumn(): string;
|
|
125
|
-
iconColumn(_: string): this;
|
|
126
|
-
iconColumn_exists(): boolean;
|
|
127
|
-
icon(): string;
|
|
128
|
-
icon(_: string): this;
|
|
129
|
-
icon_exists(): boolean;
|
|
130
|
-
iconOpacity(): number;
|
|
131
|
-
iconOpacity(_: number): this;
|
|
132
|
-
|
|
133
|
-
fontFamily(): string;
|
|
134
|
-
fontFamily(_: string): this;
|
|
135
|
-
|
|
136
|
-
labelColumn(): string;
|
|
137
|
-
labelColumn(_: string): this;
|
|
138
|
-
labelColumn_exists(): boolean;
|
|
139
|
-
labelOpacity(): number;
|
|
140
|
-
labelOpacity(_: number): this;
|
|
141
|
-
|
|
142
|
-
valueColumn(): string;
|
|
143
|
-
valueColumn(_: string): this;
|
|
144
|
-
valueColumn_exists(): boolean;
|
|
145
|
-
valueOpacity(): number;
|
|
146
|
-
valueOpacity(_: number): this;
|
|
147
|
-
|
|
148
|
-
fontSizeRatio(): number;
|
|
149
|
-
fontSizeRatio(_: number): this;
|
|
150
|
-
|
|
151
|
-
colorFillColumn(): string;
|
|
152
|
-
colorFillColumn(_: string): this;
|
|
153
|
-
colorFillColumn_exists(): boolean;
|
|
154
|
-
colorFill(): string;
|
|
155
|
-
colorFill(_: string): this;
|
|
156
|
-
colorFill_exists(): boolean;
|
|
157
|
-
colorStrokeColumn(): string;
|
|
158
|
-
colorStrokeColumn(_: string): this;
|
|
159
|
-
colorStrokeColumn_exists(): boolean;
|
|
160
|
-
colorStroke(): string;
|
|
161
|
-
colorStroke(_: string): this;
|
|
162
|
-
colorStroke_exists(): boolean;
|
|
163
|
-
|
|
164
|
-
fixedSize(): boolean;
|
|
165
|
-
fixedSize(_: boolean): this;
|
|
166
|
-
fixedSize_exists(): boolean;
|
|
167
|
-
minWidth(): number;
|
|
168
|
-
minWidth(_: number): this;
|
|
169
|
-
minWidth_exists(): boolean;
|
|
170
|
-
minHeight(): number;
|
|
171
|
-
minHeight(_: number): this;
|
|
172
|
-
minHeight_exists(): boolean;
|
|
173
|
-
playInterval(): number;
|
|
174
|
-
playInterval(_: number): this;
|
|
175
|
-
playInterval_exists(): boolean;
|
|
176
|
-
paddingSizeRatio(): number;
|
|
177
|
-
paddingSizeRatio(_: number): this;
|
|
178
|
-
iconSizeRatio(): number;
|
|
179
|
-
iconSizeRatio(_: number): this;
|
|
180
|
-
|
|
181
|
-
iconAnchor(): "start" | "middle" | "end";
|
|
182
|
-
iconAnchor(_: "start" | "middle" | "end"): this;
|
|
183
|
-
labelAnchor(): "start" | "middle" | "end";
|
|
184
|
-
labelAnchor(_: "start" | "middle" | "end"): this;
|
|
185
|
-
valueAnchor(): "start" | "middle" | "end";
|
|
186
|
-
valueAnchor(_: "start" | "middle" | "end"): this;
|
|
187
|
-
|
|
188
|
-
iconBaseline(): "top" | "middle" | "bottom";
|
|
189
|
-
iconBaseline(_: "top" | "middle" | "bottom"): this;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
SummaryC.prototype.publish("iconBaseline", "bottom", "string", "Text baseline for the icon", ["top", "middle", "bottom"]);
|
|
193
|
-
SummaryC.prototype.publish("iconAnchor", "end", "set", "Anchors the icon either at the start, middle, or end of the summary", ["start", "middle", "end"]);
|
|
194
|
-
SummaryC.prototype.publish("valueAnchor", "start", "set", "Anchors the value either at the start, middle, or end of the summary", ["start", "middle", "end"]);
|
|
195
|
-
SummaryC.prototype.publish("labelAnchor", "start", "set", "Anchors the label either at the start, middle, or end of the summary", ["start", "middle", "end"]);
|
|
196
|
-
SummaryC.prototype.publish("iconColumn", null, "set", "Select Icon Column", function () { return this.columns(); }, { optional: true });
|
|
197
|
-
SummaryC.prototype.publish("icon", "fa-briefcase", "string", "FA Char icon class", null, { disable: (w) => w.iconColumn() });
|
|
198
|
-
|
|
199
|
-
SummaryC.prototype.publish("fontFamily", "Arial", "string", "Font Family");
|
|
200
|
-
|
|
201
|
-
SummaryC.prototype.publish("labelColumn", null, "set", "Select display value", function () { return this.columns(); }, { optional: true });
|
|
202
|
-
SummaryC.prototype.publish("valueColumn", null, "set", "Select display value", function () { return this.columns(); }, { optional: true });
|
|
203
|
-
|
|
204
|
-
SummaryC.prototype.publish("colorFillColumn", null, "set", "Column for background color", function () { return this.columns(); }, { optional: true });
|
|
205
|
-
SummaryC.prototype.publish("colorFill", "#0097e6", "html-color", "Background Color", null, { disable: (w) => w.colorFillColumn() });
|
|
206
|
-
SummaryC.prototype.publish("colorStrokeColumn", null, "set", "Column for font color", function () { return this.columns(); }, { optional: true });
|
|
207
|
-
SummaryC.prototype.publish("colorStroke", "#2f3640", "html-color", "Font Color", null, { disable: (w) => w.colorStrokeColumn() });
|
|
208
|
-
|
|
209
|
-
SummaryC.prototype.publish("fixedSize", true, "boolean", "Fix Size to Min Width/Height");
|
|
210
|
-
SummaryC.prototype.publish("minWidth", 225, "number", "Minimum Width");
|
|
211
|
-
SummaryC.prototype.publish("minHeight", 150, "number", "Minimum Height");
|
|
212
|
-
SummaryC.prototype.publish("playInterval", null, "number", "Play Interval", null, { optional: true });
|
|
213
|
-
|
|
214
|
-
SummaryC.prototype.publish("fontSizeRatio", 0.618, "number", "Ratio between widget height and value font size");
|
|
215
|
-
SummaryC.prototype.publish("valueOpacity", 1, "number", "Opacity of value text (0..1)");
|
|
216
|
-
SummaryC.prototype.publish("labelOpacity", 0.9, "number", "Opacity of label text (0..1)");
|
|
217
|
-
SummaryC.prototype.publish("iconOpacity", 0.3, "number", "Opacity of icon text (0..1)");
|
|
218
|
-
|
|
219
|
-
SummaryC.prototype.publish("paddingSizeRatio", 0.1, "number", "Ratio of the smallest dimension for edge padding (0..1)");
|
|
220
|
-
SummaryC.prototype.publish("iconSizeRatio", 0.9, "number", "Ratio of the height for icon size (0..1)");
|
|
221
|
-
|
|
222
|
-
const playInterval = SummaryC.prototype.playInterval;
|
|
223
|
-
SummaryC.prototype.playInterval = function (_?: number): number | any {
|
|
224
|
-
const retVal = playInterval.apply(this, arguments);
|
|
225
|
-
if (arguments.length) {
|
|
226
|
-
if (this._playIntervalHandle) {
|
|
227
|
-
clearInterval(this._playIntervalHandle);
|
|
228
|
-
}
|
|
229
|
-
const context = this;
|
|
230
|
-
if (_) {
|
|
231
|
-
this._playIntervalHandle = setInterval(function () {
|
|
232
|
-
context._playIntervalIdx++;
|
|
233
|
-
if (context._renderCount && context.data().length) {
|
|
234
|
-
context.render();
|
|
235
|
-
}
|
|
236
|
-
}, _);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return retVal;
|
|
240
|
-
};
|
|
1
|
+
import { I2DChart } from "@hpcc-js/api";
|
|
2
|
+
import { CanvasWidget, Utility } from "@hpcc-js/common";
|
|
3
|
+
|
|
4
|
+
export class SummaryC extends CanvasWidget {
|
|
5
|
+
protected _playIntervalIdx = 0;
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
I2DChart.call(this);
|
|
10
|
+
this.playInterval(this.playInterval());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
currentRow() {
|
|
14
|
+
return this.data()[this._playIntervalIdx];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
enter(domNode, element) {
|
|
18
|
+
super.enter.apply(this, arguments);
|
|
19
|
+
const { width, height } = this.size();
|
|
20
|
+
domNode.height = height;
|
|
21
|
+
domNode.width = width;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
update(domNode, element) {
|
|
25
|
+
super.update.apply(this, arguments);
|
|
26
|
+
const context = this;
|
|
27
|
+
if (this._playIntervalIdx >= this.data().length) {
|
|
28
|
+
this._playIntervalIdx = 0;
|
|
29
|
+
}
|
|
30
|
+
const size = this.size();
|
|
31
|
+
const minDimension = Math.min(size.width, size.height);
|
|
32
|
+
const sizeRatio = this.fontSizeRatio();
|
|
33
|
+
const labelIdx = this.columns().indexOf(this.labelColumn());
|
|
34
|
+
const valueIdx = this.columns().indexOf(this.valueColumn());
|
|
35
|
+
const bgColorIdx = this.columns().indexOf(this.colorFillColumn());
|
|
36
|
+
const fontColorIdx = this.columns().indexOf(this.colorStrokeColumn());
|
|
37
|
+
const iconIdx = this.columns().indexOf(this.iconColumn());
|
|
38
|
+
const icon = iconIdx !== -1 ? this.currentRow()[iconIdx] : this.icon();
|
|
39
|
+
const label = labelIdx !== -1 ? this.currentRow()[labelIdx] : "";
|
|
40
|
+
const value = valueIdx !== -1 ? this.currentRow()[valueIdx] : "";
|
|
41
|
+
const bgColor = bgColorIdx !== -1 ? this.currentRow()[bgColorIdx] : this.colorFill();
|
|
42
|
+
const fontColor = fontColorIdx !== -1 ? this.currentRow()[fontColorIdx] : this.colorStroke();
|
|
43
|
+
|
|
44
|
+
let mainFontSize = size.height * (sizeRatio - this.paddingSizeRatio());
|
|
45
|
+
const subFontSize = size.height * (1 - sizeRatio - this.paddingSizeRatio());
|
|
46
|
+
const iconSize = size.height * (this.iconSizeRatio() - this.paddingSizeRatio());
|
|
47
|
+
const p = minDimension * this.paddingSizeRatio();
|
|
48
|
+
const ctx = domNode.getContext("2d");
|
|
49
|
+
|
|
50
|
+
ctx.clearRect(0, 0, size.width, size.height);
|
|
51
|
+
|
|
52
|
+
const fontFamily = context.fontFamily();
|
|
53
|
+
|
|
54
|
+
ctx.fillStyle = bgColor;
|
|
55
|
+
ctx.fillRect(0, 0, size.width, size.height);
|
|
56
|
+
|
|
57
|
+
ctx.globalAlpha = this.iconOpacity();
|
|
58
|
+
drawIcon(Utility.faChar(icon), iconSize, context.iconAnchor());
|
|
59
|
+
|
|
60
|
+
ctx.globalAlpha = this.valueOpacity();
|
|
61
|
+
mainFontSize = drawText(value, p, mainFontSize, context.valueAnchor());
|
|
62
|
+
|
|
63
|
+
ctx.globalAlpha = this.labelOpacity();
|
|
64
|
+
drawText(label, mainFontSize + p, subFontSize, context.labelAnchor());
|
|
65
|
+
|
|
66
|
+
function drawText(text, y, fontSize, anchorMode) {
|
|
67
|
+
ctx.textBaseline = "top";
|
|
68
|
+
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
69
|
+
ctx.fillStyle = fontColor;
|
|
70
|
+
let measurement = ctx.measureText(text);
|
|
71
|
+
if (measurement.width > (size.width - (p * 2))) {
|
|
72
|
+
const fontSizeMult = (size.width - (p * 2)) / measurement.width;
|
|
73
|
+
fontSize = fontSize * fontSizeMult;
|
|
74
|
+
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
75
|
+
measurement = ctx.measureText(text);
|
|
76
|
+
}
|
|
77
|
+
const x = getTextOffsetX(measurement.width, anchorMode);
|
|
78
|
+
ctx.fillText(text, x, y);
|
|
79
|
+
return fontSize;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function drawIcon(text, fontSize, anchorMode) {
|
|
83
|
+
if (typeof text === "undefined") return;
|
|
84
|
+
ctx.textBaseline = context.iconBaseline();
|
|
85
|
+
ctx.font = `${fontSize}px FontAwesome`;
|
|
86
|
+
ctx.fillStyle = fontColor;
|
|
87
|
+
let measurement = ctx.measureText(text);
|
|
88
|
+
if (measurement.width > (size.width - (p * 2))) {
|
|
89
|
+
const fontSizeMult = (size.width - (p * 2)) / measurement.width;
|
|
90
|
+
ctx.font = `${fontSize * fontSizeMult}px FontAwesome`;
|
|
91
|
+
measurement = ctx.measureText(text);
|
|
92
|
+
}
|
|
93
|
+
const x = getTextOffsetX(measurement.width, anchorMode);
|
|
94
|
+
const y = getTextOffsetY(context.iconBaseline());
|
|
95
|
+
ctx.fillText(text, x, y);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getTextOffsetX(width, anchorMode) {
|
|
99
|
+
switch (anchorMode) {
|
|
100
|
+
case "start":
|
|
101
|
+
return p;
|
|
102
|
+
case "middle":
|
|
103
|
+
return (size.width / 2) - (width / 2);
|
|
104
|
+
case "end":
|
|
105
|
+
return size.width - width - p;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function getTextOffsetY(anchorMode) {
|
|
109
|
+
switch (anchorMode) {
|
|
110
|
+
case "top":
|
|
111
|
+
return p;
|
|
112
|
+
case "middle":
|
|
113
|
+
return size.height / 2;
|
|
114
|
+
case "bottom":
|
|
115
|
+
return size.height - p;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
SummaryC.prototype._class += " chart_SummaryC";
|
|
121
|
+
SummaryC.prototype.implements(I2DChart.prototype);
|
|
122
|
+
|
|
123
|
+
export interface SummaryC {
|
|
124
|
+
iconColumn(): string;
|
|
125
|
+
iconColumn(_: string): this;
|
|
126
|
+
iconColumn_exists(): boolean;
|
|
127
|
+
icon(): string;
|
|
128
|
+
icon(_: string): this;
|
|
129
|
+
icon_exists(): boolean;
|
|
130
|
+
iconOpacity(): number;
|
|
131
|
+
iconOpacity(_: number): this;
|
|
132
|
+
|
|
133
|
+
fontFamily(): string;
|
|
134
|
+
fontFamily(_: string): this;
|
|
135
|
+
|
|
136
|
+
labelColumn(): string;
|
|
137
|
+
labelColumn(_: string): this;
|
|
138
|
+
labelColumn_exists(): boolean;
|
|
139
|
+
labelOpacity(): number;
|
|
140
|
+
labelOpacity(_: number): this;
|
|
141
|
+
|
|
142
|
+
valueColumn(): string;
|
|
143
|
+
valueColumn(_: string): this;
|
|
144
|
+
valueColumn_exists(): boolean;
|
|
145
|
+
valueOpacity(): number;
|
|
146
|
+
valueOpacity(_: number): this;
|
|
147
|
+
|
|
148
|
+
fontSizeRatio(): number;
|
|
149
|
+
fontSizeRatio(_: number): this;
|
|
150
|
+
|
|
151
|
+
colorFillColumn(): string;
|
|
152
|
+
colorFillColumn(_: string): this;
|
|
153
|
+
colorFillColumn_exists(): boolean;
|
|
154
|
+
colorFill(): string;
|
|
155
|
+
colorFill(_: string): this;
|
|
156
|
+
colorFill_exists(): boolean;
|
|
157
|
+
colorStrokeColumn(): string;
|
|
158
|
+
colorStrokeColumn(_: string): this;
|
|
159
|
+
colorStrokeColumn_exists(): boolean;
|
|
160
|
+
colorStroke(): string;
|
|
161
|
+
colorStroke(_: string): this;
|
|
162
|
+
colorStroke_exists(): boolean;
|
|
163
|
+
|
|
164
|
+
fixedSize(): boolean;
|
|
165
|
+
fixedSize(_: boolean): this;
|
|
166
|
+
fixedSize_exists(): boolean;
|
|
167
|
+
minWidth(): number;
|
|
168
|
+
minWidth(_: number): this;
|
|
169
|
+
minWidth_exists(): boolean;
|
|
170
|
+
minHeight(): number;
|
|
171
|
+
minHeight(_: number): this;
|
|
172
|
+
minHeight_exists(): boolean;
|
|
173
|
+
playInterval(): number;
|
|
174
|
+
playInterval(_: number): this;
|
|
175
|
+
playInterval_exists(): boolean;
|
|
176
|
+
paddingSizeRatio(): number;
|
|
177
|
+
paddingSizeRatio(_: number): this;
|
|
178
|
+
iconSizeRatio(): number;
|
|
179
|
+
iconSizeRatio(_: number): this;
|
|
180
|
+
|
|
181
|
+
iconAnchor(): "start" | "middle" | "end";
|
|
182
|
+
iconAnchor(_: "start" | "middle" | "end"): this;
|
|
183
|
+
labelAnchor(): "start" | "middle" | "end";
|
|
184
|
+
labelAnchor(_: "start" | "middle" | "end"): this;
|
|
185
|
+
valueAnchor(): "start" | "middle" | "end";
|
|
186
|
+
valueAnchor(_: "start" | "middle" | "end"): this;
|
|
187
|
+
|
|
188
|
+
iconBaseline(): "top" | "middle" | "bottom";
|
|
189
|
+
iconBaseline(_: "top" | "middle" | "bottom"): this;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
SummaryC.prototype.publish("iconBaseline", "bottom", "string", "Text baseline for the icon", ["top", "middle", "bottom"]);
|
|
193
|
+
SummaryC.prototype.publish("iconAnchor", "end", "set", "Anchors the icon either at the start, middle, or end of the summary", ["start", "middle", "end"]);
|
|
194
|
+
SummaryC.prototype.publish("valueAnchor", "start", "set", "Anchors the value either at the start, middle, or end of the summary", ["start", "middle", "end"]);
|
|
195
|
+
SummaryC.prototype.publish("labelAnchor", "start", "set", "Anchors the label either at the start, middle, or end of the summary", ["start", "middle", "end"]);
|
|
196
|
+
SummaryC.prototype.publish("iconColumn", null, "set", "Select Icon Column", function () { return this.columns(); }, { optional: true });
|
|
197
|
+
SummaryC.prototype.publish("icon", "fa-briefcase", "string", "FA Char icon class", null, { disable: (w) => w.iconColumn() });
|
|
198
|
+
|
|
199
|
+
SummaryC.prototype.publish("fontFamily", "Arial", "string", "Font Family");
|
|
200
|
+
|
|
201
|
+
SummaryC.prototype.publish("labelColumn", null, "set", "Select display value", function () { return this.columns(); }, { optional: true });
|
|
202
|
+
SummaryC.prototype.publish("valueColumn", null, "set", "Select display value", function () { return this.columns(); }, { optional: true });
|
|
203
|
+
|
|
204
|
+
SummaryC.prototype.publish("colorFillColumn", null, "set", "Column for background color", function () { return this.columns(); }, { optional: true });
|
|
205
|
+
SummaryC.prototype.publish("colorFill", "#0097e6", "html-color", "Background Color", null, { disable: (w) => w.colorFillColumn() });
|
|
206
|
+
SummaryC.prototype.publish("colorStrokeColumn", null, "set", "Column for font color", function () { return this.columns(); }, { optional: true });
|
|
207
|
+
SummaryC.prototype.publish("colorStroke", "#2f3640", "html-color", "Font Color", null, { disable: (w) => w.colorStrokeColumn() });
|
|
208
|
+
|
|
209
|
+
SummaryC.prototype.publish("fixedSize", true, "boolean", "Fix Size to Min Width/Height");
|
|
210
|
+
SummaryC.prototype.publish("minWidth", 225, "number", "Minimum Width");
|
|
211
|
+
SummaryC.prototype.publish("minHeight", 150, "number", "Minimum Height");
|
|
212
|
+
SummaryC.prototype.publish("playInterval", null, "number", "Play Interval", null, { optional: true });
|
|
213
|
+
|
|
214
|
+
SummaryC.prototype.publish("fontSizeRatio", 0.618, "number", "Ratio between widget height and value font size");
|
|
215
|
+
SummaryC.prototype.publish("valueOpacity", 1, "number", "Opacity of value text (0..1)");
|
|
216
|
+
SummaryC.prototype.publish("labelOpacity", 0.9, "number", "Opacity of label text (0..1)");
|
|
217
|
+
SummaryC.prototype.publish("iconOpacity", 0.3, "number", "Opacity of icon text (0..1)");
|
|
218
|
+
|
|
219
|
+
SummaryC.prototype.publish("paddingSizeRatio", 0.1, "number", "Ratio of the smallest dimension for edge padding (0..1)");
|
|
220
|
+
SummaryC.prototype.publish("iconSizeRatio", 0.9, "number", "Ratio of the height for icon size (0..1)");
|
|
221
|
+
|
|
222
|
+
const playInterval = SummaryC.prototype.playInterval;
|
|
223
|
+
SummaryC.prototype.playInterval = function (_?: number): number | any {
|
|
224
|
+
const retVal = playInterval.apply(this, arguments);
|
|
225
|
+
if (arguments.length) {
|
|
226
|
+
if (this._playIntervalHandle) {
|
|
227
|
+
clearInterval(this._playIntervalHandle);
|
|
228
|
+
}
|
|
229
|
+
const context = this;
|
|
230
|
+
if (_) {
|
|
231
|
+
this._playIntervalHandle = setInterval(function () {
|
|
232
|
+
context._playIntervalIdx++;
|
|
233
|
+
if (context._renderCount && context.data().length) {
|
|
234
|
+
context.render();
|
|
235
|
+
}
|
|
236
|
+
}, _);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return retVal;
|
|
240
|
+
};
|
package/src/WordCloud.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
.other_Wordcloud text {
|
|
2
|
-
cursor: pointer;
|
|
1
|
+
.other_Wordcloud text {
|
|
2
|
+
cursor: pointer;
|
|
3
3
|
}
|