Excel.ChartSeries class
Representa uma série de um gráfico.
- Extends
Comentários
Conjunto de APIs: ExcelApi 1.1
Usada por
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-leader-lines.yaml
// The following code adds data labels to the chart and positions them to demonstrate leader lines.
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem(sheetName);
const chart = sheet.charts.getItemAt(0);
const series = chart.series.getItemAt(0);
// Enable data labels for the series. Leader lines are enabled by default.
series.hasDataLabels = true;
series.points.load("items");
await context.sync();
// Load the top position for each data label.
series.points.items.forEach((point) => point.dataLabel.load("top"));
await context.sync();
// Move some data labels to create distance from their chart points.
const point1 = series.points.items[1];
const point2 = series.points.items[2];
point1.dataLabel.top -= 50;
point2.dataLabel.top += 50;
// Format the data labels.
series.dataLabels.geometricShapeType = Excel.GeometricShapeType.rectangle;
series.dataLabels.showCategoryName = true;
series.dataLabels.format.border.weight = 1;
await context.sync();
});
Propriedades
| chart |
Representa o tipo de gráfico de uma série. Consulte |
| context | O contexto de solicitação associado ao objeto. Isso conecta o processo do suplemento ao processo do aplicativo host do Office. |
| doughnut |
Representa o tamanho do furo de rosca de uma série de gráficos. Válido apenas em gráficos de rosca e rosca explodida. Gera um |
| filtered | Especifica se a série é filtrada. Não aplicável para gráficos de superfície. |
| format | Representa a formatação de uma série do gráfico, que inclui a formatação de linha e de preenchimento. |
| gap |
Representa a largura do espaçamento de uma série de gráfico. Válido apenas em gráficos de barras e colunas, bem como classes específicas de gráficos de linhas e de pizza. Lança uma exceção de argumento inválido em gráficos inválidos. |
| has |
Especifica se a série tem rótulos de dados. |
| marker |
Especifica a cor de plano de fundo do marcador de uma série de gráficos. |
| marker |
Especifica a cor do primeiro plano do marcador de uma série de gráficos. |
| marker |
Especifica o tamanho do marcador de uma série de gráficos. O intervalo de tamanho com suporte é de 2 a 72. Esse método retornará um erro InvalidArgument se ele estiver definido com um tamanho fora do intervalo com suporte. |
| marker |
Especifica o estilo do marcador de uma série de gráficos. Consulte |
| name | Especifica o nome de uma série em um gráfico. O comprimento do nome não deve ser maior que 255 caracteres. |
| plot |
Especifica a ordem de plotagem de uma série de gráficos dentro do grupo de gráficos. |
| points | Retorna uma coleção de todos os pontos da série. |
| show |
Especifica se a série tem uma sombra. |
| smooth | Especifica se a série é suave. Aplicável apenas a gráficos de linhas e gráficos de dispersão. |
| trendlines | A coleção de linhas de tendência da série. |
Métodos
| delete() | Exclui a série de gráfico. |
| load(options) | Coloca um comando na fila para carregar as propriedades especificadas do objeto. Você deve chamar |
| load(property |
Coloca um comando na fila para carregar as propriedades especificadas do objeto. Você deve chamar |
| load(property |
Coloca um comando na fila para carregar as propriedades especificadas do objeto. Você deve chamar |
| set(properties, options) | Define várias propriedades de um objeto ao mesmo tempo. Você pode passar um objeto simples com as propriedades apropriadas ou outro objeto de API do mesmo tipo. |
| set(properties) | Define várias propriedades no objeto ao mesmo tempo, com base em um objeto carregado existente. |
| set |
Define os tamanhos das bolhas para uma série de gráficos. Funciona apenas para gráficos de bolhas. |
| set |
Define os valores de uma série de gráficos. Para gráficos de dispersão, refere-se aos valores do eixo y. |
| set |
Define os valores do eixo x para uma série de gráficos. |
| toJSON() | Substitui o método JavaScript |
Detalhes da propriedade
chartType
Representa o tipo de gráfico de uma série. Consulte Excel.ChartType para obter detalhes.
chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel";
Valor da propriedade
Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"
Comentários
context
O contexto de solicitação associado ao objeto. Isso conecta o processo do suplemento ao processo do aplicativo host do Office.
context: RequestContext;
Valor da propriedade
doughnutHoleSize
Representa o tamanho do furo de rosca de uma série de gráficos. Válido apenas em gráficos de rosca e rosca explodida. Gera um InvalidArgument erro em gráficos inválidos.
doughnutHoleSize: number;
Valor da propriedade
number
Comentários
filtered
Especifica se a série é filtrada. Não aplicável para gráficos de superfície.
filtered: boolean;
Valor da propriedade
boolean
Comentários
format
Representa a formatação de uma série do gráfico, que inclui a formatação de linha e de preenchimento.
readonly format: Excel.ChartSeriesFormat;
Valor da propriedade
Comentários
Conjunto de APIs: ExcelApi 1.1
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-formatting.yaml
await Excel.run(async (context) => {
const worksheet = context.workbook.worksheets.getActiveWorksheet();
const chart = worksheet.charts.getItem("SlopeChart");
chart.series.load("count");
await context.sync();
// Color everything gray before highlighting spokes.
for (let i = 0; i < chart.series.count; i++) {
chart.series.getItemAt(i).format.line.color = "#636363";
chart.series.getItemAt(i).dataLabels.format.font.color = "#636363";
}
const highlight: Excel.ChartSeries = chart.series.getItemAt(5);
highlight.format.line.color = "#4472C4";
highlight.dataLabels.format.font.color = "#D9D9D9";
highlight.load("name");
await context.sync();
highlight.name += " (Focus)";
await context.sync();
});
gapWidth
Representa a largura do espaçamento de uma série de gráfico. Válido apenas em gráficos de barras e colunas, bem como classes específicas de gráficos de linhas e de pizza. Lança uma exceção de argumento inválido em gráficos inválidos.
gapWidth: number;
Valor da propriedade
number
Comentários
hasDataLabels
Especifica se a série tem rótulos de dados.
hasDataLabels: boolean;
Valor da propriedade
boolean
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-leader-lines.yaml
// The following code adds data labels to the chart and positions them to demonstrate leader lines.
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem(sheetName);
const chart = sheet.charts.getItemAt(0);
const series = chart.series.getItemAt(0);
// Enable data labels for the series. Leader lines are enabled by default.
series.hasDataLabels = true;
series.points.load("items");
await context.sync();
// Load the top position for each data label.
series.points.items.forEach((point) => point.dataLabel.load("top"));
await context.sync();
// Move some data labels to create distance from their chart points.
const point1 = series.points.items[1];
const point2 = series.points.items[2];
point1.dataLabel.top -= 50;
point2.dataLabel.top += 50;
// Format the data labels.
series.dataLabels.geometricShapeType = Excel.GeometricShapeType.rectangle;
series.dataLabels.showCategoryName = true;
series.dataLabels.format.border.weight = 1;
await context.sync();
});
markerBackgroundColor
Especifica a cor de plano de fundo do marcador de uma série de gráficos.
markerBackgroundColor: string;
Valor da propriedade
string
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-series-markers.yaml
await Excel.run(async (context) => {
let sheet = context.workbook.worksheets.getItem("Sample");
let salesTable = sheet.tables.getItem("SalesTable");
let dataRange = sheet.getRange("A1:E7");
// Create an XY scatter chart.
let chart = sheet.charts.add("XYScatterSmooth", dataRange, "Auto");
chart.title.text = "Bicycle Parts Quarterly Sales";
let series = chart.series;
let series0 = series.getItemAt(0);
let series1 = series.getItemAt(1);
let series2 = series.getItemAt(2);
let series3 = series.getItemAt(3);
// Set markers.
series0.markerStyle = "Dash";
series0.markerForegroundColor = "black";
series1.markerStyle = "Star";
series1.markerForegroundColor = "black";
series2.markerStyle = "X";
series2.markerSize = 12;
series3.markerStyle = "Triangle";
series3.markerBackgroundColor = "purple";
await context.sync();
});
markerForegroundColor
Especifica a cor do primeiro plano do marcador de uma série de gráficos.
markerForegroundColor: string;
Valor da propriedade
string
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-series-markers.yaml
await Excel.run(async (context) => {
let sheet = context.workbook.worksheets.getItem("Sample");
let salesTable = sheet.tables.getItem("SalesTable");
let dataRange = sheet.getRange("A1:E7");
// Create an XY scatter chart.
let chart = sheet.charts.add("XYScatterSmooth", dataRange, "Auto");
chart.title.text = "Bicycle Parts Quarterly Sales";
let series = chart.series;
let series0 = series.getItemAt(0);
let series1 = series.getItemAt(1);
let series2 = series.getItemAt(2);
let series3 = series.getItemAt(3);
// Set markers.
series0.markerStyle = "Dash";
series0.markerForegroundColor = "black";
series1.markerStyle = "Star";
series1.markerForegroundColor = "black";
series2.markerStyle = "X";
series2.markerSize = 12;
series3.markerStyle = "Triangle";
series3.markerBackgroundColor = "purple";
await context.sync();
});
markerSize
Especifica o tamanho do marcador de uma série de gráficos. O intervalo de tamanho com suporte é de 2 a 72. Esse método retornará um erro InvalidArgument se ele estiver definido com um tamanho fora do intervalo com suporte.
markerSize: number;
Valor da propriedade
number
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-series-markers.yaml
await Excel.run(async (context) => {
let sheet = context.workbook.worksheets.getItem("Sample");
let salesTable = sheet.tables.getItem("SalesTable");
let dataRange = sheet.getRange("A1:E7");
// Create an XY scatter chart.
let chart = sheet.charts.add("XYScatterSmooth", dataRange, "Auto");
chart.title.text = "Bicycle Parts Quarterly Sales";
let series = chart.series;
let series0 = series.getItemAt(0);
let series1 = series.getItemAt(1);
let series2 = series.getItemAt(2);
let series3 = series.getItemAt(3);
// Set markers.
series0.markerStyle = "Dash";
series0.markerForegroundColor = "black";
series1.markerStyle = "Star";
series1.markerForegroundColor = "black";
series2.markerStyle = "X";
series2.markerSize = 12;
series3.markerStyle = "Triangle";
series3.markerBackgroundColor = "purple";
await context.sync();
});
markerStyle
Especifica o estilo do marcador de uma série de gráficos. Consulte Excel.ChartMarkerStyle para obter detalhes.
markerStyle: Excel.ChartMarkerStyle | "Invalid" | "Automatic" | "None" | "Square" | "Diamond" | "Triangle" | "X" | "Star" | "Dot" | "Dash" | "Circle" | "Plus" | "Picture";
Valor da propriedade
Excel.ChartMarkerStyle | "Invalid" | "Automatic" | "None" | "Square" | "Diamond" | "Triangle" | "X" | "Star" | "Dot" | "Dash" | "Circle" | "Plus" | "Picture"
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-series-markers.yaml
await Excel.run(async (context) => {
let sheet = context.workbook.worksheets.getItem("Sample");
let salesTable = sheet.tables.getItem("SalesTable");
let dataRange = sheet.getRange("A1:E7");
// Create an XY scatter chart.
let chart = sheet.charts.add("XYScatterSmooth", dataRange, "Auto");
chart.title.text = "Bicycle Parts Quarterly Sales";
let series = chart.series;
let series0 = series.getItemAt(0);
let series1 = series.getItemAt(1);
let series2 = series.getItemAt(2);
let series3 = series.getItemAt(3);
// Set markers.
series0.markerStyle = "Dash";
series0.markerForegroundColor = "black";
series1.markerStyle = "Star";
series1.markerForegroundColor = "black";
series2.markerStyle = "X";
series2.markerSize = 12;
series3.markerStyle = "Triangle";
series3.markerBackgroundColor = "purple";
await context.sync();
});
name
Especifica o nome de uma série em um gráfico. O comprimento do nome não deve ser maior que 255 caracteres.
name: string;
Valor da propriedade
string
Comentários
plotOrder
Especifica a ordem de plotagem de uma série de gráficos dentro do grupo de gráficos.
plotOrder: number;
Valor da propriedade
number
Comentários
points
Retorna uma coleção de todos os pontos da série.
readonly points: Excel.ChartPointsCollection;
Valor da propriedade
Comentários
Conjunto de APIs: ExcelApi 1.1
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-leader-lines.yaml
// The following code adds data labels to the chart and positions them to demonstrate leader lines.
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem(sheetName);
const chart = sheet.charts.getItemAt(0);
const series = chart.series.getItemAt(0);
// Enable data labels for the series. Leader lines are enabled by default.
series.hasDataLabels = true;
series.points.load("items");
await context.sync();
// Load the top position for each data label.
series.points.items.forEach((point) => point.dataLabel.load("top"));
await context.sync();
// Move some data labels to create distance from their chart points.
const point1 = series.points.items[1];
const point2 = series.points.items[2];
point1.dataLabel.top -= 50;
point2.dataLabel.top += 50;
// Format the data labels.
series.dataLabels.geometricShapeType = Excel.GeometricShapeType.rectangle;
series.dataLabels.showCategoryName = true;
series.dataLabels.format.border.weight = 1;
await context.sync();
});
showShadow
Especifica se a série tem uma sombra.
showShadow: boolean;
Valor da propriedade
boolean
Comentários
smooth
Especifica se a série é suave. Aplicável apenas a gráficos de linhas e gráficos de dispersão.
smooth: boolean;
Valor da propriedade
boolean
Comentários
trendlines
A coleção de linhas de tendência da série.
readonly trendlines: Excel.ChartTrendlineCollection;
Valor da propriedade
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-trendlines.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
let seriesCollection = sheet.charts.getItemAt(0).series;
// Add a trendline.
seriesCollection.getItemAt(0).trendlines.add("Linear");
await context.sync();
});
Detalhes do método
delete()
Exclui a série de gráfico.
delete(): void;
Retornos
void
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-series.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const seriesCollection = sheet.charts.getItemAt(0).series;
seriesCollection.load("count");
await context.sync();
if (seriesCollection.count > 0) {
const series = seriesCollection.getItemAt(0);
// Delete the first series.
series.delete();
}
await context.sync();
});
load(options)
Coloca um comando na fila para carregar as propriedades especificadas do objeto. Você deve chamar context.sync() antes de ler as propriedades.
load(options?: Excel.Interfaces.ChartSeriesLoadOptions): Excel.ChartSeries;
Parâmetros
Fornece opções para quais propriedades do objeto devem ser carregadas.
Retornos
load(propertyNames)
Coloca um comando na fila para carregar as propriedades especificadas do objeto. Você deve chamar context.sync() antes de ler as propriedades.
load(propertyNames?: string | string[]): Excel.ChartSeries;
Parâmetros
- propertyNames
-
string | string[]
Uma cadeia de caracteres delimitada por vírgula ou uma matriz de cadeias de caracteres que especifica as propriedades a serem carregadas.
Retornos
Exemplos
// Rename the 1st series of Chart1 to "New Series Name".
await Excel.run(async (context) => {
const chart = context.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1");
chart.series.getItemAt(0).name = "New Series Name";
await context.sync();
console.log("Series1 Renamed");
});
load(propertyNamesAndPaths)
Coloca um comando na fila para carregar as propriedades especificadas do objeto. Você deve chamar context.sync() antes de ler as propriedades.
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Excel.ChartSeries;
Parâmetros
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select é uma cadeia de caracteres delimitada por vírgula que especifica as propriedades a serem carregadas e propertyNamesAndPaths.expand é uma cadeia de caracteres delimitada por vírgula que especifica as propriedades de navegação a serem carregadas.
Retornos
set(properties, options)
Define várias propriedades de um objeto ao mesmo tempo. Você pode passar um objeto simples com as propriedades apropriadas ou outro objeto de API do mesmo tipo.
set(properties: Interfaces.ChartSeriesUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parâmetros
- properties
- Excel.Interfaces.ChartSeriesUpdateData
Um objeto JavaScript com propriedades estruturadas isomorficamente para as propriedades do objeto no qual o método é chamado.
- options
- OfficeExtension.UpdateOptions
Fornece uma opção para suprimir erros se o objeto de propriedades tentar definir propriedades somente leitura.
Retornos
void
set(properties)
Define várias propriedades no objeto ao mesmo tempo, com base em um objeto carregado existente.
set(properties: Excel.ChartSeries): void;
Parâmetros
- properties
- Excel.ChartSeries
Retornos
void
setBubbleSizes(sourceData)
Define os tamanhos das bolhas para uma série de gráficos. Funciona apenas para gráficos de bolhas.
setBubbleSizes(sourceData: Range): void;
Parâmetros
- sourceData
- Excel.Range
O Range objeto correspondente aos dados de origem.
Retornos
void
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-bubble-chart.yaml
await Excel.run(async (context) => {
/*
The table is expected to look like this:
Product, Inventory, Price, Current Market Share
Calamansi, 2000, $2.45, 10%
...
We want each bubble to represent a single row.
*/
// Get the worksheet and table data.
const sheet = context.workbook.worksheets.getItem("Sample");
const table = sheet.tables.getItem("Sales");
const dataRange = table.getDataBodyRange();
// Get the table data without the row names.
const valueRange = dataRange.getOffsetRange(0, 1).getResizedRange(0, -1);
// Create the chart.
const bubbleChart = sheet.charts.add(Excel.ChartType.bubble, valueRange);
bubbleChart.name = "Product Chart";
// Remove the default series, since we want a unique series for each row.
bubbleChart.series.getItemAt(0).delete();
// Load the data necessary to make a chart series.
dataRange.load(["rowCount", "values"]);
await context.sync();
// For each row, create a chart series (a bubble).
for (let i = 0; i < dataRange.rowCount; i++) {
const newSeries = bubbleChart.series.add(dataRange.values[i][0], i);
newSeries.setXAxisValues(dataRange.getCell(i, 1));
newSeries.setValues(dataRange.getCell(i, 2));
newSeries.setBubbleSizes(dataRange.getCell(i, 3));
// Show the product name and market share percentage.
newSeries.dataLabels.showSeriesName = true;
newSeries.dataLabels.showBubbleSize = true;
newSeries.dataLabels.showValue = false;
}
await context.sync();
});
setValues(sourceData)
Define os valores de uma série de gráficos. Para gráficos de dispersão, refere-se aos valores do eixo y.
setValues(sourceData: Range): void;
Parâmetros
- sourceData
- Excel.Range
O Range objeto correspondente aos dados de origem.
Retornos
void
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-series.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const chart: Excel.Chart = sheet.charts.getItemAt(0);
let rangeSelection = sheet.getRange("C2:C7");
let xRangeSelection = sheet.getRange("A1:A7");
// Add a series.
const newSeries: Excel.ChartSeries = chart.series.add("Qtr2");
newSeries.setValues(rangeSelection);
newSeries.setXAxisValues(xRangeSelection);
await context.sync();
});
setXAxisValues(sourceData)
Define os valores do eixo x para uma série de gráficos.
setXAxisValues(sourceData: Range): void;
Parâmetros
- sourceData
- Excel.Range
O Range objeto correspondente aos dados de origem.
Retornos
void
Comentários
Conjunto de APIs: ExcelApi 1.7
Exemplos
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/create-doughnut-chart.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
let seriesCollection = sheet.charts.getItemAt(0);
let rangeSelection = sheet.getRange("C2:C7");
let xRangeSelection = sheet.getRange("A1:A7");
// Add a series.
const newSeries: Excel.ChartSeries = seriesCollection.series.add("Qtr2");
newSeries.setValues(rangeSelection);
newSeries.setXAxisValues(xRangeSelection);
// Set the size of the doughnut hole.
// The hole size is expressed as a percentage of the chart size.
newSeries.doughnutHoleSize = 80;
await context.sync();
});
toJSON()
Substitui o método JavaScript toJSON() para fornecer uma saída mais útil quando um objeto de API é passado para JSON.stringify(). (JSON.stringify, por sua vez, chama o toJSON método do objeto que é passado para ele.) Enquanto o objeto original Excel.ChartSeries é um objeto de API, o toJSON método retorna um objeto JavaScript simples (digitado como Excel.Interfaces.ChartSeriesData) que contém cópias superficiais de todas as propriedades filho carregadas do objeto original.
toJSON(): Excel.Interfaces.ChartSeriesData;