You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently found this project. One can get a String via .to_s, without
colours, which is super-convenient for display on a webpage - so, no
clue who had this idea, but the project is a really good idea.
Now to my proposal here.
I just tried this:
require 'rbt'
array = RBT.statistics?
require 'unicode_plot'
UnicodePlot.barplot(
data: array,
title: 'RBT - increase in the number of programs over the years'
).render
RBT.statistics? is a method in another project. It will return an Array
that has a simple two-entry structure like this:
[["25.10.2005", 274],
I then wanted to plot this.
However had, data: wants a Hash. If an array is given, it fails via:
.gem/gems/unicode_plot-0.0.5/lib/unicode_plot/barplot.rb:134:in `Hash': can't convert Array into Hash (TypeError)
The simple solution is to pass a Hash e. g. via:
data: Hash[array],
Ok problem solved. But, I think it would be more convenient if an Array can be
given, and unicode_plot tries to convert it into a Hash instead automatically.
The text was updated successfully, but these errors were encountered:
I recently found this project. One can get a String via .to_s, without
colours, which is super-convenient for display on a webpage - so, no
clue who had this idea, but the project is a really good idea.
Now to my proposal here.
I just tried this:
RBT.statistics? is a method in another project. It will return an Array
that has a simple two-entry structure like this:
I then wanted to plot this.
However had, data: wants a Hash. If an array is given, it fails via:
The simple solution is to pass a Hash e. g. via:
Ok problem solved. But, I think it would be more convenient if an Array can be
given, and unicode_plot tries to convert it into a Hash instead automatically.
The text was updated successfully, but these errors were encountered: