gwatts / jquery.sparkline

A plugin for the jQuery javascript library to generate small sparkline charts directly in the browser
http://omnipotent.net/jquery.sparkline/
1.24k stars 278 forks source link

canvas width 100% #148

Open RickdeM opened 9 years ago

RickdeM commented 9 years ago

When using 'data-width="100%" ' , the canvas width gets calculated, to px's. When my bootstrap Menu opens, the parent of the canvas width will be reduced. When the parent will get smaller and the canvas size remains, the canvas will get outside his parent.

This makes you able to scroll unwanted from left to right.

use 'this.width' instead of 'width' which will get 100% style width of the element https://github.com/gwatts/jquery.sparkline/blob/657f42892ee384691e2540fae1f04058da4145d5/src/vcanvas-canvas.js#L18

before after after_2

When using 'this.width' the element will resize due to the percentage width

correct

jfrank14 commented 8 years ago

I'm running into a similar issue.