Sergio Corral Orellana Sergio Corral Orellana - 1 year ago 198
Javascript Question

Set size chartjs in div

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

Test chart -

I try with

width:100% and height:100%

in div canvas , but don't work.

sorry my bad english :(


Answer Source

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;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download