List of usage examples for org.jfree.chart.axis CategoryLabelPositions createUpRotationLabelPositions
public static CategoryLabelPositions createUpRotationLabelPositions(double angle)
From source file:org.martus.client.swingui.actions.ActionMenuCharts.java
private void configureBarChartPlot(JFreeChart barChart) { CategoryPlot plot = (CategoryPlot) barChart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); TickUnitSource units = NumberAxis.createIntegerTickUnits(); rangeAxis.setStandardTickUnits(units); CategoryAxis domainAxis = plot.getDomainAxis(); CategoryLabelPositions newPositions = CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0); domainAxis.setCategoryLabelPositions(newPositions); barChart.addSubtitle(new TextTitle(getLocalization().getFieldLabel("ChartSelectedBulletinsDisclaimerBar"), FontHandler.getDefaultFont(), TextTitle.DEFAULT_TEXT_PAINT, RectangleEdge.BOTTOM, TextTitle.DEFAULT_HORIZONTAL_ALIGNMENT, TextTitle.DEFAULT_VERTICAL_ALIGNMENT, TextTitle.DEFAULT_PADDING)); }
From source file:com.rapidminer.gui.plotter.charts.BarChartPlotter.java
@Override public void updatePlotter() { final int categoryCount = prepareData(); SwingUtilities.invokeLater(new Runnable() { @Override/*from ww w . jav a 2 s.c om*/ public void run() { scrollablePlotterPanel.remove(viewScrollBar); } }); CategoryDataset usedCategoryDataSet = categoryDataSet; if (categoryCount > MAX_CATEGORY_VIEW_COUNT && showScrollbar) { if (orientationIndex == ORIENTATION_TYPE_VERTICAL) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { viewScrollBar.setOrientation(Adjustable.HORIZONTAL); scrollablePlotterPanel.add(viewScrollBar, BorderLayout.SOUTH); } }); } else { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { viewScrollBar.setOrientation(Adjustable.VERTICAL); scrollablePlotterPanel.add(viewScrollBar, BorderLayout.EAST); } }); } this.slidingCategoryDataSet = new SlidingCategoryDataset(categoryDataSet, 0, MAX_CATEGORY_VIEW_COUNT); viewScrollBar.setMaximum(categoryCount); viewScrollBar.setValue(0); usedCategoryDataSet = this.slidingCategoryDataSet; } else { this.slidingCategoryDataSet = null; } if (categoryCount <= MAX_CATEGORIES) { JFreeChart chart = ChartFactory.createBarChart(null, // chart title null, // domain axis label null, // range axis label usedCategoryDataSet, // data orientationIndex == ORIENTATION_TYPE_VERTICAL ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL, // orientation false, // include legend if group by column is set true, // tooltips false // URLs ); // set the background color for the chart... chart.setBackgroundPaint(Color.WHITE); chart.getPlot().setBackgroundPaint(Color.WHITE); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLabelFont(LABEL_FONT_BOLD); domainAxis.setTickLabelFont(LABEL_FONT); String domainName = groupByColumn >= 0 ? dataTable.getColumnName(groupByColumn) : null; domainAxis.setLabel(domainName); // rotate labels if (isLabelRotating()) { plot.getDomainAxis().setTickLabelsVisible(true); plot.getDomainAxis().setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d)); } // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabelFont(LABEL_FONT_BOLD); rangeAxis.setTickLabelFont(LABEL_FONT); String rangeName = valueColumn >= 0 ? dataTable.getColumnName(valueColumn) : null; rangeAxis.setLabel(rangeName); // bar renderer double[] colorValues = null; if (groupByColumn >= 0 && this.dataTable.isNominal(groupByColumn)) { colorValues = new double[this.dataTable.getNumberOfValues(groupByColumn)]; } else { colorValues = new double[categoryDataSet.getColumnCount()]; } for (int i = 0; i < colorValues.length; i++) { colorValues[i] = i; } BarRenderer renderer = new ColorizedBarRenderer(colorValues); renderer.setBarPainter(new RapidBarPainter()); renderer.setDrawBarOutline(true); int size = categoryDataSet.getRowCount(); if (size > 1) { for (int i = 0; i < size; i++) { renderer.setSeriesPaint(i, getColorProvider(true).getPointColor(i / (double) (size - 1))); } } plot.setRenderer(renderer); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(LABEL_FONT); } if (panel != null) { panel.setChart(chart); } else { panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN); scrollablePlotterPanel.add(panel, BorderLayout.CENTER); final ChartPanelShiftController controller = new ChartPanelShiftController(panel); panel.addMouseListener(controller); panel.addMouseMotionListener(controller); } // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!! panel.getChartRenderingInfo().setEntityCollection(null); } else { // LogService.getGlobal().logNote("Too many columns (" + categoryCount + // "), this chart is only able to plot up to " + MAX_CATEGORIES + // " different categories."); LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.charts.BarChartPlotter.too_many_columns", new Object[] { categoryCount, MAX_CATEGORIES }); } }
From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java
public JFreeChart getChartForPlate(PlateImpl plate) { IntensityMatrixImpl intensityMatrix = dataManager.getIntensityMatrix(); List<Injection> injections = intensityMatrix.getInjectionsByPlate().get(plate); DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (Injection one : injections) { dataset.add(Arrays.asList(intensityMatrix.getColumn(one)).stream().map((o) -> ((Double) o)) .collect(Collectors.toList()), "Intensity", one.toString()); }/* ww w. j a va2s.c o m*/ JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(plate.toString(), "Injection", "Intensity", dataset, true); chart.getCategoryPlot().getDomainAxis() .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2)); return chart; }
From source file:UserInterface.PatientRole.ManageMyVitalSignsAndFitnessRecordJPanel.java
private void createChart() { DefaultCategoryDataset vitalSignDataset = new DefaultCategoryDataset(); int selectedRow = viewVitalSignsJTable1.getSelectedRow(); ArrayList<Record> recordList = patient.getRecordHistory().getRecordList(); /*At least 2 vital sign records needed to show chart */ if (recordList.isEmpty() || recordList.size() == 1) { JOptionPane.showMessageDialog(this, "No Fitness Record or only one fitness record found. At least 2 fitness records needed to show chart!", "Warning", JOptionPane.INFORMATION_MESSAGE); return;/*from ww w . j a v a 2 s.c om*/ } for (Record record : recordList) { vitalSignDataset.addValue(record.getStandTime(), "StandTime", record.getDate()); vitalSignDataset.addValue(record.getMoveTime(), "MoveTime", record.getDate()); vitalSignDataset.addValue(record.getExcerciseTime(), "ExcerciseTime", record.getDate()); vitalSignDataset.addValue(record.getTotalTime(), "TotalTime", record.getDate()); } JFreeChart vitalSignChart = ChartFactory.createBarChart3D("Fitness Record Chart", "Time Stamp", "Time(mins)", vitalSignDataset, PlotOrientation.VERTICAL, true, false, false); vitalSignChart.setBackgroundPaint(Color.white); CategoryPlot vitalSignChartPlot = vitalSignChart.getCategoryPlot(); vitalSignChartPlot.setBackgroundPaint(Color.lightGray); CategoryAxis vitalSignDomainAxis = vitalSignChartPlot.getDomainAxis(); vitalSignDomainAxis .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); NumberAxis vitalSignRangeAxis = (NumberAxis) vitalSignChartPlot.getRangeAxis(); vitalSignRangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartFrame chartFrame = new ChartFrame("Chart", vitalSignChart); chartFrame.setVisible(true); chartFrame.setSize(500, 500); }
From source file:skoa.helpers.Graficos.java
private void barras() { unificarDatosFicheros();//from w ww . j a v a 2s. c om Vector<String> vectorOrdenUnidades = new Vector<String>(); vectorOrdenUnidades = ordenDeUnidades(); aplicarDiferencia(vectorOrdenUnidades); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset = obtenerSerieBarras(vectorOrdenUnidades); String unidad = ""; //for (int i=0;i<vectorOrdenUnidades.size();i++) unidad=unidad+vectorOrdenUnidades.elementAt(i)+", "; for (int i = 0; i < vectorOrdenUnidades.size(); i++) { if (vectorOrdenUnidades.elementAt(i).indexOf("W") >= 0 || vectorOrdenUnidades.elementAt(i).indexOf("L") >= 0 || vectorOrdenUnidades.elementAt(i).indexOf("m") >= 0 || vectorOrdenUnidades.elementAt(i).indexOf("B") >= 0) unidad = unidad + vectorOrdenUnidades.elementAt(i) + ", "; else if (vectorOrdenUnidades.elementAt(i).indexOf("C") >= 0) unidad = unidad + "C, "; else unidad = unidad + ", "; } unidad = unidad.substring(0, unidad.length() - 2); //Quita el ultimo espacio y la ultima coma. JFreeChart grafica = ChartFactory.createBarChart("Valores medidos de las direcciones de grupo", "Fechas", //titulo eje x "Mediciones (" + unidad + ")", dataset, PlotOrientation.VERTICAL, true, //leyenda true, false); if (fechaInicial.isEmpty()) { fechaInicial = fechaFinal = "?"; } TextTitle t = new TextTitle("desde " + fechaInicial + " hasta " + fechaFinal, new Font("SanSerif", Font.ITALIC, 12)); grafica.addSubtitle(t); CategoryPlot plot = grafica.getCategoryPlot(); //Modificar eje X CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); domainAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 8)); //Letra de las fechas ms pequea //Esconder las sombras de las barras del barchart. CategoryPlot categoryPlot = (CategoryPlot) grafica.getPlot(); BarRenderer renderer = new BarRenderer(); renderer.setShadowVisible(false); categoryPlot.setRenderer(renderer); //------------------------------------------------- try { ChartUtilities.saveChartAsJPEG(new File(ruta + "BarrasSmall.jpg"), grafica, 400, 300); ChartUtilities.saveChartAsJPEG(new File(ruta + "BarrasBig.jpg"), grafica, 900, 600); } catch (IOException e) { System.err.println("Problem occurred creating chart."); } }
From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java
public JFreeChart getChartForGlobalQC() { IntensityMatrixImpl intensityMatrix = dataManager.getIntensityMatrix(); if (intensityMatrix == null) return null; List<Sample> globalQCList = intensityMatrix.getGlobalQCSamples(); log.info("global QC {}", globalQCList.size()); if (globalQCList.size() == 0) return null; List<Injection> injections = intensityMatrix.getInjectionsBySample(globalQCList.get(0)); DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); for (Injection one : injections) { dataset.add(Arrays.asList(intensityMatrix.getColumn(one)).stream().map((o) -> ((Double) o)) .collect(Collectors.toList()), "Intensity", one.toString()); }// w ww . j av a 2 s. c om JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Global QC " + globalQCList.get(0).toString(), "Injection", "Intensity", dataset, true); chart.getCategoryPlot().getDomainAxis() .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2)); return chart; }
From source file:userinterface.HealthAnalystRole.ViewReportJPanel.java
private void createChart() { DefaultCategoryDataset healthDataset = new DefaultCategoryDataset(); int selectedRow = tblHealthTable.getSelectedRow(); Device effects = (Device) tblHealthTable.getValueAt(selectedRow, 0); //Device device= device.getEffectsOnBodyList().getEffectsOnBodyList().; for (Device d : organization.getDeviceDirectory().getDeviceList()) { if (d.getEffectsOnBodyList().getEffectsOnBodyList().isEmpty() || d.getEffectsOnBodyList().getEffectsOnBodyList().size() == 1) { JOptionPane.showMessageDialog(this, "No body organs or only one body organ affected found. At least 2 organs effected records needed to show chart!", "Warning", JOptionPane.INFORMATION_MESSAGE); return; } else {/*from w ww. ja v a 2s .c o m*/ Double organ = Double.parseDouble(txtOrgan.getText()); Double value = d.getMaxSAR(); } } //ArrayList<EffectsOnBody> effectsOnBodyList = device.getEffectsOnBodyList().getEffectsOnBodyList(); /*if (effectsOnBodyList.isEmpty() || effectsOnBodyList.size() == 1) { JOptionPane.showMessageDialog(this, "No body organs or only one body organ affected found. At least 2 organs effected records needed to show chart!", "Warning", JOptionPane.INFORMATION_MESSAGE); return; }*/ Double organ = Double.parseDouble(txtOrgan.getText()); for (Device device : organization.getDeviceDirectory().getDeviceList()) { for (EffectsOnBody b1 : device.getEffectsOnBodyList().getEffectsOnBodyList()) { Double value = device.getMaxSAR(); //healthDataset.addValue(vitalSign.getHeartRate(),"Most Likely Diseases", device.getMaxSAR()); //vitalSignDataset.addValue(vitalSign.getBloodPressure(),"BP", vitalSign.getTimestamp()); //vitalSignDataset.addValue(vitalSign.getWeight(),"WT", vitalSign.getTimestamp()); } } JFreeChart healthSignChart = ChartFactory.createBarChart3D("Effects On Health Chart", "Time Stamp", "Rate", healthDataset, PlotOrientation.VERTICAL, true, false, false); healthSignChart.setBackgroundPaint(Color.white); CategoryPlot vitalSignChartPlot = healthSignChart.getCategoryPlot(); vitalSignChartPlot.setBackgroundPaint(Color.lightGray); CategoryAxis vitalSignDomainAxis = vitalSignChartPlot.getDomainAxis(); vitalSignDomainAxis .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); NumberAxis vitalSignRangeAxis = (NumberAxis) vitalSignChartPlot.getRangeAxis(); vitalSignRangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartFrame chartFrame = new ChartFrame("Chart", healthSignChart); chartFrame.setVisible(true); chartFrame.setSize(500, 500); }
From source file:org.operamasks.faces.render.graph.ChartRenderer.java
private void setCategoryAxisStyles(CategoryAxis axis, UIAxis comp) { Double lowerMargin = comp.getLowerMargin(); Double upperMargin = comp.getUpperMargin(); if (lowerMargin != null) axis.setLowerMargin(lowerMargin); if (upperMargin != null) axis.setUpperMargin(upperMargin); Double labelAngle = comp.getLabelAngle(); if (labelAngle != null) { CategoryLabelPositions clp;/*from w ww . ja v a 2s.c om*/ double angle = Math.PI * labelAngle / 180.0; if (angle >= 0) { clp = CategoryLabelPositions.createDownRotationLabelPositions(angle); } else { clp = CategoryLabelPositions.createUpRotationLabelPositions(-angle); } axis.setCategoryLabelPositions(clp); } }
From source file:ro.nextreports.engine.chart.JFreeChartExporter.java
private JFreeChart createBarChart(boolean horizontal, boolean stacked, boolean isCombo) throws QueryException { barDataset = new DefaultCategoryDataset(); String chartTitle = replaceParameters(chart.getTitle().getTitle()); chartTitle = StringUtil.getI18nString(chartTitle, I18nUtil.getLanguageByName(chart, language)); Object[] charts;/*from w ww .jav a2s. c o m*/ List<String> legends; Object[] lineCharts = null; String lineLegend = null; if (isCombo) { lineCharts = new Object[1]; if (chart.getYColumnsLegends().size() < chart.getYColumns().size()) { lineLegend = ""; } else { lineLegend = chart.getYColumnsLegends().get(chart.getYColumns().size() - 1); } charts = new Object[chart.getYColumns().size() - 1]; legends = chart.getYColumnsLegends().subList(0, chart.getYColumns().size() - 1); } else { charts = new Object[chart.getYColumns().size()]; legends = chart.getYColumnsLegends(); } boolean hasLegend = false; for (int i = 0; i < charts.length; i++) { String legend = ""; try { legend = replaceParameters(legends.get(i)); legend = StringUtil.getI18nString(legend, I18nUtil.getLanguageByName(chart, language)); } catch (IndexOutOfBoundsException ex) { // no legend set } // Important : must have default different legends used in barDataset.addValue if ((legend == null) || "".equals(legend.trim())) { legend = DEFAULT_LEGEND_PREFIX + String.valueOf(i + 1); } else { hasLegend = true; } charts[i] = legend; } if (isCombo) { String leg = ""; if (lineLegend != null) { leg = replaceParameters(lineLegend); } lineCharts[0] = leg; } byte style = chart.getType().getStyle(); JFreeChart jfreechart; String xLegend = StringUtil.getI18nString(replaceParameters(chart.getXLegend().getTitle()), I18nUtil.getLanguageByName(chart, language)); String yLegend = StringUtil.getI18nString(replaceParameters(chart.getYLegend().getTitle()), I18nUtil.getLanguageByName(chart, language)); PlotOrientation plotOrientation = horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL; if (stacked) { jfreechart = ChartFactory.createStackedBarChart(chartTitle, // chart title xLegend, // x-axis Label yLegend, // y-axis Label barDataset, // data plotOrientation, // orientation true, // include legend true, // tooltips false // URLs ); } else { switch (style) { case ChartType.STYLE_BAR_PARALLELIPIPED: case ChartType.STYLE_BAR_CYLINDER: jfreechart = ChartFactory.createBarChart3D(chartTitle, // chart title xLegend, // x-axis Label yLegend, // y-axis Label barDataset, // data plotOrientation, // orientation true, // include legend true, // tooltips false // URLs ); break; default: jfreechart = ChartFactory.createBarChart(chartTitle, // chart title xLegend, // x-axis Label yLegend, // y-axis Label barDataset, // data plotOrientation, // orientation true, // include legend true, // tooltips false // URLs ); break; } } if (style == ChartType.STYLE_BAR_CYLINDER) { ((CategoryPlot) jfreechart.getPlot()).setRenderer(new CylinderRenderer()); } // hide legend if necessary if (!hasLegend) { jfreechart.removeLegend(); } // hide border jfreechart.setBorderVisible(false); // title setTitle(jfreechart); // chart colors & values shown on bars boolean showValues = (chart.getShowYValuesOnChart() == null) ? false : chart.getShowYValuesOnChart(); CategoryPlot plot = (CategoryPlot) jfreechart.getPlot(); plot.setForegroundAlpha(transparency); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); DecimalFormat decimalformat; DecimalFormat percentageFormat; if (chart.getYTooltipPattern() == null) { decimalformat = new DecimalFormat("#"); percentageFormat = new DecimalFormat("0.00%"); } else { decimalformat = new DecimalFormat(chart.getYTooltipPattern()); percentageFormat = decimalformat; } for (int i = 0; i < charts.length; i++) { renderer.setSeriesPaint(i, chart.getForegrounds().get(i)); if (showValues) { renderer.setSeriesItemLabelsVisible(i, true); renderer.setSeriesItemLabelGenerator(i, new StandardCategoryItemLabelGenerator("{2}", decimalformat, percentageFormat)); } } if (showValues) { // increase a little bit the range axis to view all item label values over bars plot.getRangeAxis().setUpperMargin(0.2); } // grid axis visibility & colors if ((chart.getXShowGrid() != null) && !chart.getXShowGrid()) { plot.setDomainGridlinesVisible(false); } else { if (chart.getXGridColor() != null) { plot.setDomainGridlinePaint(chart.getXGridColor()); } else { plot.setDomainGridlinePaint(Color.BLACK); } } if ((chart.getYShowGrid() != null) && !chart.getYShowGrid()) { plot.setRangeGridlinesVisible(false); } else { if (chart.getYGridColor() != null) { plot.setRangeGridlinePaint(chart.getYGridColor()); } else { plot.setRangeGridlinePaint(Color.BLACK); } } // chart background plot.setBackgroundPaint(chart.getBackground()); // labels color plot.getDomainAxis().setTickLabelPaint(chart.getXColor()); plot.getRangeAxis().setTickLabelPaint(chart.getYColor()); // legend color plot.getDomainAxis().setLabelPaint(chart.getXLegend().getColor()); plot.getRangeAxis().setLabelPaint(chart.getYLegend().getColor()); // legend font plot.getDomainAxis().setLabelFont(chart.getXLegend().getFont()); plot.getRangeAxis().setLabelFont(chart.getYLegend().getFont()); // axis color plot.getDomainAxis().setAxisLinePaint(chart.getxAxisColor()); plot.getRangeAxis().setAxisLinePaint(chart.getyAxisColor()); // hide labels if ((chart.getXShowLabel() != null) && !chart.getXShowLabel()) { plot.getDomainAxis().setTickLabelsVisible(false); plot.getDomainAxis().setTickMarksVisible(false); } if ((chart.getYShowLabel() != null) && !chart.getYShowLabel()) { plot.getRangeAxis().setTickLabelsVisible(false); plot.getRangeAxis().setTickMarksVisible(false); } if (chart.getType().getStyle() == ChartType.STYLE_NORMAL) { // no shadow renderer.setShadowVisible(false); // no gradient renderer.setBarPainter(new StandardBarPainter()); } // label orientation CategoryAxis domainAxis = plot.getDomainAxis(); if (chart.getXorientation() == Chart.VERTICAL) { domainAxis .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2)); } else if (chart.getXorientation() == Chart.DIAGONAL) { domainAxis .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 4)); } else if (chart.getXorientation() == Chart.HALF_DIAGONAL) { domainAxis .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8)); } // labels fonts domainAxis.setTickLabelFont(chart.getXLabelFont()); plot.getRangeAxis().setTickLabelFont(chart.getYLabelFont()); createChart(plot.getRangeAxis(), charts); if (isCombo) { addLineChartOverBar(jfreechart, lineCharts, lineLegend); } return jfreechart; }
From source file:tn.mariages.gui.Accueil.java
public JFreeChart createChart(CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createBarChart(" Ventes par mois ", // chart title " ", // domain axis label " Le nombre de produit ", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips true // urls );/*from w ww . j ava 2 s .c om*/ final CategoryPlot plot = chart.getCategoryPlot(); final CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0)); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); return chart; }