GrantMStevens / amCharts-Angular

Angular directive for amCharts library
Apache License 2.0
63 stars 39 forks source link

Delay rendering of chart #22

Closed syndesis closed 9 years ago

syndesis commented 9 years ago

I have an issue where my graph titles come from scope variables that are propagated by a promise. I needed to delay some processing in the directive until that happened. I added a watch on options to get around this issue. I think this should work in general.. Let me know if you'd like me to submit a pull request for this or if you think of a better way to solve it.

0d6d6d55d408c477a35d20075b4820d46e654979

GrantMStevens commented 9 years ago

I don't think this is the best solution.

The current version of this directive allows you to pass in a promise as the options variable. I would recommend utilizing that functionality with $q to build your config object asynchronously behind a promise, then resolve the promise to trigger the chart render.

syndesis commented 9 years ago

Ok, I'll check that out.. thanks!

syndesis commented 9 years ago

I see where you handle a promise for the data field of the options but not the options object itself. Am I missing something?

GrantMStevens commented 9 years ago

Ya know what, I was mistaken. You are right that it is only the data property that takes the promise. The chart will not render till that promise resolves. I haven't had any time lately to do any work on this, but I do welcome pull requests. Otherwise, I'll take a look at this when I get the chance.

syndesis commented 9 years ago

Ok I submitted pull request #28