Excel.ChartFill class

グラフ要素の塗りつぶしの書式設定を表します。

Extends

注釈

[ API セット: ExcelApi 1.1 ]

プロパティ

context

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

メソッド

clear()

グラフ要素の塗りつぶしの色をクリアします。

setSolidColor(color)

グラフ要素の塗りつぶしの書式設定を均一な色に設定します。

toJSON()

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

プロパティの詳細

context

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

context: RequestContext;

プロパティ値

メソッドの詳細

clear()

グラフ要素の塗りつぶしの色をクリアします。

clear(): void;

戻り値

void

注釈

[ API セット: ExcelApi 1.1 ]

// Clear the line format of the major gridlines on the value axis of the chart named "Chart1".
await Excel.run(async (context) => { 
    const gridlines = context.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1").axes.valueAxis.majorGridlines;
    gridlines.format.line.clear();
    await context.sync();
    
    console.log("Chart Major Gridlines Format Cleared");
});

setSolidColor(color)

グラフ要素の塗りつぶしの書式設定を均一な色に設定します。

setSolidColor(color: string): void;

パラメーター

color

string

背景の色を表す HTML カラー コードは、#RRGGBB形式 (例: "FFA500") または名前付き HTML カラー (例: "オレンジ") として表されます。

戻り値

void

注釈

[ API セット: ExcelApi 1.1 ]

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

await Excel.run(async (context) => {
    const sheet = context.workbook.worksheets.getItem("Sample");

    let pointsCollection = sheet.charts.getItemAt(0).series.getItemAt(0).points;
    let point = pointsCollection.getItemAt(2);

    // Set color for chart point.
    point.format.fill.setSolidColor('red');

    await context.sync();        
});

toJSON()

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

toJSON(): {
            [key: string]: string;
        };

戻り値

{ [key: string]: string; }