Excel.ChartPoint class
グラフの系列のポイントを表します。
- Extends
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-labels.yaml
// This function adds data labels to specific chart points
// and sets their text and position.
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem(sheetName);
const chart = sheet.charts.getItemAt(0);
await context.sync();
const series = chart.series.getItemAt(0);
series.points.load("dataLabel");
await context.sync();
// Define properties for data label positioning and shape.
const labelProperties = [
{
top: 70,
geometricShapeType: Excel.GeometricShapeType.rectangle
},
{
top: 200,
geometricShapeType: Excel.GeometricShapeType.rectangle
}
];
// Add data labels to specific chart points and set their text and properties.
for (let i = 0; i < dataLabelInfo.length; i++) {
const point = series.points.getItemAt(dataLabelInfo[i].index);
point.hasDataLabel = true;
const dataLabel = point.dataLabel;
dataLabel.text = dataLabelInfo[i].news;
dataLabel.set(labelProperties[i]);
}
await context.sync();
});
プロパティ
| context | オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。 |
| data |
グラフ データ ポイントのデータ ラベルを返します。 |
| format | グラフのポイントの書式設定プロパティをカプセル化します。 |
| has |
データ ポイントにデータ ラベルがあるかどうかを表します。 等高線グラフには適用されません。 |
| marker |
データ ポイントのマーカーの背景色の HTML 色コード表現 (たとえば、#FF0000 は赤を表します)。 |
| marker |
データ ポイントのマーカーの前景色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。 |
| marker |
データ ポイントのマーカー サイズを表します。 サポートされているサイズの範囲は 2 ~ 72 です。 サポートされている範囲外のサイズで設定されている場合、このメソッドは InvalidArgument エラーを返します。 |
| marker |
データ ポイントのマーカー スタイルを表します。 詳細は「 |
| value | グラフのポイントの値を返します。 |
メソッド
| load(options) | オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| set(properties, options) | オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。 |
| set(properties) | 既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。 |
| toJSON() | API オブジェクトが |
プロパティの詳細
context
オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。
context: RequestContext;
プロパティ値
dataLabel
グラフ データ ポイントのデータ ラベルを返します。
readonly dataLabel: Excel.ChartDataLabel;
プロパティ値
注釈
format
グラフのポイントの書式設定プロパティをカプセル化します。
readonly format: Excel.ChartPointFormat;
プロパティ値
注釈
hasDataLabel
データ ポイントにデータ ラベルがあるかどうかを表します。 等高線グラフには適用されません。
hasDataLabel: boolean;
プロパティ値
boolean
注釈
markerBackgroundColor
データ ポイントのマーカーの背景色の HTML 色コード表現 (たとえば、#FF0000 は赤を表します)。
markerBackgroundColor: string;
プロパティ値
string
注釈
markerForegroundColor
データ ポイントのマーカーの前景色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。
markerForegroundColor: string;
プロパティ値
string
注釈
markerSize
データ ポイントのマーカー サイズを表します。 サポートされているサイズの範囲は 2 ~ 72 です。 サポートされている範囲外のサイズで設定されている場合、このメソッドは InvalidArgument エラーを返します。
markerSize: number;
プロパティ値
number
注釈
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"
注釈
value
メソッドの詳細
load(options)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(options?: Excel.Interfaces.ChartPointLoadOptions): Excel.ChartPoint;
パラメーター
読み込むオブジェクトのプロパティのオプションを提供します。
戻り値
load(propertyNames)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(propertyNames?: string | string[]): Excel.ChartPoint;
パラメーター
- propertyNames
-
string | string[]
読み込むプロパティを指定するコンマ区切り文字列または文字列の配列。
戻り値
load(propertyNamesAndPaths)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Excel.ChartPoint;
パラメーター
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select は読み込むプロパティを指定するコンマ区切りの文字列で、 propertyNamesAndPaths.expand は読み込むナビゲーション プロパティを指定するコンマ区切りの文字列です。
戻り値
set(properties, options)
オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。
set(properties: Interfaces.ChartPointUpdateData, options?: OfficeExtension.UpdateOptions): void;
パラメーター
- properties
- Excel.Interfaces.ChartPointUpdateData
メソッドが呼び出されるオブジェクトのプロパティに等形的に構造化されたプロパティを持つ JavaScript オブジェクト。
- options
- OfficeExtension.UpdateOptions
properties オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。
戻り値
void
set(properties)
既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。
set(properties: Excel.ChartPoint): void;
パラメーター
- properties
- Excel.ChartPoint
戻り値
void
toJSON()
API オブジェクトがJSON.stringify()に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (JSON.stringify、それに渡されるオブジェクトの toJSON メソッドを呼び出します)。元の Excel.ChartPoint オブジェクトは API オブジェクトですが、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.ChartPointData として型指定) を返します。
toJSON(): Excel.Interfaces.ChartPointData;