JFreeChart PolarPlot: mathematical orientation

前端 未结 3 2010
萌比男神i
萌比男神i 2020-11-27 23:00

I\'d like to create a polar plot where the data is plotted in mathematical orientation (thus, the series starts and the east and continues counter-clockwise). The default be

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 23:20

    Unfortunately, there seems to be no built-in support for this. The angle labeling can be adapted by overriding the refreshAngleTicks() methods of PolarPlot:

    PolarPlot plot = new PolarPlot() {
    
            @Override
            protected List refreshAngleTicks() {
                List ticks = new ArrayList();
                // produce some ticks, e.g. NumberTick instances
                ticks.add(new NumberTick(0, "90", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                ticks.add(new NumberTick(45, "45", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                ticks.add(new NumberTick(90, "0", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                ticks.add(new NumberTick(135, "315", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                ticks.add(new NumberTick(180, "270", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                ticks.add(new NumberTick(225, "225", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                ticks.add(new NumberTick(270, "180", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                ticks.add(new NumberTick(315, "135", TextAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, 0));
                return ticks;
            }
        };
    

提交回复
热议问题