You can use the NumberAxis class of JFreeChart with NumberFormat for Y axis to format the values as desired and also DateAxis class of JFreeChart with SimpleDateFormat to format the value of X axis
Let's take an example below:
2/
private void buildRangeAxis(JFreeChart chart) {
XYPlot plot = chart.getXYPlot();
ValueAxis valueAxis = plot.getRangeAxis();
if (valueAxis instanceof NumberAxis) {
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
NumberFormat numberFormat = null;
double maxValue = graph.getMaxValue();
if (maxValue < 1000) { // Bps
numberFormat = new DecimalFormat("0 B");
} else if (maxValue >= 1000 && maxValue <= 999999) { // Kbps
numberFormat = new DecimalFormat("0.0 K");
} else if (maxValue >= 1000000 && maxValue <= 999999999) { // Mbps
numberFormat = new DecimalFormat("0.0 M");
} else { // Gbps
numberFormat = new DecimalFormat("0.0 G");
}
axis.setNumberFormatOverride(numberFormat);
valueAxis.setTickLabelFont(new Font(graphInfo.getFont(), Font.PLAIN ,

);
valueAxis.setAutoRange(true);
}
}
3/
private void buildDomainAxis(JFreeChart chart) {
XYPlot plot = chart.getXYPlot();
ValueAxis domainAxis = plot.getDomainAxis();
if (domainAxis instanceof DateAxis) {
//MyDateAxis dateAxis = new MyDateAxis(null);
DateAxis dateAxis = (DateAxis) domainAxis;
String dateFormat = graph.getDomainAxisFormat();
// Set the date format of domain axis
dateAxis.setDateFormatOverride(new SimpleDateFormat(dateFormat));
dateAxis.setTickMarkPosition(DateTickMarkPosition.START);
dateAxis.setLowerMargin(0.05D);
dateAxis.setUpperMargin(0.05D);
// Set the tick unit
DateFormat formatter = new SimpleDateFormat(graph.getDomainAxisFormat());
DateTickUnit unit = null;
if (graph.getDomainAxisType() == DomainAxisType.SECOND) { // daily graph
unit = new DateTickUnit(DateTickUnit.HOUR, 4, formatter);
} else if (graph.getDomainAxisType() == DomainAxisType.DAY) { // weekly graph
unit = new DateTickUnit(DateTickUnit.DAY, 1, formatter);
} else if (graph.getDomainAxisType() == DomainAxisType.WEEK) { // monthly graph
unit = new DateTickUnit(DateTickUnit.DAY, 7, formatter);
} else if (graph.getDomainAxisType() == DomainAxisType.MONTH) { // yearly graph
unit = new DateTickUnit(DateTickUnit.DAY, 30, formatter);
} else { // default graph
unit = new DateTickUnit(DateTickUnit.HOUR, 2, formatter);
}
dateAxis.setTickUnit(unit);
/** Set the font */
dateAxis.setTickLabelFont(new Font(graphInfo.getFont(), Font.PLAIN ,

);
dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
plot.setDomainAxis(dateAxis);
}
}