List of usage examples for org.jfree.chart.axis CategoryAxis setCategoryLabelPositions
public void setCategoryLabelPositions(CategoryLabelPositions positions)
From source file:charts.ErroresPorMilChart.java
private JFreeChart createChart(DefaultCategoryDataset dataset, String title) { JFreeChart chart = ChartFactory.createBarChart(title, "Tipo de Control", "Cantidad de Imagenes", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // Inclinamos 45 grados las etiquetas del eje X plot.setBackgroundAlpha(0.5f);// w w w. j a v a 2 s. com return chart; }
From source file:org.jgrasstools.gears.utils.chart.CategoryHistogram.java
public JFreeChart getChart() { if (chart == null) { createDataset();/*from ww w. java 2 s . c om*/ chart = ChartFactory.createBarChart(title, // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis rangeAxis = plot.getDomainAxis(); rangeAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); } return chart; }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.ChartAxisFactory.java
public static CategoryAxis createCategoryDomainAxis(PlotConfiguration plotConfiguration) { CategoryAxis domainAxis = new CategoryAxis(null); String label = plotConfiguration.getDomainConfigManager().getLabel(); if (label == null) { label = I18N.getGUILabel("plotter.unnamed_value_label"); }/*from ww w . j a v a2 s.com*/ domainAxis.setLabel(label); Font axesFont = plotConfiguration.getAxesFont(); if (axesFont != null) { domainAxis.setLabelFont(axesFont); domainAxis.setTickLabelFont(axesFont); } // rotate labels if (plotConfiguration.getOrientation() != PlotOrientation.HORIZONTAL) { domainAxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d)); } formatAxis(plotConfiguration, domainAxis); return domainAxis; }
From source file:com.jtk.pengelolaanujian.view.dashboard.PipePanelSample.java
private ChartPanel createChart(DefaultCategoryDataset data) { barchart = ChartFactory.createBarChart3D("Data Keterlambatan pengelolaan Soal Ujian", "Aktifitas", "Jumlah Keterlambatan", data, PlotOrientation.VERTICAL, true, true, false); barchart.setBackgroundPaint(new Color(135, 206, 250)); CategoryPlot plot = (CategoryPlot) barchart.getPlot(); plot.setNoDataMessage("Data Tidak ada"); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setBaseItemLabelsVisible(true); BarRenderer barRenderer = (BarRenderer) renderer; barRenderer.setItemMargin(0.1D);//from www.ja v a 2s .co m barRenderer.setDrawBarOutline(true); return new ChartPanel(barchart); }
From source file:de.tuberlin.dima.flinkhandson.utils.SingleSeriesBarChart.java
public SingleSeriesBarChart(String title, String xLabel, String yLabel, Color barColor, Map<String, Double> result) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Map.Entry<String, Double> e : result.entrySet()) { dataset.addValue(e.getValue(), "", e.getKey()); }/*w w w . ja va 2s . c o m*/ JFreeChart chart = ChartFactory.createBarChart(title, xLabel, yLabel, dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); plot.setBackgroundPaint(Color.WHITE); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setBarPainter(new StandardBarPainter()); renderer.setSeriesPaint(0, barColor); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(1024, 768)); getContentPane().add(chartPanel); pack(); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:org.neo4j.bench.chart.AbstractJFreeChart.java
protected void rotateCategoryAxis(JFreeChart chart, double piAngle) { CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(piAngle)); }
From source file:app.view.panel.PanelHistogramme.java
/** * Cre le graphique/* ww w . j av a 2 s . c om*/ * * @param dataset Echantillon de donnes * @return Graphique */ private JFreeChart createChart(CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createBarChart3D("Sries de bac", // chart title "Bacs", // domain axis label "Nombre", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); final CategoryPlot plot = chart.getCategoryPlot(); final CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0)); final BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); renderer.setDrawBarOutline(false); return chart; }
From source file:com.crunchify.jsp.servlet.ChartServlet.java
public JFreeChart getChart() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(25.0, "Series 1", "Category 1"); dataset.addValue(34.0, "Series 1", "Category 2"); dataset.addValue(19.0, "Series 2", "Category 1"); dataset.addValue(29.0, "Series 2", "Category 2"); dataset.addValue(41.0, "Series 3", "Category 1"); dataset.addValue(33.0, "Series 3", "Category 2"); JFreeChart chart = ChartFactory.createBarChart3D("3D Bar Chart Demo", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls );/*ww w . j a v a 2 s .c o m*/ CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0)); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); BarRenderer r = (BarRenderer) renderer; r.setMaximumBarWidth(0.05); return chart; }
From source file:Controlador.ChartServlet.java
public JFreeChart getChart() throws URISyntaxException { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Equipos eq = new Equipos(); Equipo e = eq.buscar(1);/*from w w w.ja v a 2 s. c o m*/ dataset.addValue(e.getNumSerie(), String.copyValueOf(e.getNombre()), " 1"); JFreeChart chart = ChartFactory.createBarChart3D("3D Bar Chart Demo", // chart title "equipo", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0)); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); BarRenderer r = (BarRenderer) renderer; r.setMaximumBarWidth(0.05); return chart; }
From source file:org.jgrasstools.gears.utils.chart.CategoryBoxplot.java
public JFreeChart getChart() { if (chart == null) { createDataset();//from w ww . j a v a 2 s.c o m chart = ChartFactory.createBarChart(getTitle(), // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis rangeAxis = plot.getDomainAxis(); rangeAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(true); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); renderer.setMeanVisible(isMeanVisible); plot.setRenderer(renderer); } return chart; }