@mathstack/viz 0.0.1-beta.7 → 0.0.1-beta.8

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.
@@ -1827,11 +1827,28 @@ class XyAxis extends XyAuxMarks {
1827
1827
  this.processDomain();
1828
1828
  this.drawGrid();
1829
1829
  });
1830
+ // Hide elements immediately based on config to prevent flash during transition
1831
+ this.hideElementsPerConfig();
1830
1832
  this.processTickLabels();
1831
1833
  if (this.config.label) {
1832
1834
  this.createLabel();
1833
1835
  }
1834
1836
  }
1837
+ hideElementsPerConfig() {
1838
+ // Remove tick marks immediately if configured to be hidden
1839
+ if (this.config.ticks.marksDisplay === false) {
1840
+ this.axisGroup.selectAll('.tick line').interrupt().remove();
1841
+ }
1842
+ // Remove tick labels immediately if configured to be hidden
1843
+ if (this.config.ticks.labelsDisplay === false) {
1844
+ this.axisGroup.selectAll('.tick text').interrupt().remove();
1845
+ }
1846
+ // Remove baseline immediately if not displayed and no zero baseline exists
1847
+ const zeroAxisTranslate = this.getBaselineTranslate();
1848
+ if (!this.config.baseline.display && zeroAxisTranslate === null) {
1849
+ this.axisGroup.select('.domain').interrupt().remove();
1850
+ }
1851
+ }
1835
1852
  processTicks() {
1836
1853
  const tickText = select(this.elRef.nativeElement).selectAll('.tick text');
1837
1854
  if (this.config.ticks.class) {
@@ -1856,10 +1873,7 @@ class XyAxis extends XyAuxMarks {
1856
1873
  if (this.config.ticks.wrap && this.config.ticks.wrap.width !== undefined) {
1857
1874
  this.wrapAxisTickText(tickText);
1858
1875
  }
1859
- if (this.config.ticks.marksDisplay === false) {
1860
- const marks = select(this.elRef.nativeElement).selectAll(`.${this.class.axisGroup} .tick line`);
1861
- marks.remove();
1862
- }
1876
+ // Note: marksDisplay removal is now handled immediately in hideElementsPerConfig()
1863
1877
  }
1864
1878
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1865
1879
  setTickFontSize(tickTextSelection) {
@@ -1903,14 +1917,10 @@ class XyAxis extends XyAuxMarks {
1903
1917
  .attr('transform', null)
1904
1918
  .attr('stroke-dasharray', null));
1905
1919
  }
1906
- if (!this.config.baseline.display && zeroAxisTranslate === null) {
1907
- this.axisGroup.call((g) => g.select('.domain').remove());
1908
- }
1920
+ // Note: baseline removal is now handled immediately in hideElementsPerConfig()
1909
1921
  }
1910
1922
  processTickLabels() {
1911
- if (this.config.ticks.labelsDisplay === false) {
1912
- this.axisGroup.call((g) => g.selectAll('.tick text').remove());
1913
- }
1923
+ // Note: labelsDisplay removal is now handled immediately in hideElementsPerConfig()
1914
1924
  if (this.config.ticks.rotate) {
1915
1925
  this.axisGroup.call((g) => g
1916
1926
  .selectAll('.tick text')
@@ -1943,8 +1953,6 @@ class XyAxis extends XyAuxMarks {
1943
1953
  .append('g')
1944
1954
  .attr('class', this.class.gridGroup);
1945
1955
  }
1946
- // Avoid odd animations of grid lines when they change between draws
1947
- this.gridGroup.selectAll('.tick').remove();
1948
1956
  this.gridGroup
1949
1957
  .transition(this.getTransition(this.gridGroup))
1950
1958
  .call(this.axis.tickSizeInner(this.getGridLineLength()))