mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-05 22:31:11 +08:00
Show a error message when linecolor is specified as a number
This commit is contained in:
parent
7c00f95962
commit
95a35399a2
@ -6,6 +6,27 @@
|
||||
require_relative 'processing'
|
||||
require 'unicode_plot'
|
||||
|
||||
# If the line color is specified as a number, the program will display an error
|
||||
# message to the user and exit. Remove this patch when UnicodePlot is improved.
|
||||
|
||||
module UnicodePlot
|
||||
class << self
|
||||
alias lineplot_original lineplot
|
||||
def lineplot(*args, **kw)
|
||||
if kw[:color].is_a? Numeric
|
||||
warn <<~EOS
|
||||
YouPlot: Line colors cannot be specified by numerical values.
|
||||
|
||||
For more information, please see the following issue.
|
||||
https://github.com/red-data-tools/unicode_plot.rb/issues/34
|
||||
EOS
|
||||
YouPlot.run_as_executable ? exit(1) : raise(Error)
|
||||
end
|
||||
lineplot_original(*args, **kw)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module YouPlot
|
||||
# plotting functions.
|
||||
module Backends
|
||||
@ -182,7 +203,7 @@ module YouPlot
|
||||
series = data.series
|
||||
if series.size == 1
|
||||
warn <<~EOS
|
||||
youplot: There is only one series of input data. Please check the delimiter.
|
||||
YouPlot: There is only one series of input data. Please check the delimiter.
|
||||
|
||||
Headers: \e[35m#{data.headers.inspect}\e[0m
|
||||
The first item is: \e[35m\"#{series[0][0]}\"\e[0m
|
||||
|
Loading…
Reference in New Issue
Block a user