Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/knowm/XChart into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
timmolter committed Apr 25, 2024
2 parents 446ca07 + 08db492 commit f2a5856
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void main(String[] args) {

ExampleChart<HeatMapChart> exampleChart = new HeatMapChart05();
HeatMapChart chart = exampleChart.getChart();
new SwingWrapper<HeatMapChart>(chart).displayChart();
new SwingWrapper<>(chart).displayChart();
}

@Override
Expand All @@ -45,18 +45,21 @@ public HeatMapChart getChart() {
.yAxisTitle("Working day")
.build();

chart.getStyler().setPlotContentSize(0.999);
chart.getStyler().setLegendFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
chart.getStyler().setToolTipsEnabled(true);
chart.getStyler().setPiecewise(true);
chart.getStyler().setPiecewiseRanged(false);
chart.getStyler().setShowValue(true);
chart.getStyler().setHeatMapDecimalValueFormatter(x -> "\u2265 " + x);
chart.getStyler()
.setPlotContentSize(0.999)
.setLegendFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12))
.setToolTipsEnabled(true);
chart
.getStyler()
.setPiecewise(true)
.setPiecewiseRanged(false)
.setShowValue(true)
.setHeatMapDecimalValueFormatter(x -> "\u2265 " + x);

Color[] rangeColors = {Color.YELLOW, Color.CYAN, Color.GREEN, Color.BLUE, Color.RED};
chart.getStyler().setRangeColors(rangeColors);

List<String> xData = new ArrayList<String>();
List<String> xData = new ArrayList<>();
xData.add("Tim");
xData.add("Tom");
xData.add("Lida");
Expand All @@ -65,10 +68,10 @@ public HeatMapChart getChart() {
xData.add("Lukas");
xData.add("Marie");

List<String> yData = new ArrayList<String>();
List<String> yData = new ArrayList<>();
yData.add("Monday");
yData.add("Tuesday");
yData.add("Wedesday");
yData.add("Wednesday");
yData.add("Thursday");
yData.add("Friday");

Expand Down
15 changes: 10 additions & 5 deletions xchart/src/main/java/org/knowm/xchart/style/AxesChartStyler.java
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,10 @@ public int getXAxisMaxLabelCount() {
return xAxisMaxLabelCount;
}

public void setXAxisMaxLabelCount(int xAxisMaxLabelCount) {
public AxesChartStyler setXAxisMaxLabelCount(int xAxisMaxLabelCount) {

this.xAxisMaxLabelCount = xAxisMaxLabelCount;
return this;
}

// Chart Plot Area ///////////////////////////////
Expand Down Expand Up @@ -795,18 +796,20 @@ public Function<Double, String> getxAxisTickLabelsFormattingFunction() {
return xAxisTickLabelsFormattingFunction;
}

public void setxAxisTickLabelsFormattingFunction(
public AxesChartStyler setxAxisTickLabelsFormattingFunction(
Function<Double, String> xAxisTickLabelsFormattingFunction) {
this.xAxisTickLabelsFormattingFunction = xAxisTickLabelsFormattingFunction;
return this;
}

public Function<Double, String> getyAxisTickLabelsFormattingFunction() {
return yAxisTickLabelsFormattingFunction;
}

public void setyAxisTickLabelsFormattingFunction(
public AxesChartStyler setyAxisTickLabelsFormattingFunction(
Function<Double, String> yAxisTickLabelsFormattingFunction) {
this.yAxisTickLabelsFormattingFunction = yAxisTickLabelsFormattingFunction;
return this;
}

// TickLabels and MarksColor colors for xAxis, yAxis, yAxisGroup ////////////////////////////////
Expand Down Expand Up @@ -903,19 +906,21 @@ public TextAlignment getXAxisLabelAlignment() {
return xAxisLabelAlignment;
}

public void setXAxisLabelAlignment(TextAlignment xAxisLabelAlignment) {
public AxesChartStyler setXAxisLabelAlignment(TextAlignment xAxisLabelAlignment) {

this.xAxisLabelAlignment = xAxisLabelAlignment;
return this;
}

public TextAlignment getXAxisLabelAlignmentVertical() {

return xAxisLabelAlignmentVertical;
}

public void setXAxisLabelAlignmentVertical(TextAlignment xAxisLabelAlignmentVertical) {
public AxesChartStyler setXAxisLabelAlignmentVertical(TextAlignment xAxisLabelAlignmentVertical) {

this.xAxisLabelAlignmentVertical = xAxisLabelAlignmentVertical;
return this;
}

public TextAlignment getYAxisLabelAlignment() {
Expand Down
3 changes: 2 additions & 1 deletion xchart/src/main/java/org/knowm/xchart/style/BoxStyler.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ public BoxplotCalCulationMethod getBoxplotCalCulationMethod() {
return boxplotCalCulationMethod;
}

public void setBoxplotCalCulationMethod(BoxplotCalCulationMethod boxplotCalCulationMethod) {
public BoxStyler setBoxplotCalCulationMethod(BoxplotCalCulationMethod boxplotCalCulationMethod) {

this.boxplotCalCulationMethod = boxplotCalCulationMethod;
return this;
}

/** Box plot calculation method, method for determining the position of the quartile */
Expand Down
11 changes: 7 additions & 4 deletions xchart/src/main/java/org/knowm/xchart/style/HeatMapStyler.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ public void setAllStyles() {
}

@Override
public Styler setLegendPosition(LegendPosition legendPosition) {
public HeatMapStyler setLegendPosition(LegendPosition legendPosition) {

if (!LegendPosition.OutsideE.equals(legendPosition)
&& !LegendPosition.OutsideS.equals(legendPosition)) {
throw new IllegalArgumentException(
"HeatMapStyler LegendPosition must be OutsideE or OutsideS!!!");
}
return super.setLegendPosition(legendPosition);
super.setLegendPosition(legendPosition);
return this;
}

public boolean isPiecewise() {
Expand Down Expand Up @@ -233,19 +234,21 @@ public Function<Double, String> getHeatMapDecimalValueFormatter() {
return heatMapDecimalValueFormatter;
}

public void setHeatMapDecimalValueFormatter(
public HeatMapStyler setHeatMapDecimalValueFormatter(
Function<Double, String> heatMapDecimalValueFormatter) {
this.heatMapDecimalValueFormatter = heatMapDecimalValueFormatter;
return this;
}

public boolean isPiecewiseRanged() {
return isPiecewiseRanged;
}

public void setPiecewiseRanged(boolean piecewiseRanged) {
public HeatMapStyler setPiecewiseRanged(boolean piecewiseRanged) {
if (piecewiseRanged) {
setPiecewise(true);
}
isPiecewiseRanged = piecewiseRanged;
return this;
}
}
3 changes: 2 additions & 1 deletion xchart/src/main/java/org/knowm/xchart/style/PieStyler.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ public double getLabelsDistance() {
*
* @param labelsDistance
*/
public void setLabelsDistance(double labelsDistance) {
public PieStyler setLabelsDistance(double labelsDistance) {

this.labelsDistance = labelsDistance;
return this;
}

public LabelType getLabelType() {
Expand Down
27 changes: 18 additions & 9 deletions xchart/src/main/java/org/knowm/xchart/style/RadarStyler.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,89 +117,98 @@ public boolean isRadiiTicksMarksVisible() {
return radiiTicksMarksVisible;
}

public void setRadiiTicksMarksVisible(boolean radiiTicksMarksVisible) {
public RadarStyler setRadiiTicksMarksVisible(boolean radiiTicksMarksVisible) {

this.radiiTicksMarksVisible = radiiTicksMarksVisible;
return this;
}

public Color getRadiiTickMarksColor() {

return radiiTickMarksColor;
}

public void setRadiiTickMarksColor(Color radiiTickMarksColor) {
public RadarStyler setRadiiTickMarksColor(Color radiiTickMarksColor) {

this.radiiTickMarksColor = radiiTickMarksColor;
return this;
}

public BasicStroke getRadiiTickMarksStroke() {

return radiiTickMarksStroke;
}

public void setRadiiTickMarksStroke(BasicStroke radiiTickMarksStroke) {
public RadarStyler setRadiiTickMarksStroke(BasicStroke radiiTickMarksStroke) {

this.radiiTickMarksStroke = radiiTickMarksStroke;
return this;
}

public boolean isRadiiTitleVisible() {

return isRadiiTitleVisible;
}

public void setRadiiTitleVisible(boolean radiiTitleVisible) {
public RadarStyler setRadiiTitleVisible(boolean radiiTitleVisible) {

this.isRadiiTitleVisible = radiiTitleVisible;
return this;
}

public Font getRadiiTitleFont() {

return radiiTitleFont;
}

public void setRadiiTitleFont(Font radiiTitleFont) {
public RadarStyler setRadiiTitleFont(Font radiiTitleFont) {

this.radiiTitleFont = radiiTitleFont;
return this;
}

public int getRadiiTitlePadding() {

return radiiTitlePadding;
}

public void setRadiiTitlePadding(int radiiTitlePadding) {
public RadarStyler setRadiiTitlePadding(int radiiTitlePadding) {

this.radiiTitlePadding = radiiTitlePadding;
return this;
}

public int getRadiiTickMarksCount() {

return radiiTickMarksCount;
}

public void setRadiiTickMarksCount(int radiiTickMarksCount) {
public RadarStyler setRadiiTickMarksCount(int radiiTickMarksCount) {

this.radiiTickMarksCount = radiiTickMarksCount;
return this;
}

public boolean isSeriesFilled() {

return isSeriesFilled;
}

public void setSeriesFilled(boolean seriesFilled) {
public RadarStyler setSeriesFilled(boolean seriesFilled) {

this.isSeriesFilled = seriesFilled;
return this;
}

public RadarRenderStyle getRadarRenderStyle() {

return radarRenderStyle;
}

public void setRadarRenderStyle(RadarRenderStyle radarRenderStyle) {
public RadarStyler setRadarRenderStyle(RadarRenderStyle radarRenderStyle) {

this.radarRenderStyle = radarRenderStyle;
return this;
}

public enum RadarRenderStyle {
Expand Down
Loading

0 comments on commit f2a5856

Please sign in to comment.