This component, intended for use with Apache Isis's Wicket viewer, integrates Wicked Charts.
Wicked Charts is in turn an integration between Apache Wicket and the Highcharts JS charting library).
Please note that while this project and Wicked Charts are licensed under Apache 2.0 License, Highcharts itself is only free for non-commercial use. See here for further details.
There are in fact two separate components:
-
summarycharts
: render a standalone collection withBigDecimal
properties as a chart. (This component can be thought of as an enhancement of the basesummary
view provided by Isis Wicket viewer). -
scalarchart
: renders a standalone scalar value (from an action invocation) as a chart
The following screenshots show the example app's usage of the component with some sample fixture data:
Note that the example entity (todo item) has two numeric (BigDecimal
) properties:
Invoking an action that returns a collection of entities:
... shows an additional button to view those entities in a summary chart:
Clicking on the button renders a chart where the values of all numeric (BigDecimal
) properties are plotted:
Arbitrary charts can be returned from any action. For example this action:
... renders a pie chart splitting out the example Todo entities by their category:
The prerequisite software is:
- Java JDK 8 (>= 1.9.0) or Java JDK 7 (<= 1.8.0) ** note that the compile source and target remains at JDK 7
- maven 3 (3.2.x is recommended).
To build the demo app:
git clone https://github.com/isisaddons/isis-wicket-wickedcharts.git
mvn clean install
To run the demo app:
mvn antrun:run -P self-host
Then log on using user: sven
, password: pass
There is no special usage; a standalone collection of any entity with one or more properties of type BigDecimal
will be rendered using the summarycharts
extension.
Any action returning the WickedChart
value type should be rendered as a chart. The WickedChart
value type is
simply a wrapper around the wicked chart's Options
class:
import com.googlecode.wickedcharts.highcharts.options.Options;
public class WickedChart implements Serializable {
private Options options;
public WickedChart(Options options) { ... }
...
}
Any chart supported by Wicked Charts (see their showcase app) should work.
You can either use this component "out-of-the-box", or you can fork this repo and extend to your own requirements.
To use "out-of-the-box", add the component to your project's dom
module's pom.xml
:
<dependency>
<groupId>org.isisaddons.wicket.wickedcharts</groupId>
<artifactId>isis-wicket-wickedcharts-cpt</artifactId>
<version>1.13.0</version>
</dependency>
Check for later releases by searching Maven Central Repo.
If you want to use the current -SNAPSHOT
, then the steps are the same as above, except:
- when updating the classpath, specify the appropriate -SNAPSHOT version:
<version>1.14.0-SNAPSHOT</version>
- add the repository definition to pick up the most recent snapshot (we use the Cloudbees continuous integration service). We suggest defining the repository in a
<profile>
:
<profile> <id>cloudbees-snapshots</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>snapshots-repo</id> <url>http://repository-estatio.forge.cloudbees.com/snapshot/</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile>
If instead you want to extend these components' functionality, then we recommend that you fork this repo. The repo is structured as follows:
pom.xml
- parent pomcpt
- the component implementationfixture
- fixtures, holding a sample domain objects and fixture scriptswebapp
- demo webapp (see above screenshots)
Only the cpt
project (and its submodules) is released to Maven central. The versions of the other modules
are purposely left at 0.0.1-SNAPSHOT
because they are not intended to be released.
Although the WickedChart
class (in the scalarchart
's API) has value semantics, it will (currently) not render as a
chart if used as an entity property.
Such a property should be persistable, however.
Therefore a workaround is to hide the property and instead provide an action to show the chart.
For example:
public class MyEntity {
private WickedChart chart;
@Hidden
public WickedChart getChart() { ... }
public void setChart(WickedChart chart) { ... }
public WickedChart showChart() {
return getChart();
}
}
1.13.0
- released against Isis 1.13.01.12.0
- released against Isis 1.12.01.11.0
- released against Isis 1.11.01.10.0
- released against Isis 1.10.01.9.0
- released against Isis 1.9.01.8.0
- released against Isis 1.8.01.7.0
- released against Isis 1.7.01.6.0
- re-released as part of isisaddons, changed package names for API toorg.isisaddons.wicket.wickedcharts
Please note that while this project and Wicked Charts are licensed under Apache 2.0 License, Highcharts itself is only free for non-commercial use. See here for further details.
Copyright 2013~2016 Dan Haywood
Licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
In addition to Apache Isis, this component depends on:
commons-codec:commons-codec
(ASL v2.0 License)com.googlecode.wicked-charts:wicked-charts-wicket6
(ASL v2.0 License)- http://highcharts.com/license (commercial license required unless personal/open source project)
Only the cpt
module is deployed, and is done so using Sonatype's OSS support (see
user guide).
To deploy a snapshot, use:
pushd cpt
mvn clean deploy
popd
The artifacts should be available in Sonatype's Snapshot Repo.
If you have commit access to this project (or a fork of your own) then you can create interim releases using the interim-release.sh
script.
The idea is that this will - in a new branch - update the dom/pom.xml
with a timestamped version (eg 1.13.0.20161017-0738
).
It then pushes the branch (and a tag) to the specified remote.
A CI server such as Jenkins can monitor the branches matching the wildcard origin/interim/*
and create a build.
These artifacts can then be published to a snapshot repository.
For example:
sh interim-release.sh 1.14.0 origin
where
1.14.0
is the base releaseorigin
is the name of the remote to which you have permissions to write to.
The release.sh
script automates the release process. It performs the following:
- performs a sanity check (
mvn clean install -o
) that everything builds ok - bumps the
pom.xml
to a specified release version, and tag - performs a double check (
mvn clean install -o
) that everything still builds ok - releases the code using
mvn clean deploy
- bumps the
pom.xml
to a specified release version
For example:
sh release.sh 1.13.0 \
1.14.0-SNAPSHOT \
dan@haywood-associates.co.uk \
"this is not really my passphrase"
where
$1
is the release version$2
is the snapshot version$3
is the email of the secret key (~/.gnupg/secring.gpg
) to use for signing$4
is the corresponding passphrase for that secret key.
Other ways of specifying the key and passphrase are available, see the pgp-maven-plugin
's
documentation).
If the script completes successfully, then push changes:
git push origin master
git push origin 1.13.0
If the script fails to complete, then identify the cause, perform a git reset --hard
to start over and fix the issue
before trying again. Note that in the dom
's pom.xml
the nexus-staging-maven-plugin
has the
autoReleaseAfterClose
setting set to true
(to automatically stage, close and the release the repo). You may want
to set this to false
if debugging an issue.
According to Sonatype's guide, it takes about 10 minutes to sync, but up to 2 hours to update search.