A highcharts addon for vaadin
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
compiled
readme_img
src/main
.classpath
.gitignore
.project
.travis.yml
LICENSE
README.md
build.gradle
wrapper.gradle

README.md

HighChartsAPI Add-on for Vaadin 8 and Java 8

Build Status

Install

  • Actual Build: 1.2-SNAPSHOT
  • Recommended version: 1.2-SNAPSHOT
  • Last Version: 1.1

Import jar:

Add new Maven repo: https://sebastianruziczka.de/repo/mvn

or add new ivy repo: https://sebastianruziczka.de/repo/ivy

e.g. with gradle:

repositories {
	maven {
		url 'https://sebastianruziczka.de/repo/mvn'
	}
}

and import

  • de.sebastianruziczka:VaadinHighCharts:1.2-SNAPSHOT

e.g.:

compile group: 'de.sebastianruziczka', name:'VaadinHighCharts', version: '1.2-SNAPSHOT'

Import newest jar:

Add this to your build.gradle to refresh all changing libs every build:

configurations.all {
	// Check for updates every build
	resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

Mark the VaadinHighCharts-lib as changing:

compile group: 'de.sebastianruziczka', name:'VaadinHighCharts', version: '1.2-SNAPSHOT', changing: true

Simple Examples:

Here are some simple examples. For more examples please look in the demo-project:

https://github.com/RosesTheN00b/VaadinHighChartsDemo

Example:

List<HighChartsSeries> data = new ArrayList<HighChartsSeries>();

//Setting up data
ChartDataSeries max = new ChartDataSeries("Max");
max.add(new SingleDataSet("Age", 21));
data.add(max);

ChartDataSeries tom = new ChartDataSeries("Tom");
tom.add(new SingleDataSet("Age", 25));
data.add(tom);

ChartDataSeries jessica = new ChartDataSeries("Jessica");
jessica.add(new SingleDataSet("Age", 23));
data.add(jessica);

//Create Chart
ChartConfiguration chartConfiguration = new ChartConfiguration(new Title("Bar Chart with Label"));
chartConfiguration.setLegend(State.Enabled);
chartConfiguration.setBackground(Colors.WHITE);

Axis xAxis = chartConfiguration.xAxis();
xAxis.setTitle("X Axis");

Axis yAxis = chartConfiguration.yAxis();
yAxis.setTitle("Y Axis");

HighChart barChart = HighChartFactory.renderChart(data, chartConfiguration, ChartType.BAR);

barChart.setHeight(50, Unit.REM);
barChart.setWidth(70, Unit.REM);
barChart.setSizeUndefined();

content.addComponent(barChart);

Will be rendered to:

Example Plot

and with ChartType.PIE and chartdata:

List<HighChartsSeries> data = new ArrayList<HighChartsSeries>();

ChartDataSeries cake = new ChartDataSeries("Cake");
cake.add(new SingleDataSet("Almonds", 200));
cake.add(new SingleDataSet("Sugar", 200));
cake.add(new SingleDataSet("Flour", 250));
cake.add(new SingleDataSet("Backing Powder", 15));
data.add(cake);

Example Plot

Simple area plot:

Example Plot

Simple scatter plot

Example Plot

Simple pyramid plot

Example Plot

Example Project

https://github.com/RosesTheN00b/VaadinHighChartsDemo

Usage of Color:

Implement some Function<Number,Color> or use already implemented classes:

ChartConfiguration chartConfiguration = [...] do your Stuff, setup the config-object
int limit = 20;
chartConfiguration = chartConfiguration
	.colorize(new ColorByLimitFunction(Colors.GREEN, limit, Colors.RED));

Will create:

Example Plot

Already implemented colorfunctions:

  • RoundRobinColorFunction
  • ColorByLimitFunction

Build it:

Setup eclipse workspace

Use Gradle-Command:

gradle eclipse

Build Jar-File

Use Gradle-Command:

gradle uploadArchives

Changes

Version 1.2-SNAPSHOT

  • Fixed Coloring: Value-Extractor-Function now in Charttype (No ClassCastException, Simplified ColorFunctions)

Version 1.1

  • Migrated DoubleDataSet to SingleSataSet (same responsibility, only with String-key)
  • Changed ChartConfiguration: Deletedd ChartData, ChartData is now needed for render Javascript
  • Redraw and rerender functions refactored: Deleted ChartConfiguration-State, Deleted ChartData-State (now needed as input parameter)