[−][src]Struct xlsxwriter::ChartSeries
Struct to represent an Excel chart data series. This struct is created using the chart.add_series() function. It is used in functions that modify a chart series but the members of the struct aren't modified directly.
Implementations
impl<'a> ChartSeries<'a>
[src]
pub fn set_categories(
&mut self,
sheet_name: &str,
first_row: WorksheetRow,
first_column: WorksheetCol,
last_row: WorksheetRow,
last_column: WorksheetCol
)
[src]
&mut self,
sheet_name: &str,
first_row: WorksheetRow,
first_column: WorksheetCol,
last_row: WorksheetRow,
last_column: WorksheetCol
)
The categories and values of a chart data series are generally set using the chart_add_series() function and Excel range formulas like "=Sheet1!$A$2:$A$7".
The ChartSeries.set_categories()
function is an alternative method that is easier to generate programmatically. It requires that you set the categories and values parameters in Chart.add_series() to None
and then set them using row and column values in ChartSeries.set_categories() and ChartSeries.set_values():
let mut series = chart.add_series(None, None); series.set_categories("Sheet1", 0, 0, 4, 0); // "=Sheet1!$A$1:$A$5" series.set_values("Sheet1", 0, 1, 4, 1); // "=Sheet1!$B$1:$B$5"
pub fn set_values(
&mut self,
sheet_name: &str,
first_row: WorksheetRow,
first_column: WorksheetCol,
last_row: WorksheetRow,
last_column: WorksheetCol
)
[src]
&mut self,
sheet_name: &str,
first_row: WorksheetRow,
first_column: WorksheetCol,
last_row: WorksheetRow,
last_column: WorksheetCol
)
The categories and values of a chart data series are generally set using the Chart.add_series()
function and Excel range formulas like "=Sheet1!$A$2:$A$7".
The Chart.series_set_values()
function is an alternative method that is easier to generate programmatically. See the documentation for ChartSeries.set_categories()
above.
pub fn set_name(&mut self, name: &str)
[src]
This function is used to set the name for a chart data series. The series name in Excel is displayed in the chart legend and in the formula bar. The name property is optional and if it isn't supplied it will default to Series 1..n
.
use xlsxwriter::*; let mut series = chart.add_series(None, Some("=Sheet1!$A$2:$A$6")); series.set_name("Quarterly budget data");
The name parameter can also be a formula such as =Sheet1!$A$1 to point to a cell in the workbook that contains the name:
use xlsxwriter::*; let mut series = chart.add_series(None, Some("=Sheet1!$A$2:$A$6")); series.set_name("=Sheet1!$A$1:$A$1");
pub fn set_name_range(
&mut self,
sheet_name: &str,
row: WorksheetRow,
column: WorksheetCol
)
[src]
&mut self,
sheet_name: &str,
row: WorksheetRow,
column: WorksheetCol
)
The ChartSeries.set_name_range()
function can be used to set a series name range and is an alternative to using ChartSeries.set_name()
and a string formula:
let mut series = chart.add_series(None, Some("=Sheet1!$B$2:$B$6")); series.set_name_range("Sheet1", 0, 1); // =Sheet1!$B$1
pub fn set_line(&mut self, line: &ChartLine)
[src]
Set the line/border properties of a chart series:
let mut series1 = chart.add_series(None, Some("=Sheet1!$A$2:$A$6")); let mut series2 = chart.add_series(None, Some("=Sheet1!$B$2:$B$6")); let mut series3 = chart.add_series(None, Some("=Sheet1!$C$2:$C$6")); let mut chart_line = ChartLine::new(); chart_line.color = FormatColor::Red; series1.set_line(&chart_line); series2.set_line(&chart_line); series3.set_line(&chart_line);
pub fn set_fill(&mut self, fill: &ChartFill)
[src]
Set the fill properties of a chart series:
let mut chart_fill_1 = ChartFill::new(); chart_fill_1.color = FormatColor::Red; let mut chart_fill_2 = ChartFill::new(); chart_fill_2.color = FormatColor::Yellow; let mut chart_fill_3 = ChartFill::new(); chart_fill_3.color = FormatColor::Green; series1.set_fill(&chart_fill_1); series2.set_fill(&chart_fill_2); series3.set_fill(&chart_fill_3);
pub fn set_invert_if_negative(&mut self)
[src]
Invert the fill color for negative values. Usually only applicable to column and bar charts.
series1.set_invert_if_negative();
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ChartSeries<'a>
impl<'a> !Send for ChartSeries<'a>
impl<'a> !Sync for ChartSeries<'a>
impl<'a> Unpin for ChartSeries<'a>
impl<'a> !UnwindSafe for ChartSeries<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,