GithubHelp home page GithubHelp logo

responsive charts about smoothie HOT 3 CLOSED

joewalnes avatar joewalnes commented on August 16, 2024
responsive charts

from smoothie.

Comments (3)

mg1075 avatar mg1075 commented on August 16, 2024

This is a proposed hack in a very simplistic form...

The smoothie charts builder page on the smoothie website sort of has a responsive nature in how you can customize the width and the height of a chart.

Now, if the requirement is to have responsive width for a chart, how about listening to the window resize event, and then adjusting the chart width attribute on resize?

  $( window ).resize(function() {
    var y = $( window).width();
    $('#chart').attr('width', y-50 );
  });

The problem with this approach is the width is not truly responsive: the width does adjust, and the line is not distorted, but the line remains static and does not update to the new width.

from smoothie.

ChisholmKyle avatar ChisholmKyle commented on August 16, 2024

I'm not sure if changing the attribute is any different from changing the width property of the canvas element directly in Javascript, but I made a CodePen that adjusts the chart width for a window.onresize event and scale teh height to a quarter of the width: http://codepen.io/anon/pen/MpWvjX
This implementation doesn't seem to have the problem you describe. It does flicker during the resize if you move it around a lot though.

from smoothie.

drewnoakes avatar drewnoakes commented on August 16, 2024

This is now supported. See http://smoothiecharts.org/examples/responsive.html

from smoothie.

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.