Closed woozyking closed 9 years ago
In the case of CSS changes you are looking to use Epoch.QueryCSS.purge()
, the CSS for real-time charts is kept in a cache by the QueryCSS
object inside epoch. This way we do not have to fetch the CSS values for use in the canvas on every frame in a real-time chart. By calling the purge()
method you tell Epoch to invalidate this cache.
Having to do this manually is a bit of a pain, I am open to suggestions for listening to events in the browser that indicate when CSS values have changed.
Does it make sense to expose the Epoch.QueryCSS.purge
method from the chart object as a public API? This could be a good interim solution for better accessibility on this feature.
Yes it might, mind taking a quick stab at it by whipping up a quick PR?
@rsandor yes why not, as this is not an urgent feature, it gives me a good chance to get more familiar with the code base. Also since I have to kill a good 12 hours on the plane.
:beers:
Haha nice! If you have any questions, post code snippets and I will try my best to explain. I'll keep my eyes on the notifications, but I may be asleep here in a few so might get back to you tomorrow.
It would be great to have an API to re-render Canvas based charts to handle on demand changes such as color scheme changes and window resizing.
Think of a use case where users are allow to switch "themes" (change of CSS rules that are initially applied to the charts) of a page that contains some basic charts, and some real time ones. By switching "themes" users should be able to see the changes happen to both types of charts. Currently only the pure SVG (basic) ones reflect the immediate CSS changes (I guess due to SVG's nature).
In such use cases, an API to allow on-demand redraw of the Canvas based charts can be very useful.