Skip to content
A Java library for generating JavaScript literal strings to be used for populating Google charts wtih data.
Java
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
pom.xml

README.md

google-charts-helper

Copyright 2013 SoundBite Communications

A Java library for generating JavaScript literal strings to be used for populating Google charts wtih data.

js syntax is described in Google's documentation.

Example

The main interface is LiteralBuilder:

LiteralBuilder builder = new LiteralBuilder().addColumn(ColumnType.STRING).addColumn(ColumnType.NUMBER);
builder.addRow(Cell.of("asdf"), Cell.of(3));
builder.addRow(Cell.of("qwer"), Cell.of(5));
System.out.println(builder.buildDataLiteral());

Produces:

{cols:[{type: 'string'},{type: 'number'}], rows:[{c:[{v: 'asdf'},{v: 3.0}]},{c:[{v: 'qwer'},{v: 5.0}]}]}

Usage

The library can be used via Maven:

<dependency>
    <groupId>com.soundbite</groupId>
    <artifactId>google-charts-helper</artifactId>
    <version>0.0.4</version>
</dependency>
Something went wrong with that request. Please try again.