@mathstack/viz 2.0.3 → 2.1.0
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/package.json
CHANGED
|
@@ -100,9 +100,8 @@ export abstract class XyAxis<
|
|
|
100
100
|
.attr('class', this.class.axisGroup);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
//
|
|
103
|
+
// Remove domain to avoid odd baseline/zero-axis positioning during transitions
|
|
104
104
|
this.axisGroup.select('.domain').remove();
|
|
105
|
-
this.axisGroup.selectAll('.tick').remove();
|
|
106
105
|
|
|
107
106
|
this.axisGroup
|
|
108
107
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -114,12 +113,32 @@ export abstract class XyAxis<
|
|
|
114
113
|
this.drawGrid();
|
|
115
114
|
});
|
|
116
115
|
|
|
116
|
+
// Hide elements immediately based on config to prevent flash during transition
|
|
117
|
+
this.hideElementsPerConfig();
|
|
117
118
|
this.processTickLabels();
|
|
118
119
|
if (this.config.label) {
|
|
119
120
|
this.createLabel();
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
|
|
124
|
+
hideElementsPerConfig(): void {
|
|
125
|
+
// Remove tick marks immediately if configured to be hidden
|
|
126
|
+
if (this.config.ticks.marksDisplay === false) {
|
|
127
|
+
this.axisGroup.selectAll('.tick line').interrupt().remove();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Remove tick labels immediately if configured to be hidden
|
|
131
|
+
if (this.config.ticks.labelsDisplay === false) {
|
|
132
|
+
this.axisGroup.selectAll('.tick text').interrupt().remove();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Remove baseline immediately if not displayed and no zero baseline exists
|
|
136
|
+
const zeroAxisTranslate = this.getBaselineTranslate();
|
|
137
|
+
if (!this.config.baseline.display && zeroAxisTranslate === null) {
|
|
138
|
+
this.axisGroup.select('.domain').interrupt().remove();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
123
142
|
processTicks(): void {
|
|
124
143
|
const tickText = select(this.elRef.nativeElement).selectAll('.tick text');
|
|
125
144
|
if (this.config.ticks.class) {
|
|
@@ -143,12 +162,6 @@ export abstract class XyAxis<
|
|
|
143
162
|
if (this.config.ticks.wrap && this.config.ticks.wrap.width !== undefined) {
|
|
144
163
|
this.wrapAxisTickText(tickText);
|
|
145
164
|
}
|
|
146
|
-
if (this.config.ticks.marksDisplay === false) {
|
|
147
|
-
const marks = select(this.elRef.nativeElement).selectAll(
|
|
148
|
-
`.${this.class.axisGroup} .tick line`
|
|
149
|
-
);
|
|
150
|
-
marks.remove();
|
|
151
|
-
}
|
|
152
165
|
}
|
|
153
166
|
|
|
154
167
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -202,17 +215,9 @@ export abstract class XyAxis<
|
|
|
202
215
|
.attr('stroke-dasharray', null)
|
|
203
216
|
);
|
|
204
217
|
}
|
|
205
|
-
|
|
206
|
-
if (!this.config.baseline.display && zeroAxisTranslate === null) {
|
|
207
|
-
this.axisGroup.call((g) => g.select('.domain').remove());
|
|
208
|
-
}
|
|
209
218
|
}
|
|
210
219
|
|
|
211
220
|
processTickLabels(): void {
|
|
212
|
-
if (this.config.ticks.labelsDisplay === false) {
|
|
213
|
-
this.axisGroup.call((g) => g.selectAll('.tick text').remove());
|
|
214
|
-
}
|
|
215
|
-
|
|
216
221
|
if (this.config.ticks.rotate) {
|
|
217
222
|
this.axisGroup.call((g) =>
|
|
218
223
|
g
|