diff --git a/jsplot/src/main/java/tech/tablesaw/plotly/components/TickSettings.java b/jsplot/src/main/java/tech/tablesaw/plotly/components/TickSettings.java index c39c2bf24..9ddb74907 100644 --- a/jsplot/src/main/java/tech/tablesaw/plotly/components/TickSettings.java +++ b/jsplot/src/main/java/tech/tablesaw/plotly/components/TickSettings.java @@ -51,7 +51,7 @@ public String toString() { /** Controls the display of prefixes, suffixes, and exponents on ticks */ public enum DisplayRules { - ALL("outside"), + ALL("all"), FIRST("first"), LAST("last"), NONE("none"); @@ -132,6 +132,7 @@ public String toString() { private final int angle; private final String prefix; private final String suffix; + private final String format; private final boolean autoMargin; private final DisplayRules showPrefix; private final DisplayRules showSuffix; @@ -167,6 +168,7 @@ private TickSettings(TickSettingsBuilder builder) { angle = builder.angle; prefix = builder.prefix; suffix = builder.suffix; + format = builder.format; mirror = builder.mirror; separateThousands = builder.separateThousands; } @@ -204,6 +206,7 @@ protected void updateContext(Map context) { context.put("suffix", suffix); context.put("showPrefix", showPrefix); context.put("showSuffix", showSuffix); + context.put("format", format); context.put("angle", angle); context.put("autoMargin", autoMargin); context.put("tickMode", tickMode); @@ -239,6 +242,7 @@ public static class TickSettingsBuilder { private boolean autoMargin = true; private DisplayRules showPrefix = ALL; private DisplayRules showSuffix = ALL; + private String format; private Mirror mirror; private boolean separateThousands; @@ -399,6 +403,11 @@ public TickSettings.TickSettingsBuilder suffix(String suffix) { return this; } + public TickSettings.TickSettingsBuilder format(String format) { + this.format = format; + return this; + } + /** * TODO: this is pretty hack-y. Add a separate method for dealing with dates and maybe clean up * logs too diff --git a/jsplot/src/main/resources/axis_template.html b/jsplot/src/main/resources/axis_template.html index 757e9427a..e8d20b155 100644 --- a/jsplot/src/main/resources/axis_template.html +++ b/jsplot/src/main/resources/axis_template.html @@ -28,6 +28,21 @@ {% if tick0 is not null %} tick0: '{{tick0}}', {% endif %} +{% if showPrefix is not null %} + showtickprefix: '{{showPrefix}}', +{% endif %} +{% if showSuffix is not null %} + showticksuffix: '{{showSuffix}}', +{% endif %} +{% if prefix is not null %} + tickprefix: '{{prefix}}', +{% endif %} +{% if suffix is not null %} + ticksuffix: '{{suffix}}', +{% endif %} +{% if format is not null %} + tickformat: '{{format}}', +{% endif %} {% if showExponent is not null %} showExponent: '{{showExponent}}', {% endif %}