Added chart axis display units.

This commit is contained in:
John McNamara 2017-01-12 00:04:26 +00:00
parent f5ce952b68
commit 415e0f8b1d
29 changed files with 649 additions and 0 deletions

1
.indent.pro vendored
View File

@ -49,6 +49,7 @@
-T lxw_cell
-T lxw_chart
-T lxw_chart_axis
-T lxw_chart_axis_display_unit
-T lxw_chart_axis_label_position
-T lxw_chart_axis_tick_position
-T lxw_chart_fill

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -456,6 +456,42 @@ typedef enum lxw_chart_axis_label_position {
LXW_CHART_AXIS_LABEL_POSITION_NONE
} lxw_chart_axis_label_position;
/**
* @brief Display units for chart value axis.
*/
typedef enum lxw_chart_axis_display_unit {
/** Axis display units: None. The default. */
LXW_CHART_AXIS_UNITS_NONE,
/** Axis display units: Hundreds. */
LXW_CHART_AXIS_UNITS_HUNDREDS,
/** Axis display units: Thousands. */
LXW_CHART_AXIS_UNITS_THOUSANDS,
/** Axis display units: Ten thousands. */
LXW_CHART_AXIS_UNITS_TEN_THOUSANDS,
/** Axis display units: Hundred thousands. */
LXW_CHART_AXIS_UNITS_HUNDRED_THOUSANDS,
/** Axis display units: Millions. */
LXW_CHART_AXIS_UNITS_MILLIONS,
/** Axis display units: Ten millions. */
LXW_CHART_AXIS_UNITS_TEN_MILLIONS,
/** Axis display units: Hundred millions. */
LXW_CHART_AXIS_UNITS_HUNDRED_MILLIONS,
/** Axis display units: Billions. */
LXW_CHART_AXIS_UNITS_BILLIONS,
/** Axis display units: Trillions. */
LXW_CHART_AXIS_UNITS_TRILLIONS
} lxw_chart_axis_display_unit;
enum lxw_chart_position {
LXW_CHART_AXIS_RIGHT,
LXW_CHART_AXIS_LEFT,
@ -705,6 +741,9 @@ typedef struct lxw_chart_axis {
uint16_t log_base;
uint8_t display_units;
uint8_t display_units_visible;
} lxw_chart_axis;
/**
@ -1622,6 +1661,46 @@ void chart_axis_set_major_unit(lxw_chart_axis *axis, double unit);
*/
void chart_axis_set_minor_unit(lxw_chart_axis *axis, double unit);
/**
* @brief Set the display units for a value axis.
*
* @param axis A pointer to a chart #lxw_chart_axis object.
* @param units The display units: #lxw_chart_axis_display_unit.
*
* Set the display units for the axis. This can be useful if the axis numbers
* are very large but you don't want to represent them in scientific notation:
*
* @code
* chart_axis_set_display_units(chart->x_axis, LXW_CHART_AXIS_UNITS_THOUSANDS);
* chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_MILLIONS);
* @endcode
*
* @image html chart_display_units.png
*
* **Axis types**: This function is applicable to value axes only.
* See @ref ww_charts_axes.
*/
void chart_axis_set_display_units(lxw_chart_axis *axis, uint8_t units);
/**
* @brief Turn on/off the display units for a value axis.
* @param axis A pointer to a chart #lxw_chart_axis object.
* @param visible Turn off/on the display units. (0/1)
*
* Turn on or off the display units for the axis. This option is set on
* automatically by `chart_axis_set_display_units()`.
*
* @code
* chart_axis_set_display_units_visible(chart->y_axis, LXW_TRUE);
* @endcode
*
* **Axis types**: This function is applicable to value axes only.
* See @ref ww_charts_axes.
*/
void chart_axis_set_display_units_visible(lxw_chart_axis *axis,
uint8_t visible);
/**
* @brief Turn on/off the major gridlines for an axis.
*

View File

@ -2413,6 +2413,54 @@ _chart_write_minor_unit(lxw_chart *self, lxw_chart_axis *axis)
LXW_FREE_ATTRIBUTES();
}
/*
* Write the <c:dispUnits> element.
*/
STATIC void
_chart_write_disp_units(lxw_chart *self, lxw_chart_axis *axis)
{
struct xml_attribute_list attributes;
struct xml_attribute *attribute;
if (!axis->display_units)
return;
LXW_INIT_ATTRIBUTES();
lxw_xml_start_tag(self->file, "c:dispUnits", NULL);
if (axis->display_units == LXW_CHART_AXIS_UNITS_HUNDREDS)
LXW_PUSH_ATTRIBUTES_STR("val", "hundreds");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_THOUSANDS)
LXW_PUSH_ATTRIBUTES_STR("val", "thousands");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_TEN_THOUSANDS)
LXW_PUSH_ATTRIBUTES_STR("val", "tenThousands");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_HUNDRED_THOUSANDS)
LXW_PUSH_ATTRIBUTES_STR("val", "hundredThousands");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_MILLIONS)
LXW_PUSH_ATTRIBUTES_STR("val", "millions");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_TEN_MILLIONS)
LXW_PUSH_ATTRIBUTES_STR("val", "tenMillions");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_HUNDRED_MILLIONS)
LXW_PUSH_ATTRIBUTES_STR("val", "hundredMillions");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_BILLIONS)
LXW_PUSH_ATTRIBUTES_STR("val", "billions");
else if (axis->display_units == LXW_CHART_AXIS_UNITS_TRILLIONS)
LXW_PUSH_ATTRIBUTES_STR("val", "trillions");
else
LXW_PUSH_ATTRIBUTES_STR("val", "hundreds");
lxw_xml_empty_tag(self->file, "c:builtInUnit", &attributes);
if (axis->display_units_visible) {
lxw_xml_start_tag(self->file, "c:dispUnitsLbl", NULL);
lxw_xml_empty_tag(self->file, "c:layout", NULL);
lxw_xml_end_tag(self->file, "c:dispUnitsLbl");
}
lxw_xml_end_tag(self->file, "c:dispUnits");
}
/*
* Write the <c:lblOffset> element.
*/
@ -2912,6 +2960,9 @@ _chart_write_val_axis(lxw_chart *self)
/* Write the c:minorUnit element. */
_chart_write_minor_unit(self, self->y_axis);
/* Write the c:dispUnits element. */
_chart_write_disp_units(self, self->y_axis);
lxw_xml_end_tag(self->file, "c:valAx");
}
@ -2982,6 +3033,9 @@ _chart_write_cat_val_axis(lxw_chart *self)
/* Write the c:minorUnit element. */
_chart_write_minor_unit(self, self->x_axis);
/* Write the c:dispUnits element. */
_chart_write_disp_units(self, self->x_axis);
lxw_xml_end_tag(self->file, "c:valAx");
}
@ -4140,6 +4194,29 @@ chart_axis_set_minor_unit(lxw_chart_axis *axis, double unit)
axis->minor_unit = unit;
}
/*
* Set the display units for a value axis.
*/
void
chart_axis_set_display_units(lxw_chart_axis *axis, uint8_t units)
{
LXW_WARN_VALUE_AXIS_ONLY("chart_axis_set_display_units");
axis->display_units = units;
axis->display_units_visible = LXW_TRUE;
}
/*
* Turn on/off the display units for a value axis.
*/
void
chart_axis_set_display_units_visible(lxw_chart_axis *axis, uint8_t visible)
{
LXW_WARN_VALUE_AXIS_ONLY("chart_axis_set_display_units");
axis->display_units_visible = visible;
}
/*
* Set the axis major gridlines on/off.
*/

