@hpcc-js/chart 2.86.2 → 2.86.3

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.
Files changed (78) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +93 -93
  3. package/dist/index.es6.js.map +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/package.json +6 -6
  7. package/src/Area.md +176 -176
  8. package/src/Area.ts +12 -12
  9. package/src/Axis.css +34 -34
  10. package/src/Axis.ts +733 -733
  11. package/src/Bar.md +90 -90
  12. package/src/Bar.ts +9 -9
  13. package/src/Bubble.css +16 -16
  14. package/src/Bubble.md +69 -69
  15. package/src/Bubble.ts +191 -191
  16. package/src/BubbleXY.ts +14 -14
  17. package/src/Bullet.css +60 -60
  18. package/src/Bullet.md +104 -104
  19. package/src/Bullet.ts +167 -167
  20. package/src/Column.css +17 -17
  21. package/src/Column.md +90 -90
  22. package/src/Column.ts +659 -659
  23. package/src/Contour.md +88 -88
  24. package/src/Contour.ts +97 -97
  25. package/src/D3Cloud.ts +400 -400
  26. package/src/Gantt.md +119 -119
  27. package/src/Gantt.ts +14 -14
  28. package/src/Gauge.md +148 -148
  29. package/src/Gauge.ts +358 -358
  30. package/src/HalfPie.md +62 -62
  31. package/src/HalfPie.ts +26 -26
  32. package/src/Heat.md +42 -42
  33. package/src/Heat.ts +283 -283
  34. package/src/HexBin.css +9 -9
  35. package/src/HexBin.md +88 -88
  36. package/src/HexBin.ts +139 -139
  37. package/src/Line.css +6 -6
  38. package/src/Line.md +170 -170
  39. package/src/Line.ts +14 -14
  40. package/src/Pie.css +23 -23
  41. package/src/Pie.md +88 -88
  42. package/src/Pie.ts +503 -503
  43. package/src/QuarterPie.md +61 -61
  44. package/src/QuarterPie.ts +35 -35
  45. package/src/QuartileCandlestick.md +129 -129
  46. package/src/QuartileCandlestick.ts +349 -349
  47. package/src/Radar.css +15 -15
  48. package/src/Radar.md +104 -104
  49. package/src/Radar.ts +336 -336
  50. package/src/RadialBar.css +25 -25
  51. package/src/RadialBar.md +91 -91
  52. package/src/RadialBar.ts +212 -212
  53. package/src/Scatter.css +16 -16
  54. package/src/Scatter.md +163 -163
  55. package/src/Scatter.ts +376 -376
  56. package/src/StatChart.md +117 -117
  57. package/src/StatChart.ts +253 -253
  58. package/src/Step.md +163 -163
  59. package/src/Step.ts +12 -12
  60. package/src/Summary.css +56 -56
  61. package/src/Summary.md +219 -219
  62. package/src/Summary.ts +322 -322
  63. package/src/SummaryC.md +154 -154
  64. package/src/SummaryC.ts +240 -240
  65. package/src/WordCloud.css +3 -3
  66. package/src/WordCloud.md +144 -144
  67. package/src/WordCloud.ts +263 -263
  68. package/src/XYAxis.css +41 -41
  69. package/src/XYAxis.md +149 -149
  70. package/src/XYAxis.ts +803 -803
  71. package/src/__package__.ts +3 -3
  72. package/src/__tests__/heat.ts +71 -71
  73. package/src/__tests__/index.ts +3 -3
  74. package/src/__tests__/pie.ts +20 -20
  75. package/src/__tests__/stat.ts +16 -16
  76. package/src/__tests__/test3.ts +69 -69
  77. package/src/index.ts +27 -27
  78. package/src/test.ts +71 -71
