Excel.ChartSeries class

グラフのデータ系列を表します。

Extends

注釈

API セット: ExcelApi 1.1

使用元

// 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();
});

プロパティ

axisGroup

指定した系列のグループを指定します。

binOptions

ヒストグラム図とパレート図のビンのオプションをカプセル化します。

boxwhiskerOptions

箱ひげ図グラフのオプションをカプセル化します。

bubbleScale

既定のサイズのパーセンテージを表す 0 (ゼロ) から 300 までの整数値とすることができます。 このプロパティは、バブルチャートにのみ使用できます。

chartType

グラフ系列の種類を表します。 詳細は「Excel.ChartType」をご覧ください。

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

dataLabels

系列のすべてのデータ ラベルのコレクションを表します。

doughnutHoleSize

グラフ系列のドーナツの穴の大きさを表します。 ドーナツ チャートとドーナツ爆発チャートでのみ有効です。 無効なグラフで InvalidArgument エラーをスローします。

explosion

円グラフまたはドーナツ グラフ スライスの爆発値を指定します。 切り出し表示は行われず、スライスの先端が円の中心と一致する場合、0 を返します。

filtered

系列をフィルター処理するかどうかを指定します。 等高線グラフには適用されません。

firstSliceAngle

最初の円グラフまたはドーナツ グラフ スライスの角度を度単位で指定します (垂直から時計回り)。 円グラフ、3-D 円グラフ、およびドーナツ グラフにのみ適用されます。 0 から 360 の範囲内で値を指定できます。

format

塗りつぶしと線の書式設定を含む、グラフ シリーズの書式設定を表します。

gapWidth

グラフ系列間に設けられる間隔を表します。 横棒グラフと縦棒グラフ、および折れ線グラフと円グラフの特定のクラスでのみ有効です。 無効なグラフで無効な引数例外をスローします。

gradientMaximumColor

地域マップ グラフ系列の最大値の色を指定します。

gradientMaximumType

地域マップ グラフ系列の最大値の種類を指定します。

gradientMaximumValue

地域マップ グラフ系列の最大値を指定します。

gradientMidpointColor

地域マップ グラフ系列の中間値の色を指定します。

gradientMidpointType

地域マップ グラフ系列の中間値の種類を指定します。

gradientMidpointValue

地域マップ グラフ シリーズの中間値を指定します。

gradientMinimumColor

地域マップ グラフ系列の最小値の色を指定します。

gradientMinimumType

地域マップ グラフ シリーズの最小値の種類を指定します。

gradientMinimumValue

地域マップ グラフ シリーズの最小値を指定します。

gradientStyle

地域マップ グラフの系列グラデーション スタイルを指定します。

hasDataLabels

系列にデータ ラベルがあるかどうかを指定します。

invertColor

系列内の負のデータ要素の塗りつぶしの色を指定します。

invertIfNegative

アイテムが負の数に対応するときに、Excel が反転された場合は true。

mapOptions

リージョン マップ グラフのオプションをカプセル化します。

markerBackgroundColor

グラフ シリーズのマーカーの背景色を指定します。

markerForegroundColor

グラフ シリーズのマーカーの前景色を指定します。

markerSize

グラフ シリーズのマーカー サイズを指定します。 サポートされているサイズ範囲は 2 から 72 です。 このメソッドがサポートされる範囲外のサイズに設定されている場合、InvalidArgument エラーを返します。

markerStyle

グラフ シリーズのマーカー スタイルを指定します。 詳細は「Excel.ChartMarkerStyle」をご覧ください。

name

グラフ内の系列の名前を指定します。 名前の長さは 255 文字を超えてはなりません。

overlap

横棒と縦棒の配置方法を指定します。 -100 から 100 の範囲内で値を指定できます。 2-D 横棒グラフと 2-D 縦棒グラフにのみ適用されます。

parentLabelStrategy

ツリーマップ図の系列親ラベル戦略領域を指定します。

plotOrder

グラフ グループ内のグラフ系列のプロット順序を指定します。

points

系列内のすべてのポイントのコレクションを返します。

secondPlotSize

円グラフまたは縦棒グラフのいずれかの第 2 セクションのサイズを、第 1 の円のサイズに対する割合で指定します。 5 から 200 の範囲内で値を指定できます。

showConnectorLines

ウォーターフォール図にコネクタ線を表示するかどうかを指定します。

showLeaderLines

系列内の各データ ラベルに引出線を表示するかどうかを指定します。

showShadow

系列に影があるかどうかを指定します。

smooth

系列がスムーズかどうかを指定します。 折れ線グラフと散布図にのみ適用されます。

splitType

円グラフまたは縦棒グラフの 2 つのセクションを分割する方法を指定します。

splitValue

円グラフまたは補助縦棒グラフの 2 つのセクションを区切るしきい値を指定します。

trendlines

系列内の近似曲線のコレクション。

varyByCategories

Excel が各データ マーカーに異なる色またはパターンを割り当てている場合は true。 グラフに含まれるデータ系列は 1 つだけでなければなりません。

xErrorBars

グラフ系列の誤差範囲オブジェクトを表します。

yErrorBars

グラフ系列の誤差範囲オブジェクトを表します。

メソッド

delete()

グラフ系列を削除します。

getDimensionDataSourceString(dimension)

グラフ系列のデータ ソースの文字列表現を取得します。 文字列表現には、セル アドレスなどの情報があります。

getDimensionDataSourceString(dimension)

グラフ系列のデータ ソースの文字列表現を取得します。 文字列表現には、セル アドレスなどの情報があります。

getDimensionDataSourceType(dimension)

グラフ系列のデータ ソースの種類を取得します。

getDimensionDataSourceType(dimension)

グラフ系列のデータ ソースの種類を取得します。

getDimensionValues(dimension)

グラフ系列の 1 つのディメンションから値を取得します。 これらは、指定されたディメンションとグラフ系列に対するデータのマッピング方法に応じて、カテゴリ値またはデータ値のいずれかになります。

getDimensionValues(dimension)

グラフ系列の 1 つのディメンションから値を取得します。 これらは、指定されたディメンションとグラフ系列に対するデータのマッピング方法に応じて、カテゴリ値またはデータ値のいずれかになります。

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

set(properties, options)

オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクト、または同じ型の別の API オブジェクトを渡すことができます。

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

setBubbleSizes(sourceData)

グラフ系列のバブル サイズを設定します。 バブル チャートにのみ適用されます。

setValues(sourceData)

グラフ系列の値を設定します。 散布図の場合は、Y 軸の値を参照します。

setXAxisValues(sourceData)

グラフ系列の X 軸の値を設定します。

toJSON()

API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、JSON.stringify渡されたオブジェクトの toJSON メソッドを呼び出します)。元の Excel.ChartSeries オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.ChartSeriesData と型指定) を返します。

プロパティの詳細

axisGroup

指定した系列のグループを指定します。

axisGroup: Excel.ChartAxisGroup | "Primary" | "Secondary";

プロパティ値

Excel.ChartAxisGroup | "Primary" | "Secondary"

注釈

API セット: ExcelApi 1.8

binOptions

ヒストグラム図とパレート図のビンのオプションをカプセル化します。

readonly binOptions: Excel.ChartBinOptions;

プロパティ値

注釈

API セット: ExcelApi 1.9

boxwhiskerOptions

箱ひげ図グラフのオプションをカプセル化します。

readonly boxwhiskerOptions: Excel.ChartBoxwhiskerOptions;

プロパティ値

注釈

API セット: ExcelApi 1.9

bubbleScale

既定のサイズのパーセンテージを表す 0 (ゼロ) から 300 までの整数値とすることができます。 このプロパティは、バブルチャートにのみ使用できます。

bubbleScale: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.9

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" | "ColumnClusteredEx" | "ColumnStackedEx" | "ColumnStacked100Ex" | "LineEx" | "LineStackedEx" | "LineStacked100Ex" | "PieEx" | "DoughnutEx" | "BarClusteredEx" | "BarStackedEx" | "BarStacked100Ex" | "AreaEx" | "AreaStackedEx" | "AreaStacked100Ex" | "XYScatterEx" | "BubbleEx";

プロパティ値

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" | "ColumnClusteredEx" | "ColumnStackedEx" | "ColumnStacked100Ex" | "LineEx" | "LineStackedEx" | "LineStacked100Ex" | "PieEx" | "DoughnutEx" | "BarClusteredEx" | "BarStackedEx" | "BarStacked100Ex" | "AreaEx" | "AreaStackedEx" | "AreaStacked100Ex" | "XYScatterEx" | "BubbleEx"

注釈

API セット: ExcelApi 1.7

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

context: RequestContext;

プロパティ値

dataLabels

系列のすべてのデータ ラベルのコレクションを表します。

readonly dataLabels: Excel.ChartDataLabels;

プロパティ値

注釈

API セット: ExcelApi 1.8

doughnutHoleSize

グラフ系列のドーナツの穴の大きさを表します。 ドーナツ チャートとドーナツ爆発チャートでのみ有効です。 無効なグラフで InvalidArgument エラーをスローします。

doughnutHoleSize: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.7

explosion

円グラフまたはドーナツ グラフ スライスの爆発値を指定します。 切り出し表示は行われず、スライスの先端が円の中心と一致する場合、0 を返します。

explosion: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.8

filtered

系列をフィルター処理するかどうかを指定します。 等高線グラフには適用されません。

filtered: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.7

firstSliceAngle

最初の円グラフまたはドーナツ グラフ スライスの角度を度単位で指定します (垂直から時計回り)。 円グラフ、3-D 円グラフ、およびドーナツ グラフにのみ適用されます。 0 から 360 の範囲内で値を指定できます。

firstSliceAngle: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.8

format

塗りつぶしと線の書式設定を含む、グラフ シリーズの書式設定を表します。

readonly format: Excel.ChartSeriesFormat;

プロパティ値

注釈

API セット: ExcelApi 1.1

gapWidth

グラフ系列間に設けられる間隔を表します。 横棒グラフと縦棒グラフ、および折れ線グラフと円グラフの特定のクラスでのみ有効です。 無効なグラフで無効な引数例外をスローします。

gapWidth: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.7

gradientMaximumColor

地域マップ グラフ系列の最大値の色を指定します。

gradientMaximumColor: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.9

gradientMaximumType

地域マップ グラフ系列の最大値の種類を指定します。

gradientMaximumType: Excel.ChartGradientStyleType | "ExtremeValue" | "Number" | "Percent";

プロパティ値

Excel.ChartGradientStyleType | "ExtremeValue" | "Number" | "Percent"

注釈

API セット: ExcelApi 1.9

gradientMaximumValue

地域マップ グラフ系列の最大値を指定します。

gradientMaximumValue: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.9

gradientMidpointColor

地域マップ グラフ系列の中間値の色を指定します。

gradientMidpointColor: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.9

gradientMidpointType

地域マップ グラフ系列の中間値の種類を指定します。

gradientMidpointType: Excel.ChartGradientStyleType | "ExtremeValue" | "Number" | "Percent";

プロパティ値

Excel.ChartGradientStyleType | "ExtremeValue" | "Number" | "Percent"

注釈

API セット: ExcelApi 1.9

gradientMidpointValue

地域マップ グラフ シリーズの中間値を指定します。

gradientMidpointValue: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.9

gradientMinimumColor

地域マップ グラフ系列の最小値の色を指定します。

gradientMinimumColor: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.9

gradientMinimumType

地域マップ グラフ シリーズの最小値の種類を指定します。

gradientMinimumType: Excel.ChartGradientStyleType | "ExtremeValue" | "Number" | "Percent";

プロパティ値

Excel.ChartGradientStyleType | "ExtremeValue" | "Number" | "Percent"

注釈

API セット: ExcelApi 1.9

gradientMinimumValue

地域マップ グラフ シリーズの最小値を指定します。

gradientMinimumValue: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.9

gradientStyle

地域マップ グラフの系列グラデーション スタイルを指定します。

gradientStyle: Excel.ChartGradientStyle | "TwoPhaseColor" | "ThreePhaseColor";

プロパティ値

Excel.ChartGradientStyle | "TwoPhaseColor" | "ThreePhaseColor"

注釈

API セット: ExcelApi 1.9

hasDataLabels

系列にデータ ラベルがあるかどうかを指定します。

hasDataLabels: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.7

// 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();
});

invertColor

系列内の負のデータ要素の塗りつぶしの色を指定します。

invertColor: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.9

invertIfNegative

アイテムが負の数に対応するときに、Excel が反転された場合は true。

invertIfNegative: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.8

mapOptions

リージョン マップ グラフのオプションをカプセル化します。

readonly mapOptions: Excel.ChartMapOptions;

プロパティ値

注釈

API セット: ExcelApi 1.9

markerBackgroundColor

グラフ シリーズのマーカーの背景色を指定します。

markerBackgroundColor: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

// 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

注釈

API セット: ExcelApi 1.7

// 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

注釈

API セット: ExcelApi 1.7

// 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"

注釈

API セット: ExcelApi 1.7

// 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

グラフ内の系列の名前を指定します。 名前の長さは 255 文字を超えてはなりません。

name: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.1

overlap

横棒と縦棒の配置方法を指定します。 -100 から 100 の範囲内で値を指定できます。 2-D 横棒グラフと 2-D 縦棒グラフにのみ適用されます。

overlap: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.8

parentLabelStrategy

ツリーマップ図の系列親ラベル戦略領域を指定します。

parentLabelStrategy: Excel.ChartParentLabelStrategy | "None" | "Banner" | "Overlapping";

プロパティ値

Excel.ChartParentLabelStrategy | "None" | "Banner" | "Overlapping"

注釈

API セット: ExcelApi 1.9

plotOrder

グラフ グループ内のグラフ系列のプロット順序を指定します。

plotOrder: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.7

points

系列内のすべてのポイントのコレクションを返します。

readonly points: Excel.ChartPointsCollection;

プロパティ値

注釈

API セット: ExcelApi 1.1

// 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();
});

secondPlotSize

円グラフまたは縦棒グラフのいずれかの第 2 セクションのサイズを、第 1 の円のサイズに対する割合で指定します。 5 から 200 の範囲内で値を指定できます。

secondPlotSize: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.8

showConnectorLines

ウォーターフォール図にコネクタ線を表示するかどうかを指定します。

showConnectorLines: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.9

showLeaderLines

系列内の各データ ラベルに引出線を表示するかどうかを指定します。

showLeaderLines: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.9

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-leader-lines.yaml

// The following code disables leader lines for chart data labels.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem(sheetName);
  const chart = sheet.charts.getItemAt(0);
  const series = chart.series.getItemAt(0);
  const dataLabels = series.dataLabels;
  
  // Disable leader lines.
  dataLabels.showLeaderLines = false;
  
  await context.sync();
});

showShadow

系列に影があるかどうかを指定します。

showShadow: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.7

smooth

系列がスムーズかどうかを指定します。 折れ線グラフと散布図にのみ適用されます。

smooth: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.7

splitType

円グラフまたは縦棒グラフの 2 つのセクションを分割する方法を指定します。

splitType: Excel.ChartSplitType | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit";

プロパティ値

Excel.ChartSplitType | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"

注釈

API セット: ExcelApi 1.8

splitValue

円グラフまたは補助縦棒グラフの 2 つのセクションを区切るしきい値を指定します。

splitValue: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.9

trendlines

系列内の近似曲線のコレクション。

readonly trendlines: Excel.ChartTrendlineCollection;

プロパティ値

注釈

API セット: ExcelApi 1.7

varyByCategories

Excel が各データ マーカーに異なる色またはパターンを割り当てている場合は true。 グラフに含まれるデータ系列は 1 つだけでなければなりません。

varyByCategories: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.8

xErrorBars

グラフ系列の誤差範囲オブジェクトを表します。

readonly xErrorBars: Excel.ChartErrorBars;

プロパティ値

注釈

API セット: ExcelApi 1.9

yErrorBars

グラフ系列の誤差範囲オブジェクトを表します。

readonly yErrorBars: Excel.ChartErrorBars;

プロパティ値

注釈

API セット: ExcelApi 1.9

メソッドの詳細

delete()

グラフ系列を削除します。

delete(): void;

返品

void

注釈

API セット: ExcelApi 1.7

// 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();
});

getDimensionDataSourceString(dimension)

グラフ系列のデータ ソースの文字列表現を取得します。 文字列表現には、セル アドレスなどの情報があります。

getDimensionDataSourceString(dimension: Excel.ChartSeriesDimension): OfficeExtension.ClientResult<string>;

パラメーター

dimension
Excel.ChartSeriesDimension

データの送信元となる軸のディメンション。

返品

注釈

API セット: ExcelApi 1.15

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-source.yaml

// This function retrieves the data source information of a chart series in the Sample worksheet.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Sample");

  // Get the first chart series from the first chart on the worksheet.
  const seriesCollection = sheet.charts.getItemAt(0).series;
  const series = seriesCollection.getItemAt(0);

  // Get the series data source string and type values. 
  const dataSourceString = series.getDimensionDataSourceString("Values");
  const dataSourceType = series.getDimensionDataSourceType("Values");

  series.load("name");
  await context.sync();
  
  // Log the data source information to the console.
  console.log(series.name + " data source string: " + dataSourceString.value);
  console.log(series.name + " data source type: " + dataSourceType.value);
});

getDimensionDataSourceString(dimension)

グラフ系列のデータ ソースの文字列表現を取得します。 文字列表現には、セル アドレスなどの情報があります。

getDimensionDataSourceString(dimension: "Categories" | "Values" | "XValues" | "YValues" | "BubbleSizes"): OfficeExtension.ClientResult<string>;

パラメーター

dimension

"Categories" | "Values" | "XValues" | "YValues" | "BubbleSizes"

データの送信元となる軸のディメンション。

返品

注釈

API セット: ExcelApi 1.15

getDimensionDataSourceType(dimension)

グラフ系列のデータ ソースの種類を取得します。

getDimensionDataSourceType(dimension: Excel.ChartSeriesDimension): OfficeExtension.ClientResult<Excel.ChartDataSourceType>;

パラメーター

dimension
Excel.ChartSeriesDimension

データの送信元となる軸のディメンション。

返品

注釈

API セット: ExcelApi 1.15

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-source.yaml

// This function retrieves the data source information of a chart series in the Sample worksheet.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Sample");

  // Get the first chart series from the first chart on the worksheet.
  const seriesCollection = sheet.charts.getItemAt(0).series;
  const series = seriesCollection.getItemAt(0);

  // Get the series data source string and type values. 
  const dataSourceString = series.getDimensionDataSourceString("Values");
  const dataSourceType = series.getDimensionDataSourceType("Values");

  series.load("name");
  await context.sync();
  
  // Log the data source information to the console.
  console.log(series.name + " data source string: " + dataSourceString.value);
  console.log(series.name + " data source type: " + dataSourceType.value);
});

getDimensionDataSourceType(dimension)

グラフ系列のデータ ソースの種類を取得します。

getDimensionDataSourceType(dimension: "Categories" | "Values" | "XValues" | "YValues" | "BubbleSizes"): OfficeExtension.ClientResult<Excel.ChartDataSourceType>;

パラメーター

dimension

"Categories" | "Values" | "XValues" | "YValues" | "BubbleSizes"

データの送信元となる軸のディメンション。

返品

注釈

API セット: ExcelApi 1.15

getDimensionValues(dimension)

グラフ系列の 1 つのディメンションから値を取得します。 これらは、指定されたディメンションとグラフ系列に対するデータのマッピング方法に応じて、カテゴリ値またはデータ値のいずれかになります。

getDimensionValues(dimension: Excel.ChartSeriesDimension): OfficeExtension.ClientResult<string[]>;

パラメーター

dimension
Excel.ChartSeriesDimension

データの送信元となる軸のディメンション。

返品

注釈

API セット: ExcelApi 1.12

// 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) => {
  const sheet = context.workbook.worksheets.getItem("Sample");

  // The sample chart is of type `Excel.ChartType.bubble`.
  const bubbleChart = sheet.charts.getItem("Product Chart");

  // Get the first series in the chart.
  const firstSeries = bubbleChart.series.getItemAt(0);

  // Get the values for the dimensions we're interested in.
  const bubbleSize = firstSeries.getDimensionValues(Excel.ChartSeriesDimension.bubbleSizes);
  const xValues = firstSeries.getDimensionValues(Excel.ChartSeriesDimension.xvalues);
  const yValues = firstSeries.getDimensionValues(Excel.ChartSeriesDimension.yvalues);
  const category = firstSeries.getDimensionValues(Excel.ChartSeriesDimension.categories);

  await context.sync();

  // Log the information.
  console.log(`Series ${category.value} - X: ${xValues.value}, Y: ${yValues.value}, Bubble: ${bubbleSize.value}`);
});

getDimensionValues(dimension)

グラフ系列の 1 つのディメンションから値を取得します。 これらは、指定されたディメンションとグラフ系列に対するデータのマッピング方法に応じて、カテゴリ値またはデータ値のいずれかになります。

getDimensionValues(dimension: "Categories" | "Values" | "XValues" | "YValues" | "BubbleSizes"): OfficeExtension.ClientResult<string[]>;

パラメーター

dimension

"Categories" | "Values" | "XValues" | "YValues" | "BubbleSizes"

データの送信元となる軸のディメンション。

返品

注釈

API セット: ExcelApi 1.12

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(options?: Excel.Interfaces.ChartSeriesLoadOptions): Excel.ChartSeries;

パラメーター

options
Excel.Interfaces.ChartSeriesLoadOptions

読み込むオブジェクトのプロパティのオプションを指定します。

返品

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

プロパティ オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。

返品

void

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

set(properties: Excel.ChartSeries): void;

パラメーター

properties
Excel.ChartSeries

返品

void

setBubbleSizes(sourceData)

グラフ系列のバブル サイズを設定します。 バブル チャートにのみ適用されます。

setBubbleSizes(sourceData: Range): void;

パラメーター

sourceData
Excel.Range

ソース データに対応する Range オブジェクト。

返品

void

注釈

API セット: ExcelApi 1.7

// 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

注釈

API セット: ExcelApi 1.7

// 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

注釈

API セット: ExcelApi 1.7

toJSON()

API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、JSON.stringify渡されたオブジェクトの toJSON メソッドを呼び出します)。元の Excel.ChartSeries オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.ChartSeriesData と型指定) を返します。

toJSON(): Excel.Interfaces.ChartSeriesData;

返品