question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do you update options dynamically?

See original GitHub issue

I’ve been trying for a good few days to update options dynamically but it just doesn’t seem possible…

This works fine:

this.balanceChart.addSerie({name: 'Balance', color: '#6f0cc8', data: this.balanceTimespan.map((span) => span.value)});

But these does not:

this.balanceChart.options.tooltip.pointFormat = 'Saldot för {point.x} är <b>{point.y:,.0f}kr</b>';
this.balanceChart.options.xAxis[0].categories = ['a', 'b', 'c'];

Updating any of the options after the chart is created doesn’t do anything.

Any help please?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ceborcommented, May 16, 2018

Try the following:

// version 6
yourChart.ref$.subscribe(ref => {
  ref.update({ /* options object */ }, true);
});

// version 5
ngAfterViewInit() {
  yourChart.ref.update({ /* options object */ }, true);
}
0reactions
chrillewoodzcommented, May 16, 2018

Ok thanks anyway for the quick response.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamically update options in selectfield depending on ...
(I found the example of dynamically update options depending on another select field's data but in the same form).
Read more >
How to Add / Remove Options of a Selection Box Dynamically
In this tutorial, you will learn how to dynamically add and remove options of a select box using plain JavaScript.
Read more >
Dynamically update options in a select component
I have the code snippet below wherein I'm dynamically populating and selecting options in a select component. Both objectives work, but the component...
Read more >
apex - How to dynamically provide options and update a field ...
My goal is to provide a list of options a (read-only) field, which are dynamically fetched from an api service, and when user...
Read more >
Is there a way to update options dynamically? #1131 - GitHub
I want to update the options of sortable element dynamically. I just don't understand how can I access the existing instance of sortable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found