mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-05 22:31:11 +08:00
Try to add xlim option
This commit is contained in:
parent
1fb369e26b
commit
7c0ab3ebdb
@ -32,7 +32,8 @@ module Uplot
|
||||
main_parser = create_parser
|
||||
parsers = Hash.new { |h, k| h[k] = create_parser }
|
||||
parsers['hist'] .on('--nbins VAL', Numeric) { |v| @params[:nbins] = v }
|
||||
parsers['histogram'] = parsers['hist']
|
||||
parsers['histogram'] = parsers['hist']
|
||||
parsers['line'] .on('-x', '--xlim VAL', String) { |v| @params[:xlim] = get_lim(v) }
|
||||
parsers['lineplot'] = parsers['line']
|
||||
parsers['lineplots'] = parsers['lines']
|
||||
parsers['scatterplot'] = parsers['scatter']
|
||||
@ -108,6 +109,10 @@ module Uplot
|
||||
UnicodePlot.histogram(series, **@params.compact)
|
||||
end
|
||||
|
||||
def get_lim(str)
|
||||
str.split(/-|:|\.\./)[0..1].map(&:to_f)
|
||||
end
|
||||
|
||||
def line(data, headers)
|
||||
if data.size == 1
|
||||
@params[:name] ||= headers[0] if headers
|
||||
|
Loading…
Reference in New Issue
Block a user