1 package com.calipso.reportgenerator.userinterface; 2 3 import org.jfree.chart.JFreeChart; 4 import org.jfree.chart.ChartFactory; 5 import org.jfree.chart.ChartPanel; 6 import org.jfree.chart.plot.CategoryPlot; 7 import org.jfree.chart.axis.CategoryLabelPosition; 8 import org.jfree.chart.axis.CategoryAxis; 9 import org.jfree.chart.axis.CategoryLabelPositions; 10 import org.jfree.chart.axis.CategoryLabelWidthType; 11 import org.jfree.ui.RectangleAnchor; 12 import org.jfree.ui.TextAnchor; 13 import org.jfree.text.TextBlockAnchor; 14 import org.jfree.data.category.CategoryDataset; 15 16 import java.awt.*; 17 18 import com.calipso.reportgenerator.common.LanguageTraslator; 19 20 23 24 public class VerticalBarChart3D extends Charts{ 25 26 34 public VerticalBarChart3D(CategoryDataset dataset, String tittle, Color color, boolean legend, boolean toolTips, Dimension size, boolean multipleAxis) { 35 super(dataset, tittle, color, legend, toolTips, size, multipleAxis); 36 previewVerticalBarChart3D(); 37 this.setVisible(true); 38 } 39 40 41 45 void previewVerticalBarChart3D(){ 46 JFreeChart chart = ChartFactory.createBarChart3D( 47 tittle, LanguageTraslator.traslate("336"), LanguageTraslator.traslate("337"), dataset, org.jfree.chart.plot.PlotOrientation.VERTICAL, 52 legend, toolTips, false ); 56 57 chart.setBackgroundPaint(color); 58 CategoryPlot plot = chart.getCategoryPlot(); 59 CategoryAxis domainAxis = plot.getDomainAxis(); 60 CategoryLabelPosition position = new CategoryLabelPosition( 61 RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT,-70, CategoryLabelWidthType.RANGE, 70); 62 domainAxis.setCategoryLabelPositions(new CategoryLabelPositions(position,position,position,position)); 63 64 ChartPanel chartPanel = new ChartPanel(chart); 66 chartPanel.setPreferredSize(getSize()); 67 add(chartPanel); 68 } 69 } 70 71 72 | Popular Tags |