0

I try to get mouse cursor values in Java Chart. I have two variables on Y axis and I have one variable on X axis. My y axis variables looks like: enter image description here and I use crosshair to get the values of axis. My code is attached below.

@Override
public void chartMouseMoved(ChartMouseEvent event){
  ChartEntity chartEntity = event.getEntity();
  if(chartEntity instanceof XYItemEntity)
  {
     XYItemEntity xyItemEntity = (XYItemEntity) chartEntity;
     XYDataset xyDataSet = xyItemEntity.getDataset();
     this.xCrosshair.setValue(xyDataSet.getXValue(xyItemEntity.getSeriesIndex(), 
     xyItemEntity.getItem()));
     this.yCrosshair.setValue(xyDataSet.getYValue(xyItemEntity.getSeriesIndex(), 
     xyItemEntity.getItem()));

  }

When I put my mouse to values of temperature I can get these values but when I put my values of power, I can't get the values. Here is the example of temperature values :enter image description here As you can see I got temperature value 19.215 and here is the example of power :enter image description here I can't get the value. How can I get rid of this problem and how can I get all values of two axis?

shnnens
  • 11
  • 2
  • A similar issue is examined in a series of questions [here](https://stackoverflow.com/q/64266993/230513), [here](https://stackoverflow.com/q/64217855/230513), [here](https://stackoverflow.com/q/64201748/230513) and [here](https://stackoverflow.com/q/64148281/230513). – trashgod Feb 07 '22 at 18:23
  • You can look up the power and display it with temperature in your implementation of `generateLabel()`, shown in the examples cited. – trashgod Feb 08 '22 at 18:18

0 Answers0