@hpcc-js/chart 2.86.3 → 2.86.4

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 (83) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +93 -93
  3. package/dist/index.es6.js +2 -2
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js +1 -1
  8. package/dist/index.min.js.map +1 -1
  9. package/package.json +6 -6
  10. package/src/Area.md +176 -176
  11. package/src/Area.ts +12 -12
  12. package/src/Axis.css +34 -34
  13. package/src/Axis.ts +733 -733
  14. package/src/Bar.md +90 -90
  15. package/src/Bar.ts +9 -9
  16. package/src/Bubble.css +16 -16
  17. package/src/Bubble.md +69 -69
  18. package/src/Bubble.ts +191 -191
  19. package/src/BubbleXY.ts +14 -14
  20. package/src/Bullet.css +60 -60
  21. package/src/Bullet.md +104 -104
  22. package/src/Bullet.ts +167 -167
  23. package/src/Column.css +17 -17
  24. package/src/Column.md +90 -90
  25. package/src/Column.ts +659 -659
  26. package/src/Contour.md +88 -88
  27. package/src/Contour.ts +97 -97
  28. package/src/D3Cloud.ts +400 -400
  29. package/src/Gantt.md +119 -119
  30. package/src/Gantt.ts +14 -14
  31. package/src/Gauge.md +148 -148
  32. package/src/Gauge.ts +358 -358
  33. package/src/HalfPie.md +62 -62
  34. package/src/HalfPie.ts +26 -26
  35. package/src/Heat.md +42 -42
  36. package/src/Heat.ts +283 -283
  37. package/src/HexBin.css +9 -9
  38. package/src/HexBin.md +88 -88
  39. package/src/HexBin.ts +139 -139
  40. package/src/Line.css +6 -6
  41. package/src/Line.md +170 -170
  42. package/src/Line.ts +14 -14
  43. package/src/Pie.css +23 -23
  44. package/src/Pie.md +88 -88
  45. package/src/Pie.ts +503 -503
  46. package/src/QuarterPie.md +61 -61
  47. package/src/QuarterPie.ts +35 -35
  48. package/src/QuartileCandlestick.md +129 -129
  49. package/src/QuartileCandlestick.ts +349 -349
  50. package/src/Radar.css +15 -15
  51. package/src/Radar.md +104 -104
  52. package/src/Radar.ts +336 -336
  53. package/src/RadialBar.css +25 -25
  54. package/src/RadialBar.md +91 -91
  55. package/src/RadialBar.ts +212 -212
  56. package/src/Scatter.css +16 -16
  57. package/src/Scatter.md +163 -163
  58. package/src/Scatter.ts +376 -376
  59. package/src/StatChart.md +117 -117
  60. package/src/StatChart.ts +253 -253
  61. package/src/Step.md +163 -163
  62. package/src/Step.ts +12 -12
  63. package/src/Summary.css +56 -56
  64. package/src/Summary.md +219 -219
  65. package/src/Summary.ts +322 -322
  66. package/src/SummaryC.md +154 -154
  67. package/src/SummaryC.ts +240 -240
  68. package/src/WordCloud.css +3 -3
  69. package/src/WordCloud.md +144 -144
  70. package/src/WordCloud.ts +263 -263
  71. package/src/XYAxis.css +41 -41
  72. package/src/XYAxis.md +149 -149
  73. package/src/XYAxis.ts +803 -803
  74. package/src/__package__.ts +3 -3
  75. package/src/__tests__/heat.ts +71 -71
  76. package/src/__tests__/index.ts +3 -3
  77. package/src/__tests__/pie.ts +20 -20
  78. package/src/__tests__/stat.ts +16 -16
  79. package/src/__tests__/test3.ts +69 -69
  80. package/src/index.ts +27 -27
  81. package/src/test.ts +71 -71
  82. package/types/__package__.d.ts +2 -2
  83. package/types-3.4/__package__.d.ts +2 -2
package/src/XYAxis.ts CHANGED
@@ -1,803 +1,803 @@
1
- import { d3Event, select as d3Select, SVGWidget, Utility } from "@hpcc-js/common";
2
- import { max as d3Max, min as d3Min } from "d3-array";
3
- import { brush as d3Brush, brushSelection as d3BrushSelection, brushX as d3BrushX, brushY as d3BrushY } from "d3-brush";
4
- import { hsl as d3Hsl } from "d3-color";
5
- import { Axis } from "./Axis";
6
-
7
- import "../src/XYAxis.css";
8
-
9
- export class XYAxis extends SVGWidget {
10
- protected domainAxis: Axis;
11
- protected valueAxis: Axis;
12
- protected xAxis: Axis;
13
- protected yAxis: Axis;
14
- protected xyBrush;
15
- protected xBrush;
16
- protected yBrush;
17
- protected margin;
18
- protected focusChart: XYAxis;
19
- _palette;
20
-
21
- constructor() {
22
- super();
23
- Utility.SimpleSelectionMixin.call(this);
24
-
25
- this._drawStartPos = "origin";
26
-
27
- this.domainAxis = new Axis()
28
- .classed({ domain: true })
29
- .orientation_default("bottom")
30
- .type("ordinal")
31
- .overlapMode_default("stagger")
32
- .shrinkToFit_default("high")
33
- .extend_default(0)
34
- ;
35
- this.valueAxis = new Axis()
36
- .classed({ value: true })
37
- .orientation_default("left")
38
- .type("linear")
39
- .shrinkToFit_default("high")
40
- ;
41
-
42
- this.xyBrush = d3Brush()
43
- .on("end", () => {
44
- return this.brushMoved();
45
- })
46
- .on("start.handle brush.handle end.handle", () => {
47
- return this.brushMoved2();
48
- })
49
- ;
50
- this.xBrush = d3BrushX()
51
- .on("end", () => {
52
- return this.brushMoved();
53
- })
54
- .on("start.handle brush.handle end.handle", () => {
55
- return this.brushMoved2();
56
- })
57
- ;
58
- this.yBrush = d3BrushY()
59
- .on("end", () => {
60
- return this.brushMoved();
61
- })
62
- .on("start.handle brush.handle end.handle", () => {
63
- return this.brushMoved2();
64
- })
65
- ;
66
- }
67
-
68
- protected _prevBrush;
69
- resetSelection() {
70
- this._prevBrush = null;
71
- return this;
72
- }
73
-
74
- parseData(d) {
75
- return this.domainAxis.parse(d);
76
- }
77
-
78
- parseValue(d) {
79
- return this.valueAxis.parse(d, true);
80
- }
81
-
82
- formatData(d) {
83
- return this.domainAxis.format(d);
84
- }
85
-
86
- formatValue(d) {
87
- return this.valueAxis.format(d);
88
- }
89
-
90
- parsedData() {
91
- const retVal = this.data().map(function (row) {
92
- let prevValue = 0;
93
- return row.map(function (cell, idx) {
94
- if (idx === 0) {
95
- return this.parseData(cell);
96
- }
97
- if (idx >= this.columns().length) {
98
- return cell;
99
- }
100
- const _retVal = this.yAxisStacked() ? [prevValue, prevValue + this.parseValue(cell)] : this.parseValue(cell);
101
- prevValue += this.parseValue(cell);
102
- return _retVal;
103
- }, this);
104
- }, this);
105
- return retVal;
106
- }
107
-
108
- bandwidth() {
109
- return this.domainAxis.bandwidth();
110
- }
111
-
112
- protected svg;
113
- protected svgRegions;
114
- protected svgDomainGuide;
115
- protected svgValueGuide;
116
- protected svgData;
117
- protected svgDataClipRect;
118
- protected svgFocus;
119
- protected svgBrush;
120
- enter(domNode, element) {
121
- super.enter(domNode, element);
122
- this.svg = element.append("g");
123
- this.svgRegions = element.append("g");
124
- this.svgDomainGuide = this.svg.append("g");
125
- this.svgValueGuide = this.svg.append("g");
126
- this.svgData = this.svg.append("g");
127
-
128
- this.svgDataClipRect = this.svg.append("clipPath")
129
- .attr("id", this.id() + "_clippath")
130
- .append("rect")
131
- .attr("x", 0)
132
- .attr("y", 0)
133
- ;
134
- this.svgData = this.svg.append("g")
135
- .attr("clip-path", "url(#" + this.id() + "_clippath)")
136
- ;
137
- this._selection.widgetElement(this.svgData);
138
-
139
- this.svgFocus = element.append("g");
140
-
141
- this.domainAxis
142
- .target(this.svg.node())
143
- .guideTarget(this.svgDomainGuide.node())
144
- ;
145
-
146
- this.valueAxis
147
- .target(this.svg.node())
148
- .guideTarget(this.svgValueGuide.node())
149
- ;
150
-
151
- this.svgBrush = element.append("g")
152
- .attr("class", "brush")
153
- ;
154
- this.chartsEnter(this, this.svgData, 250);
155
- }
156
-
157
- resizeBrushHandle(d, width, height) {
158
- let e;
159
- let x;
160
- let y;
161
- if (d.type === "e" || d.type === "w") {
162
- e = +(d.type === "e");
163
- x = e ? 1 : -1;
164
- y = height / 3;
165
- return "M" + (0.5 * x) + "," + y +
166
- "A6,6 0 0 " + e + " " + (6.5 * x) + "," + (y + 6) +
167
- "V" + (2 * y - 6) +
168
- "A6,6 0 0 " + e + " " + (0.5 * x) + "," + (2 * y) +
169
- "Z" +
170
- "M" + (2.5 * x) + "," + (y + 8) +
171
- "V" + (2 * y - 8) +
172
- "M" + (4.5 * x) + "," + (y + 8) +
173
- "V" + (2 * y - 8);
174
- } else {
175
- e = +(d.type === "s");
176
- y = e ? 1 : -1;
177
- x = width / 3;
178
- return "M" + x + ", " + (0.5 * y) +
179
- "A6,6 0 0 " + (e + 1) % 2 + " " + (x + 6) + "," + (6.5 * y) +
180
- "H" + (2 * x - 6) +
181
- "A6,6 0 0 " + (e + 1) % 2 + " " + (2 * x) + "," + (0.5 * y) +
182
- "Z" +
183
- "M" + (x + 8) + "," + (2.5 * y) +
184
- "H" + (2 * x - 8) +
185
- "M" + (x + 8) + "," + (4.5 * y) +
186
- "H" + (2 * x - 8);
187
- }
188
- }
189
-
190
- private _skipSelection = false;
191
- skipSelection(): boolean;
192
- skipSelection(_: boolean): this;
193
- skipSelection(_?: boolean): boolean | this {
194
- if (!arguments.length) return this._skipSelection;
195
- this._skipSelection = _;
196
- return this;
197
- }
198
-
199
- brushMoved() {
200
- if (this._skipSelection) return;
201
- let selected = [];
202
- const context = this;
203
- const currSel: any = d3BrushSelection(this.svgBrush.node());
204
- if (currSel) {
205
- selected = this.data().filter(function (d) {
206
- const pos = context.dataPos(d[0]);
207
- if (context.use2dSelection()) {
208
- const pos2 = context.valuePos(d[1]) + context.valueAxis.bandwidth() / 2;
209
- return pos >= currSel[0][0] && pos <= currSel[1][0] && pos2 >= currSel[0][1] && pos2 <= currSel[1][1];
210
- } else {
211
- return pos >= currSel[0] && pos <= currSel[1];
212
- }
213
- });
214
- }
215
- this.selection(selected);
216
- }
217
-
218
- brushMoved2() {
219
- const isHorizontal = this.orientation() === "horizontal";
220
- const handleTypes = this.use2dSelection() ? [] : isHorizontal ? [{ type: "w" }, { type: "e" }] : [{ type: "n" }, { type: "s" }];
221
- const handlePath = this.svgBrush.selectAll(".handle--custom").data(handleTypes);
222
- const s = d3Event().selection;
223
- if (s == null) {
224
- handlePath.attr("display", "none");
225
- } else if (isHorizontal) {
226
- handlePath.attr("display", null).attr("transform", (_d, i) => "translate(" + s[i] + "," + 0 + ")");
227
- } else {
228
- handlePath.attr("display", null).attr("transform", (_d, i) => "translate(" + 0 + ", " + s[i] + ")");
229
- }
230
- }
231
-
232
- dataPos(d) {
233
- return this.domainAxis.scalePos(d);
234
- }
235
-
236
- valuePos(d) {
237
- return this.valueAxis.scalePos(d);
238
- }
239
-
240
- getAxisSize(host: XYAxis): { width: number, height: number } {
241
- return {
242
- width: !this.xAxis ? host.xAxis.width() : this.xAxis.width(),
243
- height: !this.yAxis ? host.yAxis.width() : this.yAxis.height()
244
- };
245
- }
246
-
247
- calcMargin(_domNode, element, isHorizontal) {
248
- const margin = {
249
- top: !isHorizontal && this.selectionMode() ? 10 : 2,
250
- right: isHorizontal && (this.selectionMode() || this.xAxisFocus()) ? 10 : 2,
251
- bottom: (this.xAxisFocus() ? this.xAxisFocusHeight() : 0) + 2,
252
- left: 2
253
- };
254
- const width = this.width() - margin.left - margin.right;
255
- const height = this.height() - margin.top - margin.bottom;
256
-
257
- let xRight = 0;
258
- let xHeight = 30;
259
- let yTop = 0;
260
- let yWidth = 30;
261
- for (let i = 0; i < 10; ++i) {
262
- this.xAxis.width(width - yWidth).height(0);
263
- const xAxisOverlap = this.xAxis.calcOverflow(element);
264
- const newXHeight = xAxisOverlap.depth;
265
-
266
- this.yAxis.width(0).height(height - xHeight);
267
- const yAxisOverlap = this.yAxis.calcOverflow(element);
268
- const newYWidth = yAxisOverlap.depth;
269
-
270
- xRight = xAxisOverlap.right;
271
- yTop = yAxisOverlap.top;
272
-
273
- if (newXHeight === xHeight && newYWidth === yWidth) {
274
- break;
275
- }
276
- xHeight = newXHeight;
277
- yWidth = newYWidth;
278
- }
279
- this.xAxis
280
- .x(width / 2 + yWidth / 2 + margin.left)
281
- .y(height + margin.top)
282
- .width(width - yWidth)
283
- ;
284
- this.yAxis
285
- .x(margin.left)
286
- .y(height / 2 - xHeight / 2 + margin.top)
287
- .height(height - xHeight)
288
- ;
289
- margin.left += yWidth;
290
- margin.top += yTop;
291
- margin.right += xRight;
292
- margin.bottom += xHeight;
293
- return margin;
294
- }
295
-
296
- updateRegions(_domNode, _element, isHorizontal) {
297
- const context = this;
298
-
299
- const regions = this.svgRegions.selectAll(".region").data(this.regions());
300
- regions.enter().append("rect")
301
- .attr("class", "region")
302
- ;
303
- if (isHorizontal) {
304
- regions
305
- .attr("x", function (d) { return context.dataPos(d.x0); })
306
- .attr("y", 0)
307
- .attr("width", function (d) { return context.dataPos(d.x1) - context.dataPos(d.x0); })
308
- .attr("height", this.height())
309
- .style("stroke", function (d) { return context._palette(d.colorID); })
310
- .style("fill", function (d) { return d3Hsl(context._palette(d.colorID)).brighter(); })
311
- ;
312
- } else {
313
- regions
314
- .attr("x", 0)
315
- .attr("y", function (d) { return context.dataPos(d.x0); })
316
- .attr("width", this.width())
317
- .attr("height", function (d) { return context.dataPos(d.x0) - context.dataPos(d.x1); })
318
- .style("stroke", function (d) { return context._palette(d.colorID); })
319
- .style("fill", function (d) { return d3Hsl(context._palette(d.colorID)).brighter(); })
320
- ;
321
- }
322
- regions.exit().remove();
323
- }
324
-
325
- protected _prevXAxisType;
326
- update(domNode, element) {
327
- super.update(domNode, element);
328
- const context = this;
329
-
330
- const isHorizontal = this.orientation() === "horizontal";
331
- this.updateRegions(domNode, element, isHorizontal);
332
-
333
- this.domainAxis
334
- .orientation(isHorizontal ? "bottom" : "left")
335
- .title(this.xAxisTitle_exists() ? this.xAxisTitle() : this.columns()[0])
336
- ;
337
- this.valueAxis
338
- .orientation(isHorizontal ? "left" : "bottom")
339
- ;
340
- this.xAxis = isHorizontal ? this.domainAxis : this.valueAxis;
341
- this.yAxis = isHorizontal ? this.valueAxis : this.domainAxis;
342
-
343
- // Update Domain ---
344
- switch (this.xAxisType()) {
345
- case "ordinal":
346
- const colLen = this.columns().length;
347
- const ordinalMappings = {};
348
- this.domainAxis
349
- .ordinals(this.data().map(function (d) {
350
- ordinalMappings[d[0]] = context.xAxisOrdinalMapping(d, d[colLen]);
351
- return d[0];
352
- }))
353
- .ordinalMappings(ordinalMappings)
354
- ;
355
-
356
- break;
357
- default:
358
- const domainMin = this.xAxisDomainLow() ? this.xAxisDomainLow() : this.domainAxis.parseInvert(d3Min(this.parsedData(), function (data) {
359
- return data[0];
360
- }));
361
- const domainMax = this.xAxisDomainHigh() ? this.xAxisDomainHigh() : this.domainAxis.parseInvert(d3Max(this.parsedData(), function (data) {
362
- return data[0];
363
- }));
364
- if (domainMin !== undefined && domainMax !== undefined) {
365
- this.domainAxis
366
- .low(domainMin)
367
- .high(domainMax)
368
- ;
369
- }
370
- break;
371
- }
372
-
373
- const min = this.yAxisDomainLow() ? this.yAxisDomainLow() : this.valueAxis.parseInvert(d3Min(this.parsedData(), function (data: any[]) {
374
- return d3Min(data.filter(function (cell, i) { return i > 0 && context.columns()[i] && context.columns()[i].indexOf("__") !== 0 && cell !== null; }), function (d) { return d instanceof Array ? d[0] : d; });
375
- }));
376
- const max = this.yAxisDomainHigh() ? this.yAxisDomainHigh() : this.valueAxis.parseInvert(d3Max(this.parsedData(), function (data: any[]) {
377
- return d3Max(data.filter(function (cell, i) { return i > 0 && context.columns()[i] && context.columns()[i].indexOf("__") !== 0 && cell !== null; }), function (d) { return d instanceof Array ? d[1] : d; });
378
- }));
379
- this.valueAxis
380
- .low(min)
381
- .high(max)
382
- ;
383
-
384
- // Calculate Margins ---
385
- this.margin = this.calcMargin(domNode, element, isHorizontal);
386
-
387
- // Update Range ---
388
- let width = this.width() - this.margin.left - this.margin.right;
389
- if (width < 0) width = 0;
390
- let height = this.height() - this.margin.top - this.margin.bottom;
391
- if (height < 0) height = 0;
392
- const maxCurrExtent = isHorizontal ? width : height;
393
- const maxOtherExtent = isHorizontal ? height : width;
394
-
395
- // Render ---
396
- this.domainAxis
397
- .tickLength(this.xAxisGuideLines() ? maxOtherExtent : 0)
398
- .render()
399
- ;
400
- this.valueAxis
401
- .tickLength(this.yAxisGuideLines() ? maxCurrExtent : 0)
402
- .render()
403
- ;
404
-
405
- this.svgDataClipRect
406
- .attr("width", width)
407
- .attr("height", height)
408
- ;
409
- this.svgData.transition()
410
- .attr("transform", "translate(" + this.margin.left + "," + this.margin.top + ")")
411
- ;
412
-
413
- this.updateBrush(width, height, maxCurrExtent, isHorizontal);
414
- this.updateFocusChart(domNode, element, this.margin, width, height, isHorizontal);
415
- this.chartsUpdate(width, height, 250);
416
- if (this.selectionMode()) {
417
- return this.brushMoved();
418
- }
419
- }
420
-
421
- updateBrush(width, height, maxCurrExtent, isHorizontal) {
422
- const currBrush = this.use2dSelection() ? this.xyBrush : isHorizontal ? this.xBrush : this.yBrush;
423
- const prevBrushSel: any = d3BrushSelection(this.svgBrush.node());
424
- currBrush.extent([[0, 0], [width, height]]);
425
- this.svgBrush
426
- .attr("transform", "translate(" + this.margin.left + ", " + this.margin.top + ")")
427
- .style("display", this.selectionMode() ? null : "none")
428
- .call(currBrush)
429
- ;
430
- const handleTypes = this.use2dSelection() ? [] : isHorizontal ? [{ type: "w" }, { type: "e" }] : [{ type: "n" }, { type: "s" }];
431
- const handlePath = this.svgBrush.selectAll(".handle--custom").data(handleTypes);
432
- handlePath.enter().append("path")
433
- .attr("class", "handle--custom")
434
- .merge(handlePath)
435
- .attr("cursor", isHorizontal ? "ew-resize" : "ns-resize")
436
- .attr("d", (d) => this.resizeBrushHandle(d, width, height))
437
- ;
438
-
439
- if (this.selectionMode()) {
440
- if (this._prevXAxisType !== this.xAxisType()) {
441
- this._prevXAxisType = this.xAxisType();
442
- this._prevBrush = null;
443
- }
444
- if (this._prevBrush) {
445
- if (prevBrushSel) {
446
- if (this._prevBrush.orientation !== this.orientation()) {
447
- const tmp = prevBrushSel[0];
448
- prevBrushSel[0] = this._prevBrush.maxCurrExtent - prevBrushSel[1];
449
- prevBrushSel[1] = this._prevBrush.maxCurrExtent - tmp;
450
- }
451
- const ratio = maxCurrExtent / this._prevBrush.maxCurrExtent;
452
- if (ratio !== 1) {
453
- this.svgBrush.transition()
454
- .on("start", function () {
455
- currBrush.on("end", null);
456
- })
457
- .call(currBrush.move, [prevBrushSel[0] * ratio, prevBrushSel[1] * ratio])
458
- .on("end", () => {
459
- currBrush.on("end", () => {
460
- return this.brushMoved();
461
- });
462
- })
463
- ;
464
- }
465
- }
466
- } else {
467
- this.svgBrush
468
- .call(currBrush.move, [0, maxCurrExtent])
469
- ;
470
- }
471
- this._prevBrush = {
472
- orientation: this.orientation(),
473
- maxCurrExtent
474
- };
475
- }
476
- }
477
-
478
- updateFocusChart(domNode, element, margin, width, height, isHorizontal) {
479
- const context: XYAxis = this;
480
- const focusChart = this.svgFocus.selectAll("#" + this.id() + "_focusChart").data(this.xAxisFocus() ? [true] : []);
481
- focusChart.enter().append("g")
482
- .attr("id", this.id() + "_focusChart")
483
- .attr("class", "focus")
484
- .each(function () {
485
- context.focusChart = new (context.constructor as any)()
486
- .target(this)
487
- ;
488
- context.focusChart.xBrush
489
- .on("brush.focus", function () {
490
- context.syncAxis(width);
491
- context.chartsUpdate(width, height, 0);
492
- })
493
- ;
494
- context.focusChart
495
- .layers(context.layers().map((w: any) => new w.constructor()))
496
- ;
497
- })
498
- .merge(focusChart)
499
- .each(function (this: SVGElement) {
500
- context.copyPropsTo(context.focusChart, ["layers"]);
501
- let layerIdx = 0;
502
- for (const layer of context.layers()) {
503
- layer.copyPropsTo(context.focusChart.layers()[layerIdx]);
504
- layerIdx++;
505
- }
506
- context.focusChart
507
- .xAxisFocus(false)
508
- .selectionMode(true)
509
- .skipSelection(true)
510
- .orientation("horizontal")
511
- .xAxisGuideLines(false)
512
- .xAxisDomainLow(null)
513
- .xAxisDomainHigh(null)
514
- .yAxisGuideLines(false)
515
- .x(context.width() / 2)
516
- .y(context.height() - context.xAxisFocusHeight() / 2)
517
- .width(context.width())
518
- .height(context.xAxisFocusHeight())
519
- .columns(context.columns())
520
- .data(context.data())
521
- .render()
522
- ;
523
- context.syncAxis(width);
524
- })
525
- ;
526
- focusChart.exit()
527
- .each(function () {
528
- if (context.focusChart) {
529
- context.focusChart
530
- .target(null)
531
- ;
532
- delete context.focusChart;
533
- }
534
- })
535
- .remove()
536
- ;
537
- }
538
-
539
- syncAxis(width: number) {
540
- const currSel = d3BrushSelection(this.focusChart.svgBrush.node()) as [number, number];
541
- if (currSel) {
542
- if (this.focusChart.xAxisType() !== "ordinal") {
543
- this.xAxis.domain([this.focusChart.xAxis.invert(currSel[0]), this.focusChart.xAxis.invert(currSel[1])]);
544
- } else {
545
- const brushWidth = currSel[1] - currSel[0];
546
- const scale = brushWidth / width;
547
- this.xAxis.range([-currSel[0] / scale, (width - currSel[0]) / scale]);
548
- }
549
- this.xAxis.rerender();
550
- }
551
- }
552
-
553
- // Layers ---
554
- layerColumns(host: XYAxis): string[] {
555
- const masterColumns = host.columns();
556
- const retVal = super.columns().filter(col => col !== masterColumns[0]);
557
- if (!retVal.length) {
558
- return masterColumns;
559
- }
560
- return [masterColumns[0], ...retVal];
561
- }
562
-
563
- layerColumnIndices(host: XYAxis): number[] {
564
- const masterColumns = host.columns();
565
- const layerColumns = this.layerColumns(host);
566
- return layerColumns.map(col => masterColumns.indexOf(col));
567
- }
568
-
569
- layerColumnIndex(host: XYAxis, column: string): number {
570
- const masterColumns = host.columns();
571
- return masterColumns.indexOf(column);
572
- }
573
-
574
- layerData(host: XYAxis): any[][] {
575
- if (arguments.length === 1) {
576
- const indices = this.layerColumnIndices(host);
577
- return host.data().map(row => {
578
- const retVal = indices.map(idx => row[idx]);
579
- (retVal as any).__hpcc_origRow = row;
580
- return retVal;
581
- });
582
- }
583
- throw new Error("Setting data on XYAxisLayer is not supported.");
584
- }
585
-
586
- layerEnter(host: XYAxis, element, duration: number = 250) {
587
- }
588
-
589
- layerUpdate(host: XYAxis, element, duration: number = 250) {
590
- }
591
-
592
- layerExit(host: XYAxis, element, duration: number = 250) {
593
- }
594
-
595
- chartsEnter(host: XYAxis, element, duration: number = 250) {
596
- this.layerEnter(this, element, duration);
597
- for (const w of this.layers()) {
598
- w["__xyAxisElement"] = element.append("g")
599
- .attr("class", w.class())
600
- ;
601
- w
602
- .target(w["__xyAxisElement"].node() as SVGElement)
603
- .layerEnter(this, element, duration)
604
- ;
605
- }
606
- }
607
-
608
- chartsUpdate(width, height, duration): void {
609
- this.layerUpdate(this, this.svgData, duration);
610
- for (const w of this.layers()) {
611
- w
612
- .resize({ width, height })
613
- .layerUpdate(this, w["__xyAxisElement"], duration)
614
- ;
615
- }
616
- }
617
-
618
- exit(domNode, element) {
619
- this.valueAxis.target(null);
620
- this.domainAxis.target(null);
621
- super.exit(domNode, element);
622
- }
623
-
624
- selection(_selected) {
625
- const context = this;
626
- this._selection.widgetElement().selectAll(".selected,.deselected")
627
- .each(function (d) {
628
- const selected = _selected.indexOf(d.origRow) >= 0;
629
- d3Select(this)
630
- .classed("selected", selected)
631
- .classed("deselected", !selected)
632
- .attr("filter", context._selection.svgGlowID() && selected ? `url(#${context._selection.svgGlowID()})` : null)
633
- ;
634
- })
635
- ;
636
-
637
- const selRows = _selected.map(d => {
638
- return this.rowToObj(d);
639
- });
640
- setTimeout(() => {
641
- this.click(selRows, "", true);
642
- }, 0);
643
- }
644
-
645
- // XYAxis ---
646
- xAxisOrdinalMapping(origRow, lparam) {
647
- return origRow[0];
648
- }
649
-
650
- // Events ---
651
- click(row, column, selected) {
652
- // console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected);
653
- }
654
-
655
- // Selection ---
656
- _selection: Utility.SimpleSelection;
657
- }
658
- XYAxis.prototype._class += " chart_XYAxis";
659
- XYAxis.prototype.mixin(Utility.SimpleSelectionMixin);
660
-
661
- export interface XYAxis {
662
- orientation(): "horizontal" | "vertical";
663
- orientation(_: "horizontal" | "vertical"): this;
664
- orientation_default(_: string);
665
- pointSizeColumn(): string;
666
- pointSizeColumn(_: string): this;
667
- pointSizeColumn_exists(): boolean;
668
- minPointSize(): number;
669
- minPointSize(_: number): this;
670
- maxPointSize(): number;
671
- maxPointSize(_: number): this;
672
- use2dSelection(): boolean;
673
- use2dSelection(_: boolean): this;
674
- selectionMode(): boolean;
675
- selectionMode(_: boolean): this;
676
- xAxisTitle(): string;
677
- xAxisTitle(_: string): this;
678
- xAxisTitle_exists(): boolean;
679
- xAxisTickCount(): number;
680
- xAxisTickCount(_: number): this;
681
- xAxisTickFormat(): string;
682
- xAxisTickFormat(_: string): this;
683
- xAxisTicks(): Array<{ value: string, label: string }>;
684
- xAxisTicks(_: Array<{ value: string, label: string }>): this;
685
- xAxisType(): "none" | "ordinal" | "linear" | "pow" | "log" | "time";
686
- xAxisType(_: "none" | "ordinal" | "linear" | "pow" | "log" | "time"): this;
687
- xAxisType_default(_: string);
688
- xAxisTypeTimePattern(): string;
689
- xAxisTypeTimePattern(_: string): this;
690
- xAxisDomainLow(): number | string;
691
- xAxisDomainLow(_: number | string): this;
692
- xAxisDomainHigh(): number | string;
693
- xAxisDomainHigh(_: number | string): this;
694
- xAxisFontSize(): number | string;
695
- xAxisFontSize(_: number | string): this;
696
- xAxisFontFamily(): string;
697
- xAxisFontFamily(_: string): this;
698
- xAxisOrdinalPaddingInner(): number;
699
- xAxisOrdinalPaddingInner(_: number): this;
700
- xAxisOrdinalPaddingOuter(): number;
701
- xAxisOrdinalPaddingOuter(_: number): this;
702
- xAxisOverlapMode(): "none" | "stagger" | "hide" | "rotate" | "linebreak" | "wrap";
703
- xAxisOverlapMode(_: "none" | "stagger" | "hide" | "rotate" | "linebreak" | "wrap"): this;
704
- xAxisLabelRotation(): number;
705
- xAxisLabelRotation(_: number): this;
706
- xAxisDomainPadding(): number;
707
- xAxisDomainPadding(_: number): this;
708
- xAxisGuideLines(): boolean;
709
- xAxisGuideLines(_: boolean): this;
710
- xAxisGuideLines_default(_: boolean);
711
- xAxisFocus(): boolean;
712
- xAxisFocus(_: boolean): this;
713
- xAxisFocusHeight(): number;
714
- xAxisFocusHeight(_: number): this;
715
- xAxisHidden(): boolean;
716
- xAxisHidden(_: boolean): this;
717
- xAxisHidden_default(_: boolean);
718
- yAxisTitle(): string;
719
- yAxisTitle(_: string): this;
720
- yAxisTickCount(): number;
721
- yAxisTickCount(_: number): this;
722
- yAxisTickFormat(): string;
723
- yAxisTickFormat(_: string): this;
724
- yAxisTicks(): Array<{ value: string, label: string }>;
725
- yAxisTicks(_: Array<{ value: string, label: string }>): this;
726
- yAxisType(): "none" | "ordinal" | "linear" | "pow" | "log" | "time";
727
- yAxisType(_: "none" | "ordinal" | "linear" | "pow" | "log" | "time"): this;
728
- yAxisType_default(_: string);
729
- yAxisTypeTimePattern(): string;
730
- yAxisTypeTimePattern(_: string): this;
731
- yAxisTypePowExponent(): number;
732
- yAxisTypePowExponent(_: number): this;
733
- yAxisTypeLogBase(): number;
734
- yAxisTypeLogBase(_: number): this;
735
- yAxisStacked(): boolean;
736
- yAxisStacked(_: boolean): this;
737
- yAxisDomainLow(): number | string;
738
- yAxisDomainLow(_: number | string): this;
739
- yAxisDomainHigh(): number | string;
740
- yAxisDomainHigh(_: number | string): this;
741
- yAxisDomainPadding(): number;
742
- yAxisDomainPadding(_: number): this;
743
- yAxisGuideLines(): boolean;
744
- yAxisGuideLines(_: boolean): this;
745
- yAxisGuideLines_default(_: boolean);
746
- yAxisHidden(): boolean;
747
- yAxisHidden(_: boolean): this;
748
- yAxisHidden_default(_: boolean);
749
- regions(): object[];
750
- regions(_: object[]): this;
751
- layers(): XYAxis[];
752
- layers(_: XYAxis[]): this;
753
- xAxisPadding(): number;
754
- xAxisPadding(_: number): this;
755
- yAxisPadding(): number;
756
- yAxisPadding(_: number): this;
757
- }
758
-
759
- XYAxis.prototype.publish("orientation", "horizontal", "set", "Selects orientation for the axis", ["horizontal", "vertical"]);
760
- XYAxis.prototype.publish("pointSizeColumn", null, "string", "pointSizeColumn", null, { optional: true });
761
- XYAxis.prototype.publish("minPointSize", 6, "number", "minPointSize");
762
- XYAxis.prototype.publish("maxPointSize", 26, "number", "maxPointSize");
763
- XYAxis.prototype.publish("use2dSelection", false, "boolean", "2D Range Selector");
764
- XYAxis.prototype.publish("selectionMode", false, "boolean", "Range Selector");
765
- XYAxis.prototype.publishProxy("xAxisTitle", "domainAxis", "title");
766
- XYAxis.prototype.publishProxy("xAxisTickCount", "domainAxis", "tickCount");
767
- XYAxis.prototype.publishProxy("xAxisTickFormat", "domainAxis", "tickFormat");
768
- XYAxis.prototype.publishProxy("xAxisTicks", "domainAxis", "ticks");
769
- XYAxis.prototype.publishProxy("xAxisType", "domainAxis", "type");
770
- XYAxis.prototype.publishProxy("xAxisTypeTimePattern", "domainAxis", "timePattern");
771
- XYAxis.prototype.publish("xAxisDomainLow", null, "string", "X-Axis Low", null, { optional: true, disable: (w: XYAxis) => w.xAxisType() === "ordinal" });
772
- XYAxis.prototype.publish("xAxisDomainHigh", null, "string", "X-Axis High", null, { optional: true, disable: (w: XYAxis) => w.xAxisType() === "ordinal" });
773
- XYAxis.prototype.publishProxy("xAxisFontSize", "domainAxis", "fontSize");
774
- XYAxis.prototype.publishProxy("xAxisFontFamily", "domainAxis", "fontFamily");
775
- XYAxis.prototype.publishProxy("xAxisOrdinalPaddingInner", "domainAxis", "ordinalPaddingInner");
776
- XYAxis.prototype.publishProxy("xAxisOrdinalPaddingOuter", "domainAxis", "ordinalPaddingOuter");
777
- XYAxis.prototype.publishProxy("xAxisOverlapMode", "domainAxis", "overlapMode");
778
- XYAxis.prototype.publishProxy("xAxisLabelRotation", "domainAxis", "labelRotation");
779
- XYAxis.prototype.publishProxy("xAxisDomainPadding", "domainAxis", "extend");
780
- XYAxis.prototype.publish("xAxisGuideLines", false, "boolean", "Y-Axis Guide Lines");
781
- XYAxis.prototype.publish("xAxisFocus", false, "boolean", "X-Axis Focus", null, { disable: (w: any) => w.orientation() !== "horizontal" });
782
- XYAxis.prototype.publish("xAxisFocusHeight", 80, "number", "X-Axis Focus Height", null, { disable: (w: any) => !w.xAxisFocus() });
783
- XYAxis.prototype.publishProxy("xAxisHidden", "domainAxis", "hidden");
784
- XYAxis.prototype.publishProxy("yAxisFontSize", "valueAxis", "fontSize");
785
- XYAxis.prototype.publishProxy("yAxisFontFamily", "valueAxis", "fontFamily");
786
- XYAxis.prototype.publishProxy("yAxisTitle", "valueAxis", "title");
787
- XYAxis.prototype.publishProxy("yAxisTickCount", "valueAxis", "tickCount");
788
- XYAxis.prototype.publishProxy("yAxisTickFormat", "valueAxis", "tickFormat");
789
- XYAxis.prototype.publishProxy("yAxisTicks", "valueAxis", "ticks");
790
- XYAxis.prototype.publishProxy("yAxisType", "valueAxis", "type");
791
- XYAxis.prototype.publishProxy("yAxisTypeTimePattern", "valueAxis", "timePattern");
792
- XYAxis.prototype.publishProxy("yAxisTypePowExponent", "valueAxis", "powExponent");
793
- XYAxis.prototype.publishProxy("yAxisTypeLogBase", "valueAxis", "logBase");
794
- XYAxis.prototype.publish("yAxisStacked", false, "boolean", "Stacked Chart", null, { tags: ["Basic"], disable: (w: any) => w.xAxisType() !== "ordinal" || w._class.indexOf("chart_Column") < 0 });
795
- XYAxis.prototype.publish("yAxisDomainLow", null, "string", "Y-Axis Low", null, { optional: true, disable: (w: any) => w.yAxisType() === "ordinal" });
796
- XYAxis.prototype.publish("yAxisDomainHigh", null, "string", "Y-Axis High", null, { optional: true, disable: (w: any) => w.yAxisType() === "ordinal" });
797
- XYAxis.prototype.publishProxy("yAxisDomainPadding", "valueAxis", "extend");
798
- XYAxis.prototype.publish("yAxisGuideLines", true, "boolean", "Y-Axis Guide Lines");
799
- XYAxis.prototype.publishProxy("yAxisHidden", "valueAxis", "hidden");
800
- XYAxis.prototype.publish("regions", [], "array", "Regions");
801
- XYAxis.prototype.publish("layers", [], "widgetArray", "Layers", null, { render: false });
802
- XYAxis.prototype.publishProxy("xAxisPadding", "domainAxis", "padding");
803
- XYAxis.prototype.publishProxy("yAxisPadding", "valueAxis", "padding");
1
+ import { d3Event, select as d3Select, SVGWidget, Utility } from "@hpcc-js/common";
2
+ import { max as d3Max, min as d3Min } from "d3-array";
3
+ import { brush as d3Brush, brushSelection as d3BrushSelection, brushX as d3BrushX, brushY as d3BrushY } from "d3-brush";
4
+ import { hsl as d3Hsl } from "d3-color";
5
+ import { Axis } from "./Axis";
6
+
7
+ import "../src/XYAxis.css";
8
+
9
+ export class XYAxis extends SVGWidget {
10
+ protected domainAxis: Axis;
11
+ protected valueAxis: Axis;
12
+ protected xAxis: Axis;
13
+ protected yAxis: Axis;
14
+ protected xyBrush;
15
+ protected xBrush;
16
+ protected yBrush;
17
+ protected margin;
18
+ protected focusChart: XYAxis;
19
+ _palette;
20
+
21
+ constructor() {
22
+ super();
23
+ Utility.SimpleSelectionMixin.call(this);
24
+
25
+ this._drawStartPos = "origin";
26
+
27
+ this.domainAxis = new Axis()
28
+ .classed({ domain: true })
29
+ .orientation_default("bottom")
30
+ .type("ordinal")
31
+ .overlapMode_default("stagger")
32
+ .shrinkToFit_default("high")
33
+ .extend_default(0)
34
+ ;
35
+ this.valueAxis = new Axis()
36
+ .classed({ value: true })
37
+ .orientation_default("left")
38
+ .type("linear")
39
+ .shrinkToFit_default("high")
40
+ ;
41
+
42
+ this.xyBrush = d3Brush()
43
+ .on("end", () => {
44
+ return this.brushMoved();
45
+ })
46
+ .on("start.handle brush.handle end.handle", () => {
47
+ return this.brushMoved2();
48
+ })
49
+ ;
50
+ this.xBrush = d3BrushX()
51
+ .on("end", () => {
52
+ return this.brushMoved();
53
+ })
54
+ .on("start.handle brush.handle end.handle", () => {
55
+ return this.brushMoved2();
56
+ })
57
+ ;
58
+ this.yBrush = d3BrushY()
59
+ .on("end", () => {
60
+ return this.brushMoved();
61
+ })
62
+ .on("start.handle brush.handle end.handle", () => {
63
+ return this.brushMoved2();
64
+ })
65
+ ;
66
+ }
67
+
68
+ protected _prevBrush;
69
+ resetSelection() {
70
+ this._prevBrush = null;
71
+ return this;
72
+ }
73
+
74
+ parseData(d) {
75
+ return this.domainAxis.parse(d);
76
+ }
77
+
78
+ parseValue(d) {
79
+ return this.valueAxis.parse(d, true);
80
+ }
81
+
82
+ formatData(d) {
83
+ return this.domainAxis.format(d);
84
+ }
85
+
86
+ formatValue(d) {
87
+ return this.valueAxis.format(d);
88
+ }
89
+
90
+ parsedData() {
91
+ const retVal = this.data().map(function (row) {
92
+ let prevValue = 0;
93
+ return row.map(function (cell, idx) {
94
+ if (idx === 0) {
95
+ return this.parseData(cell);
96
+ }
97
+ if (idx >= this.columns().length) {
98
+ return cell;
99
+ }
100
+ const _retVal = this.yAxisStacked() ? [prevValue, prevValue + this.parseValue(cell)] : this.parseValue(cell);
101
+ prevValue += this.parseValue(cell);
102
+ return _retVal;
103
+ }, this);
104
+ }, this);
105
+ return retVal;
106
+ }
107
+
108
+ bandwidth() {
109
+ return this.domainAxis.bandwidth();
110
+ }
111
+
112
+ protected svg;
113
+ protected svgRegions;
114
+ protected svgDomainGuide;
115
+ protected svgValueGuide;
116
+ protected svgData;
117
+ protected svgDataClipRect;
118
+ protected svgFocus;
119
+ protected svgBrush;
120
+ enter(domNode, element) {
121
+ super.enter(domNode, element);
122
+ this.svg = element.append("g");
123
+ this.svgRegions = element.append("g");
124
+ this.svgDomainGuide = this.svg.append("g");
125
+ this.svgValueGuide = this.svg.append("g");
126
+ this.svgData = this.svg.append("g");
127
+
128
+ this.svgDataClipRect = this.svg.append("clipPath")
129
+ .attr("id", this.id() + "_clippath")
130
+ .append("rect")
131
+ .attr("x", 0)
132
+ .attr("y", 0)
133
+ ;
134
+ this.svgData = this.svg.append("g")
135
+ .attr("clip-path", "url(#" + this.id() + "_clippath)")
136
+ ;
137
+ this._selection.widgetElement(this.svgData);
138
+
139
+ this.svgFocus = element.append("g");
140
+
141
+ this.domainAxis
142
+ .target(this.svg.node())
143
+ .guideTarget(this.svgDomainGuide.node())
144
+ ;
145
+
146
+ this.valueAxis
147
+ .target(this.svg.node())
148
+ .guideTarget(this.svgValueGuide.node())
149
+ ;
150
+
151
+ this.svgBrush = element.append("g")
152
+ .attr("class", "brush")
153
+ ;
154
+ this.chartsEnter(this, this.svgData, 250);
155
+ }
156
+
157
+ resizeBrushHandle(d, width, height) {
158
+ let e;
159
+ let x;
160
+ let y;
161
+ if (d.type === "e" || d.type === "w") {
162
+ e = +(d.type === "e");
163
+ x = e ? 1 : -1;
164
+ y = height / 3;
165
+ return "M" + (0.5 * x) + "," + y +
166
+ "A6,6 0 0 " + e + " " + (6.5 * x) + "," + (y + 6) +
167
+ "V" + (2 * y - 6) +
168
+ "A6,6 0 0 " + e + " " + (0.5 * x) + "," + (2 * y) +
169
+ "Z" +
170
+ "M" + (2.5 * x) + "," + (y + 8) +
171
+ "V" + (2 * y - 8) +
172
+ "M" + (4.5 * x) + "," + (y + 8) +
173
+ "V" + (2 * y - 8);
174
+ } else {
175
+ e = +(d.type === "s");
176
+ y = e ? 1 : -1;
177
+ x = width / 3;
178
+ return "M" + x + ", " + (0.5 * y) +
179
+ "A6,6 0 0 " + (e + 1) % 2 + " " + (x + 6) + "," + (6.5 * y) +
180
+ "H" + (2 * x - 6) +
181
+ "A6,6 0 0 " + (e + 1) % 2 + " " + (2 * x) + "," + (0.5 * y) +
182
+ "Z" +
183
+ "M" + (x + 8) + "," + (2.5 * y) +
184
+ "H" + (2 * x - 8) +
185
+ "M" + (x + 8) + "," + (4.5 * y) +
186
+ "H" + (2 * x - 8);
187
+ }
188
+ }
189
+
190
+ private _skipSelection = false;
191
+ skipSelection(): boolean;
192
+ skipSelection(_: boolean): this;
193
+ skipSelection(_?: boolean): boolean | this {
194
+ if (!arguments.length) return this._skipSelection;
195
+ this._skipSelection = _;
196
+ return this;
197
+ }
198
+
199
+ brushMoved() {
200
+ if (this._skipSelection) return;
201
+ let selected = [];
202
+ const context = this;
203
+ const currSel: any = d3BrushSelection(this.svgBrush.node());
204
+ if (currSel) {
205
+ selected = this.data().filter(function (d) {
206
+ const pos = context.dataPos(d[0]);
207
+ if (context.use2dSelection()) {
208
+ const pos2 = context.valuePos(d[1]) + context.valueAxis.bandwidth() / 2;
209
+ return pos >= currSel[0][0] && pos <= currSel[1][0] && pos2 >= currSel[0][1] && pos2 <= currSel[1][1];
210
+ } else {
211
+ return pos >= currSel[0] && pos <= currSel[1];
212
+ }
213
+ });
214
+ }
215
+ this.selection(selected);
216
+ }
217
+
218
+ brushMoved2() {
219
+ const isHorizontal = this.orientation() === "horizontal";
220
+ const handleTypes = this.use2dSelection() ? [] : isHorizontal ? [{ type: "w" }, { type: "e" }] : [{ type: "n" }, { type: "s" }];
221
+ const handlePath = this.svgBrush.selectAll(".handle--custom").data(handleTypes);
222
+ const s = d3Event().selection;
223
+ if (s == null) {
224
+ handlePath.attr("display", "none");
225
+ } else if (isHorizontal) {
226
+ handlePath.attr("display", null).attr("transform", (_d, i) => "translate(" + s[i] + "," + 0 + ")");
227
+ } else {
228
+ handlePath.attr("display", null).attr("transform", (_d, i) => "translate(" + 0 + ", " + s[i] + ")");
229
+ }
230
+ }
231
+
232
+ dataPos(d) {
233
+ return this.domainAxis.scalePos(d);
234
+ }
235
+
236
+ valuePos(d) {
237
+ return this.valueAxis.scalePos(d);
238
+ }
239
+
240
+ getAxisSize(host: XYAxis): { width: number, height: number } {
241
+ return {
242
+ width: !this.xAxis ? host.xAxis.width() : this.xAxis.width(),
243
+ height: !this.yAxis ? host.yAxis.width() : this.yAxis.height()
244
+ };
245
+ }
246
+
247
+ calcMargin(_domNode, element, isHorizontal) {
248
+ const margin = {
249
+ top: !isHorizontal && this.selectionMode() ? 10 : 2,
250
+ right: isHorizontal && (this.selectionMode() || this.xAxisFocus()) ? 10 : 2,
251
+ bottom: (this.xAxisFocus() ? this.xAxisFocusHeight() : 0) + 2,
252
+ left: 2
253
+ };
254
+ const width = this.width() - margin.left - margin.right;
255
+ const height = this.height() - margin.top - margin.bottom;
256
+
257
+ let xRight = 0;
258
+ let xHeight = 30;
259
+ let yTop = 0;
260
+ let yWidth = 30;
261
+ for (let i = 0; i < 10; ++i) {
262
+ this.xAxis.width(width - yWidth).height(0);
263
+ const xAxisOverlap = this.xAxis.calcOverflow(element);
264
+ const newXHeight = xAxisOverlap.depth;
265
+
266
+ this.yAxis.width(0).height(height - xHeight);
267
+ const yAxisOverlap = this.yAxis.calcOverflow(element);
268
+ const newYWidth = yAxisOverlap.depth;
269
+
270
+ xRight = xAxisOverlap.right;
271
+ yTop = yAxisOverlap.top;
272
+
273
+ if (newXHeight === xHeight && newYWidth === yWidth) {
274
+ break;
275
+ }
276
+ xHeight = newXHeight;
277
+ yWidth = newYWidth;
278
+ }
279
+ this.xAxis
280
+ .x(width / 2 + yWidth / 2 + margin.left)
281
+ .y(height + margin.top)
282
+ .width(width - yWidth)
283
+ ;
284
+ this.yAxis
285
+ .x(margin.left)
286
+ .y(height / 2 - xHeight / 2 + margin.top)
287
+ .height(height - xHeight)
288
+ ;
289
+ margin.left += yWidth;
290
+ margin.top += yTop;
291
+ margin.right += xRight;
292
+ margin.bottom += xHeight;
293
+ return margin;
294
+ }
295
+
296
+ updateRegions(_domNode, _element, isHorizontal) {
297
+ const context = this;
298
+
299
+ const regions = this.svgRegions.selectAll(".region").data(this.regions());
300
+ regions.enter().append("rect")
301
+ .attr("class", "region")
302
+ ;
303
+ if (isHorizontal) {
304
+ regions
305
+ .attr("x", function (d) { return context.dataPos(d.x0); })
306
+ .attr("y", 0)
307
+ .attr("width", function (d) { return context.dataPos(d.x1) - context.dataPos(d.x0); })
308
+ .attr("height", this.height())
309
+ .style("stroke", function (d) { return context._palette(d.colorID); })
310
+ .style("fill", function (d) { return d3Hsl(context._palette(d.colorID)).brighter(); })
311
+ ;
312
+ } else {
313
+ regions
314
+ .attr("x", 0)
315
+ .attr("y", function (d) { return context.dataPos(d.x0); })
316
+ .attr("width", this.width())
317
+ .attr("height", function (d) { return context.dataPos(d.x0) - context.dataPos(d.x1); })
318
+ .style("stroke", function (d) { return context._palette(d.colorID); })
319
+ .style("fill", function (d) { return d3Hsl(context._palette(d.colorID)).brighter(); })
320
+ ;
321
+ }
322
+ regions.exit().remove();
323
+ }
324
+
325
+ protected _prevXAxisType;
326
+ update(domNode, element) {
327
+ super.update(domNode, element);
328
+ const context = this;
329
+
330
+ const isHorizontal = this.orientation() === "horizontal";
331
+ this.updateRegions(domNode, element, isHorizontal);
332
+
333
+ this.domainAxis
334
+ .orientation(isHorizontal ? "bottom" : "left")
335
+ .title(this.xAxisTitle_exists() ? this.xAxisTitle() : this.columns()[0])
336
+ ;
337
+ this.valueAxis
338
+ .orientation(isHorizontal ? "left" : "bottom")
339
+ ;
340
+ this.xAxis = isHorizontal ? this.domainAxis : this.valueAxis;
341
+ this.yAxis = isHorizontal ? this.valueAxis : this.domainAxis;
342
+
343
+ // Update Domain ---
344
+ switch (this.xAxisType()) {
345
+ case "ordinal":
346
+ const colLen = this.columns().length;
347
+ const ordinalMappings = {};
348
+ this.domainAxis
349
+ .ordinals(this.data().map(function (d) {
350
+ ordinalMappings[d[0]] = context.xAxisOrdinalMapping(d, d[colLen]);
351
+ return d[0];
352
+ }))
353
+ .ordinalMappings(ordinalMappings)
354
+ ;
355
+
356
+ break;
357
+ default:
358
+ const domainMin = this.xAxisDomainLow() ? this.xAxisDomainLow() : this.domainAxis.parseInvert(d3Min(this.parsedData(), function (data) {
359
+ return data[0];
360
+ }));
361
+ const domainMax = this.xAxisDomainHigh() ? this.xAxisDomainHigh() : this.domainAxis.parseInvert(d3Max(this.parsedData(), function (data) {
362
+ return data[0];
363
+ }));
364
+ if (domainMin !== undefined && domainMax !== undefined) {
365
+ this.domainAxis
366
+ .low(domainMin)
367
+ .high(domainMax)
368
+ ;
369
+ }
370
+ break;
371
+ }
372
+
373
+ const min = this.yAxisDomainLow() ? this.yAxisDomainLow() : this.valueAxis.parseInvert(d3Min(this.parsedData(), function (data: any[]) {
374
+ return d3Min(data.filter(function (cell, i) { return i > 0 && context.columns()[i] && context.columns()[i].indexOf("__") !== 0 && cell !== null; }), function (d) { return d instanceof Array ? d[0] : d; });
375
+ }));
376
+ const max = this.yAxisDomainHigh() ? this.yAxisDomainHigh() : this.valueAxis.parseInvert(d3Max(this.parsedData(), function (data: any[]) {
377
+ return d3Max(data.filter(function (cell, i) { return i > 0 && context.columns()[i] && context.columns()[i].indexOf("__") !== 0 && cell !== null; }), function (d) { return d instanceof Array ? d[1] : d; });
378
+ }));
379
+ this.valueAxis
380
+ .low(min)
381
+ .high(max)
382
+ ;
383
+
384
+ // Calculate Margins ---
385
+ this.margin = this.calcMargin(domNode, element, isHorizontal);
386
+
387
+ // Update Range ---
388
+ let width = this.width() - this.margin.left - this.margin.right;
389
+ if (width < 0) width = 0;
390
+ let height = this.height() - this.margin.top - this.margin.bottom;
391
+ if (height < 0) height = 0;
392
+ const maxCurrExtent = isHorizontal ? width : height;
393
+ const maxOtherExtent = isHorizontal ? height : width;
394
+
395
+ // Render ---
396
+ this.domainAxis
397
+ .tickLength(this.xAxisGuideLines() ? maxOtherExtent : 0)
398
+ .render()
399
+ ;
400
+ this.valueAxis
401
+ .tickLength(this.yAxisGuideLines() ? maxCurrExtent : 0)
402
+ .render()
403
+ ;
404
+
405
+ this.svgDataClipRect
406
+ .attr("width", width)
407
+ .attr("height", height)
408
+ ;
409
+ this.svgData.transition()
410
+ .attr("transform", "translate(" + this.margin.left + "," + this.margin.top + ")")
411
+ ;
412
+
413
+ this.updateBrush(width, height, maxCurrExtent, isHorizontal);
414
+ this.updateFocusChart(domNode, element, this.margin, width, height, isHorizontal);
415
+ this.chartsUpdate(width, height, 250);
416
+ if (this.selectionMode()) {
417
+ return this.brushMoved();
418
+ }
419
+ }
420
+
421
+ updateBrush(width, height, maxCurrExtent, isHorizontal) {
422
+ const currBrush = this.use2dSelection() ? this.xyBrush : isHorizontal ? this.xBrush : this.yBrush;
423
+ const prevBrushSel: any = d3BrushSelection(this.svgBrush.node());
424
+ currBrush.extent([[0, 0], [width, height]]);
425
+ this.svgBrush
426
+ .attr("transform", "translate(" + this.margin.left + ", " + this.margin.top + ")")
427
+ .style("display", this.selectionMode() ? null : "none")
428
+ .call(currBrush)
429
+ ;
430
+ const handleTypes = this.use2dSelection() ? [] : isHorizontal ? [{ type: "w" }, { type: "e" }] : [{ type: "n" }, { type: "s" }];
431
+ const handlePath = this.svgBrush.selectAll(".handle--custom").data(handleTypes);
432
+ handlePath.enter().append("path")
433
+ .attr("class", "handle--custom")
434
+ .merge(handlePath)
435
+ .attr("cursor", isHorizontal ? "ew-resize" : "ns-resize")
436
+ .attr("d", (d) => this.resizeBrushHandle(d, width, height))
437
+ ;
438
+
439
+ if (this.selectionMode()) {
440
+ if (this._prevXAxisType !== this.xAxisType()) {
441
+ this._prevXAxisType = this.xAxisType();
442
+ this._prevBrush = null;
443
+ }
444
+ if (this._prevBrush) {
445
+ if (prevBrushSel) {
446
+ if (this._prevBrush.orientation !== this.orientation()) {
447
+ const tmp = prevBrushSel[0];
448
+ prevBrushSel[0] = this._prevBrush.maxCurrExtent - prevBrushSel[1];
449
+ prevBrushSel[1] = this._prevBrush.maxCurrExtent - tmp;
450
+ }
451
+ const ratio = maxCurrExtent / this._prevBrush.maxCurrExtent;
452
+ if (ratio !== 1) {
453
+ this.svgBrush.transition()
454
+ .on("start", function () {
455
+ currBrush.on("end", null);
456
+ })
457
+ .call(currBrush.move, [prevBrushSel[0] * ratio, prevBrushSel[1] * ratio])
458
+ .on("end", () => {
459
+ currBrush.on("end", () => {
460
+ return this.brushMoved();
461
+ });
462
+ })
463
+ ;
464
+ }
465
+ }
466
+ } else {
467
+ this.svgBrush
468
+ .call(currBrush.move, [0, maxCurrExtent])
469
+ ;
470
+ }
471
+ this._prevBrush = {
472
+ orientation: this.orientation(),
473
+ maxCurrExtent
474
+ };
475
+ }
476
+ }
477
+
478
+ updateFocusChart(domNode, element, margin, width, height, isHorizontal) {
479
+ const context: XYAxis = this;
480
+ const focusChart = this.svgFocus.selectAll("#" + this.id() + "_focusChart").data(this.xAxisFocus() ? [true] : []);
481
+ focusChart.enter().append("g")
482
+ .attr("id", this.id() + "_focusChart")
483
+ .attr("class", "focus")
484
+ .each(function () {
485
+ context.focusChart = new (context.constructor as any)()
486
+ .target(this)
487
+ ;
488
+ context.focusChart.xBrush
489
+ .on("brush.focus", function () {
490
+ context.syncAxis(width);
491
+ context.chartsUpdate(width, height, 0);
492
+ })
493
+ ;
494
+ context.focusChart
495
+ .layers(context.layers().map((w: any) => new w.constructor()))
496
+ ;
497
+ })
498
+ .merge(focusChart)
499
+ .each(function (this: SVGElement) {
500
+ context.copyPropsTo(context.focusChart, ["layers"]);
501
+ let layerIdx = 0;
502
+ for (const layer of context.layers()) {
503
+ layer.copyPropsTo(context.focusChart.layers()[layerIdx]);
504
+ layerIdx++;
505
+ }
506
+ context.focusChart
507
+ .xAxisFocus(false)
508
+ .selectionMode(true)
509
+ .skipSelection(true)
510
+ .orientation("horizontal")
511
+ .xAxisGuideLines(false)
512
+ .xAxisDomainLow(null)
513
+ .xAxisDomainHigh(null)
514
+ .yAxisGuideLines(false)
515
+ .x(context.width() / 2)
516
+ .y(context.height() - context.xAxisFocusHeight() / 2)
517
+ .width(context.width())
518
+ .height(context.xAxisFocusHeight())
519
+ .columns(context.columns())
520
+ .data(context.data())
521
+ .render()
522
+ ;
523
+ context.syncAxis(width);
524
+ })
525
+ ;
526
+ focusChart.exit()
527
+ .each(function () {
528
+ if (context.focusChart) {
529
+ context.focusChart
530
+ .target(null)
531
+ ;
532
+ delete context.focusChart;
533
+ }
534
+ })
535
+ .remove()
536
+ ;
537
+ }
538
+
539
+ syncAxis(width: number) {
540
+ const currSel = d3BrushSelection(this.focusChart.svgBrush.node()) as [number, number];
541
+ if (currSel) {
542
+ if (this.focusChart.xAxisType() !== "ordinal") {
543
+ this.xAxis.domain([this.focusChart.xAxis.invert(currSel[0]), this.focusChart.xAxis.invert(currSel[1])]);
544
+ } else {
545
+ const brushWidth = currSel[1] - currSel[0];
546
+ const scale = brushWidth / width;
547
+ this.xAxis.range([-currSel[0] / scale, (width - currSel[0]) / scale]);
548
+ }
549
+ this.xAxis.rerender();
550
+ }
551
+ }
552
+
553
+ // Layers ---
554
+ layerColumns(host: XYAxis): string[] {
555
+ const masterColumns = host.columns();
556
+ const retVal = super.columns().filter(col => col !== masterColumns[0]);
557
+ if (!retVal.length) {
558
+ return masterColumns;
559
+ }
560
+ return [masterColumns[0], ...retVal];
561
+ }
562
+
563
+ layerColumnIndices(host: XYAxis): number[] {
564
+ const masterColumns = host.columns();
565
+ const layerColumns = this.layerColumns(host);
566
+ return layerColumns.map(col => masterColumns.indexOf(col));
567
+ }
568
+
569
+ layerColumnIndex(host: XYAxis, column: string): number {
570
+ const masterColumns = host.columns();
571
+ return masterColumns.indexOf(column);
572
+ }
573
+
574
+ layerData(host: XYAxis): any[][] {
575
+ if (arguments.length === 1) {
576
+ const indices = this.layerColumnIndices(host);
577
+ return host.data().map(row => {
578
+ const retVal = indices.map(idx => row[idx]);
579
+ (retVal as any).__hpcc_origRow = row;
580
+ return retVal;
581
+ });
582
+ }
583
+ throw new Error("Setting data on XYAxisLayer is not supported.");
584
+ }
585
+
586
+ layerEnter(host: XYAxis, element, duration: number = 250) {
587
+ }
588
+
589
+ layerUpdate(host: XYAxis, element, duration: number = 250) {
590
+ }
591
+
592
+ layerExit(host: XYAxis, element, duration: number = 250) {
593
+ }
594
+
595
+ chartsEnter(host: XYAxis, element, duration: number = 250) {
596
+ this.layerEnter(this, element, duration);
597
+ for (const w of this.layers()) {
598
+ w["__xyAxisElement"] = element.append("g")
599
+ .attr("class", w.class())
600
+ ;
601
+ w
602
+ .target(w["__xyAxisElement"].node() as SVGElement)
603
+ .layerEnter(this, element, duration)
604
+ ;
605
+ }
606
+ }
607
+
608
+ chartsUpdate(width, height, duration): void {
609
+ this.layerUpdate(this, this.svgData, duration);
610
+ for (const w of this.layers()) {
611
+ w
612
+ .resize({ width, height })
613
+ .layerUpdate(this, w["__xyAxisElement"], duration)
614
+ ;
615
+ }
616
+ }
617
+
618
+ exit(domNode, element) {
619
+ this.valueAxis.target(null);
620
+ this.domainAxis.target(null);
621
+ super.exit(domNode, element);
622
+ }
623
+
624
+ selection(_selected) {
625
+ const context = this;
626
+ this._selection.widgetElement().selectAll(".selected,.deselected")
627
+ .each(function (d) {
628
+ const selected = _selected.indexOf(d.origRow) >= 0;
629
+ d3Select(this)
630
+ .classed("selected", selected)
631
+ .classed("deselected", !selected)
632
+ .attr("filter", context._selection.svgGlowID() && selected ? `url(#${context._selection.svgGlowID()})` : null)
633
+ ;
634
+ })
635
+ ;
636
+
637
+ const selRows = _selected.map(d => {
638
+ return this.rowToObj(d);
639
+ });
640
+ setTimeout(() => {
641
+ this.click(selRows, "", true);
642
+ }, 0);
643
+ }
644
+
645
+ // XYAxis ---
646
+ xAxisOrdinalMapping(origRow, lparam) {
647
+ return origRow[0];
648
+ }
649
+
650
+ // Events ---
651
+ click(row, column, selected) {
652
+ // console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected);
653
+ }
654
+
655
+ // Selection ---
656
+ _selection: Utility.SimpleSelection;
657
+ }
658
+ XYAxis.prototype._class += " chart_XYAxis";
659
+ XYAxis.prototype.mixin(Utility.SimpleSelectionMixin);
660
+
661
+ export interface XYAxis {
662
+ orientation(): "horizontal" | "vertical";
663
+ orientation(_: "horizontal" | "vertical"): this;
664
+ orientation_default(_: string);
665
+ pointSizeColumn(): string;
666
+ pointSizeColumn(_: string): this;
667
+ pointSizeColumn_exists(): boolean;
668
+ minPointSize(): number;
669
+ minPointSize(_: number): this;
670
+ maxPointSize(): number;
671
+ maxPointSize(_: number): this;
672
+ use2dSelection(): boolean;
673
+ use2dSelection(_: boolean): this;
674
+ selectionMode(): boolean;
675
+ selectionMode(_: boolean): this;
676
+ xAxisTitle(): string;
677
+ xAxisTitle(_: string): this;
678
+ xAxisTitle_exists(): boolean;
679
+ xAxisTickCount(): number;
680
+ xAxisTickCount(_: number): this;
681
+ xAxisTickFormat(): string;
682
+ xAxisTickFormat(_: string): this;
683
+ xAxisTicks(): Array<{ value: string, label: string }>;
684
+ xAxisTicks(_: Array<{ value: string, label: string }>): this;
685
+ xAxisType(): "none" | "ordinal" | "linear" | "pow" | "log" | "time";
686
+ xAxisType(_: "none" | "ordinal" | "linear" | "pow" | "log" | "time"): this;
687
+ xAxisType_default(_: string);
688
+ xAxisTypeTimePattern(): string;
689
+ xAxisTypeTimePattern(_: string): this;
690
+ xAxisDomainLow(): number | string;
691
+ xAxisDomainLow(_: number | string): this;
692
+ xAxisDomainHigh(): number | string;
693
+ xAxisDomainHigh(_: number | string): this;
694
+ xAxisFontSize(): number | string;
695
+ xAxisFontSize(_: number | string): this;
696
+ xAxisFontFamily(): string;
697
+ xAxisFontFamily(_: string): this;
698
+ xAxisOrdinalPaddingInner(): number;
699
+ xAxisOrdinalPaddingInner(_: number): this;
700
+ xAxisOrdinalPaddingOuter(): number;
701
+ xAxisOrdinalPaddingOuter(_: number): this;
702
+ xAxisOverlapMode(): "none" | "stagger" | "hide" | "rotate" | "linebreak" | "wrap";
703
+ xAxisOverlapMode(_: "none" | "stagger" | "hide" | "rotate" | "linebreak" | "wrap"): this;
704
+ xAxisLabelRotation(): number;
705
+ xAxisLabelRotation(_: number): this;
706
+ xAxisDomainPadding(): number;
707
+ xAxisDomainPadding(_: number): this;
708
+ xAxisGuideLines(): boolean;
709
+ xAxisGuideLines(_: boolean): this;
710
+ xAxisGuideLines_default(_: boolean);
711
+ xAxisFocus(): boolean;
712
+ xAxisFocus(_: boolean): this;
713
+ xAxisFocusHeight(): number;
714
+ xAxisFocusHeight(_: number): this;
715
+ xAxisHidden(): boolean;
716
+ xAxisHidden(_: boolean): this;
717
+ xAxisHidden_default(_: boolean);
718
+ yAxisTitle(): string;
719
+ yAxisTitle(_: string): this;
720
+ yAxisTickCount(): number;
721
+ yAxisTickCount(_: number): this;
722
+ yAxisTickFormat(): string;
723
+ yAxisTickFormat(_: string): this;
724
+ yAxisTicks(): Array<{ value: string, label: string }>;
725
+ yAxisTicks(_: Array<{ value: string, label: string }>): this;
726
+ yAxisType(): "none" | "ordinal" | "linear" | "pow" | "log" | "time";
727
+ yAxisType(_: "none" | "ordinal" | "linear" | "pow" | "log" | "time"): this;
728
+ yAxisType_default(_: string);
729
+ yAxisTypeTimePattern(): string;
730
+ yAxisTypeTimePattern(_: string): this;
731
+ yAxisTypePowExponent(): number;
732
+ yAxisTypePowExponent(_: number): this;
733
+ yAxisTypeLogBase(): number;
734
+ yAxisTypeLogBase(_: number): this;
735
+ yAxisStacked(): boolean;
736
+ yAxisStacked(_: boolean): this;
737
+ yAxisDomainLow(): number | string;
738
+ yAxisDomainLow(_: number | string): this;
739
+ yAxisDomainHigh(): number | string;
740
+ yAxisDomainHigh(_: number | string): this;
741
+ yAxisDomainPadding(): number;
742
+ yAxisDomainPadding(_: number): this;
743
+ yAxisGuideLines(): boolean;
744
+ yAxisGuideLines(_: boolean): this;
745
+ yAxisGuideLines_default(_: boolean);
746
+ yAxisHidden(): boolean;
747
+ yAxisHidden(_: boolean): this;
748
+ yAxisHidden_default(_: boolean);
749
+ regions(): object[];
750
+ regions(_: object[]): this;
751
+ layers(): XYAxis[];
752
+ layers(_: XYAxis[]): this;
753
+ xAxisPadding(): number;
754
+ xAxisPadding(_: number): this;
755
+ yAxisPadding(): number;
756
+ yAxisPadding(_: number): this;
757
+ }
758
+
759
+ XYAxis.prototype.publish("orientation", "horizontal", "set", "Selects orientation for the axis", ["horizontal", "vertical"]);
760
+ XYAxis.prototype.publish("pointSizeColumn", null, "string", "pointSizeColumn", null, { optional: true });
761
+ XYAxis.prototype.publish("minPointSize", 6, "number", "minPointSize");
762
+ XYAxis.prototype.publish("maxPointSize", 26, "number", "maxPointSize");
763
+ XYAxis.prototype.publish("use2dSelection", false, "boolean", "2D Range Selector");
764
+ XYAxis.prototype.publish("selectionMode", false, "boolean", "Range Selector");
765
+ XYAxis.prototype.publishProxy("xAxisTitle", "domainAxis", "title");
766
+ XYAxis.prototype.publishProxy("xAxisTickCount", "domainAxis", "tickCount");
767
+ XYAxis.prototype.publishProxy("xAxisTickFormat", "domainAxis", "tickFormat");
768
+ XYAxis.prototype.publishProxy("xAxisTicks", "domainAxis", "ticks");
769
+ XYAxis.prototype.publishProxy("xAxisType", "domainAxis", "type");
770
+ XYAxis.prototype.publishProxy("xAxisTypeTimePattern", "domainAxis", "timePattern");
771
+ XYAxis.prototype.publish("xAxisDomainLow", null, "string", "X-Axis Low", null, { optional: true, disable: (w: XYAxis) => w.xAxisType() === "ordinal" });
772
+ XYAxis.prototype.publish("xAxisDomainHigh", null, "string", "X-Axis High", null, { optional: true, disable: (w: XYAxis) => w.xAxisType() === "ordinal" });
773
+ XYAxis.prototype.publishProxy("xAxisFontSize", "domainAxis", "fontSize");
774
+ XYAxis.prototype.publishProxy("xAxisFontFamily", "domainAxis", "fontFamily");
775
+ XYAxis.prototype.publishProxy("xAxisOrdinalPaddingInner", "domainAxis", "ordinalPaddingInner");
776
+ XYAxis.prototype.publishProxy("xAxisOrdinalPaddingOuter", "domainAxis", "ordinalPaddingOuter");
777
+ XYAxis.prototype.publishProxy("xAxisOverlapMode", "domainAxis", "overlapMode");
778
+ XYAxis.prototype.publishProxy("xAxisLabelRotation", "domainAxis", "labelRotation");
779
+ XYAxis.prototype.publishProxy("xAxisDomainPadding", "domainAxis", "extend");
780
+ XYAxis.prototype.publish("xAxisGuideLines", false, "boolean", "Y-Axis Guide Lines");
781
+ XYAxis.prototype.publish("xAxisFocus", false, "boolean", "X-Axis Focus", null, { disable: (w: any) => w.orientation() !== "horizontal" });
782
+ XYAxis.prototype.publish("xAxisFocusHeight", 80, "number", "X-Axis Focus Height", null, { disable: (w: any) => !w.xAxisFocus() });
783
+ XYAxis.prototype.publishProxy("xAxisHidden", "domainAxis", "hidden");
784
+ XYAxis.prototype.publishProxy("yAxisFontSize", "valueAxis", "fontSize");
785
+ XYAxis.prototype.publishProxy("yAxisFontFamily", "valueAxis", "fontFamily");
786
+ XYAxis.prototype.publishProxy("yAxisTitle", "valueAxis", "title");
787
+ XYAxis.prototype.publishProxy("yAxisTickCount", "valueAxis", "tickCount");
788
+ XYAxis.prototype.publishProxy("yAxisTickFormat", "valueAxis", "tickFormat");
789
+ XYAxis.prototype.publishProxy("yAxisTicks", "valueAxis", "ticks");
790
+ XYAxis.prototype.publishProxy("yAxisType", "valueAxis", "type");
791
+ XYAxis.prototype.publishProxy("yAxisTypeTimePattern", "valueAxis", "timePattern");
792
+ XYAxis.prototype.publishProxy("yAxisTypePowExponent", "valueAxis", "powExponent");
793
+ XYAxis.prototype.publishProxy("yAxisTypeLogBase", "valueAxis", "logBase");
794
+ XYAxis.prototype.publish("yAxisStacked", false, "boolean", "Stacked Chart", null, { tags: ["Basic"], disable: (w: any) => w.xAxisType() !== "ordinal" || w._class.indexOf("chart_Column") < 0 });
795
+ XYAxis.prototype.publish("yAxisDomainLow", null, "string", "Y-Axis Low", null, { optional: true, disable: (w: any) => w.yAxisType() === "ordinal" });
796
+ XYAxis.prototype.publish("yAxisDomainHigh", null, "string", "Y-Axis High", null, { optional: true, disable: (w: any) => w.yAxisType() === "ordinal" });
797
+ XYAxis.prototype.publishProxy("yAxisDomainPadding", "valueAxis", "extend");
798
+ XYAxis.prototype.publish("yAxisGuideLines", true, "boolean", "Y-Axis Guide Lines");
799
+ XYAxis.prototype.publishProxy("yAxisHidden", "valueAxis", "hidden");
800
+ XYAxis.prototype.publish("regions", [], "array", "Regions");
801
+ XYAxis.prototype.publish("layers", [], "widgetArray", "Layers", null, { render: false });
802
+ XYAxis.prototype.publishProxy("xAxisPadding", "domainAxis", "padding");
803
+ XYAxis.prototype.publishProxy("yAxisPadding", "valueAxis", "padding");