2amigos / yii2-chartjs-widget

ChartJs Widget For Yii2
https://2amigos.us
Other
109 stars 67 forks source link

100% width #1

Closed schmunk42 closed 9 years ago

schmunk42 commented 10 years ago

How can I apply a 100% width to the chart, eg. to take the width from a surrounding bootstrap container?

tonydspaniard commented 10 years ago

@schmunk42 Use the options, is the one that sets the canvas width: https://github.com/2amigos/yii2-chartjs-widget/blob/master/Chart.php#L79

schmunk42 commented 10 years ago

Tried it with

'options' => [
    'height' => 400,
    'width' => "100%"
],

but does not work at least on Safari. Width is only about 50px.

tonydspaniard commented 10 years ago

Will have a look

tonydspaniard commented 9 years ago

I know this is pretty old, but it seems the library doesn't yet support it: https://github.com/nnnick/Chart.js/issues/882