Beginning with the concept, that data it is not information. A table full of rows (i.e. 1000 rows) it can be consider data, and you’ll agree with me that trying to find meaningful data (Information) from the table it’s going to be a tedious task. At this point of the reasoning is when we use Charts (i.e. Line Charts, Pie Charts, Scatter Charts, etc) to summarize the data from the table and in that way we obtain information to make a decision. GWT Visualization will help us to add Charts to our GWT webapp, by using its simple API.
Using the GWT Visualization API
If you are not familiarized with the GWT Framework, you need to have a look at its documentation or my post. Considering that you are using the Maven GWT Plugin, all you have to do is define the next dependency in the projects pom.xml.
<dependency> <groupId>com.google.gwt.google-apis</groupId> <artifactId>gwt-visualization</artifactId> <version>1.0.2</version> </dependency>
The next thing to do is define the module inheritance so the client side of the webapp can use it. In the “myWebApp”.gwt.xml you have to write:
Now that we have GWT Visualization ready to use, let’s see the elements that are part of a Chart:
-DataTable (Data Format that is going to be injected into the Chart so it can display information)
-Options (Set of characteristics of the Chart: width, height,background,color,etc. )
If you want to see a basic example working go to this page: GWT Visualization Example.
If you want to draw a Line Chart and you have dots or coordinates best thing, you should use a Scatter Chart and set the option ScatterChart.Option.setLineSize(1); . The line size has to be 1 or greater than 1.