mdt-charts 1.32.0 → 1.33.1
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/lib/engine/features/scale/scale.d.ts +1 -1
- package/lib/engine/features/scale/scale.js +3 -1
- package/lib/engine/features/valueLabels/valueLabels.js +14 -1
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.d.ts +1 -1
- package/lib/model/model.d.ts +1 -1
- package/lib/model/notations/twoDimensionalModel.js +5 -3
- package/lib/style/charts-main.css +1 -1
- package/lib/style/charts-main.less +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export interface ScalesWithSecondary extends Scales {
|
|
|
11
11
|
export declare class Scale {
|
|
12
12
|
static getScales(scaleKey: ScaleKeyModel, scaleValue: ScaleValueModel, bandSettings: BarChartSettings): Scales;
|
|
13
13
|
static getScalesWithSecondary(scaleKey: ScaleKeyModel, scaleValue: ScaleValueModel, scaleValueSecondary: ScaleValueModel, bandSettings: BarChartSettings): ScalesWithSecondary;
|
|
14
|
-
static getScaleValue(scaleValue: ScaleValueModel): ScaleLinear<number, number,
|
|
14
|
+
static getScaleValue(scaleValue: ScaleValueModel): ScaleLinear<number, number, number>;
|
|
15
15
|
static getScaleBandWidth(scale: AxisScale<any>): number;
|
|
16
16
|
static getScaleStep(scale: AxisScale<any>): number;
|
|
17
17
|
static getScaledValue(scale: AxisScale<any>, value: any): number;
|
|
@@ -64,7 +64,9 @@ export class Scale {
|
|
|
64
64
|
return scale;
|
|
65
65
|
}
|
|
66
66
|
static getScaleLinear(domain, range) {
|
|
67
|
-
|
|
67
|
+
const scale = scaleLinear().domain(domain).range([range.start, range.end]);
|
|
68
|
+
scale.unknown(scale(0));
|
|
69
|
+
return scale;
|
|
68
70
|
}
|
|
69
71
|
static getScalePoint(domain, range) {
|
|
70
72
|
return scalePoint().domain(domain).range([range.start, range.end]);
|
|
@@ -94,9 +94,22 @@ export class ChartValueLabels {
|
|
|
94
94
|
setAttrs(valueLabels, attrs, valueFieldName, setContent, dataRowAccessor, animate = false, onEndAnimation) {
|
|
95
95
|
const animationName = "labels-updating";
|
|
96
96
|
let selection = valueLabels
|
|
97
|
-
.text((d) => setContent({ dataRow: dataRowAccessor(d), fieldName: valueFieldName }).textContent)
|
|
98
97
|
.attr("dominant-baseline", attrs.dominantBaseline)
|
|
99
98
|
.attr("text-anchor", attrs.textAnchor);
|
|
99
|
+
selection.each(function (d) {
|
|
100
|
+
select(this).selectAll("tspan").remove();
|
|
101
|
+
const content = setContent({ dataRow: dataRowAccessor(d), fieldName: valueFieldName });
|
|
102
|
+
content.rows.forEach((row, rowIndex) => {
|
|
103
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
104
|
+
// Pass empty string to count this element for correct working of dy
|
|
105
|
+
// https://stackoverflow.com/questions/34078357/empty-tspan-not-rendered-dy-value-ignored
|
|
106
|
+
tspan.textContent = row.toString() || " ";
|
|
107
|
+
if (rowIndex !== 0)
|
|
108
|
+
tspan.setAttribute("dy", `1em`);
|
|
109
|
+
tspan.setAttribute("x", attrs.x(d).toString());
|
|
110
|
+
this.appendChild(tspan);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
100
113
|
if (animate) {
|
|
101
114
|
selection = selection
|
|
102
115
|
.interrupt(animationName)
|
|
@@ -6,7 +6,7 @@ export declare const keyAxisLabelVerticalLog = "keyAxisLabel_vertical_margin_log
|
|
|
6
6
|
export declare const keyAxisLabelHorizontalLog = "keyAxisLabel_horizontal_margin_log";
|
|
7
7
|
export interface ScaleValueCalculatedInfo {
|
|
8
8
|
scale: ScaleValueModel;
|
|
9
|
-
scaleFn: ScaleLinear<number, number,
|
|
9
|
+
scaleFn: ScaleLinear<number, number, number>;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Предназначен для получения нового scaleValue и уменьшения globalMargin, если ось ключей находится где-то внутри chartBlock, а не на его границе
|
package/lib/model/model.d.ts
CHANGED
|
@@ -403,7 +403,7 @@ export interface ValueLabelsInnerContentSetterOptions {
|
|
|
403
403
|
fieldName: MdtChartsFieldName;
|
|
404
404
|
}
|
|
405
405
|
export declare type ValueLabelsInnerContentSetter = (options: ValueLabelsInnerContentSetterOptions) => {
|
|
406
|
-
|
|
406
|
+
rows: (string | number)[];
|
|
407
407
|
};
|
|
408
408
|
export interface TwoDimChartValueLabelsOptions {
|
|
409
409
|
show: boolean;
|
|
@@ -146,12 +146,14 @@ export class TwoDimensionalModel {
|
|
|
146
146
|
forFields: (_x = (_w = chart.valueLabels) === null || _w === void 0 ? void 0 : _w.renderForFields) !== null && _x !== void 0 ? _x : chart.data.valueFields.map((field) => field.name),
|
|
147
147
|
setContent: ({ dataRow, fieldName }) => {
|
|
148
148
|
var _a;
|
|
149
|
-
if ((_a = chart.valueLabels) === null || _a === void 0 ? void 0 : _a.setContent)
|
|
150
|
-
|
|
149
|
+
if ((_a = chart.valueLabels) === null || _a === void 0 ? void 0 : _a.setContent) {
|
|
150
|
+
const content = chart.valueLabels.setContent({
|
|
151
151
|
dataRow,
|
|
152
152
|
field: chart.data.valueFields.find((field) => field.name === fieldName)
|
|
153
153
|
});
|
|
154
|
-
|
|
154
|
+
return { rows: content.textContent.toString().split("\n") };
|
|
155
|
+
}
|
|
156
|
+
return { rows: [configReader.getValueLabelFormatterForChart(index)(dataRow[fieldName])] };
|
|
155
157
|
}
|
|
156
158
|
},
|
|
157
159
|
areaViewOptions: getAreaViewOptions(chart, index, style, modelInstance.version.getVersionNumber()),
|