https://github.com/leftshiftone/chartscript
ChartScript is an open source software library for script based chart generation.
https://github.com/leftshiftone/chartscript
chart-library charts jfreechart
Last synced: about 2 months ago
JSON representation
ChartScript is an open source software library for script based chart generation.
- Host: GitHub
- URL: https://github.com/leftshiftone/chartscript
- Owner: leftshiftone
- License: apache-2.0
- Created: 2020-02-22T01:41:27.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-09T14:58:24.000Z (almost 5 years ago)
- Last Synced: 2023-07-05T16:43:02.139Z (over 2 years ago)
- Topics: chart-library, charts, jfreechart
- Language: Kotlin
- Homepage:
- Size: 217 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://circleci.com/gh/leftshiftone/chartscript)
[](https://github.com/leftshiftone/chartscript/tags)
[](https://mvnrepository.com/artifact/one.leftshift.chartscript/chartscript)
# ChartScript
ChartScript is an open source software library for script based chart generation.
Each chart can be fully customized by the chartscript DSL.
## PieChart
A pie chart definition can be started by the function **piechart**.
```kotlin
piechart{
value("Java", 17)
value("C/C++", 10)
value("Python", 7)
value("C#", 5)
value("Javascript", 3)
}
```
The **piechart** function accepts a **style callback** in order to modify style settings.
```kotlin
piechart({backgroundPaint("blue")}){
value("Java", 17)
value("C/C++", 10)
value("Python", 7)
value("C#", 5)
value("Javascript", 3)
}
```
The **style callback** accepts the following properties:
| signature | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **title**(title:String) | Sets the title of the chart |
| **backgroundPaint**(paint:String) | Sets the background paint via a css compliant color string |
| **labelBackgroundPaint**(paint:String) | Sets the background paint of the labels via a css compliant color string |
| **labelOutlinePaint**(paint:String) | Sets the paint of the label outline via a css compliant color string |
| **labelShadowPaint**(paint:String) | Sets the paint of the label shadow via a css compliant color string |
| **shadowPaint**(paint:String) | Sets the paint of the chart shadow via a css compliant color string |
| **isOutlineVisible**(visible:Boolean) | Indicates if the chart outline is visible |
| **borderPaint**(paint:String) | Sets the paint of the chart border via a css compliant color string |
| **labelPaint**(paint:String) | Sets the paint of the labels via a css compliant color string |
| **labelLinkStroke**(width:Number) | Sets the stroke of the label link |
| **labelOutlineStroke**(width:Number) | Sets the stroke of the label outline |
| **outlineStroke**(width:Number) | Sets the stroke of the chart outline |
| **borderStroke**(width:Number) | Sets the stroke of the chart border |
| **antiAlias**(b:Boolean) | Indicates if anti alias is enabled |
| **isBorderVisible**(b:Boolean) | Indicates if the border is visible |
| **simpleLabels**(b:Boolean) | Indicates if labels are in the segments |
| **labelFont**(font:String, size:Number) | Sets the font for the labels |
| **legendPosition**(position:String) | Sets the position of the legend. Possible values are "bottom", "left", "right" and "top" |
| **legendShape**(shape:String) | Sets the shape of the legend items. Possible values are "box" and "circle" |
| **legendFont**(font:String, size: Number) | Sets the font of the legend items. |
| **labelFormat**(format:String) | Sets the format of the labels. Possible string placeholders are {0} (value), {1} (amount) and {2} (percent) |
Each **value** of a piechart accepts a **value style callback** in order to modify value specific style settings.
```kotlin
piechart {
value("Java", 17) {background("blue")}
value("C/C++", 10)
value("Python", 7)
value("C#", 5)
value("Javascript", 3)
}
```
The **value style callback** accepts the following properties:
| signature | Description |
| -----------------------------------| ------------------------------------------------------------------------------------------------------------ |
| **background**(paint:String) | Sets the background of the value slice via a css compliant color string |
| **explodePercent**(percent:Number) | Sets the amount of space between the value slice and all other value slices |
## BarChart
A bar chart definition can be started by the function **barchart**.
```kotlin
barchart("labelX", "labelY"){
value(10, 15, 20)
value(5, 17, 12)
value(14, 19, 27)
}
```
The **barchart** function accepts a **style callback** in order to modify style settings.
```kotlin
barchart("labelX", "labelY", {vertical(false)}){
value(10, 15, 20)
value(5, 17, 12)
value(14, 19, 27)
}
```
The **style callback** accepts the following properties:
| signature | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **title**(title:String) | Sets the title of the chart |
| **backgroundPaint**(paint:String) | Sets the background paint via a css compliant color string |
| **isOutlineVisible**(visible:Boolean) | Indicates if the chart outline is visible |
| **borderPaint**(paint:String) | Sets the paint of the chart border via a css compliant color string |
| **outlineStroke**(width:Number) | Sets the stroke of the chart outline |
| **borderStroke**(width:Number) | Sets the stroke of the chart border |
| **antiAlias**(b:Boolean) | Indicates if anti alias is enabled |
| **isBorderVisible**(b:Boolean) | Indicates if the border is visible |
| **legendPosition**(position:String) | Sets the position of the legend. Possible values are "bottom", "left", "right" and "top" |
| **legendFont**(font:String, size: Number) | Sets the font of the legend items. |
| **vertical**(b:Boolean) | Indicates if the plot orientation is vertical or horizontal |
| **seriesPaint**(series:Int, paint:String) | Sets the paint of a series via a css compliant color string |
## Development
### Release
Releases are triggered locally. Just a tag will be pushed and CI pipelines take care of the rest.
#### Major
Run `./gradlew final -x sendReleaseEmail -Prelease.scope=major` locally.
#### Minor
Run `./gradlew final -x sendReleaseEmail -Prelease.scope=minor` locally.
#### Patch
Run `./gradlew final -x sendReleaseEmail -Prelease.scope=patch` locally.