Skip to content

How to use lazy_high_charts in Iruby notebook #235

@Shekharrajak

Description

@Shekharrajak

I want to see plots in IRuby notebook.

When I do

chart = LazyHighCharts::HighChart.new('graph') do |f|
      f.title({ :text=>"Combination chart"})
      f.options[:xAxis][:categories] = ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
      f.labels(:items=>[:html=>"Total fruit consumption", :style=>{:left=>"40px", :top=>"8px", :color=>"black"} ])
      f.series(:type=> 'column',:name=> 'Jane',:data=> [3, 2, 1, 3, 4])
      f.series(:type=> 'column',:name=> 'John',:data=> [2, 3, 5, 7, 6])
      f.series(:type=> 'column', :name=> 'Joe',:data=> [4, 3, 3, 9, 0])
      f.series(:type=> 'spline',:name=> 'Average', :data=> [3, 2.67, 3, 6.33, 3.33])
      f.series(:type=> 'pie',:name=> 'Total consumption',
        :data=> [
          {:name=> 'Jane', :y=> 13, :color=> 'red'},
          {:name=> 'John', :y=> 23,:color=> 'green'},
          {:name=> 'Joe', :y=> 19,:color=> 'blue'}
        ],
        :center=> [100, 80], :size=> 100, :showInLegend=> false)
    end

I get this

#<LazyHighCharts::HighChart:0x007fc201ca9570 @series_data=[{:type=>"column", :name=>"Jane", :data=>[3, 2, 1, 3, 4]}, {:type=>"column", :name=>"John", :data=>[2, 3, 5, 7, 6]}, {:type=>"column", :name=>"Joe", :data=>[4, 3, 3, 9, 0]}, {:type=>"spline", :name=>"Average", :data=>[3, 2.67, 3, 6.33, 3.33]}, {:type=>"pie", :name=>"Total consumption", :data=>[{:name=>"Jane", :y=>13, :color=>"red"}, {:name=>"John", :y=>23, :color=>"green"}, {:name=>"Joe", :y=>19, :color=>"blue"}], :center=>[100, 80], :size=>100, :showInLegend=>false}], @options={:title=>{:text=>"Combination chart"}, :legend=>{:layout=>"vertical", :style=>{}}, :xAxis=>{:categories=>["Apples", "Oranges", "Pears", "Bananas", "Plums"]}, :yAxis=>{:title=>{:text=>nil}, :labels=>{}}, :tooltip=>{:enabled=>true}, :credits=>{:enabled=>false}, :plotOptions=>{:areaspline=>{}}, :chart=>{:defaultSeriesType=>"line", :renderTo=>nil}, :subtitle=>{}, :labels=>{:items=>[{:html=>"Total fruit consumption", :style=>{:left=>"40px", :top=>"8px", :color=>"black"}}]}}, @html_options={}, @placeholder="graph">

But I want to see the chart instead. What should I do for display charts ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions