@hpcc-js/api 3.4.9 → 3.4.10
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/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 +3 -3
- package/src/I1DChart.ts +13 -13
- package/src/I2DAggrChart.ts +25 -25
- package/src/I2DChart.ts +26 -26
- package/src/IGraph.ts +24 -24
- package/src/IHighlight.ts +7 -7
- package/src/IInput.ts +87 -87
- package/src/INDChart.ts +26 -26
- package/src/ITooltip.css +119 -119
- package/src/ITooltip.ts +225 -225
- package/src/ITree.ts +15 -15
- package/src/Tooltip.ts +384 -384
- package/src/__package__.ts +3 -3
- package/src/index.ts +10 -10
package/src/ITooltip.ts
CHANGED
|
@@ -1,225 +1,225 @@
|
|
|
1
|
-
import { Widget } from "@hpcc-js/common";
|
|
2
|
-
import { format as d3Format } from "d3-format";
|
|
3
|
-
import { tip } from "./Tooltip.ts";
|
|
4
|
-
|
|
5
|
-
import "../src/ITooltip.css";
|
|
6
|
-
|
|
7
|
-
declare const event: object;
|
|
8
|
-
|
|
9
|
-
// Use old school class declaration as this is a mixin ---
|
|
10
|
-
export function ITooltip(this: any) {
|
|
11
|
-
this.tooltip = tip();
|
|
12
|
-
|
|
13
|
-
if (this.tooltipLabelFormat_exists()) {
|
|
14
|
-
this._labelFormatter = d3Format(this.tooltipLabelFormat() as string);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (this.tooltipValueFormat_exists()) {
|
|
18
|
-
this._valueFormatter = d3Format(this.tooltipValueFormat() as string);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (this.layerEnter) {
|
|
22
|
-
const layerEnter = this.layerEnter;
|
|
23
|
-
this.layerEnter = function (_base, svgElement, _domElement) {
|
|
24
|
-
if (!this._parentOverlay) {
|
|
25
|
-
this._parentOverlay = _base._parentOverlay;
|
|
26
|
-
}
|
|
27
|
-
this.tooltipEnter(svgElement);
|
|
28
|
-
layerEnter.apply(this, arguments);
|
|
29
|
-
};
|
|
30
|
-
const layerUpdate = this.layerUpdate;
|
|
31
|
-
this.layerUpdate = function (_base) {
|
|
32
|
-
layerUpdate.apply(this, arguments);
|
|
33
|
-
this.tooltipUpdate();
|
|
34
|
-
};
|
|
35
|
-
const layerExit = this.layerExit;
|
|
36
|
-
this.layerExit = function (_base) {
|
|
37
|
-
this.tooltipExit();
|
|
38
|
-
layerExit.apply(this, arguments);
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
const enter = this.enter;
|
|
42
|
-
this.enter = function (_domNode, element) {
|
|
43
|
-
this.tooltipEnter(element);
|
|
44
|
-
enter.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
const update = this.update;
|
|
47
|
-
this.update = function (_domNode, _element) {
|
|
48
|
-
update.apply(this, arguments);
|
|
49
|
-
this.tooltipUpdate();
|
|
50
|
-
};
|
|
51
|
-
const exit = this.exit;
|
|
52
|
-
this.exit = function (_domNode, _element) {
|
|
53
|
-
this.tooltipExit();
|
|
54
|
-
exit.apply(this, arguments);
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
ITooltip.prototype = Object.create(Widget.prototype);
|
|
59
|
-
ITooltip.prototype.constructor = ITooltip;
|
|
60
|
-
|
|
61
|
-
// abstract target(): any;
|
|
62
|
-
// abstract target(_: any): this;
|
|
63
|
-
|
|
64
|
-
ITooltip.prototype.tooltipEnter = function (element) {
|
|
65
|
-
const overlayElement = this.parentOverlay();
|
|
66
|
-
if (!overlayElement.empty()) {
|
|
67
|
-
this.tooltip.rootElement(overlayElement.node().parentNode);
|
|
68
|
-
}
|
|
69
|
-
element.call(this.tooltip);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
ITooltip.prototype.tooltipUpdate = function () {
|
|
73
|
-
this.tooltip.offset(() => {
|
|
74
|
-
if (event && this.tooltipFollowMouse()) {
|
|
75
|
-
const d3tipElement: HTMLDivElement = document.querySelector(".d3-tip"); // d3Tip offers no reference to the '.d3-tip' element...?
|
|
76
|
-
d3tipElement.style.display = "block";
|
|
77
|
-
d3tipElement.style.left = this.tooltipOffset() + ((event as any).clientX) + "px";
|
|
78
|
-
d3tipElement.style.top = (event as any).clientY + "px";
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
switch (this.tooltip.direction()()) {
|
|
82
|
-
case "e":
|
|
83
|
-
return [0, this.tooltipOffset()];
|
|
84
|
-
default:
|
|
85
|
-
return [-this.tooltipOffset(), 0];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
let classed = this.tooltip.attr("class");
|
|
90
|
-
if (classed) {
|
|
91
|
-
classed = classed.split(" notick").join("") + (this.tooltipTick() ? "" : " notick") + (this.tooltipStyle() === "none" ? " hidden" : "");
|
|
92
|
-
classed = classed.split(" ")
|
|
93
|
-
.filter(function (_class) {
|
|
94
|
-
return _class.indexOf("ITooltip-tooltipStyle-") !== 0;
|
|
95
|
-
})
|
|
96
|
-
.join(" ")
|
|
97
|
-
;
|
|
98
|
-
classed += " ITooltip-tooltipStyle-" + this.tooltipStyle();
|
|
99
|
-
this.tooltip
|
|
100
|
-
.attr("class", classed)
|
|
101
|
-
;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
ITooltip.prototype.tooltipExit = function () {
|
|
106
|
-
if (this.tooltip) {
|
|
107
|
-
this.tooltip.destroy();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
ITooltip.prototype._tooltipHTML = function (d) {
|
|
112
|
-
return d;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
ITooltip.prototype.tooltipHTML = function (_) {
|
|
116
|
-
return this.tooltip.html(_);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
ITooltip.prototype.tooltipFormat = function (opts: { label?: string | number, series?: string | number, value?: Date | string | number, arr?: Array<{ color: string, label: string, value: string }> } = {}) {
|
|
120
|
-
opts.label = opts.label === undefined ? "" : opts.label;
|
|
121
|
-
if (this._labelFormatter) {
|
|
122
|
-
opts.label = this._labelFormatter(opts.label) || "";
|
|
123
|
-
} else if (this.formatData && this.parseData) {
|
|
124
|
-
opts.label = this.formatData(this.parseData(opts.label));
|
|
125
|
-
}
|
|
126
|
-
opts.series = opts.series || "";
|
|
127
|
-
if (opts.value instanceof Date) {
|
|
128
|
-
opts.value = opts.value || "";
|
|
129
|
-
} else if (this._valueFormatter) {
|
|
130
|
-
opts.value = this._valueFormatter(opts.value) || "";
|
|
131
|
-
} else if (this.formatValue && this.parseValue) {
|
|
132
|
-
opts.value = this.formatValue(this.parseValue(opts.value));
|
|
133
|
-
}
|
|
134
|
-
switch (this.tooltipStyle()) {
|
|
135
|
-
case "none":
|
|
136
|
-
break;
|
|
137
|
-
case "series-table":
|
|
138
|
-
let html = '<table class="ITooltip-series-table">'
|
|
139
|
-
+ "<thead>"
|
|
140
|
-
+ '<tr><th colspan="2">' + opts.label + "</th></tr>"
|
|
141
|
-
+ "</thead>"
|
|
142
|
-
+ "<tbody>";
|
|
143
|
-
opts.arr.forEach(function (row) {
|
|
144
|
-
html += "<tr>";
|
|
145
|
-
html += "<td>";
|
|
146
|
-
html += '<div class="series-table-row-color" style="background-color:' + row.color + '"></div>';
|
|
147
|
-
html += '<div class="series-table-row-label">' + row.label + "</div>";
|
|
148
|
-
html += "</td>";
|
|
149
|
-
html += '<td><div class="series-table-row-value">' + row.value + "</div></td>";
|
|
150
|
-
html += "</tr>";
|
|
151
|
-
});
|
|
152
|
-
html += "</tbody>";
|
|
153
|
-
html += "</table>";
|
|
154
|
-
return html;
|
|
155
|
-
default:
|
|
156
|
-
if (opts.series) {
|
|
157
|
-
return "<span style='color:" + this.tooltipSeriesColor() + "'>" + opts.series + "</span> / <span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
|
|
158
|
-
}
|
|
159
|
-
if (opts.label !== "") {
|
|
160
|
-
return "<span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
|
|
161
|
-
}
|
|
162
|
-
return "<span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
ITooltip.prototype.tooltipKeyValueFormat = function (titleKey: string, obj: object): string {
|
|
167
|
-
let body = "";
|
|
168
|
-
for (const key in obj) {
|
|
169
|
-
if (key !== titleKey) {
|
|
170
|
-
const value = obj && obj[key] ? obj[key] : "";
|
|
171
|
-
body += `<tr><td style="${this.tooltipLabelColor_exists() ? "color:" + this.tooltipLabelColor() : ""}">${key}</td><td style="font-weight:normal">${value}</td></tr>`;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return `<table>
|
|
175
|
-
<thead>
|
|
176
|
-
<tr><th colspan="2" style="font-weight:bold;font-size:16px">${obj[titleKey]}</th></tr>
|
|
177
|
-
</thead>
|
|
178
|
-
<tbody>
|
|
179
|
-
${body}
|
|
180
|
-
</tbody>
|
|
181
|
-
</table>`;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export interface ITooltip {
|
|
185
|
-
tooltipStyle: { (): "default" | "none" | "series-table"; (_: "default" | "none" | "series-table"): ITooltip; };
|
|
186
|
-
tooltipFollowMouse: { (): boolean; (_: boolean): ITooltip; };
|
|
187
|
-
tooltipLabelFormat: (_?) => string | ITooltip;
|
|
188
|
-
tooltipLabelFormat_exists: () => boolean;
|
|
189
|
-
tooltipValueFormat: (_?) => string | ITooltip;
|
|
190
|
-
tooltipValueFormat_exists: () => boolean;
|
|
191
|
-
tooltipSeriesColor: { (): string; (_: string): ITooltip; };
|
|
192
|
-
tooltipLabelColor: { (): string; (_: string): ITooltip; };
|
|
193
|
-
tooltipLabelColor_exists: () => boolean;
|
|
194
|
-
tooltipValueColor: { (): string; (_: string): ITooltip; };
|
|
195
|
-
tooltipTick: { (): boolean; (_: boolean): ITooltip; };
|
|
196
|
-
tooltipOffset: { (): number; (_: number): ITooltip; };
|
|
197
|
-
tooltipOffset_default: { (): number; (_: number): ITooltip; };
|
|
198
|
-
}
|
|
199
|
-
ITooltip.prototype.publish("tooltipStyle", "default", "set", "Style mode", ["default", "none", "series-table"], {});
|
|
200
|
-
ITooltip.prototype.publish("tooltipFollowMouse", false, "boolean", "If true, the tooltip will follow mouse movement", null, {});
|
|
201
|
-
ITooltip.prototype.publish("tooltipLabelFormat", undefined, "string", "Format of tooltip label(s) (the domain axis)", null, {});
|
|
202
|
-
ITooltip.prototype.publish("tooltipValueFormat", undefined, "string", "Number format of tooltip value(s)", null, {});
|
|
203
|
-
ITooltip.prototype.publish("tooltipSeriesColor", "#EAFFFF", "html-color", "Color of tooltip series text", null, {});
|
|
204
|
-
ITooltip.prototype.publish("tooltipLabelColor", "#CCFFFF", "html-color", "Color of tooltip label text (the domain axis)", null, {});
|
|
205
|
-
ITooltip.prototype.publish("tooltipValueColor", "white", "html-color", "Color of tooltip value(s)", null, {});
|
|
206
|
-
ITooltip.prototype.publish("tooltipTick", true, "boolean", "Show tooltip tick", null, {});
|
|
207
|
-
ITooltip.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor", null, {});
|
|
208
|
-
|
|
209
|
-
const tooltipLabelFormat = ITooltip.prototype.tooltipLabelFormat;
|
|
210
|
-
ITooltip.prototype.tooltipLabelFormat = function (_?): string | ITooltip {
|
|
211
|
-
const retVal = tooltipLabelFormat.apply(this, arguments);
|
|
212
|
-
if (arguments.length) {
|
|
213
|
-
this._labelFormatter = d3Format(_);
|
|
214
|
-
}
|
|
215
|
-
return retVal;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const tooltipValueFormat = ITooltip.prototype.tooltipValueFormat;
|
|
219
|
-
ITooltip.prototype.tooltipValueFormat = function (_?): string | ITooltip {
|
|
220
|
-
const retVal = tooltipValueFormat.apply(this, arguments);
|
|
221
|
-
if (arguments.length) {
|
|
222
|
-
this._valueFormatter = d3Format(_);
|
|
223
|
-
}
|
|
224
|
-
return retVal;
|
|
225
|
-
};
|
|
1
|
+
import { Widget } from "@hpcc-js/common";
|
|
2
|
+
import { format as d3Format } from "d3-format";
|
|
3
|
+
import { tip } from "./Tooltip.ts";
|
|
4
|
+
|
|
5
|
+
import "../src/ITooltip.css";
|
|
6
|
+
|
|
7
|
+
declare const event: object;
|
|
8
|
+
|
|
9
|
+
// Use old school class declaration as this is a mixin ---
|
|
10
|
+
export function ITooltip(this: any) {
|
|
11
|
+
this.tooltip = tip();
|
|
12
|
+
|
|
13
|
+
if (this.tooltipLabelFormat_exists()) {
|
|
14
|
+
this._labelFormatter = d3Format(this.tooltipLabelFormat() as string);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (this.tooltipValueFormat_exists()) {
|
|
18
|
+
this._valueFormatter = d3Format(this.tooltipValueFormat() as string);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (this.layerEnter) {
|
|
22
|
+
const layerEnter = this.layerEnter;
|
|
23
|
+
this.layerEnter = function (_base, svgElement, _domElement) {
|
|
24
|
+
if (!this._parentOverlay) {
|
|
25
|
+
this._parentOverlay = _base._parentOverlay;
|
|
26
|
+
}
|
|
27
|
+
this.tooltipEnter(svgElement);
|
|
28
|
+
layerEnter.apply(this, arguments);
|
|
29
|
+
};
|
|
30
|
+
const layerUpdate = this.layerUpdate;
|
|
31
|
+
this.layerUpdate = function (_base) {
|
|
32
|
+
layerUpdate.apply(this, arguments);
|
|
33
|
+
this.tooltipUpdate();
|
|
34
|
+
};
|
|
35
|
+
const layerExit = this.layerExit;
|
|
36
|
+
this.layerExit = function (_base) {
|
|
37
|
+
this.tooltipExit();
|
|
38
|
+
layerExit.apply(this, arguments);
|
|
39
|
+
};
|
|
40
|
+
} else {
|
|
41
|
+
const enter = this.enter;
|
|
42
|
+
this.enter = function (_domNode, element) {
|
|
43
|
+
this.tooltipEnter(element);
|
|
44
|
+
enter.apply(this, arguments);
|
|
45
|
+
};
|
|
46
|
+
const update = this.update;
|
|
47
|
+
this.update = function (_domNode, _element) {
|
|
48
|
+
update.apply(this, arguments);
|
|
49
|
+
this.tooltipUpdate();
|
|
50
|
+
};
|
|
51
|
+
const exit = this.exit;
|
|
52
|
+
this.exit = function (_domNode, _element) {
|
|
53
|
+
this.tooltipExit();
|
|
54
|
+
exit.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
ITooltip.prototype = Object.create(Widget.prototype);
|
|
59
|
+
ITooltip.prototype.constructor = ITooltip;
|
|
60
|
+
|
|
61
|
+
// abstract target(): any;
|
|
62
|
+
// abstract target(_: any): this;
|
|
63
|
+
|
|
64
|
+
ITooltip.prototype.tooltipEnter = function (element) {
|
|
65
|
+
const overlayElement = this.parentOverlay();
|
|
66
|
+
if (!overlayElement.empty()) {
|
|
67
|
+
this.tooltip.rootElement(overlayElement.node().parentNode);
|
|
68
|
+
}
|
|
69
|
+
element.call(this.tooltip);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
ITooltip.prototype.tooltipUpdate = function () {
|
|
73
|
+
this.tooltip.offset(() => {
|
|
74
|
+
if (event && this.tooltipFollowMouse()) {
|
|
75
|
+
const d3tipElement: HTMLDivElement = document.querySelector(".d3-tip"); // d3Tip offers no reference to the '.d3-tip' element...?
|
|
76
|
+
d3tipElement.style.display = "block";
|
|
77
|
+
d3tipElement.style.left = this.tooltipOffset() + ((event as any).clientX) + "px";
|
|
78
|
+
d3tipElement.style.top = (event as any).clientY + "px";
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
switch (this.tooltip.direction()()) {
|
|
82
|
+
case "e":
|
|
83
|
+
return [0, this.tooltipOffset()];
|
|
84
|
+
default:
|
|
85
|
+
return [-this.tooltipOffset(), 0];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
let classed = this.tooltip.attr("class");
|
|
90
|
+
if (classed) {
|
|
91
|
+
classed = classed.split(" notick").join("") + (this.tooltipTick() ? "" : " notick") + (this.tooltipStyle() === "none" ? " hidden" : "");
|
|
92
|
+
classed = classed.split(" ")
|
|
93
|
+
.filter(function (_class) {
|
|
94
|
+
return _class.indexOf("ITooltip-tooltipStyle-") !== 0;
|
|
95
|
+
})
|
|
96
|
+
.join(" ")
|
|
97
|
+
;
|
|
98
|
+
classed += " ITooltip-tooltipStyle-" + this.tooltipStyle();
|
|
99
|
+
this.tooltip
|
|
100
|
+
.attr("class", classed)
|
|
101
|
+
;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
ITooltip.prototype.tooltipExit = function () {
|
|
106
|
+
if (this.tooltip) {
|
|
107
|
+
this.tooltip.destroy();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
ITooltip.prototype._tooltipHTML = function (d) {
|
|
112
|
+
return d;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
ITooltip.prototype.tooltipHTML = function (_) {
|
|
116
|
+
return this.tooltip.html(_);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
ITooltip.prototype.tooltipFormat = function (opts: { label?: string | number, series?: string | number, value?: Date | string | number, arr?: Array<{ color: string, label: string, value: string }> } = {}) {
|
|
120
|
+
opts.label = opts.label === undefined ? "" : opts.label;
|
|
121
|
+
if (this._labelFormatter) {
|
|
122
|
+
opts.label = this._labelFormatter(opts.label) || "";
|
|
123
|
+
} else if (this.formatData && this.parseData) {
|
|
124
|
+
opts.label = this.formatData(this.parseData(opts.label));
|
|
125
|
+
}
|
|
126
|
+
opts.series = opts.series || "";
|
|
127
|
+
if (opts.value instanceof Date) {
|
|
128
|
+
opts.value = opts.value || "";
|
|
129
|
+
} else if (this._valueFormatter) {
|
|
130
|
+
opts.value = this._valueFormatter(opts.value) || "";
|
|
131
|
+
} else if (this.formatValue && this.parseValue) {
|
|
132
|
+
opts.value = this.formatValue(this.parseValue(opts.value));
|
|
133
|
+
}
|
|
134
|
+
switch (this.tooltipStyle()) {
|
|
135
|
+
case "none":
|
|
136
|
+
break;
|
|
137
|
+
case "series-table":
|
|
138
|
+
let html = '<table class="ITooltip-series-table">'
|
|
139
|
+
+ "<thead>"
|
|
140
|
+
+ '<tr><th colspan="2">' + opts.label + "</th></tr>"
|
|
141
|
+
+ "</thead>"
|
|
142
|
+
+ "<tbody>";
|
|
143
|
+
opts.arr.forEach(function (row) {
|
|
144
|
+
html += "<tr>";
|
|
145
|
+
html += "<td>";
|
|
146
|
+
html += '<div class="series-table-row-color" style="background-color:' + row.color + '"></div>';
|
|
147
|
+
html += '<div class="series-table-row-label">' + row.label + "</div>";
|
|
148
|
+
html += "</td>";
|
|
149
|
+
html += '<td><div class="series-table-row-value">' + row.value + "</div></td>";
|
|
150
|
+
html += "</tr>";
|
|
151
|
+
});
|
|
152
|
+
html += "</tbody>";
|
|
153
|
+
html += "</table>";
|
|
154
|
+
return html;
|
|
155
|
+
default:
|
|
156
|
+
if (opts.series) {
|
|
157
|
+
return "<span style='color:" + this.tooltipSeriesColor() + "'>" + opts.series + "</span> / <span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
|
|
158
|
+
}
|
|
159
|
+
if (opts.label !== "") {
|
|
160
|
+
return "<span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
|
|
161
|
+
}
|
|
162
|
+
return "<span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>";
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
ITooltip.prototype.tooltipKeyValueFormat = function (titleKey: string, obj: object): string {
|
|
167
|
+
let body = "";
|
|
168
|
+
for (const key in obj) {
|
|
169
|
+
if (key !== titleKey) {
|
|
170
|
+
const value = obj && obj[key] ? obj[key] : "";
|
|
171
|
+
body += `<tr><td style="${this.tooltipLabelColor_exists() ? "color:" + this.tooltipLabelColor() : ""}">${key}</td><td style="font-weight:normal">${value}</td></tr>`;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return `<table>
|
|
175
|
+
<thead>
|
|
176
|
+
<tr><th colspan="2" style="font-weight:bold;font-size:16px">${obj[titleKey]}</th></tr>
|
|
177
|
+
</thead>
|
|
178
|
+
<tbody>
|
|
179
|
+
${body}
|
|
180
|
+
</tbody>
|
|
181
|
+
</table>`;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export interface ITooltip {
|
|
185
|
+
tooltipStyle: { (): "default" | "none" | "series-table"; (_: "default" | "none" | "series-table"): ITooltip; };
|
|
186
|
+
tooltipFollowMouse: { (): boolean; (_: boolean): ITooltip; };
|
|
187
|
+
tooltipLabelFormat: (_?) => string | ITooltip;
|
|
188
|
+
tooltipLabelFormat_exists: () => boolean;
|
|
189
|
+
tooltipValueFormat: (_?) => string | ITooltip;
|
|
190
|
+
tooltipValueFormat_exists: () => boolean;
|
|
191
|
+
tooltipSeriesColor: { (): string; (_: string): ITooltip; };
|
|
192
|
+
tooltipLabelColor: { (): string; (_: string): ITooltip; };
|
|
193
|
+
tooltipLabelColor_exists: () => boolean;
|
|
194
|
+
tooltipValueColor: { (): string; (_: string): ITooltip; };
|
|
195
|
+
tooltipTick: { (): boolean; (_: boolean): ITooltip; };
|
|
196
|
+
tooltipOffset: { (): number; (_: number): ITooltip; };
|
|
197
|
+
tooltipOffset_default: { (): number; (_: number): ITooltip; };
|
|
198
|
+
}
|
|
199
|
+
ITooltip.prototype.publish("tooltipStyle", "default", "set", "Style mode", ["default", "none", "series-table"], {});
|
|
200
|
+
ITooltip.prototype.publish("tooltipFollowMouse", false, "boolean", "If true, the tooltip will follow mouse movement", null, {});
|
|
201
|
+
ITooltip.prototype.publish("tooltipLabelFormat", undefined, "string", "Format of tooltip label(s) (the domain axis)", null, {});
|
|
202
|
+
ITooltip.prototype.publish("tooltipValueFormat", undefined, "string", "Number format of tooltip value(s)", null, {});
|
|
203
|
+
ITooltip.prototype.publish("tooltipSeriesColor", "#EAFFFF", "html-color", "Color of tooltip series text", null, {});
|
|
204
|
+
ITooltip.prototype.publish("tooltipLabelColor", "#CCFFFF", "html-color", "Color of tooltip label text (the domain axis)", null, {});
|
|
205
|
+
ITooltip.prototype.publish("tooltipValueColor", "white", "html-color", "Color of tooltip value(s)", null, {});
|
|
206
|
+
ITooltip.prototype.publish("tooltipTick", true, "boolean", "Show tooltip tick", null, {});
|
|
207
|
+
ITooltip.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor", null, {});
|
|
208
|
+
|
|
209
|
+
const tooltipLabelFormat = ITooltip.prototype.tooltipLabelFormat;
|
|
210
|
+
ITooltip.prototype.tooltipLabelFormat = function (_?): string | ITooltip {
|
|
211
|
+
const retVal = tooltipLabelFormat.apply(this, arguments);
|
|
212
|
+
if (arguments.length) {
|
|
213
|
+
this._labelFormatter = d3Format(_);
|
|
214
|
+
}
|
|
215
|
+
return retVal;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const tooltipValueFormat = ITooltip.prototype.tooltipValueFormat;
|
|
219
|
+
ITooltip.prototype.tooltipValueFormat = function (_?): string | ITooltip {
|
|
220
|
+
const retVal = tooltipValueFormat.apply(this, arguments);
|
|
221
|
+
if (arguments.length) {
|
|
222
|
+
this._valueFormatter = d3Format(_);
|
|
223
|
+
}
|
|
224
|
+
return retVal;
|
|
225
|
+
};
|
package/src/ITree.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Palette } from "@hpcc-js/common";
|
|
2
|
-
|
|
3
|
-
// Use old school class declaration as this is a mixin ---
|
|
4
|
-
export function ITree() {
|
|
5
|
-
}
|
|
6
|
-
ITree.prototype.constructor = ITree;
|
|
7
|
-
|
|
8
|
-
// Events ---
|
|
9
|
-
ITree.prototype.click = function (row, column, selected) {
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
ITree.prototype.dblclick = function (row, column, selected) {
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
ITree.prototype._palette = Palette.ordinal("default");
|
|
1
|
+
import { Palette } from "@hpcc-js/common";
|
|
2
|
+
|
|
3
|
+
// Use old school class declaration as this is a mixin ---
|
|
4
|
+
export function ITree() {
|
|
5
|
+
}
|
|
6
|
+
ITree.prototype.constructor = ITree;
|
|
7
|
+
|
|
8
|
+
// Events ---
|
|
9
|
+
ITree.prototype.click = function (row, column, selected) {
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
ITree.prototype.dblclick = function (row, column, selected) {
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
ITree.prototype._palette = Palette.ordinal("default");
|