Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/checkBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: ./mvnw -B clean package -P run-integration-tests
# 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 Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 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
* Add options for the [Zoom plugin](https://www.chartjs.org/chartjs-plugin-zoom/latest/) #117
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how

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

<sub>Disclaimer: This is not an official ChartJS product and not associated</sub>
2 changes: 1 addition & 1 deletion chartjs-java-model-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>chartjs-java-model-demo</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand Down
28 changes: 24 additions & 4 deletions chartjs-java-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>chartjs-java-model</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>chartjs-java-model</name>
Expand Down Expand Up @@ -139,6 +139,19 @@
<artifactId>testcontainers</artifactId>
<version>${testcontainers-version}</version>
<scope>test</scope>
<exclusions>
<!-- No JUnit 4 -->
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.xdev</groupId>
<artifactId>testcontainers-junit4-mock</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
Expand All @@ -147,9 +160,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>selenium</artifactId>
<version>${testcontainers-version}</version>
<groupId>software.xdev</groupId>
<artifactId>testcontainers-selenium</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -159,6 +172,13 @@
<artifactId>selenium-chrome-driver</artifactId>
<version>4.20.0</version>
<scope>test</scope>
<exclusions>
<!-- Tracing is not needed -->
<exclusion>
<groupId>io.opentelemetry</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;

import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.AbstractData;
import software.xdev.chartjs.model.options.Options;


public abstract class AbstractChart<T, O extends Options<O, ?>, D extends Data<D, ?>>
public abstract class AbstractChart<T, O extends Options<?, ?>, D extends AbstractData<?, ?>>
implements Chart<T, O, D>
{
protected D data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.BarData;
import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.dataset.BarDataset;
import software.xdev.chartjs.model.options.BarOptions;
import software.xdev.chartjs.model.options.Options;


public class BarChart extends AbstractChart<BarChart, BarOptions, BarData>
public class BarChart extends HomogeneousChart<BarChart, BarOptions, BarData>
{
public BarChart()
{
Expand All @@ -39,7 +39,7 @@ public BarChart(final BarData data, final BarOptions options)
}

/**
* Static factory, constructs an {@link Data} implementation appropriate for a {@link BarChart}.
* Static factory, constructs an {@link HomogeneousData} implementation appropriate for a {@link BarChart}.
*
* @return a new {@link BarData} instance
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.BubbleData;
import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.options.BubbleOptions;
import software.xdev.chartjs.model.options.Options;


public class BubbleChart extends AbstractChart<BubbleChart, BubbleOptions, BubbleData>
public class BubbleChart extends HomogeneousChart<BubbleChart, BubbleOptions, BubbleData>
{
public BubbleChart()
{
Expand All @@ -38,7 +38,7 @@ public BubbleChart(final BubbleData data, final BubbleOptions options)
}

/**
* Static factory, constructs an {@link Data} implementation appropriate for a {@link BubbleChart}.
* Static factory, constructs an {@link HomogeneousData} implementation appropriate for a {@link BubbleChart}.
*
* @return a new {@link BubbleData} instance
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

import com.fasterxml.jackson.annotation.JsonProperty;

import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.AbstractData;
import software.xdev.chartjs.model.options.Options;


@SuppressWarnings("java:S119") // SELF means the Chart itself... Not a problem
public interface Chart<SELF, O extends Options<O, ?>, D extends Data<D, ?>>
public interface Chart<SELF, O extends Options<?, ?>, D extends AbstractData<?, ?>>
{
/**
* @return type of this {@link Chart} implementation for proper drawing in JavaScript.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.DoughnutData;
import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.options.DoughnutOptions;
import software.xdev.chartjs.model.options.Options;


public class DoughnutChart extends AbstractChart<DoughnutChart, DoughnutOptions, DoughnutData>
public class DoughnutChart extends HomogeneousChart<DoughnutChart, DoughnutOptions, DoughnutData>
{
public DoughnutChart()
{
Expand All @@ -38,7 +38,7 @@ public DoughnutChart(final DoughnutData data, final DoughnutOptions options)
}

/**
* Static factory, constructs an {@link Data} implementation appropriate for a {@link DoughnutChart}.
* Static factory, constructs an {@link HomogeneousData} implementation appropriate for a {@link DoughnutChart}.
*
* @return a new {@link DoughnutData} instance
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright © 2023 XDEV Software (https://xdev.software)
*
* 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.
*/
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.options.Options;


public abstract class HomogeneousChart<T, O extends Options<O, ?>, D extends HomogeneousData<D, ?>>
extends AbstractChart<T, O, D>
{
protected HomogeneousChart()
{
}

protected HomogeneousChart(final D data)
{
super(data);
}

protected HomogeneousChart(final D data, final O options)
{
super(data, options);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.data.LineData;
import software.xdev.chartjs.model.dataset.LineDataset;
import software.xdev.chartjs.model.options.LineOptions;
import software.xdev.chartjs.model.options.Options;


public class LineChart extends AbstractChart<LineChart, LineOptions, LineData>
public class LineChart extends HomogeneousChart<LineChart, LineOptions, LineData>
{
public LineChart()
{
Expand All @@ -39,7 +39,7 @@ public LineChart(final LineData data, final LineOptions options)
}

/**
* Static factory, constructs an {@link Data} implementation appropriate for a {@link LineChart}.
* Static factory, constructs an {@link HomogeneousData} implementation appropriate for a {@link LineChart}.
*
* @return a new {@link LineData} instance
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright © 2023 XDEV Software (https://xdev.software)
*
* 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.
*/
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.MixedData;
import software.xdev.chartjs.model.options.Options;


/**
* Allows creation of <a href="https://www.chartjs.org/docs/latest/charts/mixed.html">mixed chart types</a>
*/
public class MixedChart extends AbstractChart<MixedChart, Options<?, ?>, MixedData>
{
protected String type;

public MixedChart setType(final String type)
{
this.type = type;
return this.self();
}

@Override
public String getType()
{
return this.type;
}

@Override
public boolean isDrawable()
{
// Warning: Unchecked
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.data.PieData;
import software.xdev.chartjs.model.dataset.PieDataset;
import software.xdev.chartjs.model.options.Options;
import software.xdev.chartjs.model.options.PieOptions;


public class PieChart extends AbstractChart<PieChart, PieOptions, PieData>
public class PieChart extends HomogeneousChart<PieChart, PieOptions, PieData>
{
public PieChart()
{
Expand All @@ -39,7 +39,7 @@ public PieChart(final PieData data, final PieOptions options)
}

/**
* Static factory, constructs an {@link Data} implementation appropriate for a {@link PieChart}.
* Static factory, constructs an {@link HomogeneousData} implementation appropriate for a {@link PieChart}.
*
* @return a new {@link PieData} instance
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.data.PolarData;
import software.xdev.chartjs.model.dataset.PolarDataset;
import software.xdev.chartjs.model.options.Options;
import software.xdev.chartjs.model.options.PolarOptions;


public class PolarChart extends AbstractChart<PolarChart, PolarOptions, PolarData>
public class PolarChart extends HomogeneousChart<PolarChart, PolarOptions, PolarData>
{
public PolarChart()
{
Expand All @@ -39,7 +39,7 @@ public PolarChart(final PolarData data, final PolarOptions options)
}

/**
* Static factory, constructs an {@link Data} implementation appropriate for a {@link PolarChart}.
* Static factory, constructs an {@link HomogeneousData} implementation appropriate for a {@link PolarChart}.
*
* @return a new {@link PolarData} instance
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package software.xdev.chartjs.model.charts;

import software.xdev.chartjs.model.data.Data;
import software.xdev.chartjs.model.data.HomogeneousData;
import software.xdev.chartjs.model.data.RadarData;
import software.xdev.chartjs.model.dataset.RadarDataset;
import software.xdev.chartjs.model.options.Options;
import software.xdev.chartjs.model.options.RadarOptions;


public class RadarChart extends AbstractChart<RadarChart, RadarOptions, RadarData>
public class RadarChart extends HomogeneousChart<RadarChart, RadarOptions, RadarData>
{
public RadarChart()
{
Expand All @@ -39,7 +39,7 @@ public RadarChart(final RadarData data, final RadarOptions options)
}

/**
* Static factory, constructs an {@link Data} implementation appropriate for a {@link RadarChart}.
* Static factory, constructs an {@link HomogeneousData} implementation appropriate for a {@link RadarChart}.
*
* @return a new {@link RadarData} instance
*/
Expand Down
Loading