class CTioga2::Graphics::Legends::LegendProvider

This class is in charge of providing a legend for the given dataset. Most of its job is simply to collect –legend arguments from the command-line.

Attributes

auto_legend[RW]

Whether we automatically give a name to curves or not.

current_legend[RW]

The legend to be used for the next curve, if applicable

Public Class Methods

new() click to toggle source
# File lib/ctioga2/graphics/legends/provider.rb, line 34
def initialize
  @current_legend = nil
  @auto_legend = false
end

Public Instance Methods

dataset_legend(dataset) click to toggle source

Returns a legend suitable for the next curve.

# File lib/ctioga2/graphics/legends/provider.rb, line 40
def dataset_legend(dataset)
  if @current_legend
    l = @current_legend
    @current_legend = nil
    return l
  elsif @auto_legend
    return "\\texttt{#{Utils::tex_quote_string(dataset.name)}}"
  else
    return nil
  end
end