@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.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.82.0";
7
- var BUILD_VERSION = "2.105.0";
6
+ var PKG_VERSION = "2.83.2";
7
+ var BUILD_VERSION = "2.105.6";
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);
@@ -2994,6 +2997,7 @@ var Column = /** @class */ (function (_super) {
2994
2997
  if (this.useClonedPalette()) {
2995
2998
  this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
2996
2999
  }
3000
+ var formatPct = format(context.showValueAsPercentFormat());
2997
3001
  var dataLen = 10;
2998
3002
  var offset = 0;
2999
3003
  switch (host.xAxisType()) {
@@ -3094,11 +3098,11 @@ var Column = /** @class */ (function (_super) {
3094
3098
  switch (context.showValueAsPercent()) {
3095
3099
  case "series":
3096
3100
  var seriesSum = typeof dm.sum !== "undefined" ? dm.sum : seriesSums[d.idx];
3097
- valueText = format(context.showValueAsPercentFormat())(valueText / seriesSum);
3101
+ valueText = formatPct(valueText / seriesSum);
3098
3102
  break;
3099
3103
  case "domain":
3100
- var domainSum = typeof dm.sum !== "undefined" ? dm.sum : domainSums[d.idx - 1];
3101
- valueText = format(context.showValueAsPercentFormat())(valueText / domainSum);
3104
+ var domainSum = typeof dm.sum !== "undefined" ? dm.sum : domainSums[dataRowIdx];
3105
+ valueText = formatPct(valueText / domainSum);
3102
3106
  break;
3103
3107
  case null:
3104
3108
  default:
@@ -3228,7 +3232,7 @@ var Column = /** @class */ (function (_super) {
3228
3232
  ...then ASSUME THERES ROOM ON THE OPPOSITE SIDE
3229
3233
  */
3230
3234
  if (isHorizontal) { // Column
3231
- noRoomInside = context.yAxisStacked() ? false : dataRect.height < textSize.height;
3235
+ noRoomInside = dataRect.height < textSize.height;
3232
3236
  isOutside = !context.valueCentered() || noRoomInside;
3233
3237
  pos.x = dataRect.x + (dataRect.width / 2);
3234
3238
  if (isOutside) {
@@ -3268,7 +3272,7 @@ var Column = /** @class */ (function (_super) {
3268
3272
  }
3269
3273
  }
3270
3274
  else { // Bar
3271
- noRoomInside = context.yAxisStacked() ? false : dataRect.width < textSize.width;
3275
+ noRoomInside = dataRect.width < textSize.width;
3272
3276
  isOutside = !context.valueCentered() || noRoomInside;
3273
3277
  pos.y = dataRect.y + (dataRect.height / 2);
3274
3278
  if (isOutside) {
@@ -3311,7 +3315,8 @@ var Column = /** @class */ (function (_super) {
3311
3315
  var textColor = isOutside ? null : context.textColor(d.row, d.column, d.value, d.origRow);
3312
3316
  // Prevent overlapping labels on stacked columns
3313
3317
  var columns = context.columns();
3314
- var hideValue = isOutside && context.yAxisStacked() && columns.indexOf(d.column) !== columns.length - 1;
3318
+ var hideValue = (context.yAxisStacked() && noRoomInside) ||
3319
+ (isOutside && context.yAxisStacked() && columns.indexOf(d.column) !== columns.length - 1);
3315
3320
  context.textLocal.get(this)
3316
3321
  .pos(pos)
3317
3322
  .anchor(valueAnchor)