New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a re-render command? #1
Comments
The Gauge library(an JavaScript object) provide an API interface and methods for manipulating the object. It is however does not handling anything for the creation of an Gauge or the DOM insertion of a Gauge, it is up to the user on how to use it as shown in example.js as well as in your code. When you the For JavaScript, the garbage collection will clean up an object when it is out of scope, even though there is an If you need to dynamically create an Gauge as shown in your code, you are doing it correctly and in my opinion it is not clumsy, it is the minimum that the user of the library need to do. Personally, I never have a use case where I need to dynamically change the thresholds, if your value spread across a wide range, you might want to consider to use log scale, Gauge supports both linear and log scale, you can see it on the example.js or demo. |
Well, I do know about the log scale - remember, I contributed to it? - and this is what I am using. The app is about count rates of Geiger tubes, counting radioactive events. The thresholds separate the good, bad, and ugly portions. Now when using different Geiger tubes you are faced with different sensitivities, and the thresholds need to be adapted when you switch display from one tube to the other. Looking at your code - I am not very firm in d3 coding - I guess that something like |
Indeed, this little change works beautifully!
and in my code I have:
|
Another suggestion: I have to do this multiple times in my code, so why not do it once in your lib:
keeps some errors away ... |
It doesn't works that way, most of the configuration are done in the Gauge construct, in order for the new configuration to take effect, part of the construct code need to be executed. You also need to remove the "text" div in addition to the "svg" object... anyway, I've come out a solution by introducing a new method Please take a look at the codes at the |
On missing scale, sorry I forgot to push the last changes up to the git repo. On the rest of things that you are talking about, I did not change anything in related to color, transition, etc... |
Thanks. After I applied my modifications I am back to a nice system! What I don't understand is why you seem to accept errors from not preventing problems. Just try to update() with zero and NAN. log(0) and log(NAN) really do not work! |
I am using this gauge happily for quite a while, but now had the need to modify the two threshold values during a run. Unfortunately, I didn't find a way to update the graph to reflect the new settings.
It finally worked by redoing the whole gauge with:
It works, but it feels a bit clunky, having to manually overwrite and delete things. The .innerHTML is necessary, because otherwise I get an additional graph.
Is there no command like
powerGauge.re_render("#gauge");
re-applying all the settings - unchanged and changed ?If not, I'd suggest to put one in.
The text was updated successfully, but these errors were encountered: