Skip to content

Commit

Permalink
Merge branch 'develop' into update-from-template-merged
Browse files Browse the repository at this point in the history
  • Loading branch information
xdev-gh-bot committed Jun 12, 2024
2 parents f9d8378 + 2e84fc1 commit d8cb83c
Show file tree
Hide file tree
Showing 157 changed files with 13,846 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ body:
attributes:
label: "Checklist"
options:
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/chartjs-java-model/releases/latest)"
required: true
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/chartjs-java-model/issues) or [closed](https://github.com/xdev-software/chartjs-java-model/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/chartjs-java-model/issues) or [closed](https://github.com/xdev-software/chartjs-java-model/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/chartjs-java-model/issues) or [closed](https://github.com/xdev-software/chartjs-java-model/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
required: true
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

strategy:
matrix:
java: [17, 21]
java: [11, 17, 21]
distribution: [temurin]

steps:
Expand All @@ -43,7 +43,8 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: ./mvnw -B clean package
# Java 17 is required for tests
run: ./mvnw -B clean package ${{ matrix.java >=17 && '-P run-integration-tests' || '-Dmaven.test.skip=true' }}

- name: Check for uncommited changes
run: |
Expand All @@ -70,6 +71,14 @@ jobs:
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
if-no-files-found: error

- name: Upload screenshots of test failures
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-fail-screenshots-${{ matrix.java }}
path: ${{ env.PRIMARY_MAVEN_MODULE }}/target/screenshots
if-no-files-found: ignore

code-style:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
Expand Down
2 changes: 1 addition & 1 deletion .run/Run Demo.run.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="software.xdev.Application" />
<module name="template-placeholder-demo" />
<module name="chartjs-java-model-demo" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<extension name="coverage">
<pattern>
Expand Down
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## 1.5.0
* Added ``JsonIgnore`` to certain fields to help prevent infinite loops #174
* Corrected model for ``Title`` and ``Font`` #175

## 1.4.1
* Use ``Number`` instead of ``BigDecimal`` in some additional places #159 (@aripddev)

## 1.4.0
* Simplify API by using ``Number`` instead of ``BigDecimal``, ``int`` and ``double`` for ``Datapoints`` #154 (@aripddev)

## 1.3.1
* Add subtitle option #141 (@aripddev)
* Add ``PointStyle#rectRounded`` #143 (@aripddev)
* Add ``BubbleDataset#pointStyle`` #144 (@aripddev)
* ``reverse`` property should be on the ``Scale`` object #145
* Added all available properties for ``Legend``

## 1.3.0
* Allows creation of mixed charts #128
* New chart class: ``MixedChart``
* Some classes have been renamed
* ``Data`` -> ``HomogeneousData``
* ``AbstractChart`` -> ``HomogeneousChart``
* Slim down test dependencies

## 1.2.0
* Add TimeScale and TimeTicks to allow building linear time charts #90 (@astappiev)
* Add options for the [Zoom plugin](https://www.chartjs.org/chartjs-plugin-zoom/latest/) #117 (@astappiev)
* Updated dependencies

## 1.1.3
* Add ``toJsonNative`` method which doesn't run the ``isDrawable`` check #91

## 1.1.2
* ⚠️ GroupId changed from ``com.xdev-software`` to ``software.xdev``

## 1.1.1
* ``AngleLines#lineWidth`` now uses ``BigDecimal`` #76
* Updated dependencies

## 1.1.0
* Added support for more [data structures](https://www.chartjs.org/docs/4.4.0/general/data-structures.html) inside ``Dataset#data``
* ``Dataset#data`` can now contain ``Object``s

## 1.0.2
* Support Java 11
* Updated dependencies

## 1.0.1
* Added support for [stacked bar chart with groups](https://www.chartjs.org/docs/4.4.0/samples/bar/stacked-groups.html) (@dlemaignent)

## 1.0.0
Initial release

Support for Chart.js v4

Noteworthy changes compared to [Chart.java](https://github.com/mdewilde/chart):
* Changed the package to ``software.xdev.chartjs.model``
* All charts (e.g. ``BarChart``, ``LineChart``, ...) are now inside the ``charts`` package
* Breaking API changes due to compatibility with Chart.js v4; You may checkout the migration guides
* [3.x Migration Guide](https://www.chartjs.org/docs/4.3.0/migration/v3-migration.html)
* [4.x Migration Guide](https://www.chartjs.org/docs/4.3.0/migration/v4-migration.html)
* JSON is no longer pretty printed by default due to performance reasons
* Implemented integration tests
* Requires Java 17
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ You should have the following things installed:
* Ensure that the JDK/Java-Version is correct


## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/chartjs-java-model/release.yml?branch=master)](https://github.com/xdev-software/chartjs-java-model/actions/workflows/release.yml)

Before releasing:
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
* Consider doing a [test-deployment](https://github.com/xdev-software/chartjs-java-model/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
* Check the [changelog](CHANGELOG.md)

If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes
Expand Down
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/chartjs-java-model?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/chartjs-java-model)
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/chartjs-java-model/check-build.yml?branch=develop)](https://github.com/xdev-software/chartjs-java-model/actions/workflows/check-build.yml?query=branch%3Adevelop)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_chartjs-java-model&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_chartjs-java-model)
[![ChartJS Documentation](https://img.shields.io/badge/Chart.js-documentation-ff6384?logo=Chart.js)](https://www.chartjs.org/docs/latest/)

# template-placeholder
# <img src="https://www.chartjs.org/media/logo.svg" height="38" /> chartjs-java-model
Provides Java models for [Chart.js](https://www.chartjs.org/) so that e.g. a Java Server can build a chart and then instruct a JavaScript client what needs to be shown.

This repo extends the abandoned [Chart.java](https://github.com/mdewilde/chart) and adds support for Chart.js Version 4+.

## Installation
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
[Installation guide for the latest release](https://github.com/xdev-software/chartjs-java-model/releases/latest#Installation)

#### Compatibility with Chart.js
| Chart.js | ``chartjs-java-model`` version |
| --- | --- |
| 4.x | ``1+`` |

## Support
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
Expand All @@ -15,4 +23,10 @@ If you need support as soon as possible and you can't wait for any pull request,
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.

## Dependencies and Licenses
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/chartjs-java-model/dependencies)

## Acknowledgment
* To all [contributors](https://github.com/xdev-software/chartjs-java-model/graphs/contributors) that helped to improve this library
* Especially to the devs at [PrimeTek/PrimeFaces](https://www.primefaces.org/) that regularly provide feedback and PRs

<sub>Disclaimer: This is not an official ChartJS product and not associated</sub>
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/chartjs-java-model/security/advisories/new).
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>

<groupId>software.xdev</groupId>
<artifactId>template-placeholder-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>chartjs-java-model-demo</artifactId>
<version>1.5.1-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand All @@ -15,7 +15,7 @@
</organization>

<properties>
<javaVersion>17</javaVersion>
<javaVersion>11</javaVersion>
<maven.compiler.release>${javaVersion}</maven.compiler.release>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -27,7 +27,7 @@
<dependencies>
<dependency>
<groupId>software.xdev</groupId>
<artifactId>template-placeholder</artifactId>
<artifactId>chartjs-java-model</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package software.xdev;

import java.awt.Desktop;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;

import software.xdev.chartjs.model.charts.BarChart;
import software.xdev.chartjs.model.charts.Chart;
import software.xdev.chartjs.model.data.BarData;
import software.xdev.chartjs.model.dataset.BarDataset;
import software.xdev.chartjs.model.options.BarOptions;


public final class Application
{
private Application()
{
}

public static void main(final String[] args)
{
final BarData data = new BarData();
data.addLabels("A", "B", "C");
data.addDataset(new BarDataset()
.setLabel("Dataset1")
.setData(1, 3, 2));

createAndOpenTestFile(new BarChart()
.setData(data)
.setOptions(new BarOptions()));
}

@SuppressWarnings("java:S5443") // Only a demo nothing sensitive is here
private static void createAndOpenTestFile(final Chart<?, ?, ?> chart)
{
try
{
final Path tmp = Files.createTempFile("chart_test_", ".html");

Files.writeString(
tmp,
String.format("<!DOCTYPE html>\n"
+ "<html lang='en'>\n"
+ "\t<head>\n"
+ "\t\t<meta charset='UTF-8'>\n"
+ "\t\t<script src=\"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.3.0/chart.umd"
+ ".js\"></script>\n"
+ "\t</head>\n"
+ "\t<body>\n"
+ "\t\t<canvas id='c' style='border:1px solid #555;'></canvas>\n"
+ "\t\t<script>\n"
+ "\t\t\tnew Chart(document.getElementById('c').getContext('2d'), %s);\n"
+ "\t\t</script>\n"
+ "\t</body>\n"
+ "</html>", chart.toJson())
);

Desktop.getDesktop().browse(tmp.toUri());
}
catch(final IOException e)
{
throw new UncheckedIOException(e);
}
}
}
Loading

0 comments on commit d8cb83c

Please sign in to comment.