Search code examples
c#.nethighchartsdotnethighcharts

setting size of chart in dotnet highchart?


I have a HighChart in my web page (in MVC4 application). It is taking 100% width of page.

I am wondering how I can set ratio or size for chart ? Documentation on http://api.highcharts.com/highcharts#Chart.setSize%28%29 says:

"SetSize" a method is available. I tried but couldn't access this method in my MVC web application.

Can you please help and guide me.

I highly appreciate your time, guidance and help.

Thanks


Solution

  • I'm not sure I understand the question completely. But if you want to set the width and height on the chart you could just set the width and height of the div that contains it and it will fill 100% of that container.

    You should be able to do something like this.

    <div id="container" style="width: 300px; height: 300px;"></div>
    
    <script type="text/javascript">
        $(function() {
            $('#container').highcharts({ .... config options here ... });
        });
    </script>