Sha256: 2e82cbd9618e41bb2d30a8333bfe93957c4de76c5d63e5812997e5b4172a7705
Contents?: true
Size: 718 Bytes
Versions: 12
Compression:
Stored size: 718 Bytes
Contents
# frozen_string_literal: true module Gruff class Store # @private class CustomData < Struct.new(:label, :points, :color, :custom) def initialize(label, points, color, custom = nil) super(label.to_s, Array(points), color, custom) end def empty? points.empty? end def columns points.length end def min points.compact.min end def max points.compact.max end def normalize(minimum:, spread:) norm_points = points.map do |point| point.nil? ? nil : (point.to_f - minimum.to_f) / spread end self.class.new(label, norm_points, color, custom) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems