แพ็กเกจห้องสมุดและคลาสเรียนสำคัญ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โปรดดูข้อมูลเบื้องต้นเกี่ยวกับชั้นเรียนที่ใช้บ่อยที่สุดได้ที่คลาสคีย์
สำหรับข้อมูลเบื้องต้นเกี่ยวกับแพ็กเกจไลบรารี Java ของแหล่งข้อมูล โปรดไปที่ลิงก์ด้านล่าง
คลาสหลัก
คลาสคีย์คือ DataSourceServlet
, DataTable
, Query
และ DataSourceHelper
การติดตั้งใช้งานไลบรารีที่ง่ายที่สุดคือการรับค่าจาก DataSourceServlet
โดยการเขียนการใช้งาน generateDataTable()
ของคุณเอง จากนั้นจึงเรียกใช้การติดตั้งใช้งานภายในเซิร์ฟเล็ต การใช้งานประเภทนี้มีอธิบายไว้ในส่วนเริ่มต้นใช้งาน
คลาส DataTable
จะกำหนดคอลัมน์ ประเภทคอลัมน์ ป้ายกำกับ รหัส และพร็อพเพอร์ตี้ที่กำหนดเองสำหรับตารางข้อมูล
คลาส Query
เป็นคลาสพื้นฐานสำหรับการค้นหาข้อมูล ซึ่งจะจัดการการค้นหาที่สร้างขึ้นด้วยภาพ
สำหรับกรณีการใช้งานที่ซับซ้อนมากขึ้น คลาสตัวช่วย DataSourceHelper
จะมีชุดฟังก์ชันตัวช่วย การใช้งานประเภทนี้มีอธิบายอยู่ในการกำหนดความสามารถและโฟลว์ของเหตุการณ์
datasource
นี่คือแพ็กเกจระดับบนสุดและมีคลาส API ที่นักพัฒนาซอฟต์แวร์แหล่งข้อมูลส่วนใหญ่โต้ตอบด้วย
ที่ระดับ Capabilities
ด้วย ซึ่งนำไปใช้กำหนดcapabilitiesการค้นหาของแหล่งข้อมูล
base
แพ็กเกจนี้มีคลาสทั้งหมดที่มีแพ็กเกจมากกว่า 1 รายการเพื่อป้องกันทรัพยากร Dependency แบบวงกลมระหว่างแพ็กเกจ รายการที่โดดเด่นที่สุดคือข้อความแสดงข้อผิดพลาดในภาษาเริ่มต้นภาษาอังกฤษแบบสหรัฐอเมริกา เพื่อให้การใช้งานของคุณเป็นสากล คุณจะต้องแปลข้อความเหล่านี้
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 เป็นพื้นที่เก็บข้อมูล แต่ไม่ได้ให้บริการการติดตั้งใช้งานแหล่งข้อมูลโดยสมบูรณ์
ดูตัวอย่างการติดตั้งใช้งานได้ที่ SqlDataSourceServlet
ในแพ็กเกจ examples
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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."]]