Excel.ChartSeries class
グラフのデータ系列を表します。
- Extends
注釈
プロパティ
axis |
指定した系列のグループを指定します。 |
chart |
グラフ系列の種類を表します。 詳細は「 |
context | オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。 |
data |
系列内のすべてのデータ ラベルのコレクションを表します。 |
doughnut |
グラフ系列のドーナツの穴の大きさを表します。 ドーナツグラフとドーナツ分解グラフでのみ有効です。 無効な |
explosion | 円グラフまたはドーナツ グラフ スライスの展開値を指定します。 切り出し表示は行われず、スライスの先端が円の中心と一致する場合、0 を返します。 |
filtered | 系列をフィルター処理するかどうかを指定します。 等高線グラフには適用されません。 |
first |
最初の円グラフまたはドーナツ グラフ スライスの角度を度 (垂直から時計回り) で指定します。 円グラフ、3-D 円グラフ、およびドーナツ グラフにのみ適用されます。 0 から 360 の範囲内で値を指定できます。 |
format | 塗りつぶしと線の書式設定を含むグラフ系列の書式設定を表します。 |
gap |
グラフ系列間に設けられる間隔を表します。 横棒グラフと縦棒グラフ、および折れ線グラフと円グラフの特定のクラスでのみ有効です。 無効なグラフで無効な引数例外をスローします。 |
has |
系列にデータ ラベルがあるかどうかを指定します。 |
invert |
True の 場合は、負の数値に対応するアイテムのパターンを反転します。 |
marker |
グラフ系列のマーカーの背景色を指定します。 |
marker |
グラフ系列のマーカーの前景色を指定します。 |
marker |
グラフ系列のマーカー サイズを指定します。 サポートされているサイズの範囲は 2 ~ 72 です。 サポートされている範囲外のサイズで設定されている場合、このメソッドは InvalidArgument エラーを返します。 |
marker |
グラフ系列のマーカー スタイルを指定します。 詳細は「 |
name | グラフ内の系列の名前を指定します。 名前の長さは 255 文字を超えてはなりません。 |
overlap | 横棒と縦棒の配置方法を指定します。 -100 から 100 の範囲内で値を指定できます。 2-D 横棒グラフと 2-D 縦棒グラフにのみ適用されます。 |
plot |
グラフ グループ内のグラフ系列のプロット順序を指定します。 |
points | 系列内のすべてのポイントのコレクションを返します。 |
second |
円グラフまたは円グラフの 2 番目のセクションのサイズを、1 次円グラフのサイズに対する割合として指定します。 5 から 200 の範囲内で値を指定できます。 |
show |
系列に影があるかどうかを指定します。 |
smooth | 系列がスムーズかどうかを指定します。 折れ線グラフと散布図にのみ適用されます。 |
split |
円グラフまたは円グラフの 2 つのセクションを分割する方法を指定します。 |
trendlines | 系列内の近似曲線のコレクション。 |
vary |
True を指定すると、各データ マーカーに異なる色またはパターンが割り当てられます。 グラフに含まれるデータ系列は 1 つだけでなければなりません。 |
メソッド
delete() | グラフ系列を削除します。 |
load(options) | オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
set(properties, options) | オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。 |
set(properties) | 既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。 |
set |
グラフ系列のバブル サイズを設定します。 バブル チャートにのみ適用されます。 |
set |
グラフ系列の値を設定します。 散布図の場合は、y 軸の値を参照します。 |
set |
グラフ系列の x 軸の値を設定します。 |
toJSON() | API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript |
プロパティの詳細
axisGroup
指定した系列のグループを指定します。
axisGroup: Excel.ChartAxisGroup | "Primary" | "Secondary";
プロパティ値
Excel.ChartAxisGroup | "Primary" | "Secondary"
注釈
chartType
グラフ系列の種類を表します。 詳細は「Excel.ChartType
」をご覧ください。
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";
プロパティ値
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"
注釈
context
オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。
context: RequestContext;
プロパティ値
dataLabels
系列内のすべてのデータ ラベルのコレクションを表します。
readonly dataLabels: Excel.ChartDataLabels;
プロパティ値
注釈
doughnutHoleSize
グラフ系列のドーナツの穴の大きさを表します。 ドーナツグラフとドーナツ分解グラフでのみ有効です。 無効な InvalidArgument
グラフでエラーをスローします。
doughnutHoleSize: number;
プロパティ値
number
注釈
explosion
円グラフまたはドーナツ グラフ スライスの展開値を指定します。 切り出し表示は行われず、スライスの先端が円の中心と一致する場合、0 を返します。
explosion: number;
プロパティ値
number
注釈
filtered
系列をフィルター処理するかどうかを指定します。 等高線グラフには適用されません。
filtered: boolean;
プロパティ値
boolean
注釈
firstSliceAngle
最初の円グラフまたはドーナツ グラフ スライスの角度を度 (垂直から時計回り) で指定します。 円グラフ、3-D 円グラフ、およびドーナツ グラフにのみ適用されます。 0 から 360 の範囲内で値を指定できます。
firstSliceAngle: number;
プロパティ値
number
注釈
format
塗りつぶしと線の書式設定を含むグラフ系列の書式設定を表します。
readonly format: Excel.ChartSeriesFormat;
プロパティ値
注釈
gapWidth
グラフ系列間に設けられる間隔を表します。 横棒グラフと縦棒グラフ、および折れ線グラフと円グラフの特定のクラスでのみ有効です。 無効なグラフで無効な引数例外をスローします。
gapWidth: number;
プロパティ値
number
注釈
hasDataLabels
invertIfNegative
True の 場合は、負の数値に対応するアイテムのパターンを反転します。
invertIfNegative: boolean;
プロパティ値
boolean
注釈
markerBackgroundColor
グラフ系列のマーカーの背景色を指定します。
markerBackgroundColor: string;
プロパティ値
string
注釈
例
// 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
グラフ系列のマーカーの前景色を指定します。
markerForegroundColor: string;
プロパティ値
string
注釈
例
// 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
グラフ系列のマーカー サイズを指定します。 サポートされているサイズの範囲は 2 ~ 72 です。 サポートされている範囲外のサイズで設定されている場合、このメソッドは InvalidArgument エラーを返します。
markerSize: number;
プロパティ値
number
注釈
例
// 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
グラフ系列のマーカー スタイルを指定します。 詳細は「Excel.ChartMarkerStyle
」をご覧ください。
markerStyle: Excel.ChartMarkerStyle | "Invalid" | "Automatic" | "None" | "Square" | "Diamond" | "Triangle" | "X" | "Star" | "Dot" | "Dash" | "Circle" | "Plus" | "Picture";
プロパティ値
Excel.ChartMarkerStyle | "Invalid" | "Automatic" | "None" | "Square" | "Diamond" | "Triangle" | "X" | "Star" | "Dot" | "Dash" | "Circle" | "Plus" | "Picture"
注釈
例
// 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
overlap
横棒と縦棒の配置方法を指定します。 -100 から 100 の範囲内で値を指定できます。 2-D 横棒グラフと 2-D 縦棒グラフにのみ適用されます。
overlap: number;
プロパティ値
number
注釈
plotOrder
points
系列内のすべてのポイントのコレクションを返します。
readonly points: Excel.ChartPointsCollection;
プロパティ値
注釈
secondPlotSize
円グラフまたは円グラフの 2 番目のセクションのサイズを、1 次円グラフのサイズに対する割合として指定します。 5 から 200 の範囲内で値を指定できます。
secondPlotSize: number;
プロパティ値
number
注釈
showShadow
smooth
系列がスムーズかどうかを指定します。 折れ線グラフと散布図にのみ適用されます。
smooth: boolean;
プロパティ値
boolean
注釈
splitType
円グラフまたは円グラフの 2 つのセクションを分割する方法を指定します。
splitType: Excel.ChartSplitType | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit";
プロパティ値
Excel.ChartSplitType | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"
注釈
trendlines
系列内の近似曲線のコレクション。
readonly trendlines: Excel.ChartTrendlineCollection;
プロパティ値
注釈
varyByCategories
True を指定すると、各データ マーカーに異なる色またはパターンが割り当てられます。 グラフに含まれるデータ系列は 1 つだけでなければなりません。
varyByCategories: boolean;
プロパティ値
boolean
注釈
メソッドの詳細
delete()
グラフ系列を削除します。
delete(): void;
戻り値
void
注釈
例
// 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)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync()
を呼び出す必要があります。
load(options?: Excel.Interfaces.ChartSeriesLoadOptions): Excel.ChartSeries;
パラメーター
読み込むオブジェクトのプロパティのオプションを提供します。
戻り値
load(propertyNames)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync()
を呼び出す必要があります。
load(propertyNames?: string | string[]): Excel.ChartSeries;
パラメーター
- propertyNames
-
string | string[]
読み込むプロパティを指定するコンマ区切り文字列または文字列の配列。
戻り値
例
// 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)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync()
を呼び出す必要があります。
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Excel.ChartSeries;
パラメーター
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select
は、読み込むプロパティを指定するコンマ区切り文字列で propertyNamesAndPaths.expand
、読み込むナビゲーション プロパティを指定するコンマ区切りの文字列です。
戻り値
set(properties, options)
オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。
set(properties: Interfaces.ChartSeriesUpdateData, options?: OfficeExtension.UpdateOptions): void;
パラメーター
- properties
- Excel.Interfaces.ChartSeriesUpdateData
メソッドが呼び出されるオブジェクトのプロパティに等形的に構造化されたプロパティを持つ JavaScript オブジェクト。
- options
- OfficeExtension.UpdateOptions
properties オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。
戻り値
void
set(properties)
既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。
set(properties: Excel.ChartSeries): void;
パラメーター
- properties
- Excel.ChartSeries
戻り値
void
setBubbleSizes(sourceData)
グラフ系列のバブル サイズを設定します。 バブル チャートにのみ適用されます。
setBubbleSizes(sourceData: Range): void;
パラメーター
- sourceData
- Excel.Range
Range
ソース データに対応する オブジェクト。
戻り値
void
注釈
例
// 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)
グラフ系列の値を設定します。 散布図の場合は、y 軸の値を参照します。
setValues(sourceData: Range): void;
パラメーター
- sourceData
- Excel.Range
Range
ソース データに対応する オブジェクト。
戻り値
void
注釈
例
// 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");
let seriesCollection = sheet.charts.getItemAt(0);
let rangeSelection = sheet.getRange("C2:C7");
let xRangeSelection = sheet.getRange("A1:A7");
// Add a series.
let newSeries = seriesCollection.series.add("Qtr2");
newSeries.setValues(rangeSelection);
newSeries.setXAxisValues(xRangeSelection);
await context.sync();
});
setXAxisValues(sourceData)
グラフ系列の x 軸の値を設定します。
setXAxisValues(sourceData: Range): void;
パラメーター
- sourceData
- Excel.Range
Range
ソース データに対応する オブジェクト。
戻り値
void
注釈
toJSON()
API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript toJSON()
メソッドを JSON.stringify()
オーバーライドします。 (JSON.stringify
さらに、渡される オブジェクトの メソッドを呼び出 toJSON
します)。元の Excel.ChartSeries オブジェクトは API オブジェクトですが、メソッドは、元の toJSON
オブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト (として Excel.Interfaces.ChartSeriesData
型指定) を返します。
toJSON(): Excel.Interfaces.ChartSeriesData;
戻り値
Office Add-ins
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示