ExcelScript.ChartSeries interface

Represents a series in a chart.

Remarks

Examples

/**
 * This sample produces a line chart with two series.
 * The chart assumes data in A1:E5 that looks like this:
 * Product Qtr1 Qtr2 Qtr3 Qtr4
 * Frames 5000 7000 6544 4377
 * Saddles 400 323 276 651
 */
function main(workbook: ExcelScript.Workbook) {
  // Establish the ranges to use.
  const sheet = workbook.getActiveWorksheet();
  const headerRange = sheet.getRange("A1:E1");
  const firstSeriesRange = sheet.getRange("A2:E2");
  const secondSeriesRange = sheet.getRange("A3:E3");

  // Create the chart.
  const lineChart = sheet.addChart(ExcelScript.ChartType.line, headerRange);

  // Add the first chart series.
  const firstSeries = lineChart.addChartSeries();
  firstSeries.setXAxisValues(headerRange);
  firstSeries.setValues(firstSeriesRange);

  // Add the second chart series.
  const secondSeries = lineChart.addChartSeries();
  secondSeries.setXAxisValues(headerRange);
  secondSeries.setValues(secondSeriesRange);
}

Methods

addChartTrendline(type)

Adds a new trendline to trendline collection.

delete()

Deletes the chart series.

getAxisGroup()

Specifies the group for the specified series.

getBinOptions()

Encapsulates the bin options for histogram charts and pareto charts.

getBoxwhiskerOptions()

Encapsulates the options for the box and whisker charts.

getBubbleScale()

This can be an integer value from 0 (zero) to 300, representing the percentage of the default size. This property only applies to bubble charts.

getChartTrendline(index)

Gets a trendline object by index, which is the insertion order in the items array.

getChartType()

Represents the chart type of a series. See ExcelScript.ChartType for details.

getDataLabels()

Represents a collection of all data labels in the series.

getDimensionDataSourceString(dimension)

Gets the string representation of the data source of the chart series. The string representation could be information such as a cell address.

getDimensionDataSourceType(dimension)

Gets the data source type of the chart series.

getDimensionValues(dimension)

Gets the values from a single dimension of the chart series. These could be either category values or data values, depending on the dimension specified and how the data is mapped for the chart series.

getDoughnutHoleSize()

Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnut exploded charts. Throws an InvalidArgument error on invalid charts.

getExplosion()

Specifies the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie).

getFiltered()

Specifies if the series is filtered. Not applicable for surface charts.

getFirstSliceAngle()

Specifies the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360.

getFormat()

Represents the formatting of a chart series, which includes fill and line formatting.

getGapWidth()

Represents the gap width of a chart series. Only valid on bar and column charts, as well as specific classes of line and pie charts. Throws an invalid argument exception on invalid charts.

getGradientMaximumColor()

Specifies the color for maximum value of a region map chart series.

getGradientMaximumType()

Specifies the type for maximum value of a region map chart series.

getGradientMaximumValue()

Specifies the maximum value of a region map chart series.

getGradientMidpointColor()

Specifies the color for the midpoint value of a region map chart series.

getGradientMidpointType()

Specifies the type for the midpoint value of a region map chart series.

getGradientMidpointValue()

Specifies the midpoint value of a region map chart series.

getGradientMinimumColor()

Specifies the color for the minimum value of a region map chart series.

getGradientMinimumType()

Specifies the type for the minimum value of a region map chart series.

getGradientMinimumValue()

Specifies the minimum value of a region map chart series.

getGradientStyle()

Specifies the series gradient style of a region map chart.

getHasDataLabels()

Specifies if the series has data labels.

getInvertColor()

Specifies the fill color for negative data points in a series.

getInvertIfNegative()

True if Excel inverts the pattern in the item when it corresponds to a negative number.

getMapOptions()

Encapsulates the options for a region map chart.

getMarkerBackgroundColor()

Specifies the marker background color of a chart series.

getMarkerForegroundColor()

Specifies the marker foreground color of a chart series.

getMarkerSize()

