/** * Remove a label from the axis. */ public Axis removeLabel(String label) { if (labels == null) { throw new IllegalStateException(); } labels.remove(label); setSlice(); initGridLabels(); return this; }
/** * Add a label to the axis at given location. */ public Axis addLabel(String label, double location) { if (labels == null) { labels = new HashMap<>(); } labels.put(label, location); setSlice(); initGridLines(); initGridLabels(); return this; }
/** * Add a label to the axis at given location. */ public Axis addLabel(String[] label, double[] location) { if (label.length != location.length) { throw new IllegalArgumentException("Label size and location size don't match."); } if (labels == null) { labels = new HashMap<>(); } for (int i = 0; i < label.length; i++) { labels.put(label[i], location[i]); } setSlice(); initGridLines(); initGridLabels(); return this; }
/** * Sets the axis to its default initial value. */ private void init() { initOrigin(); setSlice(); initGridLines(); initGridLabels(); }