A demo of an various Excel chart data tools that are available via a libxlsxwriter chart. These include Drop Lines and High-Low Lines.
Chart 1: chart with high-low lines.
Chart 2: chart with drop lines.
Chart 3: chart with up-down bars.
Chart 4: chart with formatted Up-down bars.
Chart 5: chart with markers and data labels.
Chart 6: chart with error bars.
Chart 7: chart with a trendline.
#include "xlsxwriter.h"
int row, col;
uint8_t data[6][3] = {
{2, 10, 30},
{3, 40, 60},
{4, 50, 70},
{5, 20, 50},
{6, 10, 40},
{7, 50, 30}
};
for (row = 0; row < 6; row++)
for (col = 0; col < 3; col++)
}
int main() {
write_worksheet_data(worksheet, bold);
}
void chart_set_up_down_bars(lxw_chart *chart)
Turn on up-down bars for the chart.
void chart_series_set_error_bars(lxw_series_error_bars *error_bars, uint8_t type, double value)
@ LXW_CHART_MARKER_CIRCLE
Definition: chart.h:266
void chart_series_set_trendline(lxw_chart_series *series, uint8_t type, uint8_t value)
Turn on a trendline for a chart data series.
void chart_set_up_down_bars_format(lxw_chart *chart, lxw_chart_line *up_bar_line, lxw_chart_fill *up_bar_fill, lxw_chart_line *down_bar_line, lxw_chart_fill *down_bar_fill)
Turn on up-down bars for the chart, with formatting.
lxw_chart_series * chart_add_series(lxw_chart *chart, const char *categories, const char *values)
Add a data series to a chart.
@ LXW_CHART_ERROR_BAR_TYPE_STD_ERROR
Definition: chart.h:869
@ LXW_CHART_LINE
Definition: chart.h:126
void chart_title_set_name(lxw_chart *chart, const char *name)
Set the title of the chart.
void chart_series_set_trendline_line(lxw_chart_series *series, lxw_chart_line *line)
Set the trendline line properties for a chart data series.
void chart_set_high_low_lines(lxw_chart *chart, lxw_chart_line *line)
Turn on and format high-low Lines for a chart.
@ LXW_CHART_TRENDLINE_TYPE_POLY
Definition: chart.h:942
void chart_series_set_labels(lxw_chart_series *series)
Add data labels to a chart series.
void chart_series_set_marker_type(lxw_chart_series *series, uint8_t type)
Set the data marker type for a series.
void chart_set_drop_lines(lxw_chart *chart, lxw_chart_line *line)
Turn on and format Drop Lines for a chart.
@ LXW_CHART_LINE_DASH_LONG_DASH
Definition: chart.h:219
Struct to represent a chart fill.
Definition: chart.h:664
lxw_color_t color
Definition: chart.h:667
Struct to represent a chart line.
Definition: chart.h:640
lxw_color_t color
Definition: chart.h:643
Struct to represent an Excel chart data series.
Definition: chart.h:961
Struct to represent an Excel chart.
Definition: chart.h:1091
Struct to represent an Excel workbook.
Definition: workbook.h:293
Struct to represent an Excel worksheet.
Definition: worksheet.h:2115
#define CELL(cell)
Convert an Excel A1 cell string into a (row, col) pair.
Definition: utility.h:46
lxw_chart * workbook_add_chart(lxw_workbook *workbook, uint8_t chart_type)
Create a new chart to be added to a worksheet:
lxw_workbook * workbook_new(const char *filename)
Create a new workbook object.
lxw_format * workbook_add_format(lxw_workbook *workbook)
Create a new Format object to formats cells in worksheets.
lxw_error workbook_close(lxw_workbook *workbook)
Close the Workbook object and write the XLSX file.
lxw_worksheet * workbook_add_worksheet(lxw_workbook *workbook, const char *sheetname)
Add a new worksheet to a workbook.
lxw_error worksheet_insert_chart(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, lxw_chart *chart)
Insert a chart object into a worksheet.
lxw_error worksheet_write_string(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *string, lxw_format *format)
Write a string to a worksheet cell.
lxw_error worksheet_write_number(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, double number, lxw_format *format)
Write a number to a worksheet cell.