Method: Writexlsx::Chart::Series#initialize
- Defined in:
- lib/write_xlsx/chart/series.rb
#initialize(chart, params = {}) ⇒ Series
Returns a new instance of Series.
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/write_xlsx/chart/series.rb', line 236 def initialize(chart, params = {}) @chart = chart @values = aref_to_formula(params[:values]) @categories = aref_to_formula(params[:categories]) @name, @name_formula = chart.process_names(params[:name], params[:name_formula]) set_data_ids(params) @line = line_properties(params[:border] || params[:line]) @fill = fill_properties(params[:fill]) @pattern = pattern_properties(params[:pattern]) @gradient = gradient_properties(params[:gradient]) # Pattern fill overrides solid fill. @fill = nil if ptrue?(@pattern) # Gradient fill overrides solid and patter fills. if ptrue?(@gradient) @pattern = nil @fill = nil end # Set the marker properties for the series. @marker = Marker.new(params[:marker]) if params[:marker] # Set the trendline properties for the series. @trendline = Trendline.new(params[:trendline]) if params[:trendline] = (params[:x_error_bars], params[:y_error_bars]) if params[:points] @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]) @inverted_color = params[:invert_if_negative_color] i[ smooth invert_if_negative x2_axis y2_axis ].each { |key| instance_variable_set("@#{key}", params[key]) } end |