Hi,
I am having an issue that I don't quite understand. I am trying to write a weather station application for a weather station that outputs serial data.
I am trying to use the CompassPlot class to show the current wind direction. The issue is that the weather station uses a range of 0 to 255 to indicate wind direction (instead of the more common 0 to 360).
I am trying to set the range of the Compass to 0-255 and then set the current value of the compass to a value in that range. However, it seems as if the direction is still being mapped to a 0 to 360 range. For example, using my range of 0-255, I would expect that a value of 127.5 would give me a south pointing direction. Instead, it is pointing in a more southeast direction. After trying 180 for a value, it seems clear that this does in fact point south, but does so incorrectly for the range I have set.
Here is my code:
compassData = new DefaultMeterDataset ();
compassData.setRange(new Double(0), new Double(255.0));
compassPlot = new CompassPlot(compassData);
compassData.setValue(127); // should now point south, not southeast
Is the assumption that changing the range should correctly affect the scaling of the pointing direction? Thanks in advance.
Tom
CompassPlot Range Question
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact: