Class: XlsxWriter::Workbook::Chart::Series

Inherits:
Object
  • Object
show all
Defined in:
ext/xlsxwriter/chart.c

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object

:nodoc:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'ext/xlsxwriter/chart.c', line 103

VALUE
chart_series_init(int argc, VALUE *argv, VALUE self) {
  struct chart_series *ptr;
  struct chart *c_ptr;
  char *cats = NULL, *vals = NULL;
  rb_check_arity(argc, 1, 3);

  Data_Get_Struct(argv[0], struct chart, c_ptr);
  Data_Get_Struct(self, struct chart_series, ptr);

  if (argc > 2) {
    cats = StringValueCStr(argv[1]);
    vals = StringValueCStr(argv[2]);
  } else if (argc > 1) {
    vals = StringValueCStr(argv[1]);
  }
  if (c_ptr && c_ptr->chart) {
    ptr->chart_series = chart_add_series(c_ptr->chart, cats, vals);
  }

  return self;
}

Instance Method Details

#invert_if_negative=(p) ⇒ Object



551
552
553
554
555
556
557
# File 'ext/xlsxwriter/chart.c', line 551

VALUE
chart_series_set_invert_if_negative_(VALUE self, VALUE p) {
  if (RTEST(p)) {
    LXW_NO_RESULT_CALL(chart_series, set_invert_if_negative);
  }
  return p;
}

#name=Object

call-seq: series.name=(name) -> name

Set chart series name.

#set_categories(sheetname, range) ⇒ Object #set_categories(sheetname, cell_from, cell_to) ⇒ Object #set_categories(sheetname, row_from, col_from, row_to, col_to) ⇒ Object

Sets chart series categories (alternative to first argument of Chart#add_series).



475
476
477
478
479
480
481
482
483
484
# File 'ext/xlsxwriter/chart.c', line 475

VALUE
chart_series_set_categories_(int argc, VALUE *argv, VALUE self) {
  rb_check_arity(argc, 2, 5);
  const char *str = StringValueCStr(argv[0]);
  lxw_row_t row_from, row_to;
  lxw_col_t col_from, col_to;
  extract_range(argc - 1, argv + 1, &row_from, &col_from, &row_to, &col_to);
  LXW_NO_RESULT_CALL(chart_series, set_categories, str, row_from, col_from, row_to, col_to);
  return self;
}

#set_fill(options) ⇒ Object

Sets chart series fill options. See libxlsxwriter doc for details.



490
491
492
493
494
495
# File 'ext/xlsxwriter/chart.c', line 490

VALUE
chart_series_set_fill_(VALUE self, VALUE opts) {
  lxw_chart_fill fill = val_to_lxw_chart_fill(opts);
  LXW_NO_RESULT_CALL(chart_series, set_fill, &fill);
  return self;
}

#set_line(options) ⇒ Object

Sets chart series line options. See libxlsxwriter doc for details.



501
502
503
504
505
506
# File 'ext/xlsxwriter/chart.c', line 501

VALUE
chart_series_set_line_(VALUE self, VALUE opts) {
  lxw_chart_line line = val_to_lxw_chart_line(opts);
  LXW_NO_RESULT_CALL(chart_series, set_line, &line);
  return self;
}

#set_name_rangeObject

#set_values(sheetname, range) ⇒ Object #set_values(sheetname, cell_from, cell_to) ⇒ Object #set_values(sheetname, row_from, col_from, row_to, col_to) ⇒ Object

Sets chart series values (alternative to second argument of Chart#add_series).



515
516
517
518
519
520
521
522
523
524
# File 'ext/xlsxwriter/chart.c', line 515

VALUE
chart_series_set_values_(int argc, VALUE *argv, VALUE self) {
  rb_check_arity(argc, 2, 5);
  const char *str = StringValueCStr(argv[0]);
  lxw_row_t row_from, row_to;
  lxw_col_t col_from, col_to;
  extract_range(argc - 1, argv + 1, &row_from, &col_from, &row_to, &col_to);
  LXW_NO_RESULT_CALL(chart_series, set_values, str, row_from, col_from, row_to, col_to);
  return self;
}