Sha256: faf41c4b911366e7526c4d19410d3e4d3039446af7e3381d3b8911a152fa2763
Contents?: true
Size: 777 Bytes
Versions: 2
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true module Gruff class Store class CustomData < Struct.new(:label, :points, :color, :custom) def initialize(label, points, color, custom = nil) self.label = label.to_s self.points = Array(points) self.color = color self.custom = 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(args = {}) norm_points = points.map do |point| point.nil? ? nil : (point.to_f - args[:minimum].to_f) / args[:spread] end self.class.new(label, norm_points, color, custom) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gruff-0.11.0 | lib/gruff/store/custom_data.rb |
gruff-0.11.0-java | lib/gruff/store/custom_data.rb |