Skip to content

HighCharts features

Prakriti Gupta edited this page Jun 11, 2018 · 9 revisions

HighStock

API

To use HighStock, daru-view user just need to pass an additional option chart_class with its value as 'stock'.

For example: HighStock

Examples

For more examples do visit the following links.

How daru-view generates the JS code

Following are the steps to know how js code has been generated.

  • Firstly, daru-view user will generate the Daru::View::Plot(data, options) object and will call div(for web frameworks and show_in_iruby for IRuby notebook).

  • As plotting_library must already be set to :highcharts, transfer goes to highcharts.rb and then to the display.rb (when the methods div and show_in_iruby are called).

  • Now, in web frameworks ultimately to_html is called. In to_html

    • load_dependences is called to load the additional dependencies:

      • Modules will be loaded only if any dependencies are provided in modules option. These are the additional modules required to draw the chart apart from the ones loaded while setting the plotting_library. Once a module is loaded then there is no need afterwards to load it again.
      • If the HighMap is being drawn by the user, then the required map data will be extracted from options[:map][:chart].
    • chart_class is extracted and compared.

    • If class_chart equals StockChart, then high_stock method from lazy_high_charts is called.

  • In Iruby notebook, ultimately show_in_iruby is called in display.rb. In show_in_iruby

    • Dependencies are similarly loaded if any.
    • Extracted chart_class is passed to high_chart_iruby method.
    • All of the code to generate js in IRuby notebook is present in layout_helper_iruby.rb.

HighMap

API

To use HighMap, a daru-view user just need to pass an additional option chart_class with its value as 'map'.

For example: HighMap

Examples

HighMaps additional official examples for each country can be found here. For more examples do visit the following links.

How daru-view generates the JS code

Following are the steps to know how js code has been generated.

  • Firstly, daru-view user will generate the Daru::View::Plot(data, options) object and will call div(for web frameworks and show_in_iruby for IRuby notebook).

  • As plotting_library must already be set to :highcharts, transfer goes to highcharts.rb and then to the display.rb (when the methods div and show_in_iruby are called).

  • Now, in web frameworks ultimately to_html is called. In to_html

    • load_dependences is called to load the additional dependencies:

      • Modules will be loaded only if any dependencies are provided in modules option. These are the additional modules required to draw the chart apart from the ones loaded while setting the plotting_library. Once a module is loaded then there is no need afterwards to load it again.
      • If the HighMap is being drawn by the user, then the required map data will be extracted from options[:map][:chart].
    • chart_class is extracted and compared.

    • If class_chart equals Map, then high_map method is called to generate the js.

  • In Iruby notebook, ultimately show_in_iruby is called in display.rb. In show_in_iruby

    • Dependencies are similarly loaded if any.
    • Extracted chart_class is passed to high_chart_iruby method.
    • All of the code to generate js in IRuby notebook is present in layout_helper_iruby.rb.
Clone this wiki locally