在 jFreeChart 中的图例符号上设置前景 alpha

Set foreground alpha on legend symbol in jFreeChart

我正在 jFreeChart 上设置前景 alpha,我希望颜色与图例符号匹配。是否也可以在图例符号上设置前景 Alpha?

设置绘图 alpha 的代码:

XYPlot plot = chart.getXYPlot();
plot.setForegroundAlpha(0.6f);

绘图和图例都从绘图的 DrawingSupplier. To ensure that plot and legend stay synchronized, this 供给的红色、绿色和蓝色色调中获取颜色,每个色调都有 50% alpha

Paint[] paintArray = {
    new Color(0x80ff0000, true),
    new Color(0x8000ff00, true),
    new Color(0x800000ff, true)
};
plot.setDrawingSupplier(new DefaultDrawingSupplier(
    paintArray, …));

请注意绘图中具有浅灰色背景而非图例的细微差别。