@nova-ui/charts 12.0.17 → 12.0.20-4218
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 +63 -15
- package/bundles/nova-ui-charts.umd.js.map +1 -1
- package/chart-collection/chart-collection-id.directive.d.ts +3 -3
- package/core/common/scales/scale.d.ts +7 -0
- package/core/common/scales/types.d.ts +9 -0
- package/esm2015/chart-collection/chart-collection-id.directive.js +16 -6
- 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 +59 -15
- package/fesm2015/nova-ui-charts.js.map +1 -1
- package/nova-ui-charts.metadata.json +1 -1
- package/package.json +2 -2
|
@@ -1480,10 +1480,20 @@ class ChartCollectionIdDirective {
|
|
|
1480
1480
|
this.chartComponent = chartComponent;
|
|
1481
1481
|
this.chartCollectionService = chartCollectionService;
|
|
1482
1482
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1483
|
+
ngOnChanges(changes) {
|
|
1484
|
+
const collectionIdChange = changes.collectionId;
|
|
1485
|
+
if (collectionIdChange) {
|
|
1486
|
+
if (collectionIdChange.previousValue) {
|
|
1487
|
+
this.chartCollectionService
|
|
1488
|
+
.getChartCollection(collectionIdChange.previousValue)
|
|
1489
|
+
.removeChart(this.chartComponent.chart);
|
|
1490
|
+
}
|
|
1491
|
+
if (collectionIdChange.currentValue) {
|
|
1492
|
+
this.chartCollectionService
|
|
1493
|
+
.getChartCollection(collectionIdChange.currentValue)
|
|
1494
|
+
.addChart(this.chartComponent.chart);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1487
1497
|
}
|
|
1488
1498
|
}
|
|
1489
1499
|
ChartCollectionIdDirective.decorators = [
|
|
@@ -5385,7 +5395,9 @@ class Scale {
|
|
|
5385
5395
|
constructor(id) {
|
|
5386
5396
|
this.domainCalculator = getAutomaticDomain;
|
|
5387
5397
|
this.formatters = {};
|
|
5398
|
+
this.isTimeseriesScale = false;
|
|
5388
5399
|
this.isReversed = false;
|
|
5400
|
+
this._fixDomainValues = [];
|
|
5389
5401
|
this.id = id || UtilityService.uuid();
|
|
5390
5402
|
this._d3Scale = this.createD3Scale();
|
|
5391
5403
|
}
|
|
@@ -5393,6 +5405,17 @@ class Scale {
|
|
|
5393
5405
|
get d3Scale() {
|
|
5394
5406
|
return this._d3Scale;
|
|
5395
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
|
+
}
|
|
5396
5419
|
range(range) {
|
|
5397
5420
|
if (range) {
|
|
5398
5421
|
this._d3Scale.range(this.isReversed ? range.reverse() : range);
|
|
@@ -5650,6 +5673,17 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5650
5673
|
.getStream(INTERACTION_VALUES_EVENT)
|
|
5651
5674
|
.pipe(takeUntil(this.destroy$))
|
|
5652
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
|
+
}
|
|
5653
5687
|
this.lastInteractionValuesPayload = event.data;
|
|
5654
5688
|
if (this.isChartInView) {
|
|
5655
5689
|
this.handleLabelUpdate();
|
|
@@ -6202,6 +6236,8 @@ class Grid {
|
|
|
6202
6236
|
x2: this.config().dimension.width() +
|
|
6203
6237
|
Grid.TICK_DIMENSION_CORRECTION,
|
|
6204
6238
|
y2: this.config().dimension.height() - borderMidpoint,
|
|
6239
|
+
class: this._config.borders.bottom.className ||
|
|
6240
|
+
Grid.DEFAULT_BORDER_CLASS_NAME,
|
|
6205
6241
|
})
|
|
6206
6242
|
.classed("hidden", !((_a = this._config.borders.bottom) === null || _a === void 0 ? void 0 : _a.visible));
|
|
6207
6243
|
}
|
|
@@ -6480,12 +6516,16 @@ class XYGrid extends Grid {
|
|
|
6480
6516
|
}
|
|
6481
6517
|
/** @ignore */
|
|
6482
6518
|
drawTicks(config, axis, scale, axisGenerator) {
|
|
6519
|
+
var _a, _b;
|
|
6483
6520
|
if (config.visible) {
|
|
6484
|
-
const
|
|
6521
|
+
const labelAxis = axisGenerator(scale.d3Scale)
|
|
6485
6522
|
.ticks(config.approximateTicks)
|
|
6486
|
-
.tickSize(0)
|
|
6487
|
-
|
|
6488
|
-
|
|
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);
|
|
6489
6529
|
let tickAxis;
|
|
6490
6530
|
if (scale instanceof BandScale) {
|
|
6491
6531
|
tickAxis = axisGenerator(scale.copyToLinear().d3Scale)
|
|
@@ -6494,9 +6534,11 @@ class XYGrid extends Grid {
|
|
|
6494
6534
|
.tickFormat(() => "");
|
|
6495
6535
|
}
|
|
6496
6536
|
else {
|
|
6497
|
-
tickAxis = axisGenerator(scale.d3Scale)
|
|
6498
|
-
|
|
6499
|
-
.
|
|
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(() => "");
|
|
6500
6542
|
tickAxis.ticks(config.approximateTicks);
|
|
6501
6543
|
}
|
|
6502
6544
|
axis.tickGroup.call(tickAxis);
|
|
@@ -6509,13 +6551,15 @@ class XYGrid extends Grid {
|
|
|
6509
6551
|
}
|
|
6510
6552
|
/** @ignore */
|
|
6511
6553
|
drawGrids(config, axis, axisGenerator, scale, size) {
|
|
6554
|
+
var _a;
|
|
6512
6555
|
const modifyZeroLines = (gridGroupSelection) => gridGroupSelection
|
|
6513
6556
|
.selectAll(".tick line")
|
|
6514
6557
|
.classed("nui-zero-line", (d) => d === 0);
|
|
6515
|
-
const leftGridLines = axisGenerator(scale.d3Scale)
|
|
6516
|
-
|
|
6517
|
-
.
|
|
6518
|
-
|
|
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);
|
|
6519
6563
|
if (config.gridTicks) {
|
|
6520
6564
|
const gridSelection = axis.tickGroup.call(leftGridLines);
|
|
6521
6565
|
modifyZeroLines(gridSelection);
|