Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added TickPlacement Option to XAxis #125

Merged
merged 1 commit into from
Oct 4, 2021
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
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