@hpcc-js/chart 2.81.10 → 2.83.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es6.js +80 -28
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +80 -28
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -2
- package/src/Axis.ts +6 -1
- package/src/Column.ts +81 -28
- package/src/XYAxis.ts +6 -0
- package/src/__package__.ts +2 -2
- package/src/test.ts +43 -4
- package/types/Axis.d.ts +2 -0
- package/types/Axis.d.ts.map +1 -1
- package/types/Column.d.ts +3 -0
- package/types/Column.d.ts.map +1 -1
- package/types/XYAxis.d.ts +4 -0
- package/types/XYAxis.d.ts.map +1 -1
- package/types/__package__.d.ts +2 -2
- package/types/__package__.d.ts.map +1 -1
- package/types/test.d.ts +5 -1
- package/types/test.d.ts.map +1 -1
- package/types-3.4/Axis.d.ts +2 -0
- package/types-3.4/Column.d.ts +3 -0
- package/types-3.4/XYAxis.d.ts +4 -0
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/test.d.ts +5 -1
package/dist/index.es6.js
CHANGED
|
@@ -3,8 +3,8 @@ import { select, scaleTime, timeParse, timeFormat, scaleLog, format, scalePow, s
|
|
|
3
3
|
import { normalizeRadians, degreesToRadians } from '@hpcc-js/util';
|
|
4
4
|
|
|
5
5
|
var PKG_NAME = "@hpcc-js/chart";
|
|
6
|
-
var PKG_VERSION = "2.
|
|
7
|
-
var BUILD_VERSION = "2.
|
|
6
|
+
var PKG_VERSION = "2.83.1";
|
|
7
|
+
var BUILD_VERSION = "2.105.2";
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
10
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -1892,7 +1892,7 @@ var Axis = /** @class */ (function (_super) {
|
|
|
1892
1892
|
this.svg.style("display", this.hidden() ? "none" : null);
|
|
1893
1893
|
var overlap = this.calcOverflow(element);
|
|
1894
1894
|
var lowerPos = this.isHorizontal() ? overlap.left : this.height() - overlap.top - overlap.bottom;
|
|
1895
|
-
var upperPos = this.isHorizontal() ? this.width() - overlap.right : 0;
|
|
1895
|
+
var upperPos = this.isHorizontal() ? this.width() - overlap.right - this.padding() : 0 + this.padding();
|
|
1896
1896
|
this.range(this.reverse() ? [upperPos, lowerPos] : [lowerPos, upperPos]);
|
|
1897
1897
|
var context = this;
|
|
1898
1898
|
function doPosition(element) {
|
|
@@ -2020,6 +2020,7 @@ Axis.prototype.publish("hidden", false, "boolean", "Hides axis when 'true'");
|
|
|
2020
2020
|
Axis.prototype.publish("ordinalPaddingInner", 0.1, "number", "Determines the ratio of the range that is reserved for blank space between band (0->1)", null, { disable: function (w) { return w.type() !== "ordinal"; } });
|
|
2021
2021
|
Axis.prototype.publish("ordinalPaddingOuter", 0.1, "number", "Determines the ratio of the range that is reserved for blank space before the first band and after the last band (0->1)", null, { disable: function (w) { return w.type() !== "ordinal"; } });
|
|
2022
2022
|
Axis.prototype.publish("ordinalMappings", null, "object", "Alternative label mappings (icons)", null, { optional: true });
|
|
2023
|
+
Axis.prototype.publish("padding", 0, "number", "Padding space at top of axis (pixels)", null, { optional: true });
|
|
2023
2024
|
|
|
2024
2025
|
var css_248z$b = ".chart_XYAxis .axis{fill:#000}.chart_XYAxis .axis,.chart_XYAxis .tick>text{font:10px sans-serif}.chart_XYAxis .focus .chart_Axis.value .tick{visibility:hidden}.chart_XYAxis .axis line,.chart_XYAxis .axis path{fill:none;stroke:#000;shape-rendering:crispEdges}.chart_XYAxis .region{opacity:.33}.chart_XYAxis .brush rect.background{z-index:-999}.chart_XYAxis .brush .selection{stroke:#4682b4;stroke-opacity:1;stroke-width:1px;fill:#4682b4;fill-opacity:.125;shape-rendering:crispEdges}.chart_XYAxis .brush path.handle--custom{fill:#eee;stroke:#666}";
|
|
2025
2026
|
styleInject(css_248z$b);
|
|
@@ -2613,6 +2614,8 @@ XYAxis.prototype.publish("yAxisGuideLines", true, "boolean", "Y-Axis Guide Lines
|
|
|
2613
2614
|
XYAxis.prototype.publishProxy("yAxisHidden", "valueAxis", "hidden");
|
|
2614
2615
|
XYAxis.prototype.publish("regions", [], "array", "Regions");
|
|
2615
2616
|
XYAxis.prototype.publish("layers", [], "widgetArray", "Layers", null, { render: false });
|
|
2617
|
+
XYAxis.prototype.publishProxy("xAxisPadding", "domainAxis", "padding");
|
|
2618
|
+
XYAxis.prototype.publishProxy("yAxisPadding", "valueAxis", "padding");
|
|
2616
2619
|
|
|
2617
2620
|
var css_248z$a = ".chart_Scatter .area,.chart_Scatter .line,.chart_Scatter .pointShape{pointer-events:none}.chart_Scatter .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Scatter .point .pointSelection.selected{fill:none;stroke:red}";
|
|
2618
2621
|
styleInject(css_248z$a);
|
|
@@ -2932,6 +2935,7 @@ var Column = /** @class */ (function (_super) {
|
|
|
2932
2935
|
function Column() {
|
|
2933
2936
|
var _this = _super.call(this) || this;
|
|
2934
2937
|
_this.textLocal = local();
|
|
2938
|
+
_this.stackedTextLocal = local();
|
|
2935
2939
|
INDChart.call(_this);
|
|
2936
2940
|
ITooltip.call(_this);
|
|
2937
2941
|
_this._selection.skipBringToTop(true);
|
|
@@ -2993,6 +2997,7 @@ var Column = /** @class */ (function (_super) {
|
|
|
2993
2997
|
if (this.useClonedPalette()) {
|
|
2994
2998
|
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
|
|
2995
2999
|
}
|
|
3000
|
+
var formatPct = format(context.showValueAsPercentFormat());
|
|
2996
3001
|
var dataLen = 10;
|
|
2997
3002
|
var offset = 0;
|
|
2998
3003
|
switch (host.xAxisType()) {
|
|
@@ -3012,30 +3017,26 @@ var Column = /** @class */ (function (_super) {
|
|
|
3012
3017
|
.rangeRound(isHorizontal ? [0, dataLen] : [dataLen, 0])
|
|
3013
3018
|
.paddingInner(this.xAxisSeriesPaddingInner())
|
|
3014
3019
|
.paddingOuter(0);
|
|
3015
|
-
var rowData = this.adjustedData(host);
|
|
3016
3020
|
var domainSums = [];
|
|
3017
3021
|
var seriesSums = [];
|
|
3018
3022
|
var columnLength = this.columns().length;
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
});
|
|
3037
|
-
break;
|
|
3038
|
-
}
|
|
3023
|
+
var rowData = this.data();
|
|
3024
|
+
if (this.showValue() && this.showValueAsPercent() === "series") {
|
|
3025
|
+
rowData.forEach(function (row) {
|
|
3026
|
+
row.filter(function (_, idx) { return idx > 0 && idx < columnLength; }).forEach(function (col, idx) {
|
|
3027
|
+
if (seriesSums[idx + 1] === undefined) {
|
|
3028
|
+
seriesSums[idx + 1] = 0;
|
|
3029
|
+
}
|
|
3030
|
+
seriesSums[idx + 1] += col;
|
|
3031
|
+
});
|
|
3032
|
+
});
|
|
3033
|
+
}
|
|
3034
|
+
if (this.showDomainTotal() || (this.showValue() && this.showValueAsPercent() === "domain")) {
|
|
3035
|
+
domainSums = rowData.map(function (row) {
|
|
3036
|
+
return row.filter(function (cell, idx) { return idx > 0 && idx < columnLength; }).reduce(function (sum, cell) {
|
|
3037
|
+
return sum + cell;
|
|
3038
|
+
}, 0);
|
|
3039
|
+
});
|
|
3039
3040
|
}
|
|
3040
3041
|
var column = element.selectAll(".dataRow")
|
|
3041
3042
|
.data(this.adjustedData(host));
|
|
@@ -3097,11 +3098,11 @@ var Column = /** @class */ (function (_super) {
|
|
|
3097
3098
|
switch (context.showValueAsPercent()) {
|
|
3098
3099
|
case "series":
|
|
3099
3100
|
var seriesSum = typeof dm.sum !== "undefined" ? dm.sum : seriesSums[d.idx];
|
|
3100
|
-
valueText =
|
|
3101
|
+
valueText = formatPct(valueText / seriesSum);
|
|
3101
3102
|
break;
|
|
3102
3103
|
case "domain":
|
|
3103
|
-
var domainSum = typeof dm.sum !== "undefined" ? dm.sum : domainSums[
|
|
3104
|
-
valueText =
|
|
3104
|
+
var domainSum = typeof dm.sum !== "undefined" ? dm.sum : domainSums[dataRowIdx];
|
|
3105
|
+
valueText = formatPct(valueText / domainSum);
|
|
3105
3106
|
break;
|
|
3106
3107
|
case null:
|
|
3107
3108
|
default:
|
|
@@ -3314,7 +3315,8 @@ var Column = /** @class */ (function (_super) {
|
|
|
3314
3315
|
var textColor = isOutside ? null : context.textColor(d.row, d.column, d.value, d.origRow);
|
|
3315
3316
|
// Prevent overlapping labels on stacked columns
|
|
3316
3317
|
var columns = context.columns();
|
|
3317
|
-
var hideValue =
|
|
3318
|
+
var hideValue = (context.yAxisStacked() && noRoomInside) ||
|
|
3319
|
+
(isOutside && context.yAxisStacked() && columns.indexOf(d.column) !== columns.length - 1);
|
|
3318
3320
|
context.textLocal.get(this)
|
|
3319
3321
|
.pos(pos)
|
|
3320
3322
|
.anchor(valueAnchor)
|
|
@@ -3334,6 +3336,55 @@ var Column = /** @class */ (function (_super) {
|
|
|
3334
3336
|
columnGRect.exit().transition().duration(duration)
|
|
3335
3337
|
.style("opacity", 0)
|
|
3336
3338
|
.remove();
|
|
3339
|
+
var value4pos = host.yAxisStacked() ? domainSums[dataRowIdx] : Math.max.apply(Math, dataRow.filter(function (_, idx) { return idx > 0 && idx < columnLength; }));
|
|
3340
|
+
var stackedTotalText = element.selectAll(".stackedTotalText").data(context.showDomainTotal() ? [domainSums[dataRowIdx]] : []);
|
|
3341
|
+
var stackedTotalTextEnter = stackedTotalText.enter().append("g")
|
|
3342
|
+
.attr("class", "stackedTotalText")
|
|
3343
|
+
.each(function (d) {
|
|
3344
|
+
context.stackedTextLocal.set(this, new Text().target(this).colorStroke_default("transparent"));
|
|
3345
|
+
});
|
|
3346
|
+
stackedTotalTextEnter.merge(stackedTotalText)
|
|
3347
|
+
.each(function (d) {
|
|
3348
|
+
var pos = { x: 0, y: 0 };
|
|
3349
|
+
var domainPos = host.dataPos(dataRow[0]);
|
|
3350
|
+
var valuePos = host.valuePos(value4pos);
|
|
3351
|
+
var valueFontFamily = context.valueFontFamily();
|
|
3352
|
+
var valueFontSize = context.valueFontSize();
|
|
3353
|
+
var textSize = context.textSize(d, valueFontFamily, valueFontSize);
|
|
3354
|
+
var isPositive = parseFloat(d) >= 0;
|
|
3355
|
+
var valueAnchor = "middle";
|
|
3356
|
+
if (isHorizontal) {
|
|
3357
|
+
pos.x = domainPos;
|
|
3358
|
+
if (isPositive) {
|
|
3359
|
+
pos.y = valuePos - textSize.height / 2;
|
|
3360
|
+
}
|
|
3361
|
+
else {
|
|
3362
|
+
pos.y = valuePos + textSize.height / 2;
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
else {
|
|
3366
|
+
valueAnchor = "start";
|
|
3367
|
+
pos.y = domainPos;
|
|
3368
|
+
if (isPositive) {
|
|
3369
|
+
pos.x = valuePos + textSize.width / 2;
|
|
3370
|
+
}
|
|
3371
|
+
else {
|
|
3372
|
+
pos.x = valuePos - textSize.width / 2;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
context.stackedTextLocal.get(this)
|
|
3376
|
+
.pos(pos)
|
|
3377
|
+
.anchor(valueAnchor)
|
|
3378
|
+
.fontFamily(valueFontFamily)
|
|
3379
|
+
.fontSize(valueFontSize)
|
|
3380
|
+
.text(d)
|
|
3381
|
+
.render();
|
|
3382
|
+
});
|
|
3383
|
+
stackedTotalText.exit()
|
|
3384
|
+
.each(function (d) {
|
|
3385
|
+
context.textLocal.get(this).target(null);
|
|
3386
|
+
})
|
|
3387
|
+
.remove();
|
|
3337
3388
|
});
|
|
3338
3389
|
column.exit().transition().duration(duration)
|
|
3339
3390
|
.remove();
|
|
@@ -3420,6 +3471,7 @@ Column.prototype.publish("showInnerText", false, "boolean", "Show Label in colum
|
|
|
3420
3471
|
Column.prototype.publish("showValueFormat", ",", "string", "D3 Format for Value", null, { disable: function (w) { return !w.showValue() || !!w.showValueAsPercent(); } });
|
|
3421
3472
|
Column.prototype.publish("showValueAsPercent", null, "set", "If showValue is true, optionally show value as a percentage by Series or Domain", [null, "series", "domain"], { disable: function (w) { return !w.showValue(); }, optional: true });
|
|
3422
3473
|
Column.prototype.publish("showValueAsPercentFormat", ".0%", "string", "D3 Format for %", null, { disable: function (w) { return !w.showValue() || !w.showValueAsPercent(); } });
|
|
3474
|
+
Column.prototype.publish("showDomainTotal", false, "boolean", "Show Total Value for Stacked Columns", null);
|
|
3423
3475
|
Column.prototype.publish("valueCentered", false, "boolean", "Show Value in center of column");
|
|
3424
3476
|
Column.prototype.publish("valueAnchor", "middle", "set", "text-anchor for shown value text", ["start", "middle", "end"]);
|
|
3425
3477
|
Column.prototype.publish("xAxisSeriesPaddingInner", 0, "number", "Determines the ratio of the range that is reserved for blank space between band (0->1)");
|