mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-07 07:31:12 +08:00
Add color command
This commit is contained in:
parent
9e2f169e6c
commit
05c3b14acd
@ -193,6 +193,11 @@ module Uplot
|
|||||||
params.xlim = get_lim(v)
|
params.xlim = get_lim(v)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
parsers[:colors]
|
||||||
|
.on('-n', '--names', TrueClass) do |v|
|
||||||
|
@color_names = v
|
||||||
|
end
|
||||||
|
|
||||||
# Preventing the generation of new sub-commands
|
# Preventing the generation of new sub-commands
|
||||||
parsers.default = nil
|
parsers.default = nil
|
||||||
|
|
||||||
@ -242,6 +247,12 @@ module Uplot
|
|||||||
|
|
||||||
def run
|
def run
|
||||||
parse_options
|
parse_options
|
||||||
|
|
||||||
|
if command == :colors
|
||||||
|
Plot.colors
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
# Sometimes the input file does not end with a newline code.
|
# Sometimes the input file does not end with a newline code.
|
||||||
while input = Kernel.gets(nil)
|
while input = Kernel.gets(nil)
|
||||||
input.freeze
|
input.freeze
|
||||||
|
@ -123,6 +123,18 @@ module Uplot
|
|||||||
UnicodePlot.boxplot(headers, series, **params.to_hc)
|
UnicodePlot.boxplot(headers, series, **params.to_hc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def colors
|
||||||
|
UnicodePlot::StyledPrinter::TEXT_COLORS.each do |k,v|
|
||||||
|
print v
|
||||||
|
print k
|
||||||
|
print "\t"
|
||||||
|
print " ●"
|
||||||
|
print "\033[0m"
|
||||||
|
print "\t"
|
||||||
|
end
|
||||||
|
puts
|
||||||
|
end
|
||||||
|
|
||||||
def check_series_size(data, fmt)
|
def check_series_size(data, fmt)
|
||||||
series = data.series
|
series = data.series
|
||||||
if series.size == 1
|
if series.size == 1
|
||||||
|
Loading…
Reference in New Issue
Block a user