Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amitjoy/spider-chart-swt
Easy to use library for generating Spider Charts using SWT
https://github.com/amitjoy/spider-chart-swt
osgi spider-chart-swt spider-diagram swt
Last synced: 25 days ago
JSON representation
Easy to use library for generating Spider Charts using SWT
- Host: GitHub
- URL: https://github.com/amitjoy/spider-chart-swt
- Owner: amitjoy
- License: epl-1.0
- Created: 2016-02-03T15:48:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-31T18:14:45.000Z (about 4 years ago)
- Last Synced: 2023-06-29T20:08:58.257Z (over 1 year ago)
- Topics: osgi, spider-chart-swt, spider-diagram, swt
- Language: Java
- Homepage:
- Size: 356 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spider Chart SWT
[![Build Status](https://travis-ci.org/amitjoy/Spider-Chart-SWT.svg?branch=master)](https://travis-ci.org/amitjoy/Spider-Chart-SWT)
SWT utility library to generate Spider Chart Diagrams. The library uses all new Java 8 fluent API to generate Spider Diagram.
### How To
*In OSGi Environment (Eclipse RCP):*
Build the library using maven. You will get an OSGi bundle. You just have to install it in your Equinox runtime by just adding it to your RCP target platform.
*In Java SE:*
Build the library using maven and put the recently built jar file to your application classpath.
### Sample Usage
Check out the sample application in the project for the detailed information.
``` java
@SpiderChartPlot(name = "iPhone 6", areaColor = DARKORCHID)
public final class IPhone {@DataPoints
public double[] dataPoints() {
final double[] data = { 4, 3.5, 4, 4.6, 5 };
return data;
}}
`````` java
@SpiderChartPlot(name = "Nexus 6", areaColor = OLIVE)
public final class Nexus {@DataPoints
public double[] dataPoints() {
final double[] data = { 4, 3, 3, 4.1, 3 };
return data;
}}
`````` java
public final class Sample {enum Brand {
COMMUNAL, INTERNATIONAL, LOCAL, OUT_OF_MARKET, STANDARD
}private static SpiderChartViewer viewer;
private static void buildSpiderChart(final Shell shell) {
final Supplier iPhoneData = IPhone::new;
final Supplier nexusData = Nexus::new;viewer = SpiderChartBuilder.config(shell, settings -> {
settings.title(title -> title.setText("Smartphone Comparison Scale")).legend(legend -> {
legend.addItem(iPhoneData);
legend.addItem(nexusData);
}).plotter(plotter -> {
final AxesConfigurer configuration = new AxesConfigurer.Builder().addAxis("Battery", 5, 0)
.addAxis("Camera", 5, 0).addAxis("Display", 5, 0).addAxis("Memory", 5, 0).addAxis("Brand", 5, 0)
.build();
plotter.use(configuration);
});
}).viewer(chart -> {
chart.data(firstData -> firstData.inject(iPhoneData)).data(secondData -> secondData.inject(nexusData));
});// Updating the chart with new parameters
Display.getDefault().asyncExec(() -> {
// changing values in runtime
final LineDataSeq iPhoneDataSequence = LineDataSeq.of(iPhoneData.get(), 2.0, 4.2, 4.1, 42.8, 3.7,
Brand.INTERNATIONAL);
// Set the first sequence
viewer.getChart().getSpiderPlotter().setSeq(0, iPhoneDataSequence);// changing axes in runtime
final AxesConfigurer configuration = new AxesConfigurer.Builder().addAxis("Battery", 5, 0)
.addAxis("Screen", 5, 0).addAxis("Display", 5, 0).addAxis("Memory", 50, 0).addAxis("Sound", 5, 0)
.addAxis("Brand", Brand.class).build();final LineDataSeq nexusDataSequence = LineDataSeq.of(nexusData.get(), 2.4, 3.2, 2.1, 23.8, 1.7,
Brand.LOCAL);// Set the second sequence
viewer.getChart().getSpiderPlotter().setSeq(1, nexusDataSequence);
viewer.getChart().getSpiderPlotter().use(configuration);
viewer.getChart().getSpiderPlotter().setMarkScalesOnEveryAxis(true);
});
}public static void main(final String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display, SWT.DIALOG_TRIM);
shell.setSize(800, 750);buildSpiderChart(shell);
shell.open();while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}viewer.getChart().stopWorker();
viewer.getChart().dispose();display.dispose();
}}
```### Maven Central
```xml
com.amitinside
com.amitinside.tooling.chart.spider
1.1.0```