Module: CTioga2::Graphics::Styles

Defined in:
lib/ctioga2/graphics/styles/base.rb,
lib/ctioga2/graphics/styles/axes.rb,
lib/ctioga2/graphics/styles/plot.rb,
lib/ctioga2/graphics/styles/sets.rb,
lib/ctioga2/graphics/styles/curve.rb,
lib/ctioga2/graphics/styles/texts.rb,
lib/ctioga2/graphics/styles/legend.rb,
lib/ctioga2/graphics/styles/carrays.rb,
lib/ctioga2/graphics/styles/factory.rb,
lib/ctioga2/graphics/styles/colormap.rb,
lib/ctioga2/graphics/styles/drawable.rb,
lib/ctioga2/graphics/styles/errorbar.rb,
lib/ctioga2/graphics/styles/location.rb,
lib/ctioga2/graphics/styles/map-axes.rb,
lib/ctioga2/graphics/styles/gradients.rb,
lib/ctioga2/graphics/styles/background.rb

Overview

All the styles

Defined Under Namespace

Modules: Sets Classes: AxisStyle, BackgroundStyle, BaseTextStyle, BasicStyle, CircularArray, ColorMap, CurveFillStyle, CurveStyle, CurveStyleFactory, ErrorBarStyle, FillStyle, FullTextStyle, LaTeXFont, LegendStorageStyle, LocationStyle, MapAxisStyle, MarkerStringStyle, MarkerStyle, PlotStyle, StrokeStyle, TextLabel, TwoPointGradient

Constant Summary collapse

PartialAxisStyle =
{
  'transform' => CmdArg.new('bijection'),
  'location' => CmdArg.new('location'),
  'log' => CmdArg.new('boolean'),
  'stroke_color' => CmdArg.new('color')
}
FullAxisStyle =
PartialAxisStyle.dup
AxisGroup =
CmdGroup.new('axes-labels',
"Axes and labels", "Axes and labels", 40)
AxisTypeCommands =
[]
AxisStyleCommand =
Cmd.new("axis-style",nil,"--axis-style", 
            [
             CmdArg.new('axis'),
            ], FullAxisStyle) do |plotmaker, which, opts|
  style = AxisStyle.current_axis_style(plotmaker, which)
  style.set_from_hash(opts)
end
BackgroundLinesCommand =
Cmd.new('background-lines', nil, '--background-lines',
          [
           CmdArg.new('axis'), 
           CmdArg.new('color-or-false')
          ],{
            'style' => CmdArg.new('line-style'),
            'width' => CmdArg.new('float')
          }) do |plotmaker, which, color, options|
  axis = AxisStyle.current_axis_style(plotmaker, which)
  if color
    style = {'color' => color}
    style.merge!(options)
    if axis.background_lines
      axis.background_lines.set_from_hash(style)
    else
      axis.background_lines = StrokeStyle.from_hash(style)
    end
  else
    axis.background_lines = false
  end
end
TitleLabelCommand =
Cmd.new('title', '-t', '--title', [ CmdArg.new('text') ],
          FullTextStyleOptions) do |plotmaker, label, options|
  PlotStyle.current_plot_style(plotmaker).
    set_label_style('title', options, label)
end
NoTitleLabelCommand =
Cmd.new('no-title', nil, '--no-title', []) do |plotmaker|
  PlotStyle.current_plot_style(plotmaker).
    set_label_style('title', {}, false)
end
X2Command =
Cmd.new('x2', nil, '--x2', []) do |plotmaker|
  plotmaker.interpreter.
    run_commands("xaxis(top)\naxis-style(top,decoration=full)")
end
Y2Command =
Cmd.new('y2', nil, '--y2', []) do |plotmaker|
  plotmaker.interpreter.
    run_commands("yaxis(right)\naxis-style(right,decoration=full)")
end
NewZAxisCommand =
Cmd.new('new-zaxis', nil, '--new-zaxis',
          [
           CmdArg.new('text')
          ],ZAxisStyle) do |plotmaker, name, options|
  axis = Styles::MapAxisStyle.new
  PlotStyle.current_plot_style(plotmaker).
    set_axis_style(name, axis)
  axis.set_from_hash(options)
end
LabelStyleCommand =
Cmd.new('label-style', nil, '--label-style',
          [ CmdArg.new('label') ], # Here: change the label too... 
          FullTextLabelOptions) do |plotmaker, which, options|
  PlotStyle.current_plot_style(plotmaker).
    set_label_style(which, options)
end
FullTextStyleOptions =

A hash that can be used as a base for optional arguments to things that take texts.

{
  'angle' => CmdArg.new('float'),
  'shift' => CmdArg.new('float'),
  'scale' => CmdArg.new('float'),
  'justification' => CmdArg.new('justification'),
  'color' => CmdArg.new('color'),
  'align' => CmdArg.new('alignment'),
}
FullTextLabelOptions =

Same thing as FullTextStyleOptions, but also permits to override the #text part of the whole stuff..

FullTextStyleOptions.dup
StringMarkerOptions =
{
  'color' => CmdArg.new('color'),
  'stroke_color' => CmdArg.new('color'),
  'fill_color' => CmdArg.new('color'),
  'scale' => CmdArg.new('float'),
  'horizontal_scale' => CmdArg.new('float'),
  'vertical_scale' => CmdArg.new('float'),
  'angle' => CmdArg.new('float'),
  'justification' => CmdArg.new('justification'),
  'alignment' => CmdArg.new('alignment'),
  'font' => CmdArg.new('pdf-font')
}
ZAxisStyle =
FullAxisStyle.dup
BackgroundGroup =
CmdGroup.new('background',
                     "Background", <<EOD, 40)
Commands dealing with the aspect of the background of a plot (excluding
background lines, which are linked to axes).
EOD
BackgroundColorCmd =
Cmd.new('background', nil, '--background', 
          [ CmdArg.new('color-or-false') ]) do |plotmaker, color|
  PlotStyle.current_plot_style(plotmaker).
    background.background_color = color
end
WatermarkCmd =
Cmd.new('watermark', nil, '--watermark', 
          [ CmdArg.new('text') ], 
          StringMarkerOptions) do |plotmaker, text, opts|
  bg = PlotStyle.current_plot_style(plotmaker).
    background
  bg.watermark_text = text
  bg.watermark_style.set_from_hash(opts)
end