@nova-ui/charts 12.0.18 → 12.0.20
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/bundles/nova-ui-charts.umd.js +49 -11
- package/bundles/nova-ui-charts.umd.js.map +1 -1
- package/core/common/scales/scale.d.ts +7 -0
- package/core/common/scales/types.d.ts +9 -0
- package/esm2015/core/common/scales/scale.js +14 -1
- package/esm2015/core/common/scales/types.js +1 -1
- package/esm2015/core/grid/grid.js +3 -1
- package/esm2015/core/grid/xy-grid.js +20 -12
- package/esm2015/core/plugins/interaction/interaction-label-plugin.js +12 -1
- package/fesm2015/nova-ui-charts.js +45 -11
- package/fesm2015/nova-ui-charts.js.map +1 -1
- package/nova-ui-charts.metadata.json +1 -1
- package/package.json +2 -2
|
@@ -5395,7 +5395,9 @@ class Scale {
|
|
|
5395
5395
|
constructor(id) {
|
|
5396
5396
|
this.domainCalculator = getAutomaticDomain;
|
|
5397
5397
|
this.formatters = {};
|
|
5398
|
+
this.isTimeseriesScale = false;
|
|
5398
5399
|
this.isReversed = false;
|
|
5400
|
+
this._fixDomainValues = [];
|
|
5399
5401
|
this.id = id || UtilityService.uuid();
|
|
5400
5402
|
this._d3Scale = this.createD3Scale();
|
|
5401
5403
|
}
|
|
@@ -5403,6 +5405,17 @@ class Scale {
|
|
|
5403
5405
|
get d3Scale() {
|
|
5404
5406
|
return this._d3Scale;
|
|
5405
5407
|
}
|
|
5408
|
+
get fixDomainValues() {
|
|
5409
|
+
return this._fixDomainValues;
|
|
5410
|
+
}
|
|
5411
|
+
/** See {@link IScale#setFixDomainValues} */
|
|
5412
|
+
setFixDomainValues(values) {
|
|
5413
|
+
if (values.length > 1) {
|
|
5414
|
+
this.domain([values[0], values[values.length - 1]]);
|
|
5415
|
+
this.isDomainFixed = true;
|
|
5416
|
+
}
|
|
5417
|
+
this._fixDomainValues = values;
|
|
5418
|
+
}
|
|
5406
5419
|
range(range) {
|
|
5407
5420
|
if (range) {
|
|
5408
5421
|
this._d3Scale.range(this.isReversed ? range.reverse() : range);
|
|
@@ -5660,6 +5673,17 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5660
5673
|
.getStream(INTERACTION_VALUES_EVENT)
|
|
5661
5674
|
.pipe(takeUntil(this.destroy$))
|
|
5662
5675
|
.subscribe((event) => {
|
|
5676
|
+
var _a;
|
|
5677
|
+
if ((_a = event.data.values) === null || _a === void 0 ? void 0 : _a.y) {
|
|
5678
|
+
const chartGrid = this.chart.getGrid();
|
|
5679
|
+
const eventYAxisIds = Object.keys(event.data.values.y);
|
|
5680
|
+
const chartLeftYAxis = chartGrid.scales.y.list[0];
|
|
5681
|
+
// shows label only for a chart that is currently being hovered
|
|
5682
|
+
if (chartLeftYAxis.isTimeseriesScale &&
|
|
5683
|
+
!eventYAxisIds.includes(chartLeftYAxis.id)) {
|
|
5684
|
+
return;
|
|
5685
|
+
}
|
|
5686
|
+
}
|
|
5663
5687
|
this.lastInteractionValuesPayload = event.data;
|
|
5664
5688
|
if (this.isChartInView) {
|
|
5665
5689
|
this.handleLabelUpdate();
|
|
@@ -6212,6 +6236,8 @@ class Grid {
|
|
|
6212
6236
|
x2: this.config().dimension.width() +
|
|
6213
6237
|
Grid.TICK_DIMENSION_CORRECTION,
|
|
6214
6238
|
y2: this.config().dimension.height() - borderMidpoint,
|
|
6239
|
+
class: this._config.borders.bottom.className ||
|
|
6240
|
+
Grid.DEFAULT_BORDER_CLASS_NAME,
|
|
6215
6241
|
})
|
|
6216
6242
|
.classed("hidden", !((_a = this._config.borders.bottom) === null || _a === void 0 ? void 0 : _a.visible));
|
|
6217
6243
|
}
|
|
@@ -6490,12 +6516,16 @@ class XYGrid extends Grid {
|
|
|
6490
6516
|
}
|
|
6491
6517
|
/** @ignore */
|
|
6492
6518
|
drawTicks(config, axis, scale, axisGenerator) {
|
|
6519
|
+
var _a, _b;
|
|
6493
6520
|
if (config.visible) {
|
|
6494
|
-
const
|
|
6521
|
+
const labelAxis = axisGenerator(scale.d3Scale)
|
|
6495
6522
|
.ticks(config.approximateTicks)
|
|
6496
|
-
.tickSize(0)
|
|
6497
|
-
|
|
6498
|
-
|
|
6523
|
+
.tickSize(0);
|
|
6524
|
+
if ((_a = scale.fixDomainValues) === null || _a === void 0 ? void 0 : _a.length) {
|
|
6525
|
+
labelAxis.tickValues(scale.fixDomainValues);
|
|
6526
|
+
}
|
|
6527
|
+
labelAxis.tickFormat(scale.formatters["tick"]);
|
|
6528
|
+
axis.labelGroup.call(labelAxis);
|
|
6499
6529
|
let tickAxis;
|
|
6500
6530
|
if (scale instanceof BandScale) {
|
|
6501
6531
|
tickAxis = axisGenerator(scale.copyToLinear().d3Scale)
|
|
@@ -6504,9 +6534,11 @@ class XYGrid extends Grid {
|
|
|
6504
6534
|
.tickFormat(() => "");
|
|
6505
6535
|
}
|
|
6506
6536
|
else {
|
|
6507
|
-
tickAxis = axisGenerator(scale.d3Scale)
|
|
6508
|
-
|
|
6509
|
-
.
|
|
6537
|
+
tickAxis = axisGenerator(scale.d3Scale).tickSize(config.tickSize);
|
|
6538
|
+
if ((_b = scale.fixDomainValues) === null || _b === void 0 ? void 0 : _b.length) {
|
|
6539
|
+
tickAxis.tickValues(scale.fixDomainValues);
|
|
6540
|
+
}
|
|
6541
|
+
tickAxis.tickFormat(() => "");
|
|
6510
6542
|
tickAxis.ticks(config.approximateTicks);
|
|
6511
6543
|
}
|
|
6512
6544
|
axis.tickGroup.call(tickAxis);
|
|
@@ -6519,13 +6551,15 @@ class XYGrid extends Grid {
|
|
|
6519
6551
|
}
|
|
6520
6552
|
/** @ignore */
|
|
6521
6553
|
drawGrids(config, axis, axisGenerator, scale, size) {
|
|
6554
|
+
var _a;
|
|
6522
6555
|
const modifyZeroLines = (gridGroupSelection) => gridGroupSelection
|
|
6523
6556
|
.selectAll(".tick line")
|
|
6524
6557
|
.classed("nui-zero-line", (d) => d === 0);
|
|
6525
|
-
const leftGridLines = axisGenerator(scale.d3Scale)
|
|
6526
|
-
|
|
6527
|
-
.
|
|
6528
|
-
|
|
6558
|
+
const leftGridLines = axisGenerator(scale.d3Scale).tickSize(size);
|
|
6559
|
+
if ((_a = scale.fixDomainValues) === null || _a === void 0 ? void 0 : _a.length) {
|
|
6560
|
+
leftGridLines.tickValues(scale.fixDomainValues);
|
|
6561
|
+
}
|
|
6562
|
+
leftGridLines.tickFormat(() => "").ticks(config.approximateTicks);
|
|
6529
6563
|
if (config.gridTicks) {
|
|
6530
6564
|
const gridSelection = axis.tickGroup.call(leftGridLines);
|
|
6531
6565
|
modifyZeroLines(gridSelection);
|