Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.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 使用ajax for Rails更新highcharts_Ruby On Rails_Ajax_Highcharts - Fatal编程技术网

Ruby on rails 使用ajax for Rails更新highcharts

Ruby on rails 使用ajax for Rails更新highcharts,ruby-on-rails,ajax,highcharts,Ruby On Rails,Ajax,Highcharts,我已经用highcharts设置了一些图表,用辉煌的“gon”宝石填充了它的系列专栏。现在,我正在尝试使用ajax更新它的结果 以下是我的设置: 用户\u控制器: gon.segmentedData = ActiveRecord query here.. <div class = deposit> <%= form_tag transact_path, :remote => true, :validate => true, :method => :post

我已经用highcharts设置了一些图表,用辉煌的“gon”宝石填充了它的系列专栏。现在,我正在尝试使用ajax更新它的结果

以下是我的设置:

用户\u控制器:

gon.segmentedData = ActiveRecord query here..
<div class = deposit>
<%= form_tag transact_path, :remote => true, :validate => true, :method => :post do %>
.
.
.
 <%= submit_tag "Deposit", :id => 'deposit_button', :class => 'round', :disable_with => 'Please wait..' %> 
   var options = //here i pass all the options again

    new Highcharts.Chart(options);
application.js

var weekly_options = {  //Some standard highcharts options here


                    series: gon.segmentedData  
                };
这完美地呈现了图表。我想使用以下操作调整此图表

查看:

gon.segmentedData = ActiveRecord query here..
<div class = deposit>
<%= form_tag transact_path, :remote => true, :validate => true, :method => :post do %>
.
.
.
 <%= submit_tag "Deposit", :id => 'deposit_button', :class => 'round', :disable_with => 'Please wait..' %> 
   var options = //here i pass all the options again

    new Highcharts.Chart(options);
create.js:

gon.segmentedData = ActiveRecord query here..
<div class = deposit>
<%= form_tag transact_path, :remote => true, :validate => true, :method => :post do %>
.
.
.
 <%= submit_tag "Deposit", :id => 'deposit_button', :class => 'round', :disable_with => 'Please wait..' %> 
   var options = //here i pass all the options again

    new Highcharts.Chart(options);
我的问题是,我无法通过transaction_控制器获得一组更新的选项来创建.js。同样的图表会再次呈现


如果有人能为我评论一下这种方法,我将不胜感激。

使用懒散的高图表来节省您的时间

e、 g。 在控制器中

@h = LazyHighCharts::HighChart.new('graph') do |f|
f.options[:chart][:defaultSeriesType] = "area"
f.series(:name=>'John', :data=>[3, 20, 3, 5, 4, 10, 12 ,3, 5,6,7,7,80,9,9])
f.series(:name=>'Jane', :data=> [1, 3, 4, 3, 3, 5, 4,-46,7,8,8,9,9,0,0,9] )
end
鉴于,

<%= high_chart("my_id", @h) %>


我从控制器获取更新数据以填充highcharts数据时遇到问题。我没有使用gon(它不断返回陈旧数据),而是切换到json。现在很有魅力。

谢谢!看起来很有希望!