I would like print a stock price over the date(dd/mm/yyyy).
I have this piece of code and it works fine for the price (because it is a double).
Code: Select all
@Override
public void chartMouseClicked(ChartMouseEvent event) {
// ignore
}
@Override
public void chartMouseMoved(ChartMouseEvent event) {
Rectangle2D dataArea = this.chartPanel.getScreenDataArea();
JFreeChart chart = event.getChart();
XYPlot plot = (XYPlot) chart.getPlot();
String label = xCrosshair.getLabelGenerator().generateLabel(xCrosshair);
double milliSeconds= x.java2DToValue(event.getTrigger().getX(), dataArea, RectangleEdge.BOTTOM);
double y = DatasetUtilities.findYValue(plot.getDataset(), 0, (x.java2DToValue(event.getTrigger().getX(), dataArea, RectangleEdge.TOP)));
xCrosshair.setValue(milliSeconds);
//this.xCrosshair.setValue(milliSeconds);
this.yCrosshair.setValue(y);
}
I have another peace of code which transforms the unwanted double value into the desired String date.
Could someone please explain me, how I can print the corresponding sring date (which I get by an getDateAsString()method) in my plot and not the double value?
Thank you