@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/Contour.md CHANGED
@@ -1,88 +1,88 @@
1
- # Contour
2
-
3
- <!--meta
4
-
5
- -->
6
-
7
- Contour and [HexBin](./HexBin.md) serve a similar purpose. They summarize high density data across two continuous axes.
8
-
9
-
10
- <ClientOnly>
11
- <hpcc-vitepress style="width:100%;height:600px">
12
- <div id="placeholder" style="height:400px">
13
- </div>
14
- <script type="module">
15
- import { Contour } from "@hpcc-js/chart";
16
-
17
- new Contour()
18
- .target("placeholder")
19
- .columns(["X-Value", "Y-Value"])
20
- .data(randomData(1000))
21
- .xAxisType("linear")
22
- .render()
23
- ;
24
-
25
- function randomData(count){
26
- return Array(count).fill(1).map((n,x)=>{
27
- const y = Math.sqrt(x) * Math.random();
28
- return [x,y];
29
- });
30
- }
31
- </script>
32
- </hpcc-vitepress>
33
- </ClientOnly>
34
-
35
-
36
- _contourBandwidth_ can be used to control the standard deviation of the contour algorithm. The results can be seen in the below example.
37
-
38
-
39
- <ClientOnly>
40
- <hpcc-vitepress style="width:100%;height:600px">
41
- <div id="placeholder" style="height:400px">
42
- </div>
43
- <script type="module">
44
- import { Contour } from "@hpcc-js/chart";
45
-
46
- let bandwidth = 10;
47
-
48
- const widget = new Contour()
49
- .target("placeholder")
50
- .columns(["X-Value", "Y-Value"])
51
- .data(randomData(1000))
52
- .xAxisType("linear")
53
- .xAxisTickCount(10)
54
- .contourBandwidth(bandwidth)
55
- .render()
56
- ;
57
-
58
- function randomData(count){
59
- return Array(count).fill(1).map((n,x)=>{
60
- const y = Math.sqrt(x) * Math.random();
61
- return [x,y];
62
- });
63
- }
64
- let interval = 10;
65
- setInterval(function(){
66
- const next = bandwidth + interval;
67
- if(next > 100 || next <= 0){
68
- interval *= -1;
69
- }
70
- bandwidth += interval;
71
- widget
72
- .xAxisTitle("bandwidth = " + bandwidth)
73
- .contourBandwidth(bandwidth)
74
- .render()
75
- ;
76
- },1000);
77
- </script>
78
- </hpcc-vitepress>
79
- </ClientOnly>
80
-
81
-
82
- For documentation on axis-specific properties take a look at the [Axis Documentation](./XYAxis.md).
83
-
84
- ## API
85
-
86
- ## Published Properties
87
- ```@hpcc-js/chart:Contour
88
- ```
1
+ # Contour
2
+
3
+ <!--meta
4
+
5
+ -->
6
+
7
+ Contour and [HexBin](./HexBin.md) serve a similar purpose. They summarize high density data across two continuous axes.
8
+
9
+
10
+ <ClientOnly>
11
+ <hpcc-vitepress style="width:100%;height:600px">
12
+ <div id="placeholder" style="height:400px">
13
+ </div>
14
+ <script type="module">
15
+ import { Contour } from "@hpcc-js/chart";
16
+
17
+ new Contour()
18
+ .target("placeholder")
19
+ .columns(["X-Value", "Y-Value"])
20
+ .data(randomData(1000))
21
+ .xAxisType("linear")
22
+ .render()
23
+ ;
24
+
25
+ function randomData(count){
26
+ return Array(count).fill(1).map((n,x)=>{
27
+ const y = Math.sqrt(x) * Math.random();
28
+ return [x,y];
29
+ });
30
+ }
31
+ </script>
32
+ </hpcc-vitepress>
33
+ </ClientOnly>
34
+
35
+
36
+ _contourBandwidth_ can be used to control the standard deviation of the contour algorithm. The results can be seen in the below example.
37
+
38
+
39
+ <ClientOnly>
40
+ <hpcc-vitepress style="width:100%;height:600px">
41
+ <div id="placeholder" style="height:400px">
42
+ </div>
43
+ <script type="module">
44
+ import { Contour } from "@hpcc-js/chart";
45
+
46
+ let bandwidth = 10;
47
+
48
+ const widget = new Contour()
49
+ .target("placeholder")
50
+ .columns(["X-Value", "Y-Value"])
51
+ .data(randomData(1000))
52
+ .xAxisType("linear")
53
+ .xAxisTickCount(10)
54
+ .contourBandwidth(bandwidth)
55
+ .render()
56
+ ;
57
+
58
+ function randomData(count){
59
+ return Array(count).fill(1).map((n,x)=>{
60
+ const y = Math.sqrt(x) * Math.random();
61
+ return [x,y];
62
+ });
63
+ }
64
+ let interval = 10;
65
+ setInterval(function(){
66
+ const next = bandwidth + interval;
67
+ if(next > 100 || next <= 0){
68
+ interval *= -1;
69
+ }
70
+ bandwidth += interval;
71
+ widget
72
+ .xAxisTitle("bandwidth = " + bandwidth)
73
+ .contourBandwidth(bandwidth)
74
+ .render()
75
+ ;
76
+ },1000);
77
+ </script>
78
+ </hpcc-vitepress>
79
+ </ClientOnly>
80
+
81
+
82
+ For documentation on axis-specific properties take a look at the [Axis Documentation](./XYAxis.md).
83
+
84
+ ## API
85
+
86
+ ## Published Properties
87
+ ```@hpcc-js/chart:Contour
88
+ ```
package/src/Contour.ts CHANGED
@@ -1,97 +1,97 @@
1
- import { I1DChart } from "@hpcc-js/api";
2
- import { InputField } from "@hpcc-js/common";
3
- import { contourDensity as d3ContourDensity } from "d3-contour";
4
- import { geoPath } from "d3-geo";
5
- import { XYAxis } from "./XYAxis";
6
-
7
- export class Contour extends XYAxis {
8
- static __inputs: InputField[] = [{
9
- id: "x",
10
- type: "any"
11
- }, {
12
- id: "y",
13
- type: "number"
14
- }];
15
-
16
- protected _dataMinWeight;
17
- protected _dataMaxWeight;
18
- constructor() {
19
- super();
20
- this
21
- .xAxisGuideLines_default(false)
22
- .yAxisGuideLines_default(false)
23
- .xAxisType_default("linear")
24
- ;
25
- }
26
-
27
- xPos(host: XYAxis, d) {
28
- return host.orientation() === "horizontal" ? host.dataPos(d.label) : host.valuePos(d.value);
29
- }
30
-
31
- yPos(host: XYAxis, d) {
32
- return host.orientation() === "horizontal" ? host.valuePos(d.value) : host.dataPos(d.label);
33
- }
34
-
35
- layerEnter(host: XYAxis, element, duration: number = 250) {
36
- super.layerEnter(host, element, duration);
37
- }
38
-
39
- layerUpdate(host: XYAxis, element, duration: number = 250) {
40
- super.layerUpdate(host, element, duration);
41
-
42
- this._palette = this._palette.switch(this.paletteID());
43
-
44
- const data = this.flattenData(this.layerColumns(host), this.layerData(host));
45
- const contourData = d3ContourDensity()
46
- .x(d => this.xPos(host, d))
47
- .y(d => this.yPos(host, d))
48
- .size([this.width(), this.height()])
49
- .bandwidth(this.contourBandwidth())(data)
50
- ;
51
- const _vals = contourData.map(d => d.value);
52
- const minValue = Math.min.apply(this, _vals);
53
- const maxValue = Math.max.apply(this, _vals);
54
- this._dataMinWeight = minValue;
55
- this._dataMaxWeight = maxValue;
56
- const lines = element.selectAll("path").data(contourData);
57
- lines.enter().append("path")
58
- .merge(lines)
59
- .attr("d", geoPath())
60
- .attr("fill", d => this.showContourFill() ? this._palette(d.value, minValue, maxValue) : "none")
61
- .attr("stroke", this.contourStrokeColor())
62
- .attr("stroke-linejoin", "round")
63
- .attr("stroke-width", this.contourStrokeWidth())
64
- ;
65
- lines.exit().remove();
66
- }
67
-
68
- exit(_domNode, _element) {
69
- super.exit(_domNode, _element);
70
- }
71
- }
72
- Contour.prototype._class += " chart_Contour";
73
- Contour.prototype.implements(I1DChart.prototype);
74
-
75
- export interface Contour {
76
- paletteID(): string;
77
- paletteID(_: string): this;
78
- useClonedPalette(): boolean;
79
- useClonedPalette(_: boolean): this;
80
- showContourFill(): boolean;
81
- showContourFill(_: boolean): this;
82
- showContour(): boolean;
83
- showContour(_: boolean): this;
84
- contourBandwidth(): number;
85
- contourBandwidth(_: number): this;
86
- contourStrokeColor(): string;
87
- contourStrokeColor(_: string): this;
88
- contourStrokeWidth(): number;
89
- contourStrokeWidth(_: number): this;
90
- }
91
- Contour.prototype.publish("paletteID", "YlGnBu", "string", "Color palette for this widget");
92
- Contour.prototype.publish("useClonedPalette", true, "boolean", "Enable or disable using a cloned palette");
93
- Contour.prototype.publish("showContourFill", true, "boolean", "Show/hide the contour background colors");
94
- Contour.prototype.publish("showContour", true, "boolean", "Show/hide the contour border lines");
95
- Contour.prototype.publish("contourBandwidth", 40, "number", "Controls the sensitivity of the contour grouping algorithm");
96
- Contour.prototype.publish("contourStrokeColor", "#2C3A47", "html-color", "Color of the contour border lines");
97
- Contour.prototype.publish("contourStrokeWidth", 1, "number", "Width of the contour border lines");
1
+ import { I1DChart } from "@hpcc-js/api";
2
+ import { InputField } from "@hpcc-js/common";
3
+ import { contourDensity as d3ContourDensity } from "d3-contour";
4
+ import { geoPath } from "d3-geo";
5
+ import { XYAxis } from "./XYAxis";
6
+
7
+ export class Contour extends XYAxis {
8
+ static __inputs: InputField[] = [{
9
+ id: "x",
10
+ type: "any"
11
+ }, {
12
+ id: "y",
13
+ type: "number"
14
+ }];
15
+
16
+ protected _dataMinWeight;
17
+ protected _dataMaxWeight;
18
+ constructor() {
19
+ super();
20
+ this
21
+ .xAxisGuideLines_default(false)
22
+ .yAxisGuideLines_default(false)
23
+ .xAxisType_default("linear")
24
+ ;
25
+ }
26
+
27
+ xPos(host: XYAxis, d) {
28
+ return host.orientation() === "horizontal" ? host.dataPos(d.label) : host.valuePos(d.value);
29
+ }
30
+
31
+ yPos(host: XYAxis, d) {
32
+ return host.orientation() === "horizontal" ? host.valuePos(d.value) : host.dataPos(d.label);
33
+ }
34
+
35
+ layerEnter(host: XYAxis, element, duration: number = 250) {
36
+ super.layerEnter(host, element, duration);
37
+ }
38
+
39
+ layerUpdate(host: XYAxis, element, duration: number = 250) {
40
+ super.layerUpdate(host, element, duration);
41
+
42
+ this._palette = this._palette.switch(this.paletteID());
43
+
44
+ const data = this.flattenData(this.layerColumns(host), this.layerData(host));
45
+ const contourData = d3ContourDensity()
46
+ .x(d => this.xPos(host, d))
47
+ .y(d => this.yPos(host, d))
48
+ .size([this.width(), this.height()])
49
+ .bandwidth(this.contourBandwidth())(data)
50
+ ;
51
+ const _vals = contourData.map(d => d.value);
52
+ const minValue = Math.min.apply(this, _vals);
53
+ const maxValue = Math.max.apply(this, _vals);
54
+ this._dataMinWeight = minValue;
55
+ this._dataMaxWeight = maxValue;
56
+ const lines = element.selectAll("path").data(contourData);
57
+ lines.enter().append("path")
58
+ .merge(lines)
59
+ .attr("d", geoPath())
60
+ .attr("fill", d => this.showContourFill() ? this._palette(d.value, minValue, maxValue) : "none")
61
+ .attr("stroke", this.contourStrokeColor())
62
+ .attr("stroke-linejoin", "round")
63
+ .attr("stroke-width", this.contourStrokeWidth())
64
+ ;
65
+ lines.exit().remove();
66
+ }
67
+
68
+ exit(_domNode, _element) {
69
+ super.exit(_domNode, _element);
70
+ }
71
+ }
72
+ Contour.prototype._class += " chart_Contour";
73
+ Contour.prototype.implements(I1DChart.prototype);
74
+
75
+ export interface Contour {
76
+ paletteID(): string;
77
+ paletteID(_: string): this;
78
+ useClonedPalette(): boolean;
79
+ useClonedPalette(_: boolean): this;
80
+ showContourFill(): boolean;
81
+ showContourFill(_: boolean): this;
82
+ showContour(): boolean;
83
+ showContour(_: boolean): this;
84
+ contourBandwidth(): number;
85
+ contourBandwidth(_: number): this;
86
+ contourStrokeColor(): string;
87
+ contourStrokeColor(_: string): this;
88
+ contourStrokeWidth(): number;
89
+ contourStrokeWidth(_: number): this;
90
+ }
91
+ Contour.prototype.publish("paletteID", "YlGnBu", "string", "Color palette for this widget");
92
+ Contour.prototype.publish("useClonedPalette", true, "boolean", "Enable or disable using a cloned palette");
93
+ Contour.prototype.publish("showContourFill", true, "boolean", "Show/hide the contour background colors");
94
+ Contour.prototype.publish("showContour", true, "boolean", "Show/hide the contour border lines");
95
+ Contour.prototype.publish("contourBandwidth", 40, "number", "Controls the sensitivity of the contour grouping algorithm");
96
+ Contour.prototype.publish("contourStrokeColor", "#2C3A47", "html-color", "Color of the contour border lines");
97
+ Contour.prototype.publish("contourStrokeWidth", 1, "number", "Width of the contour border lines");