Search in sources :

Example 1 with Legend

use of org.xclcharts.renderer.info.Legend in project XCL-Charts by xcltapestry.

the class BarChart01View method drawDyLegend.

private void drawDyLegend() {
    Legend dyLegend = chart.getDyLegend();
    if (null == dyLegend)
        return;
    dyLegend.setPosition(0.8f, 0.5f);
    if (chart.getPlotArea().getHeight() > chart.getPlotArea().getWidth()) {
        dyLegend.setPosition(0.6f, 0.5f);
    }
    // dyLegend.setColSpan(30.f);
    dyLegend.getBackgroundPaint().setColor(Color.BLACK);
    dyLegend.getBackgroundPaint().setAlpha(100);
    dyLegend.setRowSpan(20.f);
    dyLegend.setMargin(15.f);
    dyLegend.setStyle(XEnum.DyInfoStyle.ROUNDRECT);
    Paint pDyLegend = new Paint(Paint.ANTI_ALIAS_FLAG);
    pDyLegend.setColor(Color.GREEN);
    PlotDot dotDyLegend = new PlotDot();
    dotDyLegend.setDotStyle(XEnum.DotStyle.RECT);
    dyLegend.addLegend(dotDyLegend, "库可用xxx(PB)", pDyLegend);
    Paint pDyLegend2 = new Paint(Paint.ANTI_ALIAS_FLAG);
    pDyLegend2.setColor(Color.RED);
    dyLegend.addLegend(dotDyLegend, "库已用xxx(PB)", pDyLegend2);
    Paint pDyLegend3 = new Paint(Paint.ANTI_ALIAS_FLAG);
    pDyLegend3.setColor(Color.CYAN);
    dyLegend.addLegend(dotDyLegend, "未分配xxx(PB)", pDyLegend3);
    Paint pDyLegend4 = new Paint(Paint.ANTI_ALIAS_FLAG);
    pDyLegend4.setColor(Color.YELLOW);
    dyLegend.addLegend("总计:xxx(PB)", pDyLegend4);
}
Also used : Legend(org.xclcharts.renderer.info.Legend) PlotDot(org.xclcharts.renderer.line.PlotDot) Paint(android.graphics.Paint)

Aggregations

Paint (android.graphics.Paint)1 Legend (org.xclcharts.renderer.info.Legend)1 PlotDot (org.xclcharts.renderer.line.PlotDot)1