Code Monkey home page Code Monkey logo

Comments (24)

metodribic avatar metodribic commented on May 21, 2024 9

Is there a plan to integrate this in core Chartist in near future?

from chartist.

hansmaad avatar hansmaad commented on May 21, 2024 2

I published my log axis patch as npm package:
https://github.com/hansmaad/chartist-logaxis

It also supports minor grid lines now:

image

from chartist.

gionkunz avatar gionkunz commented on May 21, 2024

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
Gion

from chartist.

dscmax avatar dscmax commented on May 21, 2024

Log scales are used in many applications in engineering. I think this is a very important feature to implement asap.
I'm not a js developer (just starting), but I will give a look to sources and I will evaluate if I will be able to help for this issue.

from chartist.

alejoar avatar alejoar commented on May 21, 2024

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.

from chartist.

ilanbiala avatar ilanbiala commented on May 21, 2024

@gionkunz if the scale is declared as log in the options object, does the animation need to be mathematically scaled like the graph itself?

from chartist.

gionkunz avatar gionkunz commented on May 21, 2024

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.

from chartist.

ilanbiala avatar ilanbiala commented on May 21, 2024

Sounds good.

from chartist.

sandstrom avatar sandstrom commented on May 21, 2024

Sounds awesome, logarithmic scales would be nice.

from chartist.

gionkunz avatar gionkunz commented on May 21, 2024

There is still an open PR that we need to review and unfortunately I didn't find so much time for Chartist lately :( #185

from chartist.

gionkunz avatar gionkunz commented on May 21, 2024

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?

from chartist.

hansmaad avatar hansmaad commented on May 21, 2024

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.

from chartist.

jacobq avatar jacobq commented on May 21, 2024

I would very much like to have the ability to ability to automatically apply logarithmic scaling. Is this feature still in dev only? Can I contribute? I'm planning to use chartist in my electron-based desktop application, which requires this feature, and I'd much rather work with the maintainers than fork and make my own hack.
Ultimately, I'm trying to get something similar to what is produced by MS Excel 2016's XY scatter plot:
excel_chart

chartist_chart

from chartist.

hansmaad avatar hansmaad commented on May 21, 2024

@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:
https://github.com/hansmaad/chartist-js/blob/logAxis/src/scripts/axes/auto-scale-axis.js

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?

from chartist.

jacobq avatar jacobq commented on May 21, 2024

@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:

  1. Define transformation functions (e.g. Chartist.Transformations.logBase(2))
  2. By default, AutoScaleAxis will use Chartist.Transformations.linear (identity function). The user/caller can override by setting options.scalingTransformation.
  3. In order to keep the nice / uniform spacing, AutoScaleAxis applies the transformation to highLow before calling getBounds then applies the inverse transformation to the results. That way the function being called (getBounds in this case) doesn't need to be concerned with the transformation.

Note: I haven't tried working this into FixedScaleAxis or testing in bar charts yet but plan to do so eventually. Hopefully most of this can be pulled up to Axis cleanly.

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.)
https://github.com/jacobq/chartist-js/tree/scale-transformation

from chartist.

Alessio92 avatar Alessio92 commented on May 21, 2024

@jacobq your script works perfectly, but overrides my ticks.
My situation is a bit different from your. I need to represent logarithmic scale with my ticks ([10, 16, 25...25000]) instead of your (10, 100, 1000).
Any ideas? thank u
Regards,
Alessio
mysituation

from chartist.

lucadegasperi avatar lucadegasperi commented on May 21, 2024

@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.
Uncaught Error: The input to the logarithm function must be a positive real number not equal to 0. (got 0)

from chartist.

lucadegasperi avatar lucadegasperi commented on May 21, 2024

@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

from chartist.

hansmaad avatar hansmaad commented on May 21, 2024

@lucadegasperi This is the actual code I'm using https://gist.github.com/hansmaad/0dcf0b525b94ee09edb0e0bcbe8a0f4e

from chartist.

lucadegasperi avatar lucadegasperi commented on May 21, 2024

@hansmaad thanks!

from chartist.

lucadegasperi avatar lucadegasperi commented on May 21, 2024

@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.

from chartist.

hansmaad avatar hansmaad commented on May 21, 2024

@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?

from chartist.

lucadegasperi avatar lucadegasperi commented on May 21, 2024

@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?

from chartist.

YakovL avatar YakovL commented on May 21, 2024

Yeah, without both log scale and error bars (#232) out of the box, this is somewhat complicated to use with scientific data..

from chartist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.