Class: Xlsxrb::ChartBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsxrb.rb,
sig/generated/xlsxrb.rbs

Overview

Builder for block-style chart definitions.

Defined Under Namespace

Classes: SeriesBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeChartBuilder

: () -> void



84
85
86
# File 'lib/xlsxrb.rb', line 84

def initialize
  @options = {}
end

Instance Attribute Details

#optionsObject (readonly)

: Hash[Symbol, untyped]

Returns:

  • (Object)


88
89
90
# File 'lib/xlsxrb.rb', line 88

def options
  @options
end

Instance Method Details

#category_axis(*args, **kwargs) ⇒ Object

Configures the category_axis property for this chart. : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



197
198
199
# File 'lib/xlsxrb.rb', line 197

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)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



137
138
139
# File 'lib/xlsxrb.rb', line 137

def chart_space(*args, **kwargs)
  @options[:chart_space] = kwargs.empty? ? args.first : kwargs
end

#data_labels(*args, **kwargs) ⇒ Object

Configures the data_labels property for this chart. : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



157
158
159
# File 'lib/xlsxrb.rb', line 157

def data_labels(*args, **kwargs)
  @options[:data_labels] = kwargs.empty? ? args.first : kwargs
end

#display_blanks_as(*args, **kwargs) ⇒ Object

Configures the display_blanks_as property for this chart. : (*(String) args, **String | Integer | bool | nil kwargs) -> String

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



177
178
179
# File 'lib/xlsxrb.rb', line 177

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)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



117
118
119
# File 'lib/xlsxrb.rb', line 117

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)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



127
128
129
# File 'lib/xlsxrb.rb', line 127

def plot_area(*args, **kwargs)
  @options[:plot_area] = kwargs.empty? ? args.first : kwargs
end

#plot_visible_only(*args, **kwargs) ⇒ Object

Configures the plot_visible_only property for this chart. : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



167
168
169
# File 'lib/xlsxrb.rb', line 167

def plot_visible_only(*args, **kwargs)
  @options[:plot_visible_only] = kwargs.empty? ? args.first : kwargs
end

#series(value = nil) ⇒ void

This method returns an undefined value.

: (?Hash[Symbol, untyped]? value) ?{ (SeriesBuilder) -> void } -> Array[Hash[Symbol, untyped]]

Parameters:

  • value (Hash[Symbol, untyped], nil) (defaults to: nil)


99
100
101
102
103
104
105
106
107
108
109
# File 'lib/xlsxrb.rb', line 99

def series(value = nil)
  @options[:series] ||= []
  if block_given?
    sb = SeriesBuilder.new
    yield sb
    @options[:series] << sb.options
  elsif value
    @options[:series] << value
  end
  @options[:series]
end

#show_legend_key(*args, **kwargs) ⇒ Object

Configures the show_legend_key property for this chart. : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



217
218
219
# File 'lib/xlsxrb.rb', line 217

def show_legend_key(*args, **kwargs)
  @options[:show_legend_key] = kwargs.empty? ? args.first : kwargs
end

#style(*args, **kwargs) ⇒ Object

Configures the style property 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)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



147
148
149
# File 'lib/xlsxrb.rb', line 147

def style(*args, **kwargs)
  @options[:style] = kwargs.empty? ? args.first : kwargs
end

#title(value) ⇒ Object

: (untyped value) -> untyped

Parameters:

  • value (Object)

Returns:

  • (Object)


95
# File 'lib/xlsxrb.rb', line 95

def title(value) = @options[:title] = value

#type(value) ⇒ Object

: (untyped value) -> untyped

Parameters:

  • value (Object)

Returns:

  • (Object)


92
93
94
# File 'lib/xlsxrb.rb', line 92

def type(value) = @options[:type] = value
# @api public
#: (untyped value) -> untyped

#value_axis(*args, **kwargs) ⇒ Object

Configures the value_axis property for this chart. : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



207
208
209
# File 'lib/xlsxrb.rb', line 207

def value_axis(*args, **kwargs)
  @options[:value_axis] = kwargs.empty? ? args.first : kwargs
end

#view3d(*args, **kwargs) ⇒ Object

Configures the view3d property for this chart. : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)

Parameters:

  • args (Array)

    Positional arguments.

  • kwargs (Hash)

    Keyword arguments.

Returns:

  • (Object)

    the configured property



187
188
189
# File 'lib/xlsxrb.rb', line 187

def view3d(*args, **kwargs)
  @options[:view3d] = kwargs.empty? ? args.first : kwargs
end