Great library but I've run into some problems with the Crosshair class.
- I can't seem to change the font on crosshair labels with the setLabelFont method. (in this case, I mostly want to change font size.)
- public void setLabelPaint(Paint paint) doesn't seem to do anything.
- public void setLabelOutlinePaint(Paint paint) also changes font color.
- Some kind of method to change the labels area would be nice (by means of padding / insets). Or have I missed how to set these?
Code: Select all
CrosshairOverlay tempOverlay = new CrosshairOverlay();
xCrosshair = new Crosshair(Double.NaN, Color.PINK, new BasicStroke(2f));
xCrosshair.setLabelVisible(true);
xCrosshair.setLabelPaint(Color.RED);
xCrosshair.setLabelAnchor(RectangleAnchor.TOP);
xCrosshair.setLabelFont(UIConstants.FONT_SMALL_STANDARD);
xCrosshair.setLabelBackgroundPaint(Color.WHITE);
xCrosshair.setLabelOutlineVisible(true);
xCrosshair.setLabelOutlinePaint(Color.CYAN);
xCrosshair.setLabelGenerator(new CrosshairLabelGenerator() {
@Override
public String generateLabel(Crosshair c) {
if(crosshairFollowingIndex != -1){
XYPlot plot = (XYPlot) logChart.getPlot();
Rectangle2D plotArea = graph.getScreenDataArea();
double chartX = plot.getDomainAxis().java2DToValue(pointerXValue, plotArea, plot.getDomainAxisEdge());
double chartY = plot.getRangeAxis().java2DToValue(pointerYValue, plotArea, plot.getRangeAxisEdge());
return formatDecimals(pointerYValue, crosshairFollowingIndex) + " " + logParamInformation.get(crosshairFollowingIndex).getParameter().getUnit();
}
return "" + pointerYValue;
}
});