Search code examples
phplaravelchartsresponsiveness

How to make Lavacharts Responsive


I am using Lavacharts in my Laravel web application. Rendering the chart in a view in something like this:

<?php
    echo Lava::render('DonutChart', 'malik', 'malik', array('width' => 400, 'height' => 400));
?>

The height and the width element here is absolute. I went through this Link which describes the use of Lava::get('chartName') but I don't know how and where in my code to use it.

How may I use it? any help?


Solution

  • Okay, One way to do this is apply your own styling upon this. Lavacharts takes the second argument in the render method and assigns it as an id to the div. So using the id I styled it like this:

    #malik{
          height: 100% !important;
          width: 100% !important;
    }
    

    And it worked!