@hpcc-js/chart 2.82.0 → 2.83.2

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.js CHANGED
@@ -5,8 +5,8 @@
5
5
  })(this, (function (exports, api, common, util) { 'use strict';
6
6
 
7
7
  var PKG_NAME = "@hpcc-js/chart";
8
- var PKG_VERSION = "2.82.0";
9
- var BUILD_VERSION = "2.105.0";
8
+ var PKG_VERSION = "2.83.2";
9
+ var BUILD_VERSION = "2.105.6";
10
10
 
11
11
  /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -1894,7 +1894,7 @@
1894
1894
  this.svg.style("display", this.hidden() ? "none" : null);
1895
1895
  var overlap = this.calcOverflow(element);
1896
1896
  var lowerPos = this.isHorizontal() ? overlap.left : this.height() - overlap.top - overlap.bottom;
1897
- var upperPos = this.isHorizontal() ? this.width() - overlap.right : 0;
1897
+ var upperPos = this.isHorizontal() ? this.width() - overlap.right - this.padding() : 0 + this.padding();
1898
1898
  this.range(this.reverse() ? [upperPos, lowerPos] : [lowerPos, upperPos]);
1899
1899
  var context = this;
1900
1900
  function doPosition(element) {
@@ -2022,6 +2022,7 @@
2022
2022
  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"; } });
2023
2023
  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"; } });
2024
2024
  Axis.prototype.publish("ordinalMappings", null, "object", "Alternative label mappings (icons)", null, { optional: true });
2025
+ Axis.prototype.publish("padding", 0, "number", "Padding space at top of axis (pixels)", null, { optional: true });
2025
2026
 
2026
2027
  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}";
2027
2028
  styleInject(css_248z$b);
@@ -2615,6 +2616,8 @@
2615
2616
  XYAxis.prototype.publishProxy("yAxisHidden", "valueAxis", "hidden");
2616
2617
  XYAxis.prototype.publish("regions", [], "array", "Regions");
2617
2618
  XYAxis.prototype.publish("layers", [], "widgetArray", "Layers", null, { render: false });
2619
+ XYAxis.prototype.publishProxy("xAxisPadding", "domainAxis", "padding");
2620
+ XYAxis.prototype.publishProxy("yAxisPadding", "valueAxis", "padding");
2618
2621
 
2619
2622
  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}";
2620
2623
  styleInject(css_248z$a);
@@ -2996,6 +2999,7 @@
2996
2999
  if (this.useClonedPalette()) {
2997
3000
  this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
2998
3001
  }
3002
+ var formatPct = common.format(context.showValueAsPercentFormat());
2999
3003
  var dataLen = 10;
3000
3004
  var offset = 0;
3001
3005
  switch (host.xAxisType()) {
@@ -3096,11 +3100,11 @@
3096
3100
  switch (context.showValueAsPercent()) {
3097
3101
  case "series":
3098
3102
  var seriesSum = typeof dm.sum !== "undefined" ? dm.sum : seriesSums[d.idx];
3099
- valueText = common.format(context.showValueAsPercentFormat())(valueText / seriesSum);
3103
+ valueText = formatPct(valueText / seriesSum);
3100
3104
  break;
3101
3105
  case "domain":
3102
- var domainSum = typeof dm.sum !== "undefined" ? dm.sum : domainSums[d.idx - 1];
3103
- valueText = common.format(context.showValueAsPercentFormat())(valueText / domainSum);
3106
+ var domainSum = typeof dm.sum !== "undefined" ? dm.sum : domainSums[dataRowIdx];
3107
+ valueText = formatPct(valueText / domainSum);
3104
3108
  break;
3105
3109
  case null:
3106
3110
  default:
@@ -3230,7 +3234,7 @@
3230
3234
  ...then ASSUME THERES ROOM ON THE OPPOSITE SIDE
3231
3235
  */
3232
3236
  if (isHorizontal) { // Column
3233
- noRoomInside = context.yAxisStacked() ? false : dataRect.height < textSize.height;
3237
+ noRoomInside = dataRect.height < textSize.height;
3234
3238
  isOutside = !context.valueCentered() || noRoomInside;
3235
3239
  pos.x = dataRect.x + (dataRect.width / 2);
3236
3240
  if (isOutside) {
@@ -3270,7 +3274,7 @@
3270
3274
  }
3271
3275
  }
3272
3276
  else { // Bar
3273
- noRoomInside = context.yAxisStacked() ? false : dataRect.width < textSize.width;
3277
+ noRoomInside = dataRect.width < textSize.width;
3274
3278
  isOutside = !context.valueCentered() || noRoomInside;
3275
3279
  pos.y = dataRect.y + (dataRect.height / 2);
3276
3280
  if (isOutside) {
@@ -3313,7 +3317,8 @@
3313
3317
  var textColor = isOutside ? null : context.textColor(d.row, d.column, d.value, d.origRow);
3314
3318
  // Prevent overlapping labels on stacked columns
3315
3319
  var columns = context.columns();
3316
- var hideValue = isOutside && context.yAxisStacked() && columns.indexOf(d.column) !== columns.length - 1;
3320
+ var hideValue = (context.yAxisStacked() && noRoomInside) ||
3321
+ (isOutside && context.yAxisStacked() && columns.indexOf(d.column) !== columns.length - 1);
3317
3322
  context.textLocal.get(this)
3318
3323
  .pos(pos)
3319
3324
  .anchor(valueAnchor)