mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-06 07:10:10 +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_relative 'processing'
|
||||||
require 'unicode_plot'
|
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
|
module YouPlot
|
||||||
# plotting functions.
|
# plotting functions.
|
||||||
module Backends
|
module Backends
|
||||||
@ -182,7 +203,7 @@ module YouPlot
|
|||||||
series = data.series
|
series = data.series
|
||||||
if series.size == 1
|
if series.size == 1
|
||||||
warn <<~EOS
|
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
|
Headers: \e[35m#{data.headers.inspect}\e[0m
|
||||||
The first item is: \e[35m\"#{series[0][0]}\"\e[0m
|
The first item is: \e[35m\"#{series[0][0]}\"\e[0m
|
||||||
|
Loading…
Reference in New Issue
Block a user