+ // Set the scale of the plot to the limits
+ double x1 = xUnit.toUnit(modX.getMinValue());
+ double x2 = xUnit.toUnit(modX.getMaxValue());
+
+ chart.getXYPlot().getDomainAxis().setRange(x1, x2);
+
+ // Add lines to show optimization limits
+ XYLineAnnotation line = new XYLineAnnotation(x1, -1e19, x1, 1e19);
+ chart.getXYPlot().addAnnotation(line);
+ line = new XYLineAnnotation(x2, -1e19, x2, 1e19);
+ chart.getXYPlot().addAnnotation(line);
+
+ // Mark the optimum point
+ Point optimum = path.get(path.size() - 1);
+ FunctionEvaluationData data = evaluations.get(optimum);
+ if (data != null) {
+ if (data.getParameterValue() != null) {
+ Value[] state = data.getState();
+ double x = xUnit.toUnit(state[0].getValue());
+ double y = yUnit.toUnit(data.getParameterValue().getValue());
+
+ XYPointerAnnotation text = new XYPointerAnnotation(trans.get("plot.label.optimum"),
+ x, y, Math.PI / 2);
+ text.setTextAnchor(TextAnchor.TOP_LEFT);
+ chart.getXYPlot().addAnnotation(text);
+ }
+ } else {
+ log.error("Could not find evaluation data for point " + optimum);
+ }
+
+