View File

@ -0,0 +1,33 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units01.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 69572096;
chart->axis_id_2 = 93549312;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units02.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_HUNDREDS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units03.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_THOUSANDS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units04.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_TEN_THOUSANDS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units05.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_HUNDRED_THOUSANDS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units06.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 93548544;
chart->axis_id_2 = 93550464;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_MILLIONS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units07.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_TEN_MILLIONS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units08.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_HUNDRED_MILLIONS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units09.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_BILLIONS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units10.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 56159232;
chart->axis_id_2 = 61364096;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_TRILLIONS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units11.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 69559424;
chart->axis_id_2 = 69560960;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_HUNDREDS);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,48 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = new_workbook("test_chart_display_units12.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_SCATTER);
/* For testing, copy the randomly generated axis ids in the target file. */
chart->axis_id_1 = 93550464;
chart->axis_id_2 = 93548544;
worksheet_write_number(worksheet, 0, 0, 10000000, NULL);
worksheet_write_number(worksheet, 1, 0, 20000000, NULL);
worksheet_write_number(worksheet, 2, 0, 30000000, NULL);
worksheet_write_number(worksheet, 3, 0, 20000000, NULL);
worksheet_write_number(worksheet, 4, 0, 10000000, NULL);
worksheet_write_number(worksheet, 0, 1, 10000000, NULL);
worksheet_write_number(worksheet, 1, 1, 20000000, NULL);
worksheet_write_number(worksheet, 2, 1, 30000000, NULL);
worksheet_write_number(worksheet, 3, 1, 20000000, NULL);
worksheet_write_number(worksheet, 4, 1, 10000000, NULL);
chart_add_series(chart,
"=Sheet1!$A$1:$A$5",
"=Sheet1!$B$1:$B$5"
);
chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_HUNDREDS);
chart_axis_set_display_units_visible(chart->y_axis, LXW_FALSE);
chart_axis_set_display_units(chart->x_axis, LXW_CHART_AXIS_UNITS_THOUSANDS);
chart_axis_set_display_units_visible(chart->x_axis, LXW_FALSE);
worksheet_insert_chart(worksheet, CELL("E9"), chart);
return workbook_close(workbook);
}

View File

@ -0,0 +1,51 @@
###############################################################################
#
# Tests for libxlsxwriter.
#
# Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
#
import base_test_class
class TestCompareXLSXFiles(base_test_class.XLSXBaseTest):
"""
Test file created with libxlsxwriter against a file created by Excel.
"""
def test_chart_display_units01(self):
self.run_exe_test('test_chart_display_units01')
def test_chart_display_units02(self):
self.run_exe_test('test_chart_display_units02')
def test_chart_display_units03(self):
self.run_exe_test('test_chart_display_units03')
def test_chart_display_units04(self):
self.run_exe_test('test_chart_display_units04')
def test_chart_display_units05(self):
self.run_exe_test('test_chart_display_units05')
def test_chart_display_units06(self):
self.run_exe_test('test_chart_display_units06')
def test_chart_display_units07(self):
self.run_exe_test('test_chart_display_units07')
def test_chart_display_units08(self):
self.run_exe_test('test_chart_display_units08')
def test_chart_display_units09(self):
self.run_exe_test('test_chart_display_units09')
def test_chart_display_units10(self):
self.run_exe_test('test_chart_display_units10')
def test_chart_display_units11(self):
self.run_exe_test('test_chart_display_units11')
def test_chart_display_units12(self):
self.run_exe_test('test_chart_display_units12')

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.