-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Logarithmic scale #64
Comments
Hi @alejoar This is currently not possible and I'm not sure if and when this will get into Chartist. Let's keep this issue open and track the need for this. Cheers |
Log scales are used in many applications in engineering. I think this is a very important feature to implement asap. |
Indeed, @dscmax. I was actually looking into this to use it in my diploma project to present some results. Right now I'm in another stage, but I presume I'll start working with charts in a couple of months, and I really hope I can use chartist by then, but log scales are a must have for me. |
@gionkunz if the scale is declared as log in the options object, does the animation need to be mathematically scaled like the graph itself? |
Once the new axes classes are stable we can create a log scale axis and make it cconfigurable. This is currently WIP and will be stable on dev soon. |
Sounds good. |
Sounds awesome, logarithmic scales would be nice. |
There is still an open PR that we need to review and unfortunately I didn't find so much time for Chartist lately :( #185 |
The groundwork for this is there. It's just a matter of time and contribution to implement an axis. The new dynamic axis instantiating in 0.9.0 makes this very easy. http://gionkunz.github.io/chartist-js/getting-started.html#switching-axis-type Maybe the FixedScaleAxis and AutoScaleAxis could be extended with an option to plot in log scale? |
I've implemented a scale option for AutoScaleAxis here hansmaad/chartist-js@4ddd949 . Works well for my test cases. Unfortunately, I didn't find any axes unit test, where I could add some quick tests. If it's ok for you I can create a PR. |
@jacobq I had a PR for this, but we're still not sure how to integrate this into core chartist. I hope we will get this as core feature or plugin in the next major version. For now, I'm using this code, to patch chartist in my application: I'm using this in production for several month, and it runs fine. @gionkunz I moved the code to another branch and deleted the PR. Should I reopen? |
@hansmaad @gionkunz I'm not sure how busy you are / how much time you have to work on chartist, but in case it's helpful, I've attempted to come up with a more general / natural way to integrate scale transformations like this with the rest of the code. How it basically works is:
Note: I haven't tried working this into If you have time, please take a look and let me know your thoughts. (I know it's a little rough around the edges but perhaps this will give you some ideas or at least generate some discussion.) |
@jacobq your script works perfectly, but overrides my ticks. |
@jacobq I'm trying to use your implementation but had no success. I want to plot a bar chart and the Y axis needs to be represented with a logarithmic scale. I have no 0 values in my series but what i'm getting is the following error. |
@hansmaad is your code to create a log scale still functioning with chartist 0.9.7? I'm having issues understanding how to implement it into my own charts |
@lucadegasperi This is the actual code I'm using https://gist.github.com/hansmaad/0dcf0b525b94ee09edb0e0bcbe8a0f4e |
@hansmaad thanks! |
@hansmaad I've noticed that what I needed was not a full log scale but a semi-log scale, like the ones used in trading apps. Have you had any luck implementing something similar? thanks. |
@lucadegasperi According https://en.wikipedia.org/wiki/Semi-log_plot a semi-log plot has only one log axis. You can define one axis with log scale, while the other stays linear. Is this what you mean? |
@hansmaad my bad, Im fairly new to the subject. What I meant is having a logarithmic scale on one axis (which indeed I have) but not have it tied to the decades. The underlying grid should also be irregular with items less and less spaced apart. Is there a way I can contact you privately? |
Is there a plan to integrate this in core Chartist in near future? |
Yeah, without both log scale and error bars (#232) out of the box, this is somewhat complicated to use with scientific data.. |
I published my log axis patch as npm package: It also supports minor grid lines now: |
Is it possible to use log scale? both on vertical and horizontal axis
I still didn't try this but I might use it for my next project, looks really awesome.
The text was updated successfully, but these errors were encountered: