GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — GoogleCharts Loader API GoogleCharts Loader API
Martijn Dashorst edited this page
Note: At the moment there are two Google Chart projects in wicketstuff with the following maven artefacts:
The Google Charts Project allows creation of charts using the Google Chart API.
The following example code reproduces the pie chart of the Quick Start. The API does not try to hide the Google API, instead it gives just a way to build the charts in Java programming language as close as possible to the Google API and integrate it with Apache Wicket. So please read the documentation of the original API, if you are not familiar with Google charts. <dependency> <groupId>org.wicketstuff</groupId> <artifactId>gchart</artifactId> <version>7.9.0</version> </dependency> <dependency> <groupId>org.wicketstuff</groupId> <artifactId>gchart</artifactId> <version>8.0.0-SNAPSHOT</version> </dependency> <repository> <id>wicketstuff-core-snapshots</id> <url>ttps://oss.sonatype.org/content/repositories/snapshots</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> AbstractReadOnlyModel<ChartOptions> optionsModel = new AbstractReadOnlyModel<ChartOptions>() { private static final long serialVersionUID = 1L; @Override public ChartOptions getObject() { ChartOptions opts = new ChartOptions("options"); opts.put("title", "How Much Pizza I Ate Last Night"); return opts; } }; AbstractReadOnlyModel<DataTable> dataModel = new AbstractReadOnlyModel<DataTable>() { private static final long serialVersionUID = 1L; @Override public DataTable getObject() { List<ColumnDeclaration> colDefs; List<DataRow> rows; colDefs = new ArrayList<>(2); colDefs.add(new ColumnDeclaration(ColumnType.STRING, "Topping")); colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Slices")); rows = new ArrayList<>(5); rows.add(new DataRow(Arrays.asList(new Object[]{"Mushrooms", 3}))); rows.add(new DataRow(Arrays.asList(new Object[]{"Onions", 1}))); rows.add(new DataRow(Arrays.asList(new Object[]{"Olives", 1}))); rows.add(new DataRow(Arrays.asList(new Object[]{"Zucchini", 1}))); rows.add(new DataRow(Arrays.asList(new Object[]{"Pepperoni", 2}))); return new DataTable("data", colDefs, rows); } }; add(new Chart("chartPie", Model.of(ChartType.PIE), optionsModel, dataModel)); <div class="gchart" wicket:id="chartPie"></div>
Dieter Tremel Path is: /master/gchart-parent Clone this wiki locally |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |