Skip to content

Commit

Permalink
added TickPlacement Option to XAxis (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
fynnfluegge authored Oct 4, 2021
1 parent c4b2ad9 commit 038c95f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class XAxis {
private AxisBorder axisBorder;
private AxisTicks axisTicks;
private BigDecimal tickAmount;
private TickPlacement tickPlacement;
private Double min;
private Double max;
private Double range;
Expand Down Expand Up @@ -44,6 +45,10 @@ public BigDecimal getTickAmount() {
return tickAmount;
}

public TickPlacement getTickPlacement() {
return tickPlacement;
}

public Double getMin() {
return min;
}
Expand Down Expand Up @@ -100,6 +105,10 @@ public void setTickAmount(BigDecimal tickAmount) {
this.tickAmount = tickAmount;
}

public void setTickPlacement(TickPlacement tickPlacement) {
this.tickPlacement = tickPlacement;
}

public void setMin(Double min) {
this.min = min;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class XAxisBuilder {
private AxisBorder axisBorder;
private AxisTicks axisTicks;
private BigDecimal tickAmount;
private TickPlacement tickPlacement;
private Double min;
private Double max;
private Double range;
Expand Down Expand Up @@ -61,6 +62,11 @@ public XAxisBuilder withTickAmount(BigDecimal tickAmount) {
return this;
}

public XAxisBuilder withTickPlacement(TickPlacement tickPlacement) {
this.tickPlacement = tickPlacement;
return this;
}

public XAxisBuilder withMin(Double min) {
this.min = min;
return this;
Expand Down Expand Up @@ -113,6 +119,7 @@ public XAxis build() {
xAxis.setAxisBorder(axisBorder);
xAxis.setAxisTicks(axisTicks);
xAxis.setTickAmount(tickAmount);
xAxis.setTickPlacement(tickPlacement);
xAxis.setMin(min);
xAxis.setMax(max);
xAxis.setRange(range);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.github.appreciated.apexcharts.config.xaxis;

public enum TickPlacement {
between("between"),
on("on");
private final String name;

TickPlacement(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.github.appreciated.apexcharts.config.chart.builder.ZoomBuilder;
import com.github.appreciated.apexcharts.config.grid.builder.RowBuilder;
import com.github.appreciated.apexcharts.config.stroke.Curve;
import com.github.appreciated.apexcharts.config.xaxis.TickPlacement;
import com.github.appreciated.apexcharts.helper.Series;

public class LineChartExample extends ApexChartsBuilder {
Expand All @@ -29,6 +30,7 @@ public LineChartExample() {
).build())
.withXaxis(XAxisBuilder.get()
.withCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep")
.withTickPlacement(TickPlacement.between)
.build())
.withSeries(new Series<>("Desktops", 10.0, 41.0, 35.0, 51.0, 49.0, 62.0, 69.0, 91.0, 148.0));
}
Expand Down

0 comments on commit 038c95f

Please sign in to comment.