Class: DataOutput::ScaledDatasetOutput

Inherits:
ScaledOutput show all
Defined in:
lib/output/data_output/scaled_dataset_output.rb

Overview

Child class of DatasetOutput to visualize a data set within the dimensions of the calling terminal.

Instance Attribute Summary

Attributes inherited from ScaledOutput

#scaled_dataset

Attributes inherited from DatasetOutput

#meta_data

Attributes inherited from BaseOutput

#data_set, #legend, #with_extreme_values

Instance Method Summary collapse

Methods inherited from ScaledOutput

#prepare_attributes

Methods inherited from DatasetOutput

#print_meta_information

Methods inherited from BaseOutput

#determine_output_type_and_print_value, #print_data, #print_data_and_get_extrema, #print_domain_information, #print_extreme_information, #print_extreme_values_for, #print_meta_information, #set_attributes

Constructor Details

#initialize(data_series, meta_data, options) ⇒ ScaledDatasetOutput

method to print a given dataset scaled by the terminal size

Parameters:

  • data_series (DataSeries)

    the data series from which the dataset at the provided index should be visualized

  • meta_data (VisMetaData)

    the corresponding meta data

  • options (Hash)

    hash with the relevant parameter values



17
18
19
20
21
22
23
# File 'lib/output/data_output/scaled_dataset_output.rb', line 17

def initialize(data_series, , options)
  prepare_attributes(data_series.series[options[:index]], , options)
  @legend = ColorLegend::ColorData.new(data_series.min_value,
                                       data_series.max_value)
  print_output_head(options[:index], )
  print_data(options[:legend], @meta_data.domain_x, @meta_data.domain_y)
end

Instance Method Details

method to print additional information before the x and y domain informations



38
39
40
# File 'lib/output/data_output/scaled_dataset_output.rb', line 38

def print_meta_head
    puts "\nScaled Dataset: #{@meta_data.name}"
end

method to print additional information after the x and y domain informations



44
45
46
47
48
# File 'lib/output/data_output/scaled_dataset_output.rb', line 44

def print_meta_tail
  if (@meta_data.domain_z != nil)
    print_domain_information(@meta_data.domain_z, 'Z')
  end
end

creates a headline before printing the data set based on the values of the z dimension

Parameters:

  • index (Integer)

    the number of the dataset



30
31
32
33
34
# File 'lib/output/data_output/scaled_dataset_output.rb', line 30

def print_output_head(index, )
  puts "\nPrinting autoscaled dataset for %.2f" %
        (.domain_z.lower + (index * .domain_z.step))
  puts "\n"
end