@@ -78,10 +78,10 @@ module UnicodePlot
7878
7979 def boxplot (
8080 names : Array (String ),
81- data : Array (Array (Number )),
81+ data : Array (Array (T )),
8282 ** kwargs,
83- ) : Plot
84- boxplot(names, data.map { |series | series.map( & .to_f ) }, ** kwargs)
83+ ) : Plot forall T
84+ boxplot(names, data.map { |series | to_plot_f64(series ) }, ** kwargs)
8585 end
8686
8787 def boxplot (
@@ -195,17 +195,17 @@ module UnicodePlot
195195
196196 def boxplot (
197197 name : String ,
198- data : Array (Number ),
198+ data : Array (T ),
199199 ** kwargs,
200- ) : Plot
201- boxplot(name, data.map( & .to_f ), ** kwargs)
200+ ) : Plot forall T
201+ boxplot(name, to_plot_f64(data ), ** kwargs)
202202 end
203203
204204 def boxplot (
205- data : Array (Number ),
205+ data : Array (T ),
206206 ** kwargs,
207- ) : Plot
208- boxplot(data.map( & .to_f ), ** kwargs)
207+ ) : Plot forall T
208+ boxplot(to_plot_f64(data ), ** kwargs)
209209 end
210210
211211 def boxplot (
@@ -233,7 +233,7 @@ module UnicodePlot
233233 end
234234
235235 def boxplot (
236- dict : Hash (String , Array (Number )),
236+ dict : Hash (String , Array (T )),
237237 * ,
238238 color : Symbol | UInt32 | {Int32 , Int32 , Int32 } | Array (Symbol ) | Array (UInt32 ) = :green ,
239239 title : String = " " ,
@@ -247,9 +247,9 @@ module UnicodePlot
247247 compact_labels : Bool = false ,
248248 compact : Bool = false ,
249249 width : Int32 ? = nil ,
250- ) : Plot
250+ ) : Plot forall T
251251 boxplot(
252- dict.transform_values { |v | v.map( & .to_f ) },
252+ dict.transform_values { |v | to_plot_f64(v ) },
253253 color: color, title: title, xlabel: xlabel,
254254 border: border, margin: margin, padding: padding, labels: labels,
255255 unicode_exponent: unicode_exponent, thousands_separator: thousands_separator,
@@ -286,8 +286,8 @@ module UnicodePlot
286286 plot
287287 end
288288
289- def boxplot !(plot : Plot , data : Array (Number ), ** kwargs) : Plot
290- boxplot!(plot, data.map( & .to_f ), ** kwargs)
289+ def boxplot !(plot : Plot , data : Array (T ), ** kwargs) : Plot forall T
290+ boxplot!(plot, to_plot_f64(data ), ** kwargs)
291291 end
292292
293293 def boxplot !(
@@ -300,7 +300,7 @@ module UnicodePlot
300300 boxplot!(plot, data, name: name, color: color)
301301 end
302302
303- def boxplot !(plot : Plot , name : String , data : Array (Number ), ** kwargs) : Plot
304- boxplot!(plot, name, data.map( & .to_f ), ** kwargs)
303+ def boxplot !(plot : Plot , name : String , data : Array (T ), ** kwargs) : Plot forall T
304+ boxplot!(plot, name, to_plot_f64(data ), ** kwargs)
305305 end
306306end
0 commit comments