Class TextStyle  |  Apps Script  |  Google for Developers (original) (raw)

テキストスタイル

テキスト スタイルの構成オブジェクト。グラフ オプションで使用され、タイトル、横軸、縦軸、凡例、ツールチップなど、テキスト スタイルを受け入れることができる要素のテキスト スタイルを設定します。

// This example creates a chart specifying different text styles for the title // and axes. const sampleData = Charts.newDataTable() .addColumn(Charts.ColumnType.STRING, 'Seasons') .addColumn(Charts.ColumnType.NUMBER, 'Rainy Days') .addRow(['Winter', 5]) .addRow(['Spring', 12]) .addRow(['Summer', 8]) .addRow(['Fall', 8]) .build();

const titleTextStyleBuilder = Charts.newTextStyle().setColor('#0000FF').setFontSize(26).setFontName( 'Ariel'); const axisTextStyleBuilder = Charts.newTextStyle().setColor('#3A3A3A').setFontSize(20).setFontName( 'Ariel'); const titleTextStyle = titleTextStyleBuilder.build(); const axisTextStyle = axisTextStyleBuilder.build();

const chart = Charts.newLineChart() .setTitleTextStyle(titleTextStyle) .setXAxisTitleTextStyle(axisTextStyle) .setYAxisTitleTextStyle(axisTextStyle) .setTitle('Rainy Days Per Season') .setXAxisTitle('Season') .setYAxisTitle('Number of Rainy Days') .setDataTable(sampleData) .build();

メソッド

メソッド 戻り値の型 概要
getColor() String テキスト スタイルの色を取得します。
getFontName() String テキスト スタイルのフォント名を取得します。
getFontSize() Number テキスト スタイルのフォントサイズを取得します。

詳細なドキュメント

getColor()

テキスト スタイルの色を取得します。

// Creates a new text style that uses blue text and logs the color. const textStyle = Charts.newTextStyle().setColor('blue').build(); Logger.log(textStyle.getColor());

戻る

String - 色の CSS 値("blue""#00f" など)。


getFontName()

テキスト スタイルのフォント名を取得します。

// Creates a new text style that uses Ariel font and logs the font name. const textStyle = Charts.newTextStyle().setFontName('Ariel').build(); Logger.log(textStyle.getFontName());

戻る

String - フォント名。


getFontSize()

テキスト スタイルのフォントサイズを取得します。

// Creates a new text style that uses 18 pixel font size and logs the font size. const textStyle = Charts.newTextStyle().setFontSize(18).build(); Logger.log(textStyle.getFontSize());

戻る

Number - フォントサイズ(ピクセル単位)。

特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。

最終更新日 2024-12-22 UTC。