@nova-ui/charts 13.0.6-4382 → 13.0.6-4383
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/core/common/scales/scale.d.ts +7 -0
- package/core/common/scales/types.d.ts +9 -0
- package/esm2020/core/common/scales/scale.mjs +14 -1
- package/esm2020/core/common/scales/types.mjs +1 -1
- package/esm2020/core/grid/grid.mjs +3 -1
- package/esm2020/core/grid/xy-grid.mjs +18 -12
- package/esm2020/core/plugins/interaction/interaction-label-plugin.mjs +11 -1
- package/fesm2015/nova-ui-charts.mjs +45 -11
- package/fesm2015/nova-ui-charts.mjs.map +1 -1
- package/fesm2020/nova-ui-charts.mjs +42 -11
- package/fesm2020/nova-ui-charts.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -4942,7 +4942,9 @@ class Scale {
|
|
|
4942
4942
|
constructor(id) {
|
|
4943
4943
|
this.domainCalculator = getAutomaticDomain;
|
|
4944
4944
|
this.formatters = {};
|
|
4945
|
+
this.isTimeseriesScale = false;
|
|
4945
4946
|
this.isReversed = false;
|
|
4947
|
+
this._fixDomainValues = [];
|
|
4946
4948
|
this.id = id || UtilityService.uuid();
|
|
4947
4949
|
this._d3Scale = this.createD3Scale();
|
|
4948
4950
|
}
|
|
@@ -4950,6 +4952,17 @@ class Scale {
|
|
|
4950
4952
|
get d3Scale() {
|
|
4951
4953
|
return this._d3Scale;
|
|
4952
4954
|
}
|
|
4955
|
+
get fixDomainValues() {
|
|
4956
|
+
return this._fixDomainValues;
|
|
4957
|
+
}
|
|
4958
|
+
/** See {@link IScale#setFixDomainValues} */
|
|
4959
|
+
setFixDomainValues(values) {
|
|
4960
|
+
if (values.length > 1) {
|
|
4961
|
+
this.domain([values[0], values[values.length - 1]]);
|
|
4962
|
+
this.isDomainFixed = true;
|
|
4963
|
+
}
|
|
4964
|
+
this._fixDomainValues = values;
|
|
4965
|
+
}
|
|
4953
4966
|
range(range) {
|
|
4954
4967
|
if (range) {
|
|
4955
4968
|
this._d3Scale.range(this.isReversed ? range.reverse() : range);
|
|
@@ -5207,6 +5220,17 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5207
5220
|
.getStream(INTERACTION_VALUES_EVENT)
|
|
5208
5221
|
.pipe(takeUntil(this.destroy$))
|
|
5209
5222
|
.subscribe((event) => {
|
|
5223
|
+
var _a;
|
|
5224
|
+
if ((_a = event.data.values) === null || _a === void 0 ? void 0 : _a.y) {
|
|
5225
|
+
const chartGrid = this.chart.getGrid();
|
|
5226
|
+
const eventYAxisIds = Object.keys(event.data.values.y);
|
|
5227
|
+
const chartLeftYAxis = chartGrid.scales.y.list[0];
|
|
5228
|
+
// shows label only for a chart that is currently being hovered
|
|
5229
|
+
if (chartLeftYAxis.isTimeseriesScale &&
|
|
5230
|
+
!eventYAxisIds.includes(chartLeftYAxis.id)) {
|
|
5231
|
+
return;
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5210
5234
|
this.lastInteractionValuesPayload = event.data;
|
|
5211
5235
|
if (this.isChartInView) {
|
|
5212
5236
|
this.handleLabelUpdate();
|
|
@@ -5759,6 +5783,8 @@ class Grid {
|
|
|
5759
5783
|
x2: this.config().dimension.width() +
|
|
5760
5784
|
Grid.TICK_DIMENSION_CORRECTION,
|
|
5761
5785
|
y2: this.config().dimension.height() - borderMidpoint,
|
|
5786
|
+
class: this._config.borders.bottom.className ||
|
|
5787
|
+
Grid.DEFAULT_BORDER_CLASS_NAME,
|
|
5762
5788
|
})
|
|
5763
5789
|
.classed("hidden", !((_a = this._config.borders.bottom) === null || _a === void 0 ? void 0 : _a.visible));
|
|
5764
5790
|
}
|
|
@@ -6037,12 +6063,16 @@ class XYGrid extends Grid {
|
|
|
6037
6063
|
}
|
|
6038
6064
|
/** @ignore */
|
|
6039
6065
|
drawTicks(config, axis, scale, axisGenerator) {
|
|
6066
|
+
var _a, _b;
|
|
6040
6067
|
if (config.visible) {
|
|
6041
|
-
const
|
|
6068
|
+
const labelAxis = axisGenerator(scale.d3Scale)
|
|
6042
6069
|
.ticks(config.approximateTicks)
|
|
6043
|
-
.tickSize(0)
|
|
6044
|
-
|
|
6045
|
-
|
|
6070
|
+
.tickSize(0);
|
|
6071
|
+
if ((_a = scale.fixDomainValues) === null || _a === void 0 ? void 0 : _a.length) {
|
|
6072
|
+
labelAxis.tickValues(scale.fixDomainValues);
|
|
6073
|
+
}
|
|
6074
|
+
labelAxis.tickFormat(scale.formatters["tick"]);
|
|
6075
|
+
axis.labelGroup.call(labelAxis);
|
|
6046
6076
|
let tickAxis;
|
|
6047
6077
|
if (scale instanceof BandScale) {
|
|
6048
6078
|
tickAxis = axisGenerator(scale.copyToLinear().d3Scale)
|
|
@@ -6051,9 +6081,11 @@ class XYGrid extends Grid {
|
|
|
6051
6081
|
.tickFormat(() => "");
|
|
6052
6082
|
}
|
|
6053
6083
|
else {
|
|
6054
|
-
tickAxis = axisGenerator(scale.d3Scale)
|
|
6055
|
-
|
|
6056
|
-
.
|
|
6084
|
+
tickAxis = axisGenerator(scale.d3Scale).tickSize(config.tickSize);
|
|
6085
|
+
if ((_b = scale.fixDomainValues) === null || _b === void 0 ? void 0 : _b.length) {
|
|
6086
|
+
tickAxis.tickValues(scale.fixDomainValues);
|
|
6087
|
+
}
|
|
6088
|
+
tickAxis.tickFormat(() => "");
|
|
6057
6089
|
tickAxis.ticks(config.approximateTicks);
|
|
6058
6090
|
}
|
|
6059
6091
|
axis.tickGroup.call(tickAxis);
|
|
@@ -6066,13 +6098,15 @@ class XYGrid extends Grid {
|
|
|
6066
6098
|
}
|
|
6067
6099
|
/** @ignore */
|
|
6068
6100
|
drawGrids(config, axis, axisGenerator, scale, size) {
|
|
6101
|
+
var _a;
|
|
6069
6102
|
const modifyZeroLines = (gridGroupSelection) => gridGroupSelection
|
|
6070
6103
|
.selectAll(".tick line")
|
|
6071
6104
|
.classed("nui-zero-line", (d) => d === 0);
|
|
6072
|
-
const leftGridLines = axisGenerator(scale.d3Scale)
|
|
6073
|
-
|
|
6074
|
-
.
|
|
6075
|
-
|
|
6105
|
+
const leftGridLines = axisGenerator(scale.d3Scale).tickSize(size);
|
|
6106
|
+
if ((_a = scale.fixDomainValues) === null || _a === void 0 ? void 0 : _a.length) {
|
|
6107
|
+
leftGridLines.tickValues(scale.fixDomainValues);
|
|
6108
|
+
}
|
|
6109
|
+
leftGridLines.tickFormat(() => "").ticks(config.approximateTicks);
|
|
6076
6110
|
if (config.gridTicks) {
|
|
6077
6111
|
const gridSelection = axis.tickGroup.call(leftGridLines);
|
|
6078
6112
|
modifyZeroLines(gridSelection);
|