@hpcc-js/chart 3.6.3 → 3.6.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.
Files changed (80) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +93 -93
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.cjs +1 -1
  6. package/dist/index.umd.cjs.map +1 -1
  7. package/package.json +6 -6
  8. package/src/Area.md +176 -176
  9. package/src/Area.ts +12 -12
  10. package/src/Axis.css +34 -34
  11. package/src/Axis.ts +781 -781
  12. package/src/Bar.md +90 -90
  13. package/src/Bar.ts +9 -9
  14. package/src/Bubble.css +16 -16
  15. package/src/Bubble.md +69 -69
  16. package/src/Bubble.ts +196 -196
  17. package/src/BubbleXY.ts +14 -14
  18. package/src/Bullet.css +60 -60
  19. package/src/Bullet.md +104 -104
  20. package/src/Bullet.ts +176 -176
  21. package/src/Column.css +44 -44
  22. package/src/Column.md +90 -90
  23. package/src/Column.ts +684 -684
  24. package/src/Contour.md +88 -88
  25. package/src/Contour.ts +97 -97
  26. package/src/D3Cloud.ts +403 -403
  27. package/src/Gantt.md +119 -119
  28. package/src/Gantt.ts +14 -14
  29. package/src/Gauge.md +148 -148
  30. package/src/Gauge.ts +368 -368
  31. package/src/HalfPie.md +62 -62
  32. package/src/HalfPie.ts +26 -26
  33. package/src/Heat.md +42 -42
  34. package/src/Heat.ts +283 -283
  35. package/src/HexBin.css +9 -9
  36. package/src/HexBin.md +88 -88
  37. package/src/HexBin.ts +144 -144
  38. package/src/Line.css +6 -6
  39. package/src/Line.md +170 -170
  40. package/src/Line.ts +14 -14
  41. package/src/Pie.css +50 -50
  42. package/src/Pie.md +88 -88
  43. package/src/Pie.ts +546 -546
  44. package/src/QuarterPie.md +61 -61
  45. package/src/QuarterPie.ts +35 -35
  46. package/src/QuartileCandlestick.md +129 -129
  47. package/src/QuartileCandlestick.ts +349 -349
  48. package/src/Radar.css +15 -15
  49. package/src/Radar.md +104 -104
  50. package/src/Radar.ts +336 -336
  51. package/src/RadialBar.css +25 -25
  52. package/src/RadialBar.md +91 -91
  53. package/src/RadialBar.ts +217 -217
  54. package/src/Scatter.css +42 -42
  55. package/src/Scatter.md +163 -163
  56. package/src/Scatter.ts +412 -412
  57. package/src/StatChart.md +117 -117
  58. package/src/StatChart.ts +261 -261
  59. package/src/Step.md +163 -163
  60. package/src/Step.ts +12 -12
  61. package/src/Summary.css +56 -56
  62. package/src/Summary.md +219 -219
  63. package/src/Summary.ts +322 -322
  64. package/src/SummaryC.md +154 -154
  65. package/src/SummaryC.ts +240 -240
  66. package/src/WordCloud.css +3 -3
  67. package/src/WordCloud.md +144 -144
  68. package/src/WordCloud.ts +268 -268
  69. package/src/XYAxis.css +41 -41
  70. package/src/XYAxis.md +149 -149
  71. package/src/XYAxis.ts +809 -809
  72. package/src/__package__.ts +3 -3
  73. package/src/__tests__/heat.ts +71 -71
  74. package/src/__tests__/index.ts +3 -3
  75. package/src/__tests__/pie.ts +20 -20
  76. package/src/__tests__/stat.ts +16 -16
  77. package/src/__tests__/test3.ts +68 -68
  78. package/src/index.ts +28 -28
  79. package/src/test.ts +70 -70
  80. package/src/timeFormats.ts +26 -26
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.ts";
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.ts";
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");