Sha256: 0657c6552c21c27aa598a155b8655da5de8cce054d92beae98bf3c31fa4299d2

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

// If the container element doesn't already exist, create it
var container = AmCharts.RB.Helpers.add_container_if_needed('<%= container %>', <%= builder.to_js chart.width %>, <%= builder.to_js chart.height %>);
AmCharts.RB.Helpers.add_blanket(container)
<% if chart.loading_indicator? %>
  AmCharts.RB.Helpers.add_loading_indicator(container, <%= builder.to_js(:chart_data_loading) %>, '<%= escape_javascript asset_path('amcharts/loading.gif') %>');
<% end %>

<% if chart.legend_div %>
  AmCharts.RB.Helpers.add_legend_div('<%= chart.legend_div == true ? "#{container}_legend" : chart.legend_div %>', container);
<% end %>

<% builder.render_immediate_data_load %>

AmCharts.ready(function() {
  var chart_data = <%= builder.to_js(chart.data_source.empty? ? chart.data : []) %>;
  var chart = new <%= chart.amchart_type %>;
  chart.dataProvider = chart_data;

  <% builder.render_data_source %>

  AmCharts.RB.Charts['<%= container %>'] = chart;

  chart.categoryField = <%= builder.to_js(chart.category_field) %>;
  chart.pathToImages = '<%= escape_javascript "#{File.dirname(asset_path('amcharts/dragIcon.gif'))}/" %>';

  <% builder.render_settings(chart, 'chart') %>

  <% builder.render_data %>

  <% builder.render_legend %>

  <% builder.render_component(chart.category_axis, name: :category_axis, js_object: 'chart.categoryAxis', method: false) %>
  <% builder.render_component(chart.value_axes, name: :value_axis) %>
  <% builder.render_component(chart.cursor, name: :chart_cursor) %>
  <% builder.render_component(chart.scrollbar, name: :chart_scrollbar) %>

  <% builder.render_title %>
  <% builder.render_labels %>

  <% builder.render_listeners %>

  <% builder.render_export %>

  chart.write('<%= container %>');

  AmCharts.RB.Helpers.load_from_immediate_provider(chart);
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
amcharts.rb-3.11.2.16 app/views/amcharts/chart_builder.erb
amcharts.rb-3.11.2.14 app/views/amcharts/chart_builder.erb
amcharts.rb-3.11.1.14 app/views/amcharts/chart_builder.erb