mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-09-20 03:38:07 +08:00
Compare commits
10 Commits
kojix2-rea
...
develop
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e76d4f279e | ||
![]() |
3a1a29424d | ||
![]() |
b78da2388a | ||
![]() |
a7bb75e87d | ||
![]() |
ca9f97a7dc | ||
![]() |
f67a5ce913 | ||
![]() |
dbbfd366be | ||
![]() |
42cadee553 | ||
![]() |
e689c69838 | ||
![]() |
c53169e9ee |
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@@ -13,6 +13,5 @@ jobs:
|
|||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: ${{ matrix.ruby }}
|
||||||
- run: gem install bundler
|
bundler-cache: true
|
||||||
- run: bundle install
|
|
||||||
- run: bundle exec rake test
|
- run: bundle exec rake test
|
||||||
|
6
Gemfile
6
Gemfile
@@ -4,3 +4,9 @@ source 'https://rubygems.org'
|
|||||||
|
|
||||||
# Specify your gem's dependencies in youplot.gemspec
|
# Specify your gem's dependencies in youplot.gemspec
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
|
group :test do
|
||||||
|
gem 'rake'
|
||||||
|
gem 'simplecov'
|
||||||
|
gem 'test-unit'
|
||||||
|
end
|
||||||
|
@@ -6,6 +6,12 @@ require_relative 'youplot/parameters'
|
|||||||
require_relative 'youplot/command'
|
require_relative 'youplot/command'
|
||||||
|
|
||||||
module YouPlot
|
module YouPlot
|
||||||
|
# @run_as_executable = true / false
|
||||||
|
# YouPlot behaves slightly differently when run as a command line tool
|
||||||
|
# and when run as a script (e.g. for testing). In the event of an error,
|
||||||
|
# when run as a command line tool, YouPlot will display a short error message
|
||||||
|
# and exit abnormally. When run as a script, it will just raise an error.
|
||||||
|
@run_as_executable = false
|
||||||
class << self
|
class << self
|
||||||
attr_accessor :run_as_executable
|
attr_accessor :run_as_executable
|
||||||
|
|
||||||
@@ -13,5 +19,4 @@ module YouPlot
|
|||||||
@run_as_executable
|
@run_as_executable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@run_as_executable = false
|
|
||||||
end
|
end
|
||||||
|
@@ -127,11 +127,10 @@ module YouPlot
|
|||||||
|
|
||||||
def plot_xyxy(data, method1, params)
|
def plot_xyxy(data, method1, params)
|
||||||
headers = data.headers
|
headers = data.headers
|
||||||
series = data.series
|
series2 = data.series
|
||||||
|
.map { |s| s.map(&:to_f) }
|
||||||
|
.each_slice(2).to_a
|
||||||
method2 = get_method2(method1)
|
method2 = get_method2(method1)
|
||||||
series.map! { |s| s.map(&:to_f) }
|
|
||||||
series2 = series.each_slice(2).to_a
|
|
||||||
series = nil
|
|
||||||
params.name ||= headers[0] if headers
|
params.name ||= headers[0] if headers
|
||||||
params.xlim ||= series2.map(&:first).flatten.minmax # why need?
|
params.xlim ||= series2.map(&:first).flatten.minmax # why need?
|
||||||
params.ylim ||= series2.map(&:last).flatten.minmax # why need?
|
params.ylim ||= series2.map(&:last).flatten.minmax # why need?
|
||||||
|
@@ -95,7 +95,7 @@ module YouPlot
|
|||||||
parser.on('-M', '--monochrome', TrueClass, 'no colouring even if writing to a tty') do |_v|
|
parser.on('-M', '--monochrome', TrueClass, 'no colouring even if writing to a tty') do |_v|
|
||||||
UnicodePlot::IOContext.define_method(:color?) { false } # FIXME
|
UnicodePlot::IOContext.define_method(:color?) { false } # FIXME
|
||||||
end
|
end
|
||||||
parser.on('--encoding STR', String, 'Specify the input encoding') do |v|
|
parser.on('--encoding STR', String, 'specify the input encoding') do |v|
|
||||||
options[:encoding] = v
|
options[:encoding] = v
|
||||||
end
|
end
|
||||||
# Optparse adds the help option, but it doesn't show up in usage.
|
# Optparse adds the help option, but it doesn't show up in usage.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module YouPlot
|
module YouPlot
|
||||||
VERSION = '0.4.2'
|
VERSION = '0.4.3'
|
||||||
end
|
end
|
||||||
|
@@ -19,10 +19,5 @@ Gem::Specification.new do |spec|
|
|||||||
spec.executables = %w[uplot youplot]
|
spec.executables = %w[uplot youplot]
|
||||||
spec.require_paths = ['lib']
|
spec.require_paths = ['lib']
|
||||||
|
|
||||||
spec.add_runtime_dependency 'unicode_plot'
|
spec.add_dependency 'unicode_plot', '>= 0.0.5'
|
||||||
spec.add_development_dependency 'bundler'
|
|
||||||
spec.add_development_dependency 'rake'
|
|
||||||
spec.add_development_dependency 'rubocop'
|
|
||||||
spec.add_development_dependency 'simplecov'
|
|
||||||
spec.add_development_dependency 'test-unit'
|
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user