lib/write_xlsx/chart/series.rb in write_xlsx-1.11.0 vs lib/write_xlsx/chart/series.rb in write_xlsx-1.11.1
- old
+ new
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
+# frozen_string_literal: true
module Writexlsx
class Chart
require 'write_xlsx/gradient'
@@ -180,10 +181,11 @@
include Writexlsx::Gradient
attr_reader :values, :categories, :name, :name_formula, :name_id
attr_reader :cat_data_id, :val_data_id, :fill, :pattern, :gradient
attr_reader :trendline, :smooth, :labels, :invert_if_negative
+ attr_reader :inverted_color
attr_reader :x2_axis, :y2_axis, :error_bars, :points
attr_accessor :line, :marker
def initialize(chart, params = {})
@chart = chart
@@ -215,21 +217,23 @@
@points = params[:points].collect { |p| p ? Point.new(p) : p }
end
@label_positions = chart.label_positions
@label_position_default = chart.label_position_default
- @labels = labels_properties(params[:data_labels])
+ @labels = labels_properties(params[:data_labels])
+ @inverted_color = params[:invert_if_negative_color]
- %i[smooth invert_if_negative x2_axis y2_axis]
- .each { |key| instance_variable_set("@#{key}", params[key]) }
+ %i[
+ smooth invert_if_negative x2_axis y2_axis
+ ].each { |key| instance_variable_set("@#{key}", params[key]) }
end
def ==(other)
methods = %w[
categories values name name_formula name_id
cat_data_id val_data_id
line fill gradient marker trendline
- smooth labels invert_if_neg
+ smooth labels inverted_color
x2_axis y2_axis error_bars points
]
methods.each do |method|
return false unless instance_variable_get("@#{method}") == other.instance_variable_get("@#{method}")
end