Excel.ChartFill class

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

Extends

プロパティ

context

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

メソッド

clear()

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

getSolidColor()

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

setSolidColor(color)

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

toJSON()

API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、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");
});

getSolidColor()

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

getSolidColor(): OfficeExtension.ClientResult<string>;

返品

注釈

API セット: ExcelApi 1.16

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

    // Get the solid color of the chart point.
    const colorResult = point.format.fill.getSolidColor();

    await context.sync();

    console.log(`Chart point color: ${colorResult.value}`);
});

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

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

返品

{ [key: string]: string; }