Module: CTioga2::Graphics::Styles

Defined in:
lib/ctioga2/graphics/styles/box.rb,
lib/ctioga2/graphics/styles/axes.rb,
lib/ctioga2/graphics/styles/base.rb,
lib/ctioga2/graphics/styles/plot.rb,
lib/ctioga2/graphics/styles/sets.rb,
lib/ctioga2/graphics/styles/curve.rb,
lib/ctioga2/graphics/styles/sheet.rb,
lib/ctioga2/graphics/styles/texts.rb,
lib/ctioga2/graphics/styles/arrows.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: ArrowStyle, AxisStyle, BackgroundStyle, BaseTextStyle, BasicStyle, BoxStyle, CircularArray, ColorMap, CurveFillStyle, CurveStyle, CurveStyleFactory, ErrorBarStyle, FillStyle, FullTextStyle, LaTeXFont, LegendStorageStyle, LocationStyle, MapAxisStyle, MarkerStringStyle, MarkerStyle, PlotStyle, StrokeStyle, StyleSheet, TextLabel, TwoPointGradient

Constant Summary collapse

AxisStyleOptions =
AxisStyle.options_hash()
PartialAxisStyle =
AxisStyleOptions.without('decoration')
AxisGroup =
CmdGroup.new('axes-labels',
"Axes and labels", "Axes and labels", 40)
AxisTypeCommands =
[]
AxisStyleCommand =
Cmd.new("axis-style",nil,"--axis-style", 
            [
             CmdArg.new('axis'),
            ], AxisStyleOptions) 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')
          ],
          StrokeStyle.options_hash().without('color')
          ) 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') ],
          TextLabel.options_hash().without('text')
          ) 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
StyleSheetGroup =
CmdGroup.new('style-sheets',
                                     "Default styles", 
                                     <<EOD, 40)
Commands for defining default styles.

All commands take the name of the style to redefine. Different styles
live in a different name space, so there is no risk naming an @axis@ and
a @text@ style with the same name. All styles for a given type inherit from 
the style name @base@.

ctioga2 does not support changing a style after its use. It may
affect only the following objects or all the ones that were created
from the beginning, depending on the context. For safety, only define
style before issueing any graphics command.

ctioga2 may support at a later time loading style files, but that is
not the case for now.

EOD
StyleSheetCommands =
{}
StyleSheetPredefinedNames =
{}
FullTextStyleOptions =

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

FullTextStyle.options_hash()
FullTextLabelOptions =
TextLabel.options_hash()
ZAxisStyle =
TODO:

This naming doesn’t look that good, honestly

MapAxisStyle.options_hash()
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') ], 
          MarkerStringStyle.options_hash) do |plotmaker, text, opts|
  bg = PlotStyle.current_plot_style(plotmaker).
    background
  bg.watermark = text
  bg.watermark_style.set_from_hash(opts)
end