Git Product home page Git Product logo

Comments (2)

gionkunz avatar gionkunz commented on July 17, 2024

Hi There! Nice styling! :-)

The problem you're facing is that Chartist is always using the configured areaBase to close the area shape and this is by default 0. Check http://gionkunz.github.io/chartist-js/api-documentation.html#chartistline-method-line for the configuration defaults.

The areaBase value is used to close the shape which means that in your first example it tries to close the shape down until the value 0 which is very much off the chart.

Now you could either set the areaBase to your lowest level in the chart if you know this always or you could set your low config to 0 so that the chart is always including the value down to zero. This looks more like a financial chart though where it's probably not nice to always pivot the y axis at 0.

I think we could safely file a bug where we say that areaBase should be used as long as it's in the range of the low and high of the chart. Otherwise low or height should be used. This way the drawing will stop at 50 in your first chart. Let me think about this a bit more.

Cheers and thanks for the detailed report!
Gion

from chartist.

gionkunz avatar gionkunz commented on July 17, 2024

Also a nice trick if you'd like to draw charts that should look more accurate. Try to play around with https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering

Specially for the grid lines the style shape-rendering: crispEdges is very nice. I'm even thinking about to include that per default in the generated stylesheet for all grid lines.

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.