Module: RCharts

Extended by:
ActiveSupport::Autoload
Defined in:
lib/rcharts.rb,
lib/rcharts/type.rb,
lib/rcharts/engine.rb,
lib/rcharts/version.rb,
lib/rcharts/percentage.rb,
lib/rcharts/type/symbol.rb,
lib/rcharts/type/percentage.rb,
app/helpers/rcharts/graph_helper.rb,
app/helpers/rcharts/graph_helper/axes.rb,
app/helpers/rcharts/graph_helper/graph.rb,
app/helpers/rcharts/graph_helper/element.rb,
app/helpers/rcharts/graph_helper/graph/axes.rb,
app/helpers/rcharts/graph_helper/graph/axis.rb,
app/helpers/rcharts/graph_helper/series/path.rb,
app/helpers/rcharts/graph_helper/rule_element.rb,
app/helpers/rcharts/graph_helper/series/point.rb,
app/helpers/rcharts/graph_helper/graph/options.rb,
app/helpers/rcharts/graph_helper/graph_builder.rb,
app/helpers/rcharts/graph_helper/element_builder.rb,
lib/generators/rcharts/install/install_generator.rb,
app/helpers/rcharts/graph_helper/graph/axis/ticks.rb,
app/helpers/rcharts/graph_helper/graph/calculator.rb,
app/helpers/rcharts/graph_helper/axes/axis_element.rb,
app/helpers/rcharts/graph_helper/axes/tick_element.rb,
app/helpers/rcharts/graph_helper/graph/axis/caster.rb,
app/helpers/rcharts/graph_helper/graph/composition.rb,
app/helpers/rcharts/graph_helper/axes/label_element.rb,
app/helpers/rcharts/graph_helper/series/area_element.rb,
app/helpers/rcharts/graph_helper/series/path_element.rb,
app/helpers/rcharts/graph_helper/legend_entry_builder.rb,
app/helpers/rcharts/graph_helper/series/series_builder.rb,
app/helpers/rcharts/graph_helper/categories/bar_builder.rb,
app/helpers/rcharts/graph_helper/graph/axis/positioning.rb,
app/helpers/rcharts/graph_helper/series/scatter_element.rb,
app/helpers/rcharts/graph_helper/tooltips/entry_builder.rb,
app/helpers/rcharts/graph_helper/categories/bars_element.rb,
app/helpers/rcharts/graph_helper/tooltips/marker_element.rb,
app/helpers/rcharts/graph_helper/axes/axis_element/styles.rb,
app/helpers/rcharts/graph_helper/tooltips/tooltip_builder.rb,
app/helpers/rcharts/graph_helper/tooltips/tooltip_element.rb,
app/helpers/rcharts/graph_helper/categories/category_builder.rb,
app/helpers/rcharts/graph_helper/tooltips/hover_target_element.rb,
app/helpers/rcharts/graph_helper/categories/bar_segment_element.rb,
app/helpers/rcharts/graph_helper/tooltips/foreign_object_element.rb

Overview

RCharts

RCharts is a simple but highly extensible and customizable framework for rendering charts with Action View. Unlike many other charting libraries, RCharts produces charts with non-uniform scaling without resorting to any client-side rendering, so that the browser has enough information to be able to resize the chart itself. You can then progressively enhance this baseline functionality to achieve things like panning and zooming, without needing to consider how and when the chart is rendered.

To get started rendering charts, see GraphHelper.

Defined Under Namespace

Modules: GraphHelper, Type Classes: Engine, InstallGenerator, Percentage

Constant Summary collapse

VERSION =

Fake comment to trigger workflow

'0.1.0'

Class Method Summary collapse

Class Method Details

.color_class_for(index) ⇒ Object

Returns a color class based on the index. You can set the color classes using Rails.application.config.rcharts.series_color_classes=.

module MyApplication
  class Application < Rails::Application
    config.rcharts.series_color_classes = %w[blue red green]
  end
end

RCharts.color_class_for(1) # => 'red'


34
35
36
# File 'lib/rcharts.rb', line 34

def self.color_class_for(index)
  series_color_classes[index % series_color_classes.size]
end

.symbol_for(index) ⇒ Object

Returns a symbol based on the index. You can set the symbols using Rails.application.config.rcharts.series_symbols=. Symbols are characters like ●, ■, ◆, ▲, ▼.

module MyApplication
  class Application < Rails::Application
    config.rcharts.series_symbols = %w[    ]
  end
end

RCharts.symbol_for(1) # => '■'


49
50
51
# File 'lib/rcharts.rb', line 49

def self.symbol_for(index)
  series_symbols[index % series_symbols.size]
end