Skip to content

Conversation

@medbenmakhlouf
Copy link
Contributor

Summary
This Pull Request introduces significant improvements to the Highcharts wrapper API, focusing on simplifying the chart update logic and giving developers granular control over the rendering lifecycle.

By moving away from "black-box" input bindings, we are streamlining API usage and exposing the native Highcharts instance directly. This allows for more performant and predictable chart updates

Key Changes

  • Deprecation: Marked [(update)] and [(oneToOne)] inputs as deprecated.
  • Simplified Logic: Shifted the responsibility of triggering updates from the wrapper's internal state checking to the developer via manual .update() calls.

⚠️ Deprecation Notice
The following inputs are now deprecated and will be removed in a future release. Please migrate to the new chartInstance approach described below. [(update)] and [(oneToOne)]

💻 Usage Example
Instead of relying on two-way binding to trigger updates, developers should now capture the chart instance and call the .update() method manually (e.g., on a button click or signal effect).

HTML Template:

<highcharts-chart
    constructorType="chart"
    [options]="options()"
    (chartInstance)="chartInstance = $event">
</highcharts-chart>

<button (click)="redraw()">Redraw Chart</button>
export class GraphComponent {
  // Store the reference to the chart
  chartInstance: Highcharts.Chart | undefined = undefined;

  redraw() {
    if (this.chartInstance) {
      // Manual control: update(options, redraw, oneToOne)
      this.chartInstance.update(this.options(), true, true);
    }
  }
}

@medbenmakhlouf
Copy link
Contributor Author

@karolkolodziej Thanks in advance for the review! 😉

@medbenmakhlouf
Copy link
Contributor Author

fix : #428

@karolkolodziej
Copy link
Member

We always assumed the wrapper would handle updates based on the input, and now that responsibility shifts to the implementer.
At first glance, it looks fine, but I need a few days to test it more thoroughly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants