Sha256: 3eaf3c5c2621811dae188b19f91eb0399fce478554674655acfb2292b995f77b

Contents?: true

Size: 912 Bytes

Versions: 6

Compression:

Stored size: 912 Bytes

Contents

//= require ./ajax

AmCharts.RB.RemoteJSONProvider = AmCharts.RB.Util.Class.create(function()
{
  function state_changed()
  {
    var response = this.request.response;

    if (response.ready_state() == 4)
    {
      if (response.status() == 200)
      {
        this.data = response.get_json();
        this.chart.load_data(this.data);
      }
      else
      {
        this.chart.failed("Error loading chart data: " + this.url);
      }
    }
  }

  return {
    request: null,

    initialize: function(chart, url, params, method)
    {
      this.url = url;
      this.params = params;
      this.method = method || 'GET';
      this.chart = new AmCharts.RB.Chart(chart);
    },

    load: function(defer)
    {
      setTimeout(function(){
        this.request = new AmCharts.RB.Ajax.Request(this.url, this.params, this.method, state_changed.bind(this));
      }.bind(this), defer || 0)
    }
  }
}());

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
amcharts.rb-3.4.8.0 app/assets/javascripts/amcharts/remote_json_provider.js
amcharts.rb-3.4.7.5 app/assets/javascripts/amcharts/remote_json_provider.js
amcharts.rb-3.4.7.4 app/assets/javascripts/amcharts/remote_json_provider.js
amcharts.rb-3.4.7.3 app/assets/javascripts/amcharts/remote_json_provider.js
amcharts.rb-3.4.7.2 app/assets/javascripts/amcharts/remote_json_provider.js
amcharts.rb-3.4.7.1 app/assets/javascripts/amcharts/remote_json_provider.js