0

My Y axis values on a line chart are for example ranging from 645,000 to 667,500. I would like to be able to add units to the value, such as 645K, to shorten the length of the legend.

I have seen a similar question asked, but the answer given did not provide complete code and was not very helpful.

I appreciate any help.

user949229
  • 51
  • 2

1 Answers1

1

You can use setNumberFormatOverride() and pass in a suitable NumberFormat, such as the one shown here for MILLIONS.

NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setNumberFormatOverride(new NumberFormat(){…});
Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045