package/src/Bubble.ts CHANGED
@@ -1,191 +1,191 @@
1
- import { I2DChart, ITooltip } from "@hpcc-js/api";
2
- import { FAChar, InputField, ISize, SVGWidget, Text, Utility } from "@hpcc-js/common";
3
- import { hierarchy as d3Hierarchy, pack as d3Pack } from "d3-hierarchy";
4
- import { select as d3Select } from "d3-selection";
5
-
6
- import "../src/Bubble.css";
7
-
8
- export class Bubble extends SVGWidget {
9
- static __inputs: InputField[] = [{
10
- id: "label",
11
- type: "string"
12
- }, {
13
- id: "value",
14
- type: "number"
15
- }];
16
-
17
- labelWidgets;
18
- d3Pack;
19
-
20
- constructor() {
21
- super();
22
- I2DChart.call(this);
23
- ITooltip.call(this);
24
- Utility.SimpleSelectionMixin.call(this);
25
-
26
- this._drawStartPos = "origin";
27
-
28
- this.labelWidgets = {};
29
-
30
- this.d3Pack = d3Pack()
31
- .size([this.width(), this.height()])
32
- .padding(1.5)
33
- ;
34
- }
35
-
36
- size(): ISize;
37
- size(_): this;
38
- size(_?): ISize | this {
39
- const retVal = super.size.apply(this, arguments);
40
- if (arguments.length) {
41
- this.d3Pack
42
- .size([this.width(), this.height()])
43
- ;
44
- }
45
- return retVal;
46
- }
47
-
48
- enter(domNode, element) {
49
- super.enter(domNode, element);
50
- this._selection.widgetElement(element);
51
- const context = this;
52
- this
53
- .tooltipHTML(function (d) {
54
- switch (context.tooltipStyle()) {
55
- case "series-table":
56
- return context.tooltipFormat({
57
- label: d[0],
58
- arr: context.columns().slice(1).map(function (column, i) {
59
- return {
60
- label: column,
61
- color: context._palette(d[0]),
62
- value: d[1]
63
- };
64
- })
65
- });
66
- default:
67
- return context.tooltipFormat({ label: d.data[0], value: d.data[1] });
68
- }
69
- })
70
- ;
71
- }
72
-
73
- update(domNode, element) {
74
- super.update(domNode, element);
75
- const context = this;
76
-
77
- this._palette = this._palette.switch(this.paletteID());
78
- if (this.useClonedPalette()) {
79
- this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
80
- }
81
-
82
- const root = d3Hierarchy({ children: this.cloneData() })
83
- .sum(function (d) { return d[1]; })
84
- .sort(function (b, a) {
85
- return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0;
86
- })
87
- ;
88
- this.d3Pack(root);
89
-
90
- const node = element.selectAll(".node").data(root.children || [], d => d.data[0]);
91
-
92
- // Enter ---
93
- node.enter().append("g")
94
- .attr("class", (d, i) => "node series series-" + this.cssTag(d.data[0]))
95
- .attr("opacity", 0)
96
- .call(this._selection.enter.bind(this._selection))
97
- .on("click", function (d) {
98
- context.click(context.rowToObj(d.data), context.columns()[1], context._selection.selected(this));
99
- })
100
- .on("dblclick", function (d) {
101
- context.dblclick(context.rowToObj(d.data), context.columns()[1], context._selection.selected(this));
102
- })
103
- .each(function (d) {
104
- const element2 = d3Select(this);
105
- const pos = { x: d.x, y: d.y };
106
- element2.append("circle")
107
- .attr("transform", "translate(" + pos.x + "," + pos.y + ")")
108
- .attr("r", 0)
109
- .on("mouseout.tooltip", context.tooltip.hide)
110
- .on("mousemove.tooltip", context.tooltip.show)
111
- ;
112
- if (d.__viz_faChar) {
113
- context.labelWidgets[d.data[0]] = new FAChar()
114
- .char(d.__viz_faChar)
115
- .target(this)
116
- .render()
117
- ;
118
- } else {
119
- context.labelWidgets[d.data[0]] = new Text()
120
- .text(d.data[0])
121
- .target(this)
122
- .render()
123
- ;
124
- }
125
- })
126
- .merge(node).transition()
127
- .attr("opacity", 1)
128
- .each(function (d) {
129
- const element2 = d3Select(this);
130
- const pos = { x: d.x, y: d.y };
131
- element2.select("circle").transition()
132
- .attr("transform", "translate(" + pos.x + "," + pos.y + ")")
133
- .style("fill", context.fillColor(d.data, context.columns()[1], d.data[1]))
134
- .attr("r", d.r)
135
- .select("title")
136
- .text(d.data[0] + " (" + d.data[1] + ")")
137
- ;
138
- if (d.__viz_faChar) {
139
- context.labelWidgets[d.data[0]]
140
- .pos(pos)
141
- .render()
142
- ;
143
- } else {
144
- context.labelWidgets[d.data[0]]
145
- .pos(pos)
146
- .colorFill_default(context.textColor(d.data, context.columns()[1], d.data[1]))
147
- .width(d.r * 2)
148
- .text(d.data[0])
149
- .render()
150
- ;
151
- }
152
- })
153
- ;
154
-
155
- // Exit ---
156
- node.exit().transition()
157
- .style("opacity", 0)
158
- .remove()
159
- ;
160
- }
161
-
162
- exit(domNode, element) {
163
- super.exit(domNode, element);
164
- }
165
-
166
- paletteID: { (): string; (_: string): Bubble; };
167
- useClonedPalette: { (): boolean; (_: boolean): Bubble; };
168
-
169
- // I2DChart
170
- _palette;
171
- fillColor: (row: any[], column: string, value: number) => string;
172
- textColor: (row: any[], column: string, value: number) => string;
173
- click: (row, column, selected) => void;
174
- dblclick: (row, column, selected) => void;
175
-
176
- // ITooltip
177
- tooltip;
178
- tooltipHTML: (_) => string;
179
- tooltipFormat: (_) => string;
180
- tooltipStyle: () => "default" | "none" | "series-table";
181
-
182
- // SimpleSelectionMixin
183
- _selection;
184
- }
185
- Bubble.prototype._class += " chart_Bubble";
186
- Bubble.prototype.implements(I2DChart.prototype);
187
- Bubble.prototype.implements(ITooltip.prototype);
188
- Bubble.prototype.mixin(Utility.SimpleSelectionMixin);
189
-
190
- Bubble.prototype.publish("paletteID", "default", "set", "Color palette for this widget", Bubble.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
191
- Bubble.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
1
+ import { I2DChart, ITooltip } from "@hpcc-js/api";
2
+ import { FAChar, InputField, ISize, SVGWidget, Text, Utility } from "@hpcc-js/common";
3
+ import { hierarchy as d3Hierarchy, pack as d3Pack } from "d3-hierarchy";
4
+ import { select as d3Select } from "d3-selection";
5
+
6
+ import "../src/Bubble.css";
7
+
8
+ export class Bubble extends SVGWidget {
9
+ static __inputs: InputField[] = [{
10
+ id: "label",
11
+ type: "string"
12
+ }, {
13
+ id: "value",
14
+ type: "number"
15
+ }];
16
+
17
+ labelWidgets;
18
+ d3Pack;
19
+
20
+ constructor() {
21
+ super();
22
+ I2DChart.call(this);
23
+ ITooltip.call(this);
24
+ Utility.SimpleSelectionMixin.call(this);
25
+
26
+ this._drawStartPos = "origin";
27
+
28
+ this.labelWidgets = {};
29
+
30
+ this.d3Pack = d3Pack()
31
+ .size([this.width(), this.height()])
32
+ .padding(1.5)
33
+ ;
34
+ }
35
+
36
+ size(): ISize;
37
+ size(_): this;
38
+ size(_?): ISize | this {
39
+ const retVal = super.size.apply(this, arguments);
40
+ if (arguments.length) {
41
+ this.d3Pack
42
+ .size([this.width(), this.height()])
43
+ ;
44
+ }
45
+ return retVal;
46
+ }
47
+
48
+ enter(domNode, element) {
49
+ super.enter(domNode, element);
50
+ this._selection.widgetElement(element);
51
+ const context = this;
52
+ this
53
+ .tooltipHTML(function (d) {
54
+ switch (context.tooltipStyle()) {
55
+ case "series-table":
56
+ return context.tooltipFormat({
57
+ label: d[0],
58
+ arr: context.columns().slice(1).map(function (column, i) {
59
+ return {
60
+ label: column,
61
+ color: context._palette(d[0]),
62
+ value: d[1]
63
+ };
64
+ })
65
+ });
66
+ default:
67
+ return context.tooltipFormat({ label: d.data[0], value: d.data[1] });
68
+ }
69
+ })
70
+ ;
71
+ }
72
+
73
+ update(domNode, element) {
74
+ super.update(domNode, element);
75
+ const context = this;
76
+
77
+ this._palette = this._palette.switch(this.paletteID());
78
+ if (this.useClonedPalette()) {
79
+ this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
80
+ }
81
+
82
+ const root = d3Hierarchy({ children: this.cloneData() })
83
+ .sum(function (d) { return d[1]; })
84
+ .sort(function (b, a) {
85
+ return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0;
86
+ })
87
+ ;
88
+ this.d3Pack(root);
89
+
90
+ const node = element.selectAll(".node").data(root.children || [], d => d.data[0]);
91
+
92
+ // Enter ---
93
+ node.enter().append("g")
94
+ .attr("class", (d, i) => "node series series-" + this.cssTag(d.data[0]))
95
+ .attr("opacity", 0)
96
+ .call(this._selection.enter.bind(this._selection))
97
+ .on("click", function (d) {
98
+ context.click(context.rowToObj(d.data), context.columns()[1], context._selection.selected(this));
99
+ })
100
+ .on("dblclick", function (d) {
101
+ context.dblclick(context.rowToObj(d.data), context.columns()[1], context._selection.selected(this));
102
+ })
103
+ .each(function (d) {
104
+ const element2 = d3Select(this);
105
+ const pos = { x: d.x, y: d.y };
106
+ element2.append("circle")
107
+ .attr("transform", "translate(" + pos.x + "," + pos.y + ")")
108
+ .attr("r", 0)
109
+ .on("mouseout.tooltip", context.tooltip.hide)
110
+ .on("mousemove.tooltip", context.tooltip.show)
111
+ ;
112
+ if (d.__viz_faChar) {
113
+ context.labelWidgets[d.data[0]] = new FAChar()
114
+ .char(d.__viz_faChar)
115
+ .target(this)
116
+ .render()
117
+ ;
118
+ } else {
119
+ context.labelWidgets[d.data[0]] = new Text()
120
+ .text(d.data[0])
121
+ .target(this)
122
+ .render()
123
+ ;
124
+ }
125
+ })
126
+ .merge(node).transition()
127
+ .attr("opacity", 1)
128
+ .each(function (d) {
129
+ const element2 = d3Select(this);
130
+ const pos = { x: d.x, y: d.y };
131
+ element2.select("circle").transition()
132
+ .attr("transform", "translate(" + pos.x + "," + pos.y + ")")
133
+ .style("fill", context.fillColor(d.data, context.columns()[1], d.data[1]))
134
+ .attr("r", d.r)
135
+ .select("title")
136
+ .text(d.data[0] + " (" + d.data[1] + ")")
137
+ ;
138
+ if (d.__viz_faChar) {
139
+ context.labelWidgets[d.data[0]]
140
+ .pos(pos)
141
+ .render()
142
+ ;
143
+ } else {
144
+ context.labelWidgets[d.data[0]]
145
+ .pos(pos)
146
+ .colorFill_default(context.textColor(d.data, context.columns()[1], d.data[1]))
147
+ .width(d.r * 2)
148
+ .text(d.data[0])
149
+ .render()
150
+ ;
151
+ }
152
+ })
153
+ ;
154
+
155
+ // Exit ---
156
+ node.exit().transition()
157
+ .style("opacity", 0)
158
+ .remove()
159
+ ;
160
+ }
161
+
162
+ exit(domNode, element) {
163
+ super.exit(domNode, element);
164
+ }
165
+
166
+ paletteID: { (): string; (_: string): Bubble; };
167
+ useClonedPalette: { (): boolean; (_: boolean): Bubble; };
168
+
169
+ // I2DChart
170
+ _palette;
171
+ fillColor: (row: any[], column: string, value: number) => string;
172
+ textColor: (row: any[], column: string, value: number) => string;
173
+ click: (row, column, selected) => void;
174
+ dblclick: (row, column, selected) => void;
175
+
176
+ // ITooltip
177
+ tooltip;
178
+ tooltipHTML: (_) => string;
179
+ tooltipFormat: (_) => string;
180
+ tooltipStyle: () => "default" | "none" | "series-table";
181
+
182
+ // SimpleSelectionMixin
183
+ _selection;
184
+ }
185
+ Bubble.prototype._class += " chart_Bubble";
186
+ Bubble.prototype.implements(I2DChart.prototype);
187
+ Bubble.prototype.implements(ITooltip.prototype);
188
+ Bubble.prototype.mixin(Utility.SimpleSelectionMixin);
189
+
190
+ Bubble.prototype.publish("paletteID", "default", "set", "Color palette for this widget", Bubble.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
191
+ Bubble.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
package/src/BubbleXY.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { Scatter } from "./Scatter";
2
-
3
- export class BubbleXY extends Scatter {
4
- constructor() {
5
- super();
6
- }
7
- enter(domNode, element) {
8
- if (!this.pointSizeColumn_exists()) {
9
- this.pointSizeColumn(this.columns()[this.columns().length - 1]);
10
- }
11
- super.enter(domNode, element);
12
- }
13
- }
14
- BubbleXY.prototype._class += " chart_BubbleXY";
1
+ import { Scatter } from "./Scatter";
2
+
3
+ export class BubbleXY extends Scatter {
4
+ constructor() {
5
+ super();
6
+ }
7
+ enter(domNode, element) {
8
+ if (!this.pointSizeColumn_exists()) {
9
+ this.pointSizeColumn(this.columns()[this.columns().length - 1]);
10
+ }
11
+ super.enter(domNode, element);
12
+ }
13
+ }
14
+ BubbleXY.prototype._class += " chart_BubbleXY";
package/src/Bullet.css CHANGED
@@ -1,60 +1,60 @@
1
- .chart_Bullet .domain {
2
- opacity: 0;
3
- }
4
-
5
- .chart_Bullet .bullet {
6
- border: solid 1px;
7
- border-color: transparent;
8
- font: 10px sans-serif;
9
- }
10
-
11
- .chart_Bullet .bullet.selected {
12
- border-color: red;
13
- }
14
-
15
- .chart_Bullet .bullet.over {
16
- border-color: orange;
17
- }
18
-
19
- .chart_Bullet .bullet.selected.over {
20
- border-color: red;
21
- }
22
-
23
- .chart_Bullet .bullet .marker {
24
- stroke: #000;
25
- stroke-width: 2px;
26
- }
27
-
28
- .chart_Bullet .bullet .tick line {
29
- stroke: #666;
30
- stroke-width: .5px;
31
- }
32
-
33
- .chart_Bullet .bullet .range.s0 {
34
- fill: #eee;
35
- }
36
-
37
- .chart_Bullet .bullet .range.s1 {
38
- fill: #ddd;
39
- }
40
-
41
- .chart_Bullet .bullet .range.s2 {
42
- fill: #ccc;
43
- }
44
-
45
- .chart_Bullet .bullet .measure.s0 {
46
- fill: lightsteelblue;
47
- }
48
-
49
- .chart_Bullet .bullet .measure.s1 {
50
- fill: steelblue;
51
- }
52
-
53
- .chart_Bullet .bullet .title {
54
- font-size: 14px;
55
- font-weight: bold;
56
- }
57
-
58
- .chart_Bullet .bullet .subtitle {
59
- fill: #999;
60
- }
1
+ .chart_Bullet .domain {
2
+ opacity: 0;
3
+ }
4
+
5
+ .chart_Bullet .bullet {
6
+ border: solid 1px;
7
+ border-color: transparent;
8
+ font: 10px sans-serif;
9
+ }
10
+
11
+ .chart_Bullet .bullet.selected {
12
+ border-color: red;
13
+ }
14
+
15
+ .chart_Bullet .bullet.over {
16
+ border-color: orange;
17
+ }
18
+
19
+ .chart_Bullet .bullet.selected.over {
20
+ border-color: red;
21
+ }
22
+
23
+ .chart_Bullet .bullet .marker {
24
+ stroke: #000;
25
+ stroke-width: 2px;
26
+ }
27
+
28
+ .chart_Bullet .bullet .tick line {
29
+ stroke: #666;
30
+ stroke-width: .5px;
31
+ }
32
+
33
+ .chart_Bullet .bullet .range.s0 {
34
+ fill: #eee;
35
+ }
36
+
37
+ .chart_Bullet .bullet .range.s1 {
38
+ fill: #ddd;
39
+ }
40
+
41
+ .chart_Bullet .bullet .range.s2 {
42
+ fill: #ccc;
43
+ }
44
+
45
+ .chart_Bullet .bullet .measure.s0 {
46
+ fill: lightsteelblue;
47
+ }
48
+
49
+ .chart_Bullet .bullet .measure.s1 {
50
+ fill: steelblue;
51
+ }
52
+
53
+ .chart_Bullet .bullet .title {
54
+ font-size: 14px;
55
+ font-weight: bold;
56
+ }
57
+
58
+ .chart_Bullet .bullet .subtitle {
59
+ fill: #999;
60
+ }