Skip to content

GotanDev/chartjs4java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChartJS for java

Javadocs License

Chart.java enables integration with the excellent Chart.js library (version 2.x) from within a Java application.

Usage example

In Java:

BarDataset dataset = new BarDataset()
		.setLabel("sample chart")
		.setData(65, 59, 80, 81, 56, 55, 40)
		.addBackgroundColors(Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW, Color.ORANGE, Color.GRAY, Color.BLACK)
		.setBorderWidth(2);

BarData data = new BarData()
		.addLabels("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
		.addDataset(dataset);

return new BarChart(data).toJson();

In JavaScript:

var ctx = document.getElementById('canvasId'));
new Chart(ctx, json);

Get Started

Maven

Include this project directly from Gotan Maven repository

<dependency>
	<groupId>io.gotan.os</groupId>
	<artifactId>chartjs4java</artifactId>
	<version>2.6.0.7</version>
</dependency>

Add custom repository

<repositories>
	<repository>
		<id>gotan</id>
		<name>Gotan multi-proxies and OpenSource Contributions</name>
		<url>https://repository.dev.gotan.io/repository/maven-public/</url>
		<releases><enabled>true</enabled></releases>
		<snapshots><enabled>true</enabled></snapshots>
	</repository>
</repositories>

Download

Downloads for this project at Gotan Maven OS Repository.

Documentation

Javadoc

Browse this project's javadoc at javadoc.io.

Other resources

The docs for Chart.js are a helpful source of info on what's possible and how to achieve it.

Compatibility

Chart.js Chart.java
1.x 0.9.x
2.x 2.x

Test

See example charts by running the included unit tests:

mvn clean compile test

License

ChartJS4Java is licensed under the Apache 2.0 license.
Based and forked from Chart.java

About

Java library for use with Chart.js javascript library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%