01: package com.calipso.reportgenerator.userinterface;
02:
03: import org.jfree.chart.ChartFactory;
04: import org.jfree.chart.JFreeChart;
05: import org.jfree.chart.ChartPanel;
06: import org.jfree.data.category.CategoryDataset;
07:
08: import java.awt.*;
09: import javax.swing.*;
10:
11: import com.calipso.reportgenerator.common.LanguageTraslator;
12:
13: /**
14: * Representa un grafico de tipo Barras Horizontales en 3D.
15: */
16:
17: public class HorizontalBarChart3D extends Charts {
18:
19: /**
20: * Crea una instancia de HorizontalBarChart3D.
21: * @param dataset
22: * @param tittle
23: * @param color
24: * @param legend
25: * @param toolTips
26:
27: */
28: public HorizontalBarChart3D(CategoryDataset dataset, String tittle,
29: Color color, boolean legend, boolean toolTips,
30: Dimension size, boolean multipleAxis) {
31: super (dataset, tittle, color, legend, toolTips, size,
32: multipleAxis);
33: previewHorizontalBarChart3D();
34: this .setVisible(true);
35: }
36:
37: /**
38: * Crea el chart correspondiente a partir de un <code>CategoryDataset</code>,
39: * titulo, leyenda y toolTips
40: */
41: private void previewHorizontalBarChart3D() {
42:
43: JFreeChart chart = ChartFactory.createBarChart3D(
44: tittle, // chart title
45: LanguageTraslator.traslate("337"), // range axis label
46: LanguageTraslator.traslate("336"),
47: dataset, // data
48: org.jfree.chart.plot.PlotOrientation.HORIZONTAL,
49: legend, // include legend
50: toolTips, // tooltips
51: false// urls
52: );
53:
54: chart.setBackgroundPaint(color);
55:
56: // add the chart to a panel...
57: ChartPanel chartPanel = new ChartPanel(chart);
58: chartPanel.setPreferredSize(new Dimension(700, 500));
59: add(chartPanel);
60:
61: }
62: }
|