Specifies the marker size of a chart series. The supported size range is 2 to 72. This method returns an InvalidArgument error if it's set with a size outside of the supported range.

getMarkerStyle()

Specifies the marker style of a chart series. See ExcelScript.ChartMarkerStyle for details.

getName()

Specifies the name of a series in a chart. The name's length should not be greater than 255 characters.

getOverlap()

Specifies how bars and columns are positioned. Can be a value between -100 and 100. Applies only to 2-D bar and 2-D column charts.

getParentLabelStrategy()

Specifies the series parent label strategy area for a treemap chart.

getPlotOrder()

Specifies the plot order of a chart series within the chart group.

getPoints()

Returns a collection of all points in the series.

getSecondPlotSize()

Specifies the size of the secondary section of either a pie-of-pie chart or a bar-of-pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200.

getShowConnectorLines()

Specifies whether connector lines are shown in waterfall charts.

getShowLeaderLines()

Specifies whether leader lines are displayed for each data label in the series.

getShowShadow()

Specifies if the series has a shadow.

getSmooth()

Specifies if the series is smooth. Only applicable to line and scatter charts.

getSplitType()

Specifies the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are split.

getSplitValue()

Specifies the threshold value that separates two sections of either a pie-of-pie chart or a bar-of-pie chart.

getTrendlines()

The collection of trendlines in the series.

getVaryByCategories()

True if Excel assigns a different color or pattern to each data marker. The chart must contain only one series.

getXErrorBars()

Represents the error bar object of a chart series.

getYErrorBars()

Represents the error bar object of a chart series.

setAxisGroup(axisGroup)

Specifies the group for the specified series.

setBubbleScale(bubbleScale)

This can be an integer value from 0 (zero) to 300, representing the percentage of the default size. This property only applies to bubble charts.

setBubbleSizes(sourceData)

Sets the bubble sizes for a chart series. Only works for bubble charts.

setChartType(chartType)

Represents the chart type of a series. See ExcelScript.ChartType for details.

setDoughnutHoleSize(doughnutHoleSize)

Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnut exploded charts. Throws an InvalidArgument error on invalid charts.

setExplosion(explosion)

Specifies the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie).

setFiltered(filtered)

Specifies if the series is filtered. Not applicable for surface charts.

setFirstSliceAngle(firstSliceAngle)

Specifies the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360.

setGapWidth(gapWidth)

Represents the gap width of a chart series. Only valid on bar and column charts, as well as specific classes of line and pie charts. Throws an invalid argument exception on invalid charts.

setGradientMaximumColor(gradientMaximumColor)

Specifies the color for maximum value of a region map chart series.

setGradientMaximumType(gradientMaximumType)

Specifies the type for maximum value of a region map chart series.

setGradientMaximumValue(gradientMaximumValue)

Specifies the maximum value of a region map chart series.

setGradientMidpointColor(gradientMidpointColor)

Specifies the color for the midpoint value of a region map chart series.

setGradientMidpointType(gradientMidpointType)

Specifies the type for the midpoint value of a region map chart series.

setGradientMidpointValue(gradientMidpointValue)

Specifies the midpoint value of a region map chart series.

setGradientMinimumColor(gradientMinimumColor)

Specifies the color for the minimum value of a region map chart series.

setGradientMinimumType(gradientMinimumType)

Specifies the type for the minimum value of a region map chart series.

setGradientMinimumValue(gradientMinimumValue)

Specifies the minimum value of a region map chart series.

setGradientStyle(gradientStyle)

Specifies the series gradient style of a region map chart.

setHasDataLabels(hasDataLabels)

Specifies if the series has data labels.

setInvertColor(invertColor)

Specifies the fill color for negative data points in a series.

setInvertIfNegative(invertIfNegative)

True if Excel inverts the pattern in the item when it corresponds to a negative number.

setMarkerBackgroundColor(markerBackgroundColor)

Specifies the marker background color of a chart series.

setMarkerForegroundColor(markerForegroundColor)

Specifies the marker foreground color of a chart series.

setMarkerSize(markerSize)

Specifies the marker size of a chart series. The supported size range is 2 to 72. This method returns an InvalidArgument error if it's set with a size outside of the supported range.

setMarkerStyle(markerStyle)

Specifies the marker style of a chart series. See ExcelScript.ChartMarkerStyle for details.

setName(name)

Specifies the name of a series in a chart. The name's length should not be greater than 255 characters.

setOverlap(overlap)

Specifies how bars and columns are positioned. Can be a value between -100 and 100. Applies only to 2-D bar and 2-D column charts.

setParentLabelStrategy(parentLabelStrategy)

Specifies the series parent label strategy area for a treemap chart.

setPlotOrder(plotOrder)

Specifies the plot order of a chart series within the chart group.

setSecondPlotSize(secondPlotSize)

Specifies the size of the secondary section of either a pie-of-pie chart or a bar-of-pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200.

setShowConnectorLines(showConnectorLines)

Specifies whether connector lines are shown in waterfall charts.

setShowLeaderLines(showLeaderLines)

Specifies whether leader lines are displayed for each data label in the series.

setShowShadow(showShadow)

Specifies if the series has a shadow.

setSmooth(smooth)

Specifies if the series is smooth. Only applicable to line and scatter charts.

setSplitType(splitType)

Specifies the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are split.

setSplitValue(splitValue)

Specifies the threshold value that separates two sections of either a pie-of-pie chart or a bar-of-pie chart.

setValues(sourceData)

Sets the values for a chart series. For scatter charts, it refers to y-axis values.

setVaryByCategories(varyByCategories)

True if Excel assigns a different color or pattern to each data marker. The chart must contain only one series.

setXAxisValues(sourceData)

Sets the values of the x-axis for a chart series.

Method Details

addChartTrendline(type)

Adds a new trendline to trendline collection.

addChartTrendline(type?: ChartTrendlineType): ChartTrendline;

Parameters

type
ExcelScript.ChartTrendlineType

Specifies the trendline type. The default value is "Linear". See ExcelScript.ChartTrendline for details.

Returns

delete()

Deletes the chart series.

delete(): void;

Returns

void

getAxisGroup()

Specifies the group for the specified series.

getAxisGroup(): ChartAxisGroup;

Returns

getBinOptions()

Encapsulates the bin options for histogram charts and pareto charts.

getBinOptions(): ChartBinOptions;

Returns

getBoxwhiskerOptions()

Encapsulates the options for the box and whisker charts.

getBoxwhiskerOptions(): ChartBoxwhiskerOptions;

Returns

getBubbleScale()

This can be an integer value from 0 (zero) to 300, representing the percentage of the default size. This property only applies to bubble charts.

getBubbleScale(): number;

Returns

number

getChartTrendline(index)

Gets a trendline object by index, which is the insertion order in the items array.

getChartTrendline(index: number): ChartTrendline;

Parameters

index

number

Represents the insertion order in the items array.

Returns

getChartType()

Represents the chart type of a series. See ExcelScript.ChartType for details.

getChartType(): ChartType;

Returns

getDataLabels()

Represents a collection of all data labels in the series.

getDataLabels(): ChartDataLabels;

Returns

getDimensionDataSourceString(dimension)

Gets the string representation of the data source of the chart series. The string representation could be information such as a cell address.

getDimensionDataSourceString(dimension: ChartSeriesDimension): string;

Parameters

dimension
ExcelScript.ChartSeriesDimension

The dimension of the axis where the data is from.

Returns

string

getDimensionDataSourceType(dimension)

Gets the data source type of the chart series.

getDimensionDataSourceType(
            dimension: ChartSeriesDimension
        ): ChartDataSourceType;

Parameters

dimension
ExcelScript.ChartSeriesDimension

The dimension of the axis where the data is from.

Returns

getDimensionValues(dimension)

Gets the values from a single dimension of the chart series. These could be either category values or data values, depending on the dimension specified and how the data is mapped for the chart series.

getDimensionValues(dimension: ChartSeriesDimension): string[];

Parameters

dimension
ExcelScript.ChartSeriesDimension

The dimension of the axis where the data is from.

Returns

string[]

getDoughnutHoleSize()

Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnut exploded charts. Throws an InvalidArgument error on invalid charts.

getDoughnutHoleSize(): number;

Returns

number

getExplosion()

Specifies the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie).

getExplosion(): number;

Returns

number

getFiltered()

Specifies if the series is filtered. Not applicable for surface charts.

getFiltered(): boolean;

Returns

boolean

getFirstSliceAngle()

Specifies the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360.

getFirstSliceAngle(): number;

Returns

number

getFormat()

Represents the formatting of a chart series, which includes fill and line formatting.

getFormat(): ChartSeriesFormat;

Returns

getGapWidth()

Represents the gap width of a chart series. Only valid on bar and column charts, as well as specific classes of line and pie charts. Throws an invalid argument exception on invalid charts.

getGapWidth(): number;

Returns

number

getGradientMaximumColor()

Specifies the color for maximum value of a region map chart series.

getGradientMaximumColor(): string;

Returns

string

getGradientMaximumType()

Specifies the type for maximum value of a region map chart series.

getGradientMaximumType(): ChartGradientStyleType;

Returns

getGradientMaximumValue()

Specifies the maximum value of a region map chart series.

getGradientMaximumValue(): number;

Returns

number

getGradientMidpointColor()

Specifies the color for the midpoint value of a region map chart series.

getGradientMidpointColor(): string;

Returns

string

getGradientMidpointType()

Specifies the type for the midpoint value of a region map chart series.

getGradientMidpointType(): ChartGradientStyleType;

Returns

getGradientMidpointValue()

Specifies the midpoint value of a region map chart series.

getGradientMidpointValue(): number;

Returns

number

getGradientMinimumColor()

Specifies the color for the minimum value of a region map chart series.

getGradientMinimumColor(): string;

Returns

string

getGradientMinimumType()

Specifies the type for the minimum value of a region map chart series.

getGradientMinimumType(): ChartGradientStyleType;

Returns

getGradientMinimumValue()

Specifies the minimum value of a region map chart series.

getGradientMinimumValue(): number;

Returns

number

getGradientStyle()

Specifies the series gradient style of a region map chart.

getGradientStyle(): ChartGradientStyle;

Returns

getHasDataLabels()

Specifies if the series has data labels.

getHasDataLabels(): boolean;

Returns

boolean

getInvertColor()

Specifies the fill color for negative data points in a series.

getInvertColor(): string;

Returns

string

getInvertIfNegative()

True if Excel inverts the pattern in the item when it corresponds to a negative number.

getInvertIfNegative(): boolean;

Returns

boolean

getMapOptions()

Encapsulates the options for a region map chart.

getMapOptions(): ChartMapOptions;

Returns

getMarkerBackgroundColor()

Specifies the marker background color of a chart series.

getMarkerBackgroundColor(): string;

Returns

string

getMarkerForegroundColor()

Specifies the marker foreground color of a chart series.

getMarkerForegroundColor(): string;

Returns

string

getMarkerSize()

Specifies the marker size of a chart series. The supported size range is 2 to 72. This method returns an InvalidArgument error if it's set with a size outside of the supported range.

getMarkerSize(): number;

Returns

number

getMarkerStyle()

Specifies the marker style of a chart series. See ExcelScript.ChartMarkerStyle for details.

getMarkerStyle(): ChartMarkerStyle;

Returns

getName()

Specifies the name of a series in a chart. The name's length should not be greater than 255 characters.

getName(): string;

Returns

string

Examples

/**
 * This sample logs the names of each of the chart series in a chart named "ColumnClusteredChart".
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the current worksheet.
  let selectedSheet = workbook.getActiveWorksheet();

  // Get an existing chart named "ColumnClusteredChart".
  let chart = selectedSheet.getChart("ColumnClusteredChart");

  // Log the name of each chart series in the chart.
  let seriesList = chart.getSeries();
  seriesList.forEach((series) => {
    console.log(series.getName());
  });
}

getOverlap()

Specifies how bars and columns are positioned. Can be a value between -100 and 100. Applies only to 2-D bar and 2-D column charts.

getOverlap(): number;

Returns

number

getParentLabelStrategy()

Specifies the series parent label strategy area for a treemap chart.

getParentLabelStrategy(): ChartParentLabelStrategy;

Returns

getPlotOrder()

Specifies the plot order of a chart series within the chart group.

getPlotOrder(): number;

Returns

number

getPoints()

Returns a collection of all points in the series.

getPoints(): ChartPoint[];

Returns

getSecondPlotSize()

Specifies the size of the secondary section of either a pie-of-pie chart or a bar-of-pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200.

getSecondPlotSize(): number;

Returns

number

getShowConnectorLines()

Specifies whether connector lines are shown in waterfall charts.

getShowConnectorLines(): boolean;

Returns

boolean

getShowLeaderLines()

Specifies whether leader lines are displayed for each data label in the series.

getShowLeaderLines(): boolean;

Returns

boolean

getShowShadow()

Specifies if the series has a shadow.

getShowShadow(): boolean;

Returns

boolean

getSmooth()

Specifies if the series is smooth. Only applicable to line and scatter charts.

getSmooth(): boolean;

Returns

boolean

getSplitType()

Specifies the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are split.

getSplitType(): ChartSplitType;

Returns

getSplitValue()

Specifies the threshold value that separates two sections of either a pie-of-pie chart or a bar-of-pie chart.

getSplitValue(): number;

Returns

number

getTrendlines()

The collection of trendlines in the series.

getTrendlines(): ChartTrendline[];

Returns

getVaryByCategories()

True if Excel assigns a different color or pattern to each data marker. The chart must contain only one series.

getVaryByCategories(): boolean;

Returns

boolean

getXErrorBars()

Represents the error bar object of a chart series.

getXErrorBars(): ChartErrorBars;

Returns

getYErrorBars()

Represents the error bar object of a chart series.

getYErrorBars(): ChartErrorBars;

Returns

Examples

/**
 * This script adds error bars for the standard error of each chart series point.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the range for the chart.
  const worksheet = workbook.getWorksheet("Sample");
  const dataRange = worksheet.getRange("A1:B15");

  // Create a line chart.
  const chart = worksheet.addChart(ExcelScript.ChartType.line, dataRange);

  // For each series, add error bars for the standard error on each point
  const allSeries = chart.getSeries();
  allSeries.forEach((series) => {
    series.getYErrorBars().setType(ExcelScript.ChartErrorBarsType.stError);
    series.getYErrorBars().setVisible(true);
  });
}

setAxisGroup(axisGroup)

Specifies the group for the specified series.

setAxisGroup(axisGroup: ChartAxisGroup): void;

Parameters

Returns

void

setBubbleScale(bubbleScale)

This can be an integer value from 0 (zero) to 300, representing the percentage of the default size. This property only applies to bubble charts.

setBubbleScale(bubbleScale: number): void;

Parameters

bubbleScale

number

Returns

void

setBubbleSizes(sourceData)

Sets the bubble sizes for a chart series. Only works for bubble charts.

setBubbleSizes(sourceData: Range): void;

Parameters

sourceData
ExcelScript.Range

The Range object corresponding to the source data.

Returns

void

setChartType(chartType)

Represents the chart type of a series. See ExcelScript.ChartType for details.

setChartType(chartType: ChartType): void;

Parameters

Returns

void

setDoughnutHoleSize(doughnutHoleSize)

Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnut exploded charts. Throws an InvalidArgument error on invalid charts.

setDoughnutHoleSize(doughnutHoleSize: number): void;

Parameters

doughnutHoleSize

number

Returns

void

setExplosion(explosion)

Specifies the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie).

setExplosion(explosion: number): void;

Parameters

explosion

number

Returns

void

setFiltered(filtered)

Specifies if the series is filtered. Not applicable for surface charts.

setFiltered(filtered: boolean): void;

Parameters

filtered

boolean

Returns

void

setFirstSliceAngle(firstSliceAngle)

Specifies the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360.

setFirstSliceAngle(firstSliceAngle: number): void;

Parameters

firstSliceAngle

number

Returns

void

setGapWidth(gapWidth)

Represents the gap width of a chart series. Only valid on bar and column charts, as well as specific classes of line and pie charts. Throws an invalid argument exception on invalid charts.

setGapWidth(gapWidth: number): void;

Parameters

gapWidth

number

Returns

void

setGradientMaximumColor(gradientMaximumColor)

Specifies the color for maximum value of a region map chart series.

setGradientMaximumColor(gradientMaximumColor: string): void;

Parameters

gradientMaximumColor

string

Returns

void

setGradientMaximumType(gradientMaximumType)

Specifies the type for maximum value of a region map chart series.

setGradientMaximumType(
            gradientMaximumType: ChartGradientStyleType
        ): void;

Parameters

Returns

void

setGradientMaximumValue(gradientMaximumValue)

Specifies the maximum value of a region map chart series.

setGradientMaximumValue(gradientMaximumValue: number): void;

Parameters

gradientMaximumValue

number

Returns

void

setGradientMidpointColor(gradientMidpointColor)

Specifies the color for the midpoint value of a region map chart series.

setGradientMidpointColor(gradientMidpointColor: string): void;

Parameters

gradientMidpointColor

string

Returns

void

setGradientMidpointType(gradientMidpointType)

Specifies the type for the midpoint value of a region map chart series.

setGradientMidpointType(
            gradientMidpointType: ChartGradientStyleType
        ): void;

Parameters

gradientMidpointType
ExcelScript.ChartGradientStyleType

Returns

void

setGradientMidpointValue(gradientMidpointValue)

Specifies the midpoint value of a region map chart series.

setGradientMidpointValue(gradientMidpointValue: number): void;

Parameters

gradientMidpointValue

number

Returns

void

setGradientMinimumColor(gradientMinimumColor)

Specifies the color for the minimum value of a region map chart series.

setGradientMinimumColor(gradientMinimumColor: string): void;

Parameters

gradientMinimumColor

string

Returns

void

setGradientMinimumType(gradientMinimumType)

Specifies the type for the minimum value of a region map chart series.

setGradientMinimumType(
            gradientMinimumType: ChartGradientStyleType
        ): void;

Parameters

Returns

void

setGradientMinimumValue(gradientMinimumValue)

Specifies the minimum value of a region map chart series.

setGradientMinimumValue(gradientMinimumValue: number): void;

Parameters

gradientMinimumValue

number

Returns

void

setGradientStyle(gradientStyle)

Specifies the series gradient style of a region map chart.

setGradientStyle(gradientStyle: ChartGradientStyle): void;

Parameters

Returns

void

setHasDataLabels(hasDataLabels)

Specifies if the series has data labels.

setHasDataLabels(hasDataLabels: boolean): void;

Parameters

hasDataLabels

boolean

Returns

void

setInvertColor(invertColor)

Specifies the fill color for negative data points in a series.

setInvertColor(invertColor: string): void;

Parameters

invertColor

string

Returns

void

setInvertIfNegative(invertIfNegative)

True if Excel inverts the pattern in the item when it corresponds to a negative number.

setInvertIfNegative(invertIfNegative: boolean): void;

Parameters

invertIfNegative

boolean

Returns

void

setMarkerBackgroundColor(markerBackgroundColor)

Specifies the marker background color of a chart series.

setMarkerBackgroundColor(markerBackgroundColor: string): void;

Parameters

markerBackgroundColor

string

Returns

void

setMarkerForegroundColor(markerForegroundColor)

Specifies the marker foreground color of a chart series.

setMarkerForegroundColor(markerForegroundColor: string): void;

Parameters

markerForegroundColor

string

Returns

void

setMarkerSize(markerSize)

Specifies the marker size of a chart series. The supported size range is 2 to 72. This method returns an InvalidArgument error if it's set with a size outside of the supported range.

setMarkerSize(markerSize: number): void;

Parameters

markerSize

number

Returns

void

setMarkerStyle(markerStyle)

Specifies the marker style of a chart series. See ExcelScript.ChartMarkerStyle for details.

setMarkerStyle(markerStyle: ChartMarkerStyle): void;

Parameters

Returns

void

setName(name)

Specifies the name of a series in a chart. The name's length should not be greater than 255 characters.

setName(name: string): void;

Parameters

name

string

Returns

void

setOverlap(overlap)

Specifies how bars and columns are positioned. Can be a value between -100 and 100. Applies only to 2-D bar and 2-D column charts.

setOverlap(overlap: number): void;

Parameters

overlap

number

Returns

void

Examples

/**
 * This sample sets the overlap of the columns in a chart named "ColumnClusteredChart".
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the current worksheet.
  let selectedSheet = workbook.getActiveWorksheet();

  // Get an existing chart named "ColumnClusteredChart".
  let chart = selectedSheet.getChart("ColumnClusteredChart");

  // Set the overlap of every column of each series within a category.
  let seriesList = chart.getSeries();
  seriesList.forEach((series) => {
    // An overlap of 25 means the columns have 25% of their length overlapping with the adjacent columns in the same category.
    series.setOverlap(25);
  });
}

setParentLabelStrategy(parentLabelStrategy)

Specifies the series parent label strategy area for a treemap chart.

setParentLabelStrategy(
            parentLabelStrategy: ChartParentLabelStrategy
        ): void;

Parameters

Returns

void

setPlotOrder(plotOrder)

Specifies the plot order of a chart series within the chart group.

setPlotOrder(plotOrder: number): void;

Parameters

plotOrder

number

Returns

void

setSecondPlotSize(secondPlotSize)

Specifies the size of the secondary section of either a pie-of-pie chart or a bar-of-pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200.

setSecondPlotSize(secondPlotSize: number): void;

Parameters

secondPlotSize

number

Returns

void

setShowConnectorLines(showConnectorLines)

Specifies whether connector lines are shown in waterfall charts.

setShowConnectorLines(showConnectorLines: boolean): void;

Parameters

showConnectorLines

boolean

Returns

void

setShowLeaderLines(showLeaderLines)

Specifies whether leader lines are displayed for each data label in the series.

setShowLeaderLines(showLeaderLines: boolean): void;

Parameters

showLeaderLines

boolean

Returns

void

setShowShadow(showShadow)

Specifies if the series has a shadow.

setShowShadow(showShadow: boolean): void;

Parameters

showShadow

boolean

Returns

void

setSmooth(smooth)

Specifies if the series is smooth. Only applicable to line and scatter charts.

setSmooth(smooth: boolean): void;

Parameters

smooth

boolean

Returns

void

setSplitType(splitType)

Specifies the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are split.

setSplitType(splitType: ChartSplitType): void;

Parameters

Returns

void

setSplitValue(splitValue)

Specifies the threshold value that separates two sections of either a pie-of-pie chart or a bar-of-pie chart.

setSplitValue(splitValue: number): void;

Parameters

splitValue

number

Returns

void

setValues(sourceData)

Sets the values for a chart series. For scatter charts, it refers to y-axis values.

setValues(sourceData: Range): void;

Parameters

sourceData
ExcelScript.Range

The Range object corresponding to the source data.

Returns

void

setVaryByCategories(varyByCategories)

True if Excel assigns a different color or pattern to each data marker. The chart must contain only one series.

setVaryByCategories(varyByCategories: boolean): void;

Parameters

varyByCategories

boolean

Returns

void

setXAxisValues(sourceData)

Sets the values of the x-axis for a chart series.

setXAxisValues(sourceData: Range): void;

Parameters

sourceData
ExcelScript.Range

The Range object corresponding to the source data.

Returns

void