Sergio Corral Orellana Sergio Corral Orellana - 16 days ago 5
Javascript Question

Set size chartjs in div

how can I set the size of this chartjs ? all screen ( height - width )

Test chart - jsfiddle.net

I try with

width:100% and height:100%


in div canvas , but don't work.

sorry my bad english :(

Thanks!

Answer

As per the comments:

Seems to work for me. I'll add that height: 100% gets ignored as the chart will attempt to keep the aspect ratio. So you can set height to a px value to have it ignore the aspect ratio.

The styling was done via css:

#chart {
    width: 100%;
    height: 600px;
}

http://jsfiddle.net/swtakxo0/2