Class: DataOutput::SingleOutput

Inherits:
DatasetOutput show all
Defined in:
lib/output/data_output/single_output.rb

Overview

Simple data output for the terminal visualization and a dataset

Instance Attribute Summary

Attributes inherited from DatasetOutput

#meta_data

Attributes inherited from BaseOutput

#data_set, #legend, #with_extreme_values

Instance Method Summary collapse

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) ⇒ SingleOutput

method to visualize the dataset at the index

Parameters:

  • data_series (DataSeries)

    the data series which should be visualized

  • meta_data (VisMetaData)

    the corresponding meta data

  • options (Hash)

    hash with the boolean values for extreme values and extended legend output



16
17
18
19
20
21
22
23
24
25
# File 'lib/output/data_output/single_output.rb', line 16

def initialize(data_series, , options)
  @meta_data = 
  set_attributes(data_series.series[options[:index]],
                 options[:extreme_values])
  @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



40
41
42
# File 'lib/output/data_output/single_output.rb', line 40

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

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



46
47
48
49
50
# File 'lib/output/data_output/single_output.rb', line 46

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



32
33
34
35
36
# File 'lib/output/data_output/single_output.rb', line 32

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