Class: Xlsxrb::ChartBuilder
- Inherits:
-
Object
- Object
- Xlsxrb::ChartBuilder
- Defined in:
- lib/xlsxrb/chart_builder.rb,
sig/generated/xlsxrb/chart_builder.rbs
Overview
Builder for block-style chart definitions.
Defined Under Namespace
Classes: SeriesBuilder
Instance Attribute Summary collapse
-
#options ⇒ Hash{Symbol => Object}
readonly
: Hash[Symbol, untyped].
Instance Method Summary collapse
-
#category_axis(*args, **kwargs) ⇒ Object
Configures the category axis properties for this chart.
-
#chart_space(*args, **kwargs) ⇒ Object
Configures the chart_space property for this chart.
-
#data_labels(*args, **kwargs) ⇒ Object
Configures data labels for this chart.
-
#display_blanks_as(*args, **kwargs) ⇒ String
Configures how blank cells are displayed in the chart.
-
#initialize ⇒ Hash{Symbol => Object}
constructor
: () -> void.
-
#legend(*args, **kwargs) ⇒ Object
Configures the legend property for this chart.
-
#plot_area(*args, **kwargs) ⇒ Object
Configures the plot_area property for this chart.
-
#plot_visible_only(*args, **kwargs) ⇒ Boolean, String
Configures whether to plot visible cells only.
-
#series(value = nil) ⇒ void
Adds a data series to the chart.
-
#show_legend_key(*args, **kwargs) ⇒ Boolean, String
Configures whether to show the legend key in data labels.
-
#style(*args, **kwargs) ⇒ Object
Configures the style index/id for this chart.
-
#title(value) ⇒ String, ...
Sets the chart title.
-
#type(value) ⇒ Symbol, String
Sets the chart type (e.g. :line, :bar, :pie, :area, :radar, :scatter).
-
#value_axis(*args, **kwargs) ⇒ Object
Configures the value axis properties for this chart.
-
#view3d(*args, **kwargs) ⇒ Object
Configures 3D view properties for 3D charts.
Constructor Details
#initialize ⇒ Hash{Symbol => Object}
: () -> void
22 23 24 |
# File 'lib/xlsxrb/chart_builder.rb', line 22 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Hash{Symbol => Object} (readonly)
: Hash[Symbol, untyped]
28 29 30 |
# File 'lib/xlsxrb/chart_builder.rb', line 28 def @options end |
Instance Method Details
#category_axis(*args, **kwargs) ⇒ Object
Configures the category axis properties for this chart.
: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
172 173 174 |
# File 'lib/xlsxrb/chart_builder.rb', line 172 def category_axis(*args, **kwargs) @options[:category_axis] = kwargs.empty? ? args.first : kwargs end |
#chart_space(*args, **kwargs) ⇒ Object
Configures the chart_space property for this chart.
: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
106 107 108 |
# File 'lib/xlsxrb/chart_builder.rb', line 106 def chart_space(*args, **kwargs) @options[:chart_space] = kwargs.empty? ? args.first : kwargs end |
#data_labels(*args, **kwargs) ⇒ Object
Configures data labels for this chart.
: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
128 129 130 |
# File 'lib/xlsxrb/chart_builder.rb', line 128 def data_labels(*args, **kwargs) @options[:data_labels] = kwargs.empty? ? args.first : kwargs end |
#display_blanks_as(*args, **kwargs) ⇒ String
Configures how blank cells are displayed in the chart.
: (*(String) args, **String | Integer | bool | nil kwargs) -> String
150 151 152 |
# File 'lib/xlsxrb/chart_builder.rb', line 150 def display_blanks_as(*args, **kwargs) @options[:display_blanks_as] = kwargs.empty? ? args.first : kwargs end |
#legend(*args, **kwargs) ⇒ Object
Configures the legend property for this chart.
: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
84 85 86 |
# File 'lib/xlsxrb/chart_builder.rb', line 84 def legend(*args, **kwargs) @options[:legend] = kwargs.empty? ? args.first : kwargs end |
#plot_area(*args, **kwargs) ⇒ Object
Configures the plot_area property for this chart.
: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
95 96 97 |
# File 'lib/xlsxrb/chart_builder.rb', line 95 def plot_area(*args, **kwargs) @options[:plot_area] = kwargs.empty? ? args.first : kwargs end |
#plot_visible_only(*args, **kwargs) ⇒ Boolean, String
Configures whether to plot visible cells only.
: (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
139 140 141 |
# File 'lib/xlsxrb/chart_builder.rb', line 139 def plot_visible_only(*args, **kwargs) @options[:plot_visible_only] = kwargs.empty? ? args.first : kwargs end |
#series(value) ⇒ Array<Hash{Symbol => Object}> #series {|series_builder| ... } ⇒ Array<Hash{Symbol => Object}>
This method returns an undefined value.
Adds a data series to the chart.
: (?Hash[Symbol, untyped]? value) ?{ (SeriesBuilder) -> void } -> Array[Hash[Symbol, untyped]]
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/xlsxrb/chart_builder.rb', line 65 def series(value = nil) @options[:series] ||= [] if block_given? sb = SeriesBuilder.new yield sb @options[:series] << sb. elsif value @options[:series] << value end @options[:series] end |
#show_legend_key(*args, **kwargs) ⇒ Boolean, String
Configures whether to show the legend key in data labels.
: (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
194 195 196 |
# File 'lib/xlsxrb/chart_builder.rb', line 194 def show_legend_key(*args, **kwargs) @options[:show_legend_key] = kwargs.empty? ? args.first : kwargs end |
#style(*args, **kwargs) ⇒ Object
Configures the style index/id for this chart.
: (*(Hash[Symbol, String | Integer | bool | nil] | String | Integer) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String | Integer)
117 118 119 |
# File 'lib/xlsxrb/chart_builder.rb', line 117 def style(*args, **kwargs) @options[:style] = kwargs.empty? ? args.first : kwargs end |
#title(value) ⇒ String, ...
Sets the chart title.
: (String | Hash[Symbol, untyped] | nil value) -> (String | Hash[Symbol, untyped] | nil)
46 47 48 |
# File 'lib/xlsxrb/chart_builder.rb', line 46 def title(value) @options[:title] = value end |
#type(value) ⇒ Symbol, String
Sets the chart type (e.g. :line, :bar, :pie, :area, :radar, :scatter).
: (Symbol | String value) -> (Symbol | String)
36 37 38 |
# File 'lib/xlsxrb/chart_builder.rb', line 36 def type(value) @options[:type] = value end |
#value_axis(*args, **kwargs) ⇒ Object
Configures the value axis properties for this chart.
: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
183 184 185 |
# File 'lib/xlsxrb/chart_builder.rb', line 183 def value_axis(*args, **kwargs) @options[:value_axis] = kwargs.empty? ? args.first : kwargs end |
#view3d(*args, **kwargs) ⇒ Object
Configures 3D view properties for 3D charts.
: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
161 162 163 |
# File 'lib/xlsxrb/chart_builder.rb', line 161 def view3d(*args, **kwargs) @options[:view3d] = kwargs.empty? ? args.first : kwargs end |