List of usage examples for org.jfree.chart.plot XYPlot setRangeCrosshairVisible
public void setRangeCrosshairVisible(boolean flag)
From source file:org.ramadda.geodata.cdmdata.PointDatabaseTypeHandler.java
/** * _more_//from w w w . ja va2 s .c o m * * * @param request _more_ * @param entry _more_ * @param dataset _more_ * * @return _more_ */ private static JFreeChart createChart(Request request, Entry entry, XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart( request.getString(ARG_POINT_TIMESERIES_TITLE, entry.getName()), // title "Date", // x-axis label "", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); ValueAxis rangeAxis = new NumberAxis(""); rangeAxis.setVisible(false); XYPlot plot = (XYPlot) chart.getPlot(); if (request.get("gray", false)) { plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); } else { plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); } plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setRangeAxis(0, rangeAxis, false); XYItemRenderer r = plot.getRenderer(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); return chart; }
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.AdvancedXY_PlotPanel.java
private void initChart(XY_PlotPanel pPanel) { this.plotPanel = pPanel; this.chartPanel = pPanel.getChartPanel(); if (pPanel instanceof SimpleXY_PlotPanel) { this.setTitle(((SimpleXY_PlotPanel) pPanel).getTitle()); }/*w ww . jav a 2s . c o m*/ JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); // how many data sets will there be (may not exist yet, cause swing worker may still be constructing them) int numRows = 2; // enough for counts, and delta counts if ((XY_PlotType.ADV_PORT_UTIL_PLUS.equals(getType()))) numRows = 4; boolean includeExtra = numRows > MAX_DATASETS / 2 ? true : false; int rowSize = includeExtra ? MAX_DS_SIZE : MAX_DS_SIZE / 2 + 19; // extra for padding NumDataSets = numRows; // build the table model from the data sets, then build the table and slider // see "chartProgress()" method chart.addProgressListener(this); this.chartPanel.setPreferredSize(new java.awt.Dimension(750, 300)); this.chartPanel.setDomainZoomable(true); this.chartPanel.setRangeZoomable(true); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createEtchedBorder()); this.chartPanel.setBorder(border); add(this.chartPanel); JPanel dashboard = new JPanel(new BorderLayout()); dashboard.setPreferredSize(new Dimension(400, rowSize)); dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4)); this.model = new XY_PlotTableModel(numRows); // initialize the model, and table, here // this.model.setValueAt("name", 0, 1); this.model.setValueAt(new Double("0.00"), 0, 1); this.model.setValueAt(new Double("0.00"), 0, 2); // this.model.setValueAt("units", 0, 3); JTable table = new JTable(this.model); // the columns are name, time, value, units. both name and units are strings // so need special renderers for time and value TableCellRenderer renderer1 = new DateCellRenderer(new SimpleDateFormat("HH:mm:ss")); TableCellRenderer renderer2 = new NumberCellRenderer(); table.getColumnModel().getColumn(1).setCellRenderer(renderer1); table.getColumnModel().getColumn(2).setCellRenderer(renderer2); JScrollPane scroller = new JScrollPane(table); dashboard.add(scroller); this.slider = new JSlider(0, 100, 10); this.slider.addChangeListener(this); dashboard.add(this.slider, BorderLayout.SOUTH); add(dashboard, BorderLayout.SOUTH); // XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainCrosshairLockedOnData(true); plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(true); }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JFreeChart createInterruptChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Interrupt Chart", "Time", "Count", dataset, true, true, false);/*w ww . j ava 2 s .com*/ chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); // plot.setOutlinePaint(null); plot.setBackgroundPaint(Color.black); plot.setDomainGridlinePaint(Color.green); plot.setRangeGridlinePaint(Color.green); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(false); final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("s.SS")); return chart; }
From source file:com.afunms.system.manage.equipManager.java
/** * Creates a sample chart./*w ww. j a va 2s .co m*/ * * @return a sample chart. */ private JFreeChart createChart() { final XYDataset direction = createDirectionDataset(600); final JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", direction, true, true, false); final XYPlot plot = chart.getXYPlot(); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setUpperMargin(0.0); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairVisible(true); plot.setBackgroundPaint(Color.WHITE); plot.setForegroundAlpha(0.8f); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.darkGray); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(new Color(139, 69, 19)); XYLineAndShapeRenderer render0 = (XYLineAndShapeRenderer) plot.getRenderer(0); render0.setSeriesPaint(0, Color.BLUE); XYAreaRenderer xyarearenderer = new XYAreaRenderer(); xyarearenderer.setSeriesPaint(1, Color.GREEN); // xyarearenderer.setSeriesFillPaint(1, Color.GREEN); xyarearenderer.setPaint(Color.GREEN); // configure the range axis to display directions... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); final TickUnits units = new TickUnits(); units.add(new NumberTickUnit(180.0, new CompassFormat())); units.add(new NumberTickUnit(90.0, new CompassFormat())); units.add(new NumberTickUnit(45.0, new CompassFormat())); units.add(new NumberTickUnit(22.5, new CompassFormat())); rangeAxis.setStandardTickUnits(units); // add the wind force with a secondary dataset/renderer/axis plot.setRangeAxis(rangeAxis); final XYItemRenderer renderer2 = new XYAreaRenderer(); final ValueAxis axis2 = new NumberAxis(""); axis2.setRange(0.0, 12.0); xyarearenderer.setSeriesPaint(1, new Color(0, 204, 0)); // xyarearenderer.setSeriesFillPaint(1, Color.GREEN); xyarearenderer.setPaint(Color.GREEN); plot.setDataset(1, createForceDataset(600)); plot.setRenderer(1, xyarearenderer); plot.setRangeAxis(1, axis2); plot.mapDatasetToRangeAxis(1, 1); return chart; }
From source file:interfaces.InterfazPrincipal.java
private void botonGenerarReporteClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGenerarReporteClienteActionPerformed // TODO add your handling code here: try {//from w ww . ja v a 2s .co m if (clienteReporteClienteFechaFinal.getSelectedDate().getTime() .compareTo(clienteReporteClienteFechaInicial.getSelectedDate().getTime()) < 0) { JOptionPane.showMessageDialog(this, "La fecha final debe ser posterior al dia de inicio"); } else { final ArrayList<Integer> listaIDFlujos = new ArrayList<>(); final JDialog dialogoEditar = new JDialog(); dialogoEditar.setTitle("Reporte cliente"); dialogoEditar.setSize(350, 610); dialogoEditar.setResizable(false); JPanel panelDialogo = new JPanel(); panelDialogo.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); //c.fill = GridBagConstraints.HORIZONTAL; JLabel ediitarTextoPrincipalDialogo = new JLabel("Informe cliente"); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.insets = new Insets(10, 45, 10, 10); Font textoGrande = new Font("Arial", 1, 18); ediitarTextoPrincipalDialogo.setFont(textoGrande); panelDialogo.add(ediitarTextoPrincipalDialogo, c); final JTable tablaDialogo = new JTable(); DefaultTableModel modeloTabla = new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { //all cells false return false; } }; ; modeloTabla.addColumn("Factura"); modeloTabla.addColumn("Tipo Flujo"); modeloTabla.addColumn("Fecha"); modeloTabla.addColumn("Valor"); //Llenar tabla ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura(); ArrayList<String[]> flujosCliente = controladorFlujoFactura.getTodosFlujo_Factura( " where factura_id in (select factura_id from Factura where cliente_id = " + String.valueOf(jTextFieldIdentificacionClienteReporte.getText()) + ") order by factura_id"); // {"flujo_id","factura_id","tipo_flujo","fecha","valor"}; ArrayList<Calendar> fechasFlujos = new ArrayList<>(); for (int i = 0; i < flujosCliente.size(); i++) { String fila[] = new String[4]; String[] objeto = flujosCliente.get(i); fila[0] = objeto[1]; fila[1] = objeto[2]; fila[2] = objeto[3]; fila[3] = objeto[4]; //Filtrar, mirar las fechas String[] partirEspacios = objeto[3].split("\\s"); //El primer string es la fecha sin hora //Ahora esparamos por - String[] tomarAgeMesDia = partirEspacios[0].split("-"); //Realizar filtro int ageConsulta = Integer.parseInt(tomarAgeMesDia[0]); int mesConsulta = Integer.parseInt(tomarAgeMesDia[1]); int diaConsulta = Integer.parseInt(tomarAgeMesDia[2]); //Obtenemos dias, mes y ao de la consulta //Inicial int anioInicial = clienteReporteClienteFechaFinal.getSelectedDate().get(Calendar.YEAR); int mesInicial = clienteReporteClienteFechaFinal.getSelectedDate().get(Calendar.MONTH) + 1; int diaInicial = clienteReporteClienteFechaFinal.getSelectedDate().get(Calendar.DAY_OF_MONTH); //Final int anioFinal = clienteReporteClienteFechaInicial.getSelectedDate().get(Calendar.YEAR); int mesFinal = clienteReporteClienteFechaInicial.getSelectedDate().get(Calendar.MONTH) + 1; int diaFinal = clienteReporteClienteFechaInicial.getSelectedDate().get(Calendar.DAY_OF_MONTH); //Construir fechas Calendar fechaDeLaBD = new GregorianCalendar(ageConsulta, mesConsulta, diaConsulta); //Set year, month, day) Calendar fechaInicialRango = new GregorianCalendar(anioInicial, mesInicial, diaInicial); Calendar fechaFinalRango = new GregorianCalendar(anioFinal, mesFinal, diaFinal); if (fechaDeLaBD.compareTo(fechaInicialRango) <= 0 && fechaDeLaBD.compareTo(fechaFinalRango) >= 0) { fechasFlujos.add(fechaDeLaBD); modeloTabla.addRow(fila); } } if (modeloTabla.getRowCount() > 0) { tablaDialogo.setModel(modeloTabla); tablaDialogo.getColumn("Factura").setMinWidth(80); tablaDialogo.getColumn("Tipo Flujo").setMinWidth(80); tablaDialogo.getColumn("Fecha").setMinWidth(90); tablaDialogo.getColumn("Valor").setMinWidth(80); tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll = new JScrollPane(tablaDialogo); scroll.setPreferredSize(new Dimension(330, 150)); c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.insets = new Insets(0, 0, 0, 0); panelDialogo.add(scroll, c); TimeSeries localTimeSeries = new TimeSeries("Compras del cliente en el periodo"); Map listaAbonos = new HashMap(); for (int i = 0; i < modeloTabla.getRowCount(); i++) { listaIDFlujos.add(Integer.parseInt(flujosCliente.get(i)[0])); if (modeloTabla.getValueAt(i, 1).equals("abono")) { Calendar fechaFlujo = fechasFlujos.get(i); double valor = Double.parseDouble(String.valueOf(modeloTabla.getValueAt(i, 3))); int anoDato = fechaFlujo.get(Calendar.YEAR); int mesDato = fechaFlujo.get(Calendar.MONTH) + 1; int diaDato = fechaFlujo.get(Calendar.DAY_OF_MONTH); Day FechaDato = new Day(diaDato, mesDato, anoDato); if (listaAbonos.get(FechaDato) != null) { double valorAbono = (double) listaAbonos.get(FechaDato); listaAbonos.remove(FechaDato); listaAbonos.put(FechaDato, valorAbono + valor); } else { listaAbonos.put(FechaDato, valor); } } } Double maximo = 0.0; Iterator iterator = listaAbonos.keySet().iterator(); while (iterator.hasNext()) { Day key = (Day) iterator.next(); Double value = (double) listaAbonos.get(key); maximo = Math.max(maximo, value); localTimeSeries.add(key, value); } //localTimeSeries.add(); TimeSeriesCollection datos = new TimeSeriesCollection(localTimeSeries); JFreeChart chart = ChartFactory.createTimeSeriesChart("Compras del cliente en el periodo", // Title "Tiempo", // x-axis Label "Total ($)", // y-axis Label datos, // Dataset true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); /*Altering the graph */ XYPlot plot = (XYPlot) chart.getPlot(); plot.setAxisOffset(new RectangleInsets(5.0, 10.0, 10.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis(); numberAxis.setRange(new Range(0, maximo * 1.2)); Font font = new Font("Dialog", Font.PLAIN, 9); numberAxis.setTickLabelFont(font); numberAxis.setLabelFont(font); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yyyy")); axis.setAutoTickUnitSelection(false); axis.setVerticalTickLabels(true); axis.setTickLabelFont(font); axis.setLabelFont(font); LegendTitle leyendaChart = chart.getLegend(); leyendaChart.setItemFont(font); Font fontTitulo = new Font("Dialog", Font.BOLD, 12); TextTitle tituloChart = chart.getTitle(); tituloChart.setFont(fontTitulo); ChartPanel CP = new ChartPanel(chart); Dimension D = new Dimension(330, 300); CP.setPreferredSize(D); CP.setVisible(true); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.insets = new Insets(10, 0, 0, 0); panelDialogo.add(CP, c); c.gridx = 0; c.gridy = 3; c.gridwidth = 1; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(10, 30, 0, 0); JButton botonCerrar = new JButton("Cerrar"); botonCerrar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialogoEditar.dispose(); } }); panelDialogo.add(botonCerrar, c); JButton botonGenerarPDF = new JButton("Guardar archivo"); botonGenerarPDF.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ReporteFlujosCliente reporteFlujosCliente = new ReporteFlujosCliente(); reporteFlujosCliente.guardarDocumentoDialogo(dialogoEditar, listaIDFlujos, Integer.parseInt(jTextFieldIdentificacionClienteReporte.getText()), clienteReporteClienteFechaInicial.getSelectedDate(), clienteReporteClienteFechaFinal.getSelectedDate()); } }); c.insets = new Insets(10, 100, 0, 0); panelDialogo.add(botonGenerarPDF, c); JButton botonImprimir = new JButton("Imprimir"); botonImprimir.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ReporteFlujosCliente reporteFlujosCliente = new ReporteFlujosCliente(); reporteFlujosCliente.imprimirFlujo(listaIDFlujos, Integer.parseInt(jTextFieldIdentificacionClienteReporte.getText()), clienteReporteClienteFechaInicial.getSelectedDate(), clienteReporteClienteFechaFinal.getSelectedDate()); } }); c.insets = new Insets(10, 230, 0, 0); panelDialogo.add(botonImprimir, c); dialogoEditar.add(panelDialogo); dialogoEditar.setVisible(true); } else { JOptionPane.showMessageDialog(this, "El cliente no registra movimientos en el rango de fechas seleccionado"); } } } catch (Exception e) { JOptionPane.showMessageDialog(this, "Debe seleccionar un da inicial y final de fechas"); } }
From source file:gov.llnl.lustre.lwatch.PlotFrame2.java
/** * Define the JFreeChart chart.//from w ww. j a v a 2 s . co m * * @param dataset dataset to be plotted in the chart. */ public JFreeChart createChart(XYDataset dataset) { // Load data for settings from last "Refresh" time String[] selectedRows = lastRefreshPlotParams.getCategories(); String[] selectedVars = lastRefreshPlotParams.getVariables(); String[] selectedCurves = lastRefreshPlotParams.getCurves(); int savedGranularity = granularity; granularity = lastRefreshPlotParams.getGranularity(); boolean showLegend = true; //if (((isAnAggPlot) && (nColsSelected * nCurvesSelected > 8)) || //(nRowsSelected * nColsSelected * nCurvesSelected > 8)) //showLegend = false; if (((isAnAggPlot) && (selectedVars.length * selectedCurves.length > 8)) || (selectedRows.length * selectedVars.length * selectedCurves.length > 8)) showLegend = false; //if (fromRefresh && (nRowsSelected > 0 && nColsSelected > 0 && nCurvesSelected > 0) && //(!noVarSelected)) { if (fromRefresh && (selectedRows.length > 0 && selectedVars.length > 0 && selectedCurves.length > 0) && (!noVarSelected)) { //Debug.out("nRowsSelected = " + nRowsSelected + //" nColsSelected = " + nColsSelected + //" nCurvesSelected = " + nCurvesSelected); pD = new PlotDescriptor(); } chart = ChartFactory.createTimeSeriesChart(fsName + " - " + type + " data", // title "Date", // x-axis label yAxisLabel, // y-axis label dataset, // data showLegend, // create legend false, // generate tooltips false // generate URLs ); chart.setBackgroundPaint(Color.black); //white); // Border color chart.setBorderVisible(true); TextTitle tTitle = chart.getTitle(); tTitle.setPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.black); //lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // Check need for logorihmic axis if (useLogRangeAxis) { LogarithmicAxis rangeAxis2 = new LogarithmicAxis(yAxisLabel); plot.setRangeAxis(0, rangeAxis2); } // Default axis annotation is in black. So if the chart background // Paint was set to black above, we need to set axis labels, // tick labels and tick marks to be a contrasting color. plot.getDomainAxis().setLabelPaint(Color.white); plot.getDomainAxis().setTickLabelPaint(Color.white); plot.getDomainAxis().setTickMarkPaint(Color.white); plot.getRangeAxis().setLabelPaint(Color.white); plot.getRangeAxis().setTickLabelPaint(Color.white); plot.getRangeAxis().setTickMarkPaint(Color.white); // Grab the colors from the legend. //int nCurves = nRowsSelected * nColsSelected * nCurvesSelected; int nCurves = selectedRows.length * selectedVars.length * selectedCurves.length; if (localDebug) { Debug.out("selectedRows.length, selectedVars.length, selectedCurves.length = " + selectedRows.length + ", " + selectedVars.length + ", " + selectedCurves.length); Debug.out("Dimension legendColors to size = " + nCurves); } legendColors = new Color[nCurves]; LegendItemCollection lic = plot.getLegendItems(); for (int i = 0; i < lic.getItemCount(); i++) { LegendItem li = lic.get(i); legendColors[i] = (Color) li.getLinePaint(); //if (localDebug) //Debug.out("Line Paint for legend " + i + " = " + //legendColors[i]); } XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(showIcons); // Controls icons at data pts. renderer.setBaseShapesFilled(false); } DateAxis axis = (DateAxis) plot.getDomainAxis(); if (granularity == Database.HOUR) axis.setDateFormatOverride(new SimpleDateFormat("MM/dd HH")); //("dd-MMM-yy")); else if (granularity == Database.DAY) axis.setDateFormatOverride(new SimpleDateFormat("MM/dd/yy")); //("dd-MMM-yy")); else if (granularity == Database.WEEK) axis.setDateFormatOverride(new SimpleDateFormat("MM/dd/yy")); //("dd-MMM-yy")); else if (granularity == Database.MONTH) axis.setDateFormatOverride(new SimpleDateFormat("MM/yy")); //("dd-MMM-yy")); else if (granularity == Database.YEAR) axis.setDateFormatOverride(new SimpleDateFormat("yyyy HH:mm")); //("dd-MMM-yy")); else // granualrity == Database.RAW or HEARTBEAT axis.setDateFormatOverride(new SimpleDateFormat("MM/dd HH:mm:ss")); //("dd-MMM-yy")); // Reset granularity; granularity = savedGranularity; return chart; }
From source file:org.jfree.chart.ChartFactory.java
/** * Creates a stepped XY plot with default settings. * * @param title the chart title ({@code null} permitted). * @param xAxisLabel a label for the X-axis ({@code null} permitted). * @param yAxisLabel a label for the Y-axis ({@code null} permitted). * @param dataset the dataset for the chart ({@code null} permitted). * * @return A chart.//from w ww.j a v a 2 s .c o m */ public static JFreeChart createXYStepChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset) { DateAxis xAxis = new DateAxis(xAxisLabel); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator(); XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, null); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); plot.setRenderer(renderer); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, plot); currentTheme.apply(chart); return chart; }
From source file:org.jfree.chart.ChartFactory.java
/** * Creates a filled stepped XY plot with default settings. * * @param title the chart title ({@code null} permitted). * @param xAxisLabel a label for the X-axis ({@code null} permitted). * @param yAxisLabel a label for the Y-axis ({@code null} permitted). * @param dataset the dataset for the chart ({@code null} permitted). * * @return A chart./*w w w.jav a 2s.c om*/ */ public static JFreeChart createXYStepAreaChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset) { NumberAxis xAxis = new NumberAxis(xAxisLabel); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(yAxisLabel); XYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator(); XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, null); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); plot.setRenderer(renderer); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, plot); currentTheme.apply(chart); return chart; }