Giter Club home page Giter Club logo

Comments (9)

benpickles avatar benpickles commented on May 18, 2024 1

Fixed by #26, only took two years!

from peity.

benpickles avatar benpickles commented on May 18, 2024

Yes! Absolutely! In fact it should be the default for line and bar charts.

from peity.

nicjohnson avatar nicjohnson commented on May 18, 2024

Thanks for the quick reply. I'm not sure if you mean it already should be the default, or you think that the default should change to 100%. In the docs here (http://benpickles.github.com/peity/) the default width for line and bar is 32px.

from peity.

tim-peterson avatar tim-peterson commented on May 18, 2024

I would also love to be able to set percent width.

Many sites are responsively designed these days (including mine) so setting a percent rather than pixel width would allow the peity.js charts to resize depending on browser width.

thanks @benpickles for making such a great plugin!

from peity.

hudster avatar hudster commented on May 18, 2024

Percentage width would be very useful, particularly as I use these graphs above & underneath other content which has a variable width

from peity.

tim-peterson avatar tim-peterson commented on May 18, 2024

I think this Stackoverflow (SO) thread answer by @6052 is the answer we are looking for.

It seems the key thing is that there are two sets of height/widths for the canvas, a JS and a CSS one.
The crappy solution is to set the canvas CSS width as a % while leaving the canvas.width and canvas.height in pixels. An example of this is shown in this JSFiddle. You'll notice that the canvas does resize when you change the browser width, its just that canvas is blurry when the browser width gets big enough.

The improvement on this seems to be to only specify the canvas.width when you know the browser width. So one implemenation could be getting the window.innerWidth and taking some pixel percentage of that?

Perhaps check out the SO thread and give your thoughts?

from peity.

benpickles avatar benpickles commented on May 18, 2024

FYI I'm thinking about this but haven't quite come to a final decision yet. It seems sensible to support percentage dimensions but I have to give some further thought to the implications.

from peity.

tim-peterson avatar tim-peterson commented on May 18, 2024

thanks, yeah it is not as simple as I originally thought...

from peity.

benpickles avatar benpickles commented on May 18, 2024

I have a proof of concept for using percentage dimensions, there's more work to do and I've only tried it with line charts but it looks promising - #26.

from peity.

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.