axidio-styleguide-library1-v2 0.1.74 → 0.1.75

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.
@@ -7176,21 +7176,57 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
7176
7176
  }
7177
7177
  isZoomOutSelected(isZoomOut) {
7178
7178
  this.isZoomedOut = isZoomOut;
7179
- this.ngOnChanges();
7179
+ this.clearChart();
7180
+ setTimeout(() => {
7181
+ this.initializeStackedChart();
7182
+ }, 10);
7180
7183
  }
7181
- ngOnChanges() {
7182
- let self = this;
7183
- d3.select('#' + self.uniqueId).remove();
7184
- this.initializeStackedChart();
7184
+ ngOnChanges(changes) {
7185
+ // Only reinitialize if chartData actually changed and it's not the first change
7186
+ if (changes.chartData && !changes.chartData.firstChange) {
7187
+ this.clearChart();
7188
+ // Small timeout to ensure DOM cleanup is complete
7189
+ setTimeout(() => {
7190
+ this.initializeStackedChart();
7191
+ }, 10);
7192
+ }
7193
+ // Handle configuration changes
7194
+ if (changes.customChartConfiguration && !changes.customChartConfiguration.firstChange) {
7195
+ this.clearChart();
7196
+ setTimeout(() => {
7197
+ this.initializeStackedChart();
7198
+ }, 10);
7199
+ }
7200
+ }
7201
+ clearChart() {
7202
+ try {
7203
+ // Remove all content from container
7204
+ const container = d3.select(this.containerElt.nativeElement);
7205
+ container.selectAll('*').remove();
7206
+ // Remove by unique ID as backup
7207
+ d3.select('#' + this.uniqueId).remove();
7208
+ // Clear any event listeners
7209
+ container.on('click', null);
7210
+ container.on('mouseenter', null);
7211
+ container.on('mouseout', null);
7212
+ }
7213
+ catch (error) {
7214
+ console.warn('Error clearing chart:', error);
7215
+ }
7185
7216
  }
7186
7217
  onResized(event) {
7187
7218
  let self = this;
7188
- setTimeout(function () {
7189
- d3.select('#' + self.uniqueId).remove();
7219
+ this.clearChart();
7220
+ setTimeout(() => {
7190
7221
  self.initializeStackedChart();
7191
- }.bind(self), 10);
7222
+ }, 20); // Slightly longer timeout for resize events
7223
+ }
7224
+ ngOnInit() {
7225
+ // Initialize chart on component init
7226
+ if (this.chartData && this.chartData.data) {
7227
+ this.initializeStackedChart();
7228
+ }
7192
7229
  }
7193
- ngOnInit() { }
7194
7230
  initializeStackedChart() {
7195
7231
  var self = this;
7196
7232
  let data = [];