Here's a google drive folder with some images of the charts that I'm working on.

https://drive.google.com/drive/folders/ ... sp=sharing

My questions are, in order of increasing difficulty:

If you look at normalchartexample.png, you can see that the vertical dashed line in the center is a different color than everything else. It seems trivial, but how do I change that? I styled the graph with the following, if it helps.

Code: Select all

```
if (plot instanceof XYPlot) {
XYPlot xyp = (XYPlot) plot;
xyp.setDomainZeroBaselineVisible(true);
xyp.setRangeZeroBaselineVisible(true);
xyp.setDomainPannable(true);
xyp.setRangePannable(true);
// Style axes
NumberAxis rangeAxis = (NumberAxis) xyp.getRangeAxis();
rangeAxis.setLabelPaint(Color.WHITE);
rangeAxis.setAxisLinePaint(Color.LIGHT_GRAY);
rangeAxis.setTickLabelPaint(Color.LIGHT_GRAY);
rangeAxis.setTickLabelsVisible(true);
ValueAxis domainAxis = xyp.getDomainAxis();
domainAxis.setLabelPaint(Color.WHITE);
domainAxis.setAxisLinePaint(Color.LIGHT_GRAY);
domainAxis.setTickLabelPaint(Color.LIGHT_GRAY);
domainAxis.setTickLabelsVisible(true);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
// TODO style integral (This will be done after I obtain the answer to a more difficult question)
XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) xyp.getRenderer();
r.setDrawSeriesLineAsPath(true);
// Style annotations
@SuppressWarnings("unchecked")
List<XYTextAnnotation> annotations = xyp.getAnnotations();
for (int i = 0; i < annotations.size(); i++) {
XYTextAnnotation a = (XYTextAnnotation) annotations.get(i);
a.setTextAnchor(TextAnchor.HALF_ASCENT_CENTER);
a.setBackgroundPaint(paintProgression[i % paintProgression.length]);
a.setOutlinePaint(Color.LIGHT_GRAY);
}
}
```

Code: Select all

```
if (plot instanceof CategoryPlot) {
CategoryPlot cp = (CategoryPlot) plot;
if (cp.getRenderer() instanceof DefaultCategoryItemRenderer) {
DefaultCategoryItemRenderer renderer = (DefaultCategoryItemRenderer) cp.getRenderer();
int i = 0;
boolean cont = true;
while (cont) {
if (renderer.getSeriesStroke(i) == null) {
cont = false;
continue;
}
renderer.setSeriesStroke(i, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
System.out.println("Styled #" + i);
i++;
}
}
}
```

My last and most difficult question, which may get its own separate post later is: I would like to add a fill below my normal distribution chart. This question has been asked once in the past, but I've blown a few hours on trying to understand what the solution actually was, and I've come up short. I want to fill an area from an arbitrary beginning point to an arbitrary ending point on the domain, and I want to be able to do it any number of times with different values, preferably in a way such that you can't tell if they're overlapping, yet does not obscure any other series beneath it. I also want to be sure that everything is rendered in the correct order.

Another consideration is that this operation should preferably be fast, since I need to generate the graph on the fly, save, and send the file.

If it's helpful, I've already implemented a getHeightAt() function to help me place labels that finds the height of the bell curve at a specific x value. The equation can be found here: http://davidmlane.com/hyperstat/A25726.html

Code: Select all

```
public double getHeightAt(Double x) {
Double coefficient = 1.0 / Math.sqrt(2.0 * Math.PI * getStandardDeviation() * getStandardDeviation());
Double exponentnumerator = -1.0 * (x - getMean()) * (x - getMean());
Double exponentdenominator = 2 * getStandardDeviation() * getStandardDeviation();
return coefficient * (Math.pow(Math.E, exponentnumerator/exponentdenominator));
}
```