Frage

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

War es hilfreich?

Lösung 2

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>

Andere Tipps

You are going about this the wrong way. Set the height of the chart with the Init Method of the chart in your controller:

myChart.InitChart(new Chart {Width = 300, Height = 500});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top