Skip to content

Commit

Permalink
Merge pull request #1841 from ag-grid/AG-11800
Browse files Browse the repository at this point in the history
AG-11800 Ensure visibility changes in the series options are picked up
  • Loading branch information
alantreadway committed Jun 24, 2024
2 parents 2b86336 + 6b77951 commit 9cc3253
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 9 additions & 4 deletions packages/ag-charts-community/src/chart/axis/categoryAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ export class CategoryAxis<

protected override calculateDomain() {
if (!this._paddingOverrideEnabled) {
const paddings = this.boundSeries.map((s) => s.getBandScalePadding?.()).filter((p) => p != null);
if (paddings.length > 0) {
this.scale.paddingInner = Math.min(...paddings.map((p) => p!.inner));
this.scale.paddingOuter = Math.max(...paddings.map((p) => p!.outer));
let paddingInner = Infinity;
let paddingOuter = -Infinity;
for (const s of this.boundSeries) {
const padding = s.getBandScalePadding?.();
if (padding == null) continue;
paddingInner = Math.min(paddingInner, padding.inner);
paddingOuter = Math.max(paddingOuter, padding.outer);
}
this.scale.paddingInner = Number.isFinite(paddingInner) ? paddingInner : 0;
this.scale.paddingOuter = Number.isFinite(paddingOuter) ? paddingOuter : 0;
}

return super.calculateDomain();
Expand Down
5 changes: 3 additions & 2 deletions packages/ag-charts-community/src/chart/series/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export abstract class Series<

set visible(value: boolean) {
this.properties.visible = value;
this.visibleChanged();
this.visibleMaybeChanged();
}

get visible() {
Expand Down Expand Up @@ -571,9 +571,10 @@ export abstract class Series<
// Indicate that something external changed and we should recalculate nodeData.
markNodeDataDirty() {
this.nodeDataRefresh = true;
this.visibleMaybeChanged();
}

visibleChanged() {
private visibleMaybeChanged() {
this.ctx.seriesStateManager.registerSeries(this);
}

Expand Down

0 comments on commit 9cc3253

Please sign in to comment.