List of usage examples for org.jfree.chart ChartFactory createBarChart3D
public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:pt.ist.expenditureTrackingSystem.presentationTier.actions.statistics.ChartGenerator.java
protected static JFreeChart createBarChart(final CategoryDataset categoryDataset, final String title) { final JFreeChart chart = ChartFactory.createBarChart3D(title, "", "", categoryDataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(new Color(0xF5, 0xF5, 0xF5)); final CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:co.udea.edu.proyectointegrador.gr11.parqueaderoapp.domain.stadistics.graphics.implement.Grafica.java
@Override public JFreeChart createBarChartToVehicleType(List<TipoVehiculoEstadistica> tipoVehiculos) { //Se crea el conjunto de datos para realizar el grafico de barras DefaultCategoryDataset dataset = createDataForVehicleType(tipoVehiculos); //Se crea el grafico de barras JFreeChart chart = ChartFactory.createBarChart3D(TITLE_OF_BAR_CHART, //Titulo del grfico DOMAIN_AXIS_LABEL, //Nombre del dominio RANGE_AXIS_LABEL, //Nombre del Rango dataset, //Conjunto de datos PlotOrientation.VERTICAL, //Orientacion del grafico true, //Incluye leyendas true, false);/* www .j av a 2 s . c o m*/ //Se pinta el fondo de blanco chart.setBackgroundPaint(Color.WHITE); //Se pintan el fondo del grafico de gris y las lineas de blanco CategoryPlot categoryPlot = chart.getCategoryPlot(); categoryPlot.setBackgroundPaint(Color.LIGHT_GRAY); categoryPlot.setDomainGridlinePaint(Color.WHITE); categoryPlot.setRangeGridlinePaint(Color.WHITE); categoryPlot.setNoDataMessage(NO_DATA_TO_DISPLAY); //Se configura para que solo muestre nmeros enteros NumberAxis rangeAxis = (NumberAxis) categoryPlot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer barRenderer = (BarRenderer) categoryPlot.getRenderer(); barRenderer.setDrawBarOutline(false); return chart; }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedDGView.java
public JFreeChart createChart(String title, String domainLabel, DefaultCategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title domainLabel, // domain axis label Misc.getString("SONG_COUNT"), // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend true, // tooltips? false // URLs? );//w ww .j av a2s . co m // _artistChart.addSubtitle(HomePanel // .createSubtitle("How many songs you have in each genre")); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(chart); Misc.formatChart(plot); plot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.5f); CategoryItemRenderer renderer = plot.getRenderer(); BarRenderer3D barRenderer = (BarRenderer3D) renderer; barRenderer.setWallPaint(Color.white); barRenderer.setSeriesPaint(0, Theme.getColorSet()[1]); return chart; }
From source file:GUI.Control.java
private void boton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: ArrayList<String> y = graf1(); Datos.addValue(Integer.parseInt(y.get(0)), "Ao " + anio, "Enero"); Datos.addValue(Integer.parseInt(y.get(1)), "Ao " + anio, "Febrero"); Datos.addValue(Integer.parseInt(y.get(2)), "Ao " + anio, "Marzo"); Datos.addValue(Integer.parseInt(y.get(3)), "Ao " + anio, "Abril"); Datos.addValue(Integer.parseInt(y.get(4)), "Ao " + anio, "Mayo"); Datos.addValue(Integer.parseInt(y.get(5)), "Ao " + anio, "Junio"); Datos.addValue(Integer.parseInt(y.get(6)), "Ao " + anio, "Julio"); Datos.addValue(Integer.parseInt(y.get(7)), "Ao " + anio, "Agosto"); Datos.addValue(Integer.parseInt(y.get(8)), "Ao " + anio, "Septiembre"); Datos.addValue(Integer.parseInt(y.get(9)), "Ao " + anio, "Octubre"); Datos.addValue(Integer.parseInt(y.get(10)), "Ao " + anio, "Noviembre"); Datos.addValue(Integer.parseInt(y.get(11)), "Ao " + anio, "Diciembre"); Grafica = ChartFactory.createBarChart3D("Meses con ms clientes", "Mes", "Clientes", Datos, PlotOrientation.VERTICAL, true, true, false); ChartPanel Panel = new ChartPanel(Grafica); JFrame Ventana = new JFrame("Grfica 1"); Ventana.getContentPane().add(Panel); Ventana.pack();/* w ww . j a v a 2s . com*/ Ventana.setVisible(true); //Ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedAAView.java
public JFreeChart createChart(String title, String domainLabel, DefaultCategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title domainLabel, // domain axis label Misc.getString("SONG_COUNT"), // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation false, // include legend true, // tooltips? false // URLs? );// w w w . ja v a2 s .c o m // _artistChart.addSubtitle(HomePanel // .createSubtitle("How many songs you have in each genre")); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(chart); Misc.formatChart(plot); plot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.5f); CategoryItemRenderer renderer = plot.getRenderer(); BarRenderer3D barRenderer = (BarRenderer3D) renderer; barRenderer.setWallPaint(Color.white); barRenderer.setSeriesPaint(0, Theme.getColorSet()[1]); return chart; }
From source file:clientesbac.frmConsultaClientes.java
public void barras() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(1, "Cliente", "Regular"); dataset.setValue(1, "Cliente", "Corporativo"); dataset.setValue(1, "Cliente", "Adulto Mayor"); dataset.setValue(1, "Cliente", "Embarazada"); dataset.setValue(1, "Cliente", "Discapacitado"); // Creando el Grafico JFreeChart chart = ChartFactory.createBarChart3D("Grfico de barras por tipo de Cliente", "", "Cantidad", dataset, PlotOrientation.VERTICAL, true, true, false); ChartFrame frame = new ChartFrame("Reporte", chart); frame.pack();/*from w ww .j a va 2 s .c om*/ frame.setVisible(true); }
From source file:com.netsteadfast.greenstep.action.CommonBarChartAction.java
private void fillChart(String title, String categoryLabel, String valueLabel, List<String> names, List<Float> values, List<String> colors, boolean horizontal) throws Exception { DefaultCategoryDataset data = new DefaultCategoryDataset(); for (int ix = 0; ix < names.size(); ix++) { data.addValue(values.get(ix), "", names.get(ix)); }/* w ww . jav a2 s. co m*/ this.chart = ChartFactory.createBarChart3D(title, // title categoryLabel, valueLabel, data, (horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL), false, false, false); CategoryPlot plot = (CategoryPlot) this.chart.getPlot(); CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9)); categoryAxis.setTickLabelFont(new Font("", Font.TRUETYPE_FONT, 9)); NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis(); numberAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9)); this.setPlotColor(plot, names, colors); this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9))); }
From source file:ambit.ui.data.AmbitResultViewer.java
public void propertyChange(PropertyChangeEvent e) { result = e.getNewValue();// w w w . j av a2s . com System.out.println(e.getPropertyName()); if (result == null) { image = null; return; } if (result instanceof FingerprintProfile) { String[] seriesNames = new String[] { ((FingerprintProfile) result).toString() }; FingerprintProfile fp = (FingerprintProfile) result; String[] categoryNames = new String[fp.getLength()]; DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < fp.getLength(); i++) { dataset.addValue(fp.getBitFrequency(i), seriesNames[0], new Integer(i)); } JFreeChart chart = ChartFactory.createBarChart3D("Consensus fingerprint", "Bits", "Frequency", dataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); image = chart.createBufferedImage(450, 200); chart = null; } if (result instanceof SimilarityMatrix) { image = ((SimilarityMatrix) result).toImage(); } if (image == null) label.setIcon(null); else label.setIcon(new ImageIcon(image)); }
From source file:edu.ucla.stat.SOCR.chart.demo.BarChart3DDemo3.java
/** * Creates a chart./* w w w .jav a 2s.com*/ * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation !legendPanelOn, // 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.setBaseItemLabelsVisible(true); BarRenderer r = (BarRenderer) renderer; r.setMaximumBarWidth(0.05); r.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); setCategorySummary(dataset); return chart; }
From source file:Interface.ResultadoJanela.java
public JFreeChart gerarGrafico(CategoryDataset dataSet) { JFreeChart chart = ChartFactory.createBarChart3D("Resultado da Localizao de Defeitos", //Titulo " ", // Eixo X "Probabilidade (%)", //Eixo Y dataSet, // Dados para o grafico PlotOrientation.VERTICAL, //Orientacao do grafico true, true, true); // exibir: legendas, tooltips, url chart.setBackgroundPaint(Color.getHSBColor(0, 0, (float) 0.835)); // Set the background colour of the chart CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.white); // Modify the plot background p.setRangeGridlinePaint(Color.BLACK); CategoryAxis axis = p.getDomainAxis(); axis.setTickLabelFont(new Font("Helvetica", Font.PLAIN, 10)); axis.setMaximumCategoryLabelWidthRatio(1.0f); axis.setMaximumCategoryLabelLines(2); p.setDomainAxis(axis);//from w ww. ja v a 2 s . c om return chart; }