1
JFreeChart 원형 차트에서 하나의 레이블을 제거하지만 나머지는 보관하려면 어떻게합니까?JFreeChart에서 원형 섹션 레이블 하나를 제거하십시오.
다음은 파이 차트의 단순화 된 버전입니다. "휴면"카테고리를 제외한 모든 파이 조각에 대한 라벨을 원합니다. 더 많은 자리 표시 자입니다.
DefaultPieDataset dataset = new DefaultPieDataset();
dataset.setValue("Cat1", 2);
dataset.setValue("Cat2", 4);
dataset.setValue("Cat3", 3);
dataset.setValue("dormant", 2);
JFreeChart chart = ChartFactory.createPieChart3D(
null,
dataset,
false, // legend?
true, // tooltips?
false // URLs?
);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
//CREATE LABELS, but I don't want any for the "dormant" category
StandardPieSectionLabelGenerator labelGen = new StandardPieSectionLabelGenerator("{0} ({2})", new DecimalFormat("0"), new DecimalFormat("0%"));
plot.setLabelGenerator(labelGen);
감사합니다. StandardPieSectionLabelGenerator로 무언가를 오버라이드해야한다는 것을 알았습니다. 다행이었습니다. – tmn