Cómo instalar la biblioteca de Java de fuente de datos
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta página, se describe cómo usar o modificar la biblioteca de Java de visualización de Google y cómo contribuir al código abierto para el proyecto.
Nota: También es posible usar la versión 5.0 de JDK. Sin embargo, debes quitar @Override de cada método de la biblioteca que anule un método de interfaz. Esto se debe al cambio en el comportamiento de la anotación @Override en la versión 6.0 de JDK.
Dependencias
La biblioteca Java de fuente de datos tiene las siguientes dependencias. La biblioteca se probó con las versiones indicadas. Otras versiones pueden ser aceptables, pero no se probaron.
Versión 4.2 de javacc.
Esto solo es necesario si tienes la intención de compilar las bibliotecas, por ejemplo, cuando las modificas como se describe a continuación.
opencsv versión 1.8. Esto es necesario solo si tienes la intención de usar una fuente de datos CSV.
No se incluyen en la fuente ni en la descarga:
Para usar la clase SqlDataSourceHelper con una base de datos MySQL, también necesitas mysql.jar en tu entorno de ejecución. Consulta http://www.mysql.com/products/connector/j/ para obtener detalles y versiones descargables.
Cómo usar la biblioteca tal como se proporciona
En esta sección, se describe cómo usar la biblioteca de visualización de Java si no necesitas modificarla. Este proceso varía según tu sistema de compilación:
Si usas Maven, establece una dependencia en la biblioteca de visualizaciones con la siguiente configuración:
ID de grupo: com.google.visualization
ID del artefacto: Visualizaciones-fuente de datos
Número de versión: Usa el número de versión más reciente que aparece en la página del proyecto.
Si usas cualquier otro sistema de compilación, haz lo siguiente:
Descarga el archivo ZIP de la biblioteca desde la página del proyecto, descomprime los archivos e inclúyelos en tu proyecto como lo requiera el sistema de compilación.
Cómo ejecutar los ejemplos
Los archivos de ejemplo JAR se incluyen junto con los archivos JAR de la biblioteca en el archivo ZIP descargable. Las instrucciones para ejecutar los ejemplos se proporcionan en la página de introducción.
Cómo modificar la biblioteca
Si deseas modificar el código de la biblioteca, deberás descargar el código fuente del sitio de hosting de código abierto y compilarlo. Antes de hacerlo, lee la información de licencia vinculada a la sección "Licencia de código" en la página del proyecto para ver si se permite tu caso práctico.
Para descargar y compilar la biblioteca, sigue estos pasos:
Descarga el código fuente mediante SVN, como se describe en la pestaña Fuente > Confirmación de la compra en la página del proyecto de código abierto.
Compila tu código. Si compilas en Maven, usa el archivo pom.xml proporcionado con la fuente. Si compilas con Apache Ant, sigue las instrucciones que se proporcionan a continuación (ten en cuenta que el código se probó con la versión 1.7.0 de Ant; si tienes una versión anterior de Ant, es posible que debas actualizarla).
Instrucciones de compilación de hormigas
1. Modifica las propiedades de compilación:
Navega hasta el subdirectorio build-src del directorio de instalación elegido.
Con un editor de texto, abre el archivo build.properties y realiza los siguientes cambios:
Edita la propiedad servlet-api.jar para que apunte a tu archivo servlet-api.jar.
Por ejemplo, si instalaste Tomcat en la unidad c: del directorio tomcat_home, debes especificar la propiedad servlet-api.jar de la siguiente manera: servlet-api.jar=C:/tomcat_home/common/lib/servlet-api.jar
Nota: Usa barras diagonales en lugar de barras inversas en la ruta de acceso del archivo, incluso si usas Windows.
Para usar tus propias copias de las dependencias descritas anteriormente, edita las rutas de acceso en el mismo archivo build.properties.
2. Compila la biblioteca:
Navega por el subdirectorio build-src del archivo y escribe una de las siguientes opciones:
ant datasource: Compila la biblioteca de fuentes de datos
ant example: Compila los ejemplos
ant: Compila fuentes de datos y ejemplos
ant test: Compila y ejecuta las pruebas de la biblioteca de fuentes de datos.
Es muy útil cuando modificas la biblioteca.
Cómo contribuir al proyecto de código abierto
Si deseas aportar cambios al proyecto de código abierto, deberás obtener permisos de envío para el proyecto. Envía un correo electrónico a google-visualization-api@googlegroups.com para solicitar permiso y solicitar instrucciones sobre cómo enviar los cambios.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2024-07-10 (UTC)"],[[["\u003cp\u003eThis documentation guides you on utilizing and extending the Google Visualization Java library for incorporating interactive charts into your applications.\u003c/p\u003e\n"],["\u003cp\u003eIt outlines prerequisites, dependencies, and steps for utilizing the library directly or modifying it to suit your specific needs.\u003c/p\u003e\n"],["\u003cp\u003eInstructions are provided for building the library from source and running included examples for a hands-on understanding.\u003c/p\u003e\n"],["\u003cp\u003eFor those interested in contributing to the project, guidance is offered on seeking permissions and submitting changes to the open-source codebase.\u003c/p\u003e\n"]]],[],null,["# Installing the Data Source Java Library\n\nThis page describes how to use or modify the Google Visualization Java library,\nand how to contribute to the open source code for the project.\n\nContents\n--------\n\n1. [Requirements](#requirements)\n2. [Dependencies](#dependencies)\n3. [Using the Library as Provided](#usingthelibrary)\n4. [Running the Examples](#buildingexamples)\n5. [Modifying the Library](#build_self)\n6. [Contributing to the Open Source Project](#contributing)\n\nRequirements\n------------\n\nYou must have the following components in order to use the Google Visualization\nJava library:\n\n- A servlet container and the Servlet API version 2.4 or higher. One of the most commonly used servlet containers is Apache Tomcat, which includes the Servlet API. See \u003chttp://tomcat.apache.org/download-55.cgi\u003e to download the binary for version 5.5. You need install only the Core module. You also need Tomcat to complete the tutorial sections: [Getting\n Started](/chart/interactive/docs/dev/dsl_get_started), [Using an External Data Store](/chart/interactive/docs/dev/dsl_csv), and [Defining\n Capabilities and the Flow of Events](/chart/interactive/docs/dev/dsl_httpservlet).\n- The [Java Development Kit](http://java.sun.com/) version 6.0 or greater.\n\n **Note** : It is also possible to use the JDK\n version 5.0. However, you must then remove `@Override` from\n every method in the library that overrides an interface method. This is\n due to the change in the `@Override` annotation behavior in\n JDK version 6.0.\n\nDependencies\n------------\n\nThe data source Java library has the following dependencies. The library was\ntested with the versions listed; other versions might be acceptable, but have not\nbeen tested.\n\n**Included in the source or download:**\n\n- [icu4j](http://site.icu-project.org/) version 4.0.1.\n- [Jakarta commons lang](http://commons.apache.org/lang/) version 2.4.\n- [Jakarta commons logging](http://commons.apache.org/logging/) version 1.1.1.\n- [Google collections\n library](http://code.google.com/p/google-collections/) version 1.0.\n- [*javacc*](https://javacc.dev.java.net/) version 4.2. This is required only if you intend to compile the libraries, for example when modifying them as described [below](#build_self).\n- [*opencsv*](http://opencsv.sourceforge.net/) version 1.8. This is required only if you intend to use a CSV data source.\n\n**Not included in the source or download:**\n\n- To use the `SqlDataSourceHelper` class with a mySQL database, you also need `mysql.jar` in your runtime environment. See: \u003chttp://www.mysql.com/products/connector/j/\u003e for details and downloadable versions.\n\nUsing the Library as Provided\n-----------------------------\n\nThis section describes how to use the visualization Java library if you don't\nneed to modify it. This process varies with your build system:\n\n**If using [Maven](http://maven.apache.org/index.html),** set\nup a dependency on the visualization library with the following settings:\n\n- Group ID: com.google.visualization\n- Artifact ID: visualization-datasource\n- Version number: Use the latest version number listed on the [project\n page](http://code.google.com/p/google-visualization-java/).\n\n**If using any other build system**:\n\n- [Download\n the library ZIP file](http://code.google.com/p/google-visualization-java/) from the project page, unzip the files, and include them in your project as your build system requires.\n\nRunning the Examples\n--------------------\n\nThe JAR example files are included along with the library JARs in the [downloadable\nZIP file](http://code.google.com/p/google-visualization-java/). Instructions on running the examples are given on the [Getting\nStarted](/chart/interactive/docs/dev/dsl_get_started) page.\n\nModifying the Library\n---------------------\n\nIf you want to modify the library code, you'll have to download the source from\nthe open source hosting site and build it. Before doing this, read the licensing\ninformation linked to by the \"Code license\" section on the [project\npage](http://code.google.com/p/google-visualization-java/) to see whether your use case is allowed.\n\nHere are the steps for downloading and building the library:\n\n1. **Download the source code** using SVN, as described in on the **Source \\\u003e Checkout** tab on the [open\n source project page](http://code.google.com/p/google-visualization-java/source/checkout).\n2. **Build your code.** If building in Maven, use the pom.xml file provided with the source. If building with [Apache\n Ant](http://ant.apache.org/), follow the instructions given next (note that the code has been tested with Ant version 1.7.0; if you have an earlier version of Ant, you might need to upgrade)\n\n### Ant Build Instructions\n\n**1. Modify your build properties:**\n\n1. Navigate to the `build-src` subdirectory of your chosen installation directory.\n2. Using a text editor, open the `build.properties` file and make the following changes:\n - Edit the `servlet-api.jar` property to point to your `servlet-api.jar` file. For example, if you installed Tomcat to your `c:` drive in the `tomcat_home` directory, then you would specify the `servlet-api.jar` property as follows: \n `servlet-api.jar=C:/tomcat_home/common/lib/servlet-api.jar`\n\n **Note**: Use forward slashes rather than\n backslashes in the file path, even when using Windows\n - To use your own copies of the dependencies described above, edit the paths in the same build.properties file.\n\n**2. Build the library:**\n\nNavigate the `build-src` subdirectory in the file and type one of the\nfollowing:\n\n- `ant datasource` - Builds the data source library\n- `ant example` - Builds the examples\n- `ant` - Builds both data source and examples\n- `ant test` - Builds and runs the data source library tests. Very useful when you are modifying the library.\n\nContributing to the Open Source\nProject\n---------------------------------------\n\nIf you want to contribute changes to the open source project, you'll have to get\nsubmission permissions to the project. Send an email to [google-visualization-api@googlegroups.com](mailto:google-visualization-api@googlegroups.com) asking\nfor permission and instructions on how to submit changes."]]