I have 3 variables in Y axis and I am trying to get the name of the axis according to value which I look for.
Variables are attached here. I can get the value of the variable with label, but I can't get the name of variable.
I want to write the name of the variable in front of the label. How can I find it? My code looks like:
public void chartMouseMoved(ChartMouseEvent event){
ChartEntity chartEntity = event.getEntity();
if ( chartEntity instanceof XYItemEntity) {
XYItemEntity xyItemEntity = (XYItemEntity) chartEntity;
XYDataSet xyDataSet = xyItemEntity.getDataset();
double xValue = xyDataSet .getXValue(xyItemEntity.getSeriesIndex(), xyItemEntity.getItem());
double yValue = xyDataSet .getYValue(xyItemEntity.getSeriesIndex(), xyItemEntity.getItem());
this.xCrosshair.setValue(xValue);
this.yCrosshair.setValue(yValue);
label.setText(String.format("%.2f, yValue));
label.setSize(label.getPreferredSize());
}
}
}