Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 使用fluid bootstrap布局重新调整google图表的大小_Ruby On Rails_Twitter Bootstrap_Google Visualization - Fatal编程技术网

Ruby on rails 使用fluid bootstrap布局重新调整google图表的大小

Ruby on rails 使用fluid bootstrap布局重新调整google图表的大小,ruby-on-rails,twitter-bootstrap,google-visualization,Ruby On Rails,Twitter Bootstrap,Google Visualization,我正在rails应用程序中使用twitter引导 在流体布局中,如果跨度宽度减小,图表将溢出其父div 谷歌图表宽度可以用百分比表示吗 请帮忙 更新 我用的是宝石 这是我的控制器代码 def home # Indents indent_status_table = GoogleVisualr::DataTable.new indent_status_table.new_column('string', 'STATUS') indent_status_table.new_colu

我正在rails应用程序中使用twitter引导

在流体布局中,如果跨度宽度减小,图表将溢出其父div

谷歌图表宽度可以用百分比表示吗

请帮忙

更新

我用的是宝石

这是我的控制器代码

def home

  # Indents
  indent_status_table = GoogleVisualr::DataTable.new
  indent_status_table.new_column('string', 'STATUS')
  indent_status_table.new_column('number', 'COUNT')
  indent_status_table.add_rows(1)
  indent_status_table.set_cell(0, 0, 'Open')
  indent_status_table.set_cell(0, 1, 100)

  opts   = { :title => 'INDENT STATUS', :is3D => true }
  @indent_status_chart = GoogleVisualr::Interactive::PieChart.new(indent_status_table, opts)

end
这是我的html.erb代码

<div id='shipment_status_chart' style="width:100%; height:200px"></div>
<%= render_chart @shipment_status_chart, 'shipment_status_chart' %>

您可以在HTML中指定图表宽度

<div id="chart_div" style="width:100%; height:300px"></div>

这是一个显示100%宽度的屏幕调整更新。

我正在使用谷歌图表,为了使我的图表具有响应性,我添加了
style=“max width:100%”

例如:

<div class="row">
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
</div>


它工作得很好。但是当我们调整窗口大小时,我们需要刷新页面。我们也能做点什么吗?更新部分似乎不起作用。它会重新绘制页面中的所有图表吗?它会运行
drawChart()
函数。所以你的可能被称为别的。如果你发布你的javascript,我将能够给出一个更准确的答案。首先,非常感谢你的帮助。我已经更新了这个问题。这里是一个使用
.load()
的黑客程序,请参见这里使用
$('html').load(window.location)因为它基本上只是刷新页面内容
$(document).ready(function () {
    $(window).resize(function(){
        drawChart();
    });
});
<div class="row">
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
  <div class="col-md-3">
    <div google-chart style="max-width:100%" chart="chart"/>
  </div>
</div>