ライブラリ パッケージとキークラス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
最もよく使用されるクラスの概要については、キークラスをご覧ください。
データソースの Java ライブラリ パッケージの概要については、以下のリンクをご覧ください。
鍵クラス
キークラスは DataSourceServlet
、DataTable
、Query
、DataSourceHelper
です。
ライブラリの最も簡単な実装は、DataSourceServlet
から継承し、generateDataTable()
の独自の実装を作成して、サーブレット内で実装を実行することです。このタイプの実装については、スタートガイドをご覧ください。
DataTable
クラスは、データテーブルの列、列の型、ラベル、ID、カスタム プロパティを定義します。
Query
クラスはデータクエリの基本クラスで、可視化によって生成されたクエリを処理します。
より複雑なユースケースの場合、ヘルパークラス DataSourceHelper
にはヘルパー関数のセットが用意されています。このタイプの実装については、機能とイベントのフローの定義をご覧ください。
datasource
これはトップレベル パッケージであり、ほとんどのデータソース デベロッパーが操作する API クラスが含まれています。
この最上位レベルには Capabilities
があり、データソースのクエリcapabilitiesの定義に使用されます。
base
このパッケージには、パッケージ間の循環依存関係を防ぐために複数のパッケージで使用されるすべてのクラスが含まれています。最も注目すべき項目は、デフォルトの言語 / 地域(英語(米国))のエラー メッセージです。実装を多言語化するには、これらのメッセージを翻訳する必要があります。
datatable
このパッケージには、データテーブルの構造(列、行、セル)と機能(挿入、追加)を処理するクラスが含まれています。
このパッケージには、ライブラリでサポートされている値と値の型を処理する value
パッケージも含まれています。使用可能な値の型は ValueType
列挙型で定義され、ブール値、日付、時刻、日時、null、数値、テキストなどがあります。
query
このパッケージにはクエリを処理するクラスが含まれています。基本クラスは Query
です。このパッケージには、次のパッケージも含まれています。
parser
- クエリ解析を処理するクラス。
engine
- クエリ実行を処理するクラス。
scalarfunction
- クエリで使用されるスカラー関数を処理するクラス。
render
このパッケージには、レスポンスをフォーマットするクラスが含まれています。次に例を示します。
CsvRenderer
は、データ表を CSV としてレンダリングします。
HtmlRenderer
はデータ表を HTML としてレンダリングします。
JsonRenderer
は、データテーブルを JSON としてレンダリングします。
EscapeUtil
には、文字列をエスケープするユーティリティが用意されています。
util
このパッケージには、次の 2 つのヘルパー関数セットが用意されています。
CsvDataSourceHelper
と CsvDataSourceException
は、CSV ファイルをデータストアとして使用するためのヘルパー関数を提供しますが、データソースの完全な実装を提供するものではありません。実装例については、外部データストアの使用をご覧ください。
SqlDataSourceHelper
と SqlDatabaseDescription
は、mySQL データベースをデータストアとして使用するためのヘルパー関数を提供しますが、データソースの完全な実装を提供するものではありません。実装例については、examples
パッケージの SqlDataSourceServlet
をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-07-10 UTC。
[null,null,["最終更新日 2024-07-10 UTC。"],[[["\u003cp\u003eThis library enables developers to connect their data to Google Visualization charts using Java.\u003c/p\u003e\n"],["\u003cp\u003eKey classes include \u003ccode\u003eDataSourceServlet\u003c/code\u003e, \u003ccode\u003eDataTable\u003c/code\u003e, \u003ccode\u003eQuery\u003c/code\u003e, and \u003ccode\u003eDataSourceHelper\u003c/code\u003e for building data source implementations.\u003c/p\u003e\n"],["\u003cp\u003eThe library provides packages for data source management (\u003ccode\u003edatasource\u003c/code\u003e), base functionalities (\u003ccode\u003ebase\u003c/code\u003e), data table structure (\u003ccode\u003edatatable\u003c/code\u003e), query handling (\u003ccode\u003equery\u003c/code\u003e), response formatting (\u003ccode\u003erender\u003c/code\u003e), and utility functions (\u003ccode\u003eutil\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage helper functions for CSV and SQL data stores through \u003ccode\u003eCsvDataSourceHelper\u003c/code\u003e and \u003ccode\u003eSqlDataSourceHelper\u003c/code\u003e, respectively.\u003c/p\u003e\n"],["\u003cp\u003eFor simple implementations, inherit from \u003ccode\u003eDataSourceServlet\u003c/code\u003e and implement \u003ccode\u003egenerateDataTable()\u003c/code\u003e; for complex cases, use \u003ccode\u003eDataSourceHelper\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Library Packages and Key Classes\n\nFor an introduction to the most commonly used classes, see [key\nclasses](#keyclasses).\n\nFor an introduction to the data source Java library packages follow\nthe links below:\n\n- [datasource](#datasource \"datasource\")\n- [datasource.base](#base)\n- [datasource.datatable](#datatable)\n- [datasource.query](#query)\n- [datasource.render](#render)\n- [datasource.util](#util)\n\nKey Classes\n-----------\n\nThe key classes are [DataSourceServlet](https://code.google.com/p/google-visualization-java/source/browse/trunk/src/main/java/com/google/visualization/datasource/DataSourceServlet.java), [DataTable](https://code.google.com/p/google-visualization-java/source/browse/trunk/src/main/java/com/google/visualization/datasource/datatable/DataTable.java),\n[Query](https://code.google.com/p/google-visualization-java/source/browse/trunk/src/main/java/com/google/visualization/datasource/query/Query.java) and [DataSourceHelper](https://code.google.com/p/google-visualization-java/source/browse/trunk/src/main/java/com/google/visualization/datasource/DataSourceHelper.java).\n\nThe simplest implementation of the library involves inheriting from `DataSourceServlet`,\nwriting your own implementation of `generateDataTable()` and\nthen running the implementation within a servlet. This type of implementation\nis described in the [Getting\nStarted](/chart/interactive/docs/dev/dsl_get_started) section.\n\nThe `DataTable` class defines the columns, column types,\nlabels, ids, and custom properties for a data table.\n\nThe `Query` class is the base class for data queries, it\nhandles a visualization-generated query.\n\nFor more complex\nuse cases, the helper class `DataSourceHelper` provides\na set of helper functions. This type of implementation\nis described in [Defining Capabilities and the Flow of Events](/chart/interactive/docs/dev/dsl_httpservlet).\n\n`datasource`\n------------\n\nThis is the [top\nlevel package](http://code.google.com/p/google-visualization-java/source/browse/#svn/trunk/src/java/com/google/chart/interactive/datasource%3Fstate%3Dclosed) and contains the API classes with which\nmost data source developers interact.\n\nAlso at this top level is `Capabilities`, which is\nused to define the data source's query [capabilities](/chart/interactive/docs/dev/dsl_key_concepts#capabilities).\n\n\n`base`\n------\n\n[This\npackage](http://code.google.com/p/google-visualization-java/source/browse/#svn/trunk/src/java/com/google/chart/interactive/datasource/base) contains all classes that are used by more than one package\nto prevent circular dependencies between the packages. The most notable\nitems are error messages in the default locale of US English. To internationalize\nyour implementation, you will need to translate these messages.\n\n`datatable`\n-----------\n\n[This\npackage](http://code.google.com/p/google-visualization-java/source/browse/#svn/trunk/src/java/com/google/chart/interactive/datasource/datatable) contains classes that handle data table structure (columns,\nrows, cells) and functionality (insert, add).\n\nThis package also contains the `value` package that handles\nvalues and value types supported by the library. Available value types\nare defined in the `ValueType` enumeration and include: boolean,\ndate, time of day, date and time, null, number, and text.\n\n`query`\n-------\n\n[This\npackage](http://code.google.com/p/google-visualization-java/source/browse/#svn/trunk/src/java/com/google/chart/interactive/datasource/query) contains classes that handle queries, the base class is `Query`.\nThis package also contains the following packages:\n\n- `parser` - classes that handle query parsing. \n- `engine` - classes that handle query execution.\n- `scalarfunction` - classes that handle scalar functions used in a query.\n\n`render`\n--------\n\n[This\npackage](http://code.google.com/p/google-visualization-java/source/browse/#svn/trunk/src/java/com/google/chart/interactive/datasource/render) contains the classes that format a response. For example:\n\n- `CsvRenderer` renders a data table as CSV.\n- `HtmlRenderer` renders a data table as HTML.\n- `JsonRenderer` renders a data table as JSON.\n- `EscapeUtil` provides a utility to escape strings.\n\n`util`\n------\n\n[This\npackage](http://code.google.com/p/google-visualization-java/source/browse/#svn/trunk/src/java/com/google/chart/interactive/datasource/util) provides two sets of helper functions:\n\n- `CsvDataSourceHelper` and `CsvDataSourceException` provide helper functions for using a CSV file as a data store, they do not provide a complete implementation of a data source. For an example implementation, see [Using an External Data Store](/chart/interactive/docs/dev/dsl_csv).\n- `SqlDataSourceHelper` and `SqlDatabaseDescription` provide helper functions for using a mySQL database as a data store, they do not provide a complete implementation of a data source. For an example implementation, see `SqlDataSourceServlet` in the `examples` package."]]