List of usage examples for org.jfree.chart.renderer.category CategoryItemRenderer setItemLabelsVisible
public void setItemLabelsVisible(Boolean visible);
From source file:grafici.StatisticheBarChart3D.java
/** * Creates a sample chart./*from www .j a v a2 s . c o m*/ * * @param dataset * the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset, Table results, int variabile1, int variabile2, int valore) { // create the chart... JFreeChart chart = ChartFactory.createBarChart3D(titolo, // chart // title results.getColumn(variabile2).getText().toUpperCase(), // domain axis label results.getColumn(valore).getText().toUpperCase(), // 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 CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); final BarRenderer r = (BarRenderer) renderer; return chart; }
From source file:org.exist.xquery.modules.jfreechart.JFreeChartFactory.java
private static void setCategoryItemLabelGenerator(JFreeChart chart, Configuration config) throws XPathException { String className = config.getCategoryItemLabelGeneratorClass(); CategoryItemLabelGenerator generator = null; if (className != null) { try {// w w w . j ava 2 s .com Class generatorClass = Class.forName(className); Class[] argsClass = new Class[] { String.class, NumberFormat.class }; String param = config.getCategoryItemLabelGeneratorParameter(); NumberFormat fmt = new DecimalFormat(config.getCategoryItemLabelGeneratorNumberFormat()); Object[] args = new Object[] { param, fmt }; Constructor argsConstructor = generatorClass.getConstructor(argsClass); generator = (CategoryItemLabelGenerator) argsConstructor.newInstance(args); } catch (Exception e) { throw (new XPathException( "Cannot instantiate CategoryItemLabelGeneratorClass: " + className + ", exception: " + e)); } if (chart.getPlot() instanceof SpiderWebPlot) { ((SpiderWebPlot) chart.getPlot()).setLabelGenerator(generator); } else { CategoryItemRenderer renderer = ((CategoryPlot) chart.getPlot()).getRenderer(); renderer.setBaseItemLabelGenerator(generator); renderer.setItemLabelsVisible(true); } } }
From source file:edu.esprit.pi.workshop.statistiques.BarChart.java
@Override public JFreeChart construireChart2D() { graphe = ChartFactory.createBarChart("Pourcentage revenue par Dpartement", "Departement", "Pourcentage du revenu", createDataset(), PlotOrientation.VERTICAL, true, true, true); final CategoryPlot plot = graphe.getCategoryPlot(); final CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0)); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); return graphe; }
From source file:edu.esprit.pi.workshop.statistiques.BarChart.java
@Override public JFreeChart construireChart3D() { graphe = ChartFactory.createBarChart3D("Pourcentage revenue par Dpartement", "", "Pourcentage du revenu", createDataset(), PlotOrientation.HORIZONTAL, true, true, true); final CategoryPlot plot = graphe.getCategoryPlot(); final CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0)); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); return graphe; }
From source file:brightwell.gui.drawingplane.Chart3D.java
private JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart3D("Centrality", "Neuron", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = jfreechart.getCategoryPlot(); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(0.39269908169872414D)); CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer(); categoryitemrenderer.setItemLabelsVisible(true); BarRenderer barrenderer = (BarRenderer) categoryitemrenderer; barrenderer.setMaxBarWidth(0.050000000000000003D); return jfreechart; }
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 a2 s.c om*/ 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);/* w ww . j av a2 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:j2se.jfreechart.barchart.BarChart3DDemo3.java
/** * Creates a chart.//from ww w . j a v a2 s .c om * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final 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 ); final CategoryPlot plot = chart.getCategoryPlot(); final CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0)); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); final BarRenderer r = (BarRenderer) renderer; r.setMaximumBarWidth(0.05); return chart; }
From source file:org.jfree.chart.demo.BarChart3DDemo3.java
/** * Creates a chart./*from w w w .j a v a 2s . c om*/ * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final 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 ); final CategoryPlot plot = chart.getCategoryPlot(); final CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0)); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); final BarRenderer r = (BarRenderer) renderer; r.setMaxBarWidth(0.05); return chart; }
From source file:org.jfree.chart.demo.StackedAreaChartDemo.java
/** * Creates a sample chart./*from www . j av a 2 s . c o m*/ * * @param dataset the dataset. * * @return A sample chart. */ public JFreeChart createChart(CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createStackedAreaChart("Stacked Area Chart", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setForegroundAlpha(0.5f); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); return chart; }