JFreeChart极地图表自定义X标签

时间:2017-04-29 16:38:44

标签: java swing jfreechart

我想自定义PolarChart来替换PolarChart中默认显示的角度值 enter image description here ,使用这样的自定义字符串: enter image description here

1 个答案:

答案 0 :(得分:2)

您可以覆盖refreshAngleTicks()PolarPlot方法,如图所示here

import static org.jfree.ui.TextAnchor.*
…
PolarPlot plot = new PolarPlot() {

    @Override
    protected List refreshAngleTicks() {
        List ticks = new ArrayList();
        ticks.add(new NumberTick(0, "maxCharTick: 20", TOP_LEFT, TOP_LEFT, 0));
        ticks.add(new NumberTick(45, "energyComsuption: 1", TOP_LEFT, TOP_LEFT, 0));
        ticks.add(new NumberTick(90, "maxDamage: 40", TOP_LEFT, TOP_LEFT, 0));
        …
        return ticks;
    }
};

或者,考虑SpiderWebPlot,显示为here