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:edu.ucla.stat.SOCR.chart.SuperCategoryChart_Bar3D.java
protected JFreeChart createLegend(CategoryDataset dataset) { // JFreeChart chart = ChartFactory.createAreaChart( JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls );/* www . jav a 2 s . co m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); // renderer.setDrawOutlines(true); // renderer.setUseFillPaint(true); // renderer.setFillPaint(Color.white); renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); return chart; }
From source file:com.ouc.cpss.view.ChartProBuilder.java
private static JFreeChart createJFreeChart(CategoryDataset dataset) { /**/*from www .j a v a2s . c om*/ * JFreeChart */ //? StandardChartTheme standardChartTheme = new StandardChartTheme("CN"); // standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 20)); // standardChartTheme.setRegularFont(new Font("", Font.PLAIN, 15)); //? standardChartTheme.setLargeFont(new Font("", Font.PLAIN, 15)); //? ChartFactory.setChartTheme(standardChartTheme); //? // ? JFreeChart jfreeChart = null; if (choice == 1) { jfreeChart = ChartFactory.createBarChart3D("? -- ?TOP10", "", "?", dataset, PlotOrientation.VERTICAL, true, false, false); /** * JFreeChart */ jfreeChart.setTitle(new TextTitle("? -- ?TOP10", new Font("", Font.BOLD + Font.ITALIC, 20))); CategoryPlot plot = (CategoryPlot) jfreeChart.getPlot(); CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setLabelFont(new Font("", Font.ROMAN_BASELINE, 12)); } else { jfreeChart = ChartFactory.createBarChart3D("? -- ?TOP10", "", "?", dataset, PlotOrientation.VERTICAL, true, false, false); jfreeChart.setTitle(new TextTitle("? -- ?TOP10", new Font("", Font.BOLD + Font.ITALIC, 20))); CategoryPlot plot = (CategoryPlot) jfreeChart.getPlot(); CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setLabelFont(new Font("", Font.ROMAN_BASELINE, 12)); } return jfreeChart; }
From source file:de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.TimeStatisticsPanel.java
public TimeStatisticsPanel() { setName("Uhrzeit"); setLayout(new BorderLayout()); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int alarmCount[] = new int[24]; try {/*from www.ja v a 2 s. c o m*/ ResultSet resultSet = Starter.getDatabase().getStatement().executeQuery( "SELECT STARTTIME_HOUR, COUNT(*) AS COUNT FROM ALARMHISTORY GROUP BY STARTTIME_HOUR"); while (resultSet.next()) { alarmCount[resultSet.getInt("STARTTIME_HOUR")] = resultSet.getInt("COUNT"); } } catch (SQLException e) { e.printStackTrace(); } for (int i = 0; i < 24; i++) { dataset.addValue(alarmCount[i], "", "" + i); } JFreeChart chart = ChartFactory.createBarChart3D("Zeitbersicht", "Uhrzeit", "Einstze", dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(getBackground()); ChartPanel panel = new ChartPanel(chart); panel.setPopupMenu(null); add(panel, BorderLayout.CENTER); }
From source file:Servlets.servletGraficas.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods.//from w ww. j a va2 s . co m * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String SITIO_1 = "prueba 1"; String SITIO_2 = "prueba 2"; // Visitas del sitio web 1 dataset.setValue(100, SITIO_1, "Lunes"); dataset.setValue(120, SITIO_1, "Martes"); dataset.setValue(110, SITIO_1, "Mircoles"); dataset.setValue(103, SITIO_1, "Jueves"); dataset.setValue(106, SITIO_1, "Viernes"); // Visitas del sitio web 2 dataset.setValue(60, SITIO_2, "Lunes"); dataset.setValue(62, SITIO_2, "Martes"); dataset.setValue(61, SITIO_2, "Mircoles"); dataset.setValue(63, SITIO_2, "Jueves"); dataset.setValue(66, SITIO_2, "Viernes"); JFreeChart chart = ChartFactory.createBarChart3D("Aspirantes", "", "Nmero visitas", dataset, PlotOrientation.VERTICAL, true, true, false); try { File image = File.createTempFile("image", "tmp"); // Assume that we have the chart ChartUtilities.saveChartAsPNG(image, chart, 500, 300); FileInputStream fileInStream = new FileInputStream(image); OutputStream outStream = response.getOutputStream(); long fileLength; byte[] byteStream; fileLength = image.length(); byteStream = new byte[(int) fileLength]; fileInStream.read(byteStream, 0, (int) fileLength); response.setContentType("image/png"); response.setContentLength((int) fileLength); response.setHeader("Cache-Control", "no-store,no-cache, must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "no-cache"); fileInStream.close(); outStream.write(byteStream); outStream.flush(); outStream.close(); } catch (IOException e) { System.err.println("Problem occurred creating 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 );/*from www . j av a 2 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:de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.MonthlyStatisticPanel.java
public MonthlyStatisticPanel() { setName("Monat"); setLayout(new BorderLayout()); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int alarmCount[] = new int[12]; try {/*from w w w .ja v a 2 s .co m*/ ResultSet resultSet = Starter.getDatabase().getStatement().executeQuery( "SELECT STARTDATE_MONTH, COUNT(*) AS COUNT FROM ALARMHISTORY GROUP BY STARTDATE_MONTH"); while (resultSet.next()) { alarmCount[resultSet.getInt("STARTDATE_MONTH") - 1] = resultSet.getInt("COUNT"); } } catch (SQLException e) { e.printStackTrace(); } for (int i = 0; i < 12; i++) { dataset.addValue(alarmCount[i], "", "" + (i + 1)); } JFreeChart chart = ChartFactory.createBarChart3D("Monatsbersicht", "Monat", "Einstze", dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(getBackground()); ChartPanel panel = new ChartPanel(chart); panel.setPopupMenu(null); add(panel, BorderLayout.CENTER); }
From source file:unikn.dbis.univis.visualization.chart.BarChart.java
/** * @return JFreeChart as BarChart3D.//from w w w .j a v a 2s .c o m */ protected JFreeChart createChart() { if (ChartType.BAR_CHART_HORIZONTAL.equals(chartType)) { return ChartFactory.createBarChart3D(getChartName(), "", xAxis, getDataset(), PlotOrientation.HORIZONTAL, true, false, false); } else if (ChartType.BAR_CHART_VERTICAL.equals(chartType)) { return ChartFactory.createBarChart3D(getChartName(), "", xAxis, getDataset(), PlotOrientation.VERTICAL, true, false, false); } else { return null; } }
From source file:gchisto.gui.panels.gcstats.MetricChartPanel.java
/** * It creates a chart for the given dataset and adds the chart to the panel. * * @param dataset The dataset that will provide the values for the chart. *///w w w . j ava 2 s .c o m private void addChart() { JFreeChart chart = ChartFactory.createBarChart3D(getTitle(), null, "Time" + unitSuffix(), dataset, PlotOrientation.VERTICAL, true, true, false); chart.addProgressListener(locker); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(dataset); mainPanel().add(BorderLayout.CENTER, new ChartPanel(chart)); }
From source file:room.utilization.BarGraph.java
private JFreeChart createGraph(CategoryDataset dataset) { JFreeChart graph = null;// w ww. jav a 2 s . c o m BarRenderer3D br = null; graph = ChartFactory.createBarChart3D(title, AXIS_LABEL, VALUE_AXIS_LABEL, dataset, PlotOrientation.VERTICAL, true, true, false); return graph; }
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 www. j av a2s.c om*/ 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; }