[Chartjs]-ChartJS on small screen

3๐Ÿ‘

I believe that following settings will work for you. Set responsive to true, maintainAspectRatio to false in the chart options and set style as like as max-height: 300px; width: auto;

0๐Ÿ‘

You could try giving it a min-width (something like 200px) and height: auto.

0๐Ÿ‘

I know this thread is a bit old โ€“ but this worked for me

plugins: {
            legend: {
                display: true,
                position: function () {
                    //you can return position based on inner width of your display area
                    if (window.innerWidth < 600) {
                        return "bottom";
                    }

Leave a comment