Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
In questa pagina viene descritto come utilizzare o modificare la libreria Java di Google Visualization e come contribuire al codice open source per il progetto.
Nota: è anche possibile utilizzare JDK versione 5.0. Tuttavia, devi rimuovere @Override da ogni metodo nella libreria che esegue l'override di un metodo di interfaccia. Ciò è
dovuto al cambiamento del comportamento dell'annotazione @Override in
JDK versione 6.0.
Dipendenze
La libreria Java dell'origine dati ha le seguenti dipendenze. La libreria è stata testata con le versioni elencate; altre versioni potrebbero essere accettabili, ma non sono state testate.
javacc versione 4.2.
Questa operazione è necessaria solo se intendi compilare le librerie, ad esempio
quando le modifichi come descritto di seguito.
opencsv versione
1.8. Questa operazione è necessaria solo se intendi utilizzare un'origine dati CSV.
Non inclusi nella fonte o nel download:
Per utilizzare la classe SqlDataSourceHelper con un database MySQL, hai bisogno anche di mysql.jar nell'ambiente di runtime. Consulta: http://www.mysql.com/products/connector/j/ per
dettagli e versioni scaricabili.
Utilizzare la Raccolta così come viene fornita
In questa sezione viene descritto come utilizzare la libreria Java di visualizzazione se non devi modificarla. Questo processo varia a seconda del sistema di compilazione:
Se utilizzi Maven, configura una dipendenza dalla libreria di visualizzazioni con le seguenti impostazioni:
ID gruppo: com.google.visualization
ID artefatto: visualizzazione-origine dati
Numero di versione: usa il numero di versione più recente elencato nella pagina del progetto.
Se utilizzi un altro sistema di compilazione:
Scarica il file ZIP della libreria dalla pagina del progetto, decomprimi i file e includili nel tuo progetto come richiesto dal sistema di build.
Esecuzione degli esempi
I file di esempio JAR sono inclusi, insieme ai JAR della libreria, nel file ZIP
scaricabile. Le istruzioni per l'esecuzione degli esempi sono disponibili nella pagina Per iniziare.
Modifica della Raccolta
Se vuoi modificare il codice libreria, dovrai scaricare il codice sorgente dal sito di hosting open source e crearlo. Prima di farlo, leggi le informazioni sulla licenza a cui rimanda la sezione "Licenza del codice" nella pagina del progetto per vedere se il tuo caso d'uso è consentito.
Ecco la procedura per scaricare e creare la libreria:
Scarica il codice sorgente utilizzando SVN, come descritto nella scheda Origine > Pagamento della pagina del progetto open source.
Crea il tuo codice. Se crei in Maven, usa il file pom.xml fornito con l'origine. Se crei con Apache Ant, segui le istruzioni riportate di seguito (tieni presente che il codice è stato testato con Ant versione 1.7.0; se hai una versione precedente di Ant, potrebbe essere necessario eseguire l'upgrade)
Istruzioni per la creazione di formiche
1. Modifica le proprietà della build:
Vai alla sottodirectory build-src della directory di installazione
scelta.
Con un editor di testo, apri il file build.properties e apporta
le seguenti modifiche:
Modifica la proprietà servlet-api.jar in modo che punti al file servlet-api.jar.
Ad esempio, se hai installato Tomcat sull'unità c: nella directory tomcat_home, devi specificare la proprietà servlet-api.jar come segue: servlet-api.jar=C:/tomcat_home/common/lib/servlet-api.jar
Nota: nel percorso del file utilizza barre non rovesciate, anche in Windows.
Per utilizzare le tue copie delle dipendenze descritte in precedenza, modifica i percorsi nello stesso file build.properties.
2. Crea la raccolta:
Passa alla sottodirectory build-src nel file e digita una delle seguenti
indicazioni:
ant datasource: crea la libreria dell'origine dati
ant example - Crea gli esempi
ant: crea sia origini dati che esempi
ant test: crea ed esegue i test della libreria di origini dati.
Molto utile quando modifichi la libreria.
Contribuire al progetto open source
Se vuoi contribuire con modifiche al progetto open source, devi ottenere le autorizzazioni di invio del progetto. Invia un'email all'indirizzo google-visualization-api@googlegroups.com per chiedere l'autorizzazione e le istruzioni su come inviare le modifiche.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]