0
저는 여기 새로 왔습니다, 질문이 있습니다. 나는이 바카르트를 가지고 있으며, 하나의 색 (각 막대) 만 채울 필요가 있지만, 다른 색을 만들기 위해서는 각 막대의 윤곽이 다른 색 (빨간색 또는 녹색)이 필요합니다. 내 방법 수신 데이터 세트 1과 2, 배열 내부에서도 동일한 데이터. 자, 배열을 비교하고 색상을 녹색 또는 빨간색으로 설정합니다. 하지만 문제는 렌더러가 세리의 마지막 값을 취하는 것입니다. 당신은 당신이 getItemOutlinePaint()
를 오버라이드 (override) 할 수있는 BarRenderer 클래스를 서브 클래스 화해, 모든 색상을 반환하는 경우jfreechart에서 여러 outlinePaint를 렌더러로 설정하는 방법 (저는 barchart를 사용하고 있습니다)
public void crearChartSemanal(DefaultCategoryDataset dataPresupuestos, DefaultCategoryDataset dataGastos, Color[] colores, Color[] coloresBlancos, String tipo, JPanel panel,double[]g,double[]p) {
Paint coloPaint[] = new Paint[colores.length];
Paint colorBordes[] = new Paint[coloresBlancos.length];
coloPaint = coloresBlancos;
colorBordes = colores;
final CategoryItemRenderer rendererP = new CustomRenderer(
coloPaint);
Paint outline = Color.BLACK;
// Paint orilla=new Paint(Color.CYAN);
System.out.println("count "+g.length);
for (int i = 0; i < g.length; i++) {
if (g[i] > p[i]) {
// outline = Color.YELLOW;
rendererP.setSeriesOutlinePaint(i,Color.green);
System.out.println("pase al rojo");
} else if (g[i]<=p[i]){
//outline = Color.RED;
rendererP.setSeriesOutlinePaint(i,Color.red); //the renderer takes this value at the end
System.out.println("njhbñ");
}
}
System.out.println("Estoy aquí");
// renderer.setLabelGenerator(generator);
rendererP.setItemLabelsVisible(true);
final CategoryPlot plot = new CategoryPlot();
plot.setDataset(dataGastos);
// plot.setOutlinePaint(null);
.... (또한, 나는 나의 영어에 대한 미안 해요 당신이 이해 바랍니다)
고마워요, 지금은 윤곽선없이 잘 보이게 만드는 방법을 알아 냈습니다. 그러나 나는 당신이 말한 것을 시도 할 것입니다. :) – Azu