Class: XlsxWriter::Workbook::Chart::Axis
- Inherits:
-
Object
- Object
- XlsxWriter::Workbook::Chart::Axis
- Defined in:
- ext/xlsxwriter/chart.c
Instance Method Summary collapse
-
#initialize(chart, type) ⇒ Object
constructor
:nodoc:.
-
#name=(name) ⇒ Object
Sets the chart axis
name. -
#set_fill(options) ⇒ Object
Sets axis fill options.
-
#set_line(options) ⇒ Object
Sets axis line options.
-
#set_name_font(options) ⇒ self
Same as Chart#set_font, but for axis name.
-
#set_name_range(*args) ⇒ Object
Sets the chart axis name range from
cell, with valuename. -
#set_num_font(options) ⇒ self
Same as Chart#set_font, but for axis numbers.
Constructor Details
#initialize(chart, type) ⇒ Object
:nodoc:
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'ext/xlsxwriter/chart.c', line 51 VALUE chart_axis_init(VALUE self, VALUE chart, VALUE type) { struct chart_axis *ptr; struct chart *c_ptr; Data_Get_Struct(chart, struct chart, c_ptr); Data_Get_Struct(self, struct chart_axis, ptr); rb_iv_set(self, "@chart", chart); if (c_ptr && c_ptr->chart) { ID axis = rb_check_id_cstr("x", 1, NULL); if (axis && axis == rb_check_id(&type)) { ptr->axis = c_ptr->chart->x_axis; return self; } axis = rb_check_id_cstr("y", 1, NULL); if (axis && axis == rb_check_id(&type)) { ptr->axis = c_ptr->chart->y_axis; return self; } rb_raise(rb_eArgError, "Unexpected axis type %"PRIsVALUE, rb_inspect(type)); } else { rb_raise(rb_eRuntimeError, "Chart seems to be already closed."); } return self; } |
Instance Method Details
#name=(name) ⇒ Object
Sets the chart axis name.
308 309 310 311 312 313 314 315 |
# File 'ext/xlsxwriter/chart.c', line 308 VALUE chart_axis_set_name_(VALUE self, VALUE val) { struct chart_axis *ptr; Data_Get_Struct(self, struct chart_axis, ptr); chart_axis_set_name(ptr->axis, StringValueCStr(val)); return val; } |
#set_fill(options) ⇒ Object
Sets axis fill options. See libxlsxwriter doc for details.
383 384 385 386 387 388 389 390 391 392 |
# File 'ext/xlsxwriter/chart.c', line 383 VALUE chart_axis_set_fill_(VALUE self, VALUE opts) { struct chart_axis *ptr; lxw_chart_fill fill = val_to_lxw_chart_fill(opts); Data_Get_Struct(self, struct chart_axis, ptr); chart_axis_set_fill(ptr->axis, &fill); return self; } |
#set_line(options) ⇒ Object
Sets axis line options. See libxlsxwriter doc for details.
368 369 370 371 372 373 374 375 376 377 |
# File 'ext/xlsxwriter/chart.c', line 368 VALUE chart_axis_set_line_(VALUE self, VALUE opts) { struct chart_axis *ptr; lxw_chart_line line = val_to_lxw_chart_line(opts); Data_Get_Struct(self, struct chart_axis, ptr); chart_axis_set_line(ptr->axis, &line); return self; } |
#set_name_font(options) ⇒ self
Same as Chart#set_font, but for axis name.
340 341 342 343 344 345 346 347 348 |
# File 'ext/xlsxwriter/chart.c', line 340 VALUE chart_axis_set_name_font_(VALUE self, VALUE value) { struct chart_axis *ptr; lxw_chart_font font = val_to_lxw_chart_font(value); Data_Get_Struct(self, struct chart_axis, ptr); chart_axis_set_name_font(ptr->axis, &font); return self; } |
#set_name_range(name, cell) ⇒ self #set_name_range(name, row, col) ⇒ self
Sets the chart axis name range from cell, with value name.
323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'ext/xlsxwriter/chart.c', line 323 VALUE chart_axis_set_name_range_(int argc, VALUE *argv, VALUE self) { rb_check_arity(argc, 2, 3); const char *str = StringValueCStr(argv[0]); lxw_row_t row; lxw_col_t col; extract_cell(argc - 1, argv + 1, &row, &col); struct chart_axis *ptr; Data_Get_Struct(self, struct chart_axis, ptr); chart_axis_set_name_range(ptr->axis, str, row, col); return self; } |
#set_num_font(options) ⇒ self
Same as Chart#set_font, but for axis numbers.
354 355 356 357 358 359 360 361 362 |
# File 'ext/xlsxwriter/chart.c', line 354 VALUE chart_axis_set_num_font_(VALUE self, VALUE value) { struct chart_axis *ptr; lxw_chart_font font = val_to_lxw_chart_font(value); Data_Get_Struct(self, struct chart_axis, ptr); chart_axis_set_num_font(ptr->axis, &font); return self; } |