lazy_high_charts
lazy_high_charts copied to clipboard
defined `show` and `show_in_iruby` methods
Fixes https://github.com/michelson/lazy_high_charts/issues/235
e.g. in iruby notebook :
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
include LazyHighCharts::LayoutHelper
IRuby.display high_chart("some_id", chart), mime: 'text/html'
# or
IRuby.html high_chart("some_id", chart).to_s
I am not able to understand why high_chart_iruby("some_id1", chart) not working.
Ping @michelson
@michelson , if this PR is merged, then it will be very helpful for me to use it in Daru gem and plugin gem daru-view. So please try to review it as soon as possible.
Hi @Shekharrajak , this looks good!. Could you provide an example in spec/dummy for iruby in order to do some integration tests?
best!
@michelson , I hope, now it is good to go.
Using show and show_in_iruby method use don't need to run these lines :
include LazyHighCharts::LayoutHelper
IRuby.display high_chart("some_id", chart), mime: 'text/html'
Most of the time developers and users try their code in iruby notebook. So it will be very helpful if lazy_high_charts is usable in iruby notebook. I have tried one example and pushed in this branch. You can check it in this link : http://nbviewer.jupyter.org/github/Shekharrajak/lazy_high_charts/blob/iruby_setup/examples/notebook/lazy_high_charts.ipynb
It will be helpful for me to continue my work on daru-view, if this PR is merged as soon as possible. Thanks.
Hi Shekhar, thanks for this contribution , I guess this will be very helpful for iruby users. Let me check this out , do some tests and merge this PR asap
regards from Chile
Atte. Miguel Michelson Martinez www.vadb.org http://vadb.org
On Mon, Jun 5, 2017 at 6:26 AM, Shekhar Prasad Rajak < [email protected]> wrote:
Most of the time developers and users try their code in iruby notebook. So it will be very helpful if lazy_high_charts is usable in iruby notebook. I have tried one example and pushed in this branch. You can check it in this link : http://nbviewer.jupyter.org/github/Shekharrajak/lazy_high_ charts/blob/iruby_setup/examples/notebook/lazy_high_charts.ipynb
It will be helpful for me to continue my work on daru-view, if this PR is merged as soon as possible. Thanks.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/michelson/lazy_high_charts/pull/236#issuecomment-306143844, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAuyKXd68HkcJqs2QMs_9rjKPEmlqOWks5sA8m1gaJpZM4NvB8A .
Hi @Shekharrajak , The example should be moved to spec/dummy_iruby in order to merge this the example should contain all the dependences in a Gemfile , and the iRuby dep should be removed from gemspec. The Gemfile from the example project should be something like:
source "http://rubygems.org"
gem "iruby"
gem "cztop"
gemspec :path => '../../'
btw I'm having troubles to run the notebook, all the output is turned to text, so is no chart. but I can see the example you pointed on jupyter.org correctly
regards
Thanks for review . @michelson are you getting nothing in output cell of the notebook, when you run show_in_iruby ?
I have added more examples in spec/dummy_iruby : http://nbviewer.jupyter.org/github/Shekharrajak/lazy_high_charts/blob/iruby_setup/spec/dummy_iruby/lazy_high_charts_basics.ipynb
Please check the last example, why it is failing. I think that is other issue.
yup , I'm not seeing any html output for the graph
i'm doing bundle exec iruby notebook inside spec/dummy_iruby

I've updated the gemfile as follows:
source "http://rubygems.org"
gem "iruby"
gem "cztop"
#gem 'rbczmq' <- this is not compiling on ruby 2.4.0 (osx)
gem 'actionview', '~> 4.2'
gemspec :path => '../../'
is this working for you on local environment ? I get some errors just after notebook starts , FATAL -- : Kernel died: uninitialized constant IRuby::Kernel::Session
gem 'rbczmq' # or 'ffi-rzmq'
is needed for iruby notebook. You can try it with 2.3 ruby
see : https://stackoverflow.com/questions/35999925/kernel-dies-when-creating-iruby-notebook
yup , I'm not seeing any html output for the graph'
When you do print preview in iruby notebook you will be able to see the chart. I also got the same problem I didn't understand why.
@michelson , I think for 3d charts need to use <script src="/https://code.highcharts.com/highcharts-3d.js"><script>. But previously I thought 3d charts is usable with highcharts.js only. Is there any dependency in 3d plotting?
Problem is onload method used here . I will update the PR soon