javascript - Google Chart not displaying with the correct height and width -


i'm having problem google graph displaying in default size (width: 400px , height: 200px) while want different size. i'm wondering if has being in partial view or something, display correct if change size in code , refresh. if me out in advance.

@model projectserverside.presentationmodels.pmdata    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>  <script type="text/javascript">      google.charts.load('current', { packages: ['corechart', 'bar'] });      google.charts.setonloadcallback(drawchart);          function drawchart() {            var data = google.visualization.arraytodatatable([              ['element', 'count', { role: 'annotation' }],              ['threads',@html.displayfor(model => model.threadcount), 'threads'],              ['votes', @html.displayfor(model => model.votecount), 'votes'],              ['comments',@html.displayfor(model => model.commentcount), 'comments'],            ]);              var options = {                chart: {                    title: 'interest performance',                    subtitle: 'threads, votes, , comments',                    width: 900,                    height: 500                }                          };              var chart = new google.charts.bar(document.getelementbyid('graph'));              chart.draw(data, options);        }  </script>  <div id="graph" style="width: 900px; height: 500px"></div>

not missing since it's on layout html file included in header. again if me thank in advance.

this how displays on page now

there no width/height-properties options.chart

you must define width , height properties of options

var options = {                   width: 900,                   height: 500,                   chart: {                            title: 'interest performance',                            subtitle: 'threads, votes, , comments'                                                }                             }; 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -