Skip to content

Commit

Permalink
Nyaplot example GIF added
Browse files Browse the repository at this point in the history
  • Loading branch information
Shekharrajak committed Jan 11, 2019
1 parent eab2ee3 commit b3b7929
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions README.md
Expand Up @@ -134,7 +134,7 @@ The line `<%=raw Daru::View.dependent_script(:highcharts) %>` for rails app , mu
You can read more about this feature in [this wiki page section](https://github.com/SciRuby/daru-view/wiki/GSoC-2018---Progress-Report#reduce-a-bunch-of-lines-due-to-js-files-in-source-html-in-rails-pr-115-in-daru-view-pr-23-in-daru-data_tables).


HighCharts example :
##### HighCharts example :

```ruby

Expand All @@ -158,7 +158,34 @@ Daru::View.plotting_library = :highcharts
![Line Graph](https://github.com/shekharrajak/medium-daru-view-blog/blob/master/GIF_Images/HighChartBlog/lineChart.gif)
Nyaplot example :
##### GoogleChart example:
```ruby
# Default chart type is Line.
data = [
[0, 0], [1, 10], [2, 23], [3, 17], [4, 18], [5, 9],
[6, 11], [7, 27], [8, 33], [9, 40], [10, 32], [11, 35],
[12, 30], [13, 40], [14, 42], [15, 47], [16, 44], [17, 48],
[18, 52], [19, 54], [20, 42], [21, 55], [22, 56], [23, 57],
[24, 60], [25, 50], [26, 52], [27, 51], [28, 49], [29, 53],
[30, 55], [31, 60], [32, 61], [33, 59], [34, 62], [35, 65],
[36, 62], [37, 58], [38, 55], [39, 61], [40, 64], [41, 65],
[42, 63], [43, 66], [44, 67], [45, 69], [46, 69], [47, 70],
[48, 72], [49, 68], [50, 66], [51, 65], [52, 67], [53, 70],
[54, 71], [55, 72], [56, 73], [57, 75], [58, 70], [59, 68],
[60, 64], [61, 60], [62, 65], [63, 67], [64, 68], [65, 69],
[66, 70], [67, 72], [68, 75], [69, 80]
]
line_basic_chart = Daru::View::Plot.new(data)
line_basic_chart.show_in_iruby
```
![Line Graph GoogleChart](https://github.com/Shekharrajak/medium-daru-view-blog/blob/master/GIF_Images/GoogleChart/lineChart.gif)
##### Nyaplot example :
```ruby
Expand All @@ -181,8 +208,8 @@ data_df = Daru::DataFrame.new({
data_df.to_category :c
# initialize
@bar_graph1 = Daru::View::Plot.new(data_vector ,opts)
@bar_graph2 = Daru::View::Plot.new(data_df, type: :bar, x: :c)
@bar_graph_vector = Daru::View::Plot.new(data_vector ,opts)
@bar_graph_df = Daru::View::Plot.new(data_df, type: :bar, x: :c)
# Add this line in your view file, where you want to see you graph in web application. (It will put the html code of the line graph in web page)
Expand All @@ -191,8 +218,25 @@ data_df.to_category :c
# Now refresh the page, you will be able to see your graph.
# IRuby notebook
@bar_graph_vector.show_in_iruby
```
![Bar Graph Nyaplot Vector](https://github.com/Shekharrajak/medium-daru-view-blog/blob/master/GIF_Images/Nyaplot/nyaplot%2Bvector.gif)
```
@bar_graph_df.show_in_iruby
```
![Bar Graph Nyaplot Dataframe](https://github.com/Shekharrajak/medium-daru-view-blog/blob/master/GIF_Images/Nyaplot/nyaplot_df.gif)
- User can try examples, that is added in [Demo web applicatioons (Rails, Sinatra, Nanoc)](https://github.com/Shekharrajak/demo_daru-view). To setup the rails app, run following commands :
```
Expand Down

0 comments on commit b3b7929

Please sign in to comment.