33
33
# AXIS_WITH_TICKS_ONLY,
34
34
# AXIS_WITH_MAJOR_TICKS_AND_NUMERIC_LABELS, and
35
35
# AXIS_WITH_TICKS_AND_NUMERIC_LABELS.
36
attr_accessor :decoration
36
typed_attribute :decoration, 'axis-decoration'
38
38
# The position of the axis. Can be one of :left, :right, :top,
39
39
# :bottom, :at_y_origin or :at_x_origin.
40
attr_accessor :location
40
typed_attribute :location, 'location'
42
42
# Offset of the axis with respect to its normal position. It
43
43
# is counted *away* from the graph. It is either a
44
44
# Types::Dimension object or _nil_.
45
typed_attribute :offset, 'dimension'
47
47
# The background lines for the given axis. _nil_ for nothing,
48
48
# or a StrokeStyle object if we want to draw something.
49
attr_accessor :background_lines
50
# @todo Use a sub-style for that when that is implemented.
51
sub_style :background_lines, StrokeStyle
51
53
# The style of the tick labels
52
attr_accessor :tick_label_style
54
sub_style :tick_label_style, FullTextStyle, "tick_label_%s"
54
56
# The label of the axis, if there is one
55
attr_accessor :axis_label
57
sub_style :axis_label, TextLabel
57
59
# Whether the axis should be log scale or not
60
typed_attribute :log, 'boolean'
60
62
# Transform: a Types::Bijection object specifying a coordinate
61
63
# transformation for the axis.
62
attr_accessor :transform
64
typed_attribute :transform, 'bijection'
64
66
# The color of the stroke for the lines of the axis
65
attr_accessor :stroke_color
67
typed_attribute :stroke_color, 'color'
69
typed_attribute :major_tick_length, 'float'
70
typed_attribute :major_tick_width, 'float'
72
typed_attribute :minor_tick_length, 'float'
73
typed_attribute :minor_tick_width, 'float'
68
76
# Creates a new AxisStyle object at the given location with
89
97
spec = get_axis_specification(t)
90
98
# Add tick label style:
91
99
spec.merge!(@tick_label_style.to_hash)
93
spec['stroke_color'] = @stroke_color
101
# Direct copy of attributes
102
for key in %w(stroke_color major_tick_length major_tick_width
103
minor_tick_length minor_tick_width)
104
val = self.send(key.to_sym)
96
110
@axis_label.loc = @location
262
'transform' => CmdArg.new('bijection'),
263
'location' => CmdArg.new('location'),
264
'stroke_color' => CmdArg.new('color')
267
FullAxisStyle = PartialAxisStyle.dup
268
FullAxisStyle['decoration'] = CmdArg.new('axis-decoration')
275
AxisStyleOptions = AxisStyle.options_hash()
276
PartialAxisStyle = AxisStyleOptions.without('decoration')