List of usage examples for org.jfree.chart.axis ValueAxis setLabel
public void setLabel(String label)
From source file:logica.LGraficapeso.java
public static void logicaBtnGraficar(JRadioButton jRLinea) { ChartPanel panel;//from w ww. ja va2 s . c o m JFreeChart chart = null; if (jRLinea.isSelected()) { // ejecuto linea XYSplineRenderer graficoLinea = new XYSplineRenderer(); XYSeriesCollection dataset = new XYSeriesCollection(); ValueAxis x = new NumberAxis(); ValueAxis y = new NumberAxis(); XYSeries serie = new XYSeries("Datos"); XYPlot plot; graficoLinea.setSeriesPaint(0, Color.YELLOW); VGraficaPeso.getPanelLinea().removeAll(); for (int i = 0; i < VGraficaPeso.getjTable1().getRowCount(); i++) { float valor1 = Float.parseFloat(String.valueOf(VGraficaPeso.getjTable1().getValueAt(i, 0))); float valor2 = Float.parseFloat(String.valueOf(VGraficaPeso.getjTable1().getValueAt(i, 1))); System.out.println("valores " + valor1 + " " + valor2); serie.add(valor1, valor2); } dataset.addSeries(serie); x.setLabel("MES"); y.setLabel("peso"); plot = new XYPlot(dataset, x, y, graficoLinea); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(10, 15); chart = new JFreeChart(plot); chart.setTitle("grafico"); panel = new ChartPanel(chart); panel.setBounds(5, 10, 410, 350); VGraficaPeso.getPanelLinea().add(panel); VGraficaPeso.getPanelLinea().repaint(); } }
From source file:logica.LGraficaAltura.java
public static void logicaBtnGraficar(JRadioButton jRLinea) { ChartPanel panel;// w ww .ja va 2 s. c o m JFreeChart chart = null; if (jRLinea.isSelected()) { // ejecuto linea XYSplineRenderer graficoLinea = new XYSplineRenderer(); XYSeriesCollection dataset = new XYSeriesCollection(); ValueAxis x = new NumberAxis(); ValueAxis y = new NumberAxis(); XYSeries serie = new XYSeries("Datos"); XYPlot plot; graficoLinea.setSeriesPaint(0, Color.YELLOW); VGraficaAltura.getPanelLinea().removeAll(); for (int i = 0; i < VGraficaAltura.getjTable1().getRowCount(); i++) { float valor1 = Float.parseFloat(String.valueOf(VGraficaAltura.getjTable1().getValueAt(i, 0))); float valor2 = Float.parseFloat(String.valueOf(VGraficaAltura.getjTable1().getValueAt(i, 1))); System.out.println("valores " + valor1 + " " + valor2); serie.add(valor1, valor2); } dataset.addSeries(serie); x.setLabel("MES"); y.setLabel("ALTURA"); plot = new XYPlot(dataset, x, y, graficoLinea); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(15, 30); chart = new JFreeChart(plot); chart.setTitle("grafico"); panel = new ChartPanel(chart); panel.setBounds(5, 10, 410, 350); VGraficaAltura.getPanelLinea().add(panel); VGraficaAltura.getPanelLinea().repaint(); } }
From source file:net.sf.statcvs.output.xml.chart.AbstractBarChart.java
public void setValueAxisLabel(String text) { CategoryPlot plot = getChart().getCategoryPlot(); ValueAxis axis = plot.getRangeAxis(); axis.setLabel(text); }
From source file:de.berlios.statcvs.xml.chart.AbstractChart.java
/** * @deprecated//from w w w . j a v a 2 s.c om */ public void setValueAxisLabel(String text) { CategoryPlot plot = getChart().getCategoryPlot(); ValueAxis axis = plot.getRangeAxis(); axis.setLabel(text); }
From source file:com.philng.telemetrydisplay.GraphDisplay.java
/** * Create the chart itself with datasets * @param dataset/*from w ww. j av a2s.c o m*/ * @return */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createTimeSeriesChart("Telemetry Display", "Time", "Voltage", dataset, true, true, false); final XYPlot plot = result.getXYPlot(); // Add in a new y axis for current ValueAxis currentAxis = new NumberAxis(); currentAxis.setRange(0, 100); currentAxis.setLabel("Current"); plot.setRangeAxis(1, currentAxis); plot.setDataset(1, createDatasetCurrent()); plot.mapDatasetToRangeAxis(1, 1); // Set information for the x axis (time) ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); // Set the information for the voltage axis axis = plot.getRangeAxis(); axis.setAutoRange(false); axis.setRange(0.0, 12.0); final XYItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); if (renderer instanceof StandardXYItemRenderer) { final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; rr.setShapesFilled(true); } final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.GREEN); renderer.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); plot.setRenderer(1, renderer2); return result; }
From source file:greenapi.ui.charts.ChartPanelSupport.java
public void cleanLabels() { this.getChart().setTitle(""); DateAxis localDateAxis = (DateAxis) ((XYPlot) this.chart.getPlot()).getDomainAxis(); localDateAxis.setLabel(""); ValueAxis localValueAxis = ((XYPlot) this.chart.getPlot()).getRangeAxis(); localValueAxis.setLabel(""); }
From source file:de.fub.maps.gpx.analysis.ui.GpxTrkSegAnalysizerTopComponent.java
private void initCharts() { // set chart titles velocityChart.setTitle(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.velocity.chart.name")); accelerationChart.setTitle(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.acceleration.chart.name")); headingChart.setTitle(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.heading.chart.name")); // config domain axis ValueAxis domainAxis = velocityChart.getDomainAxis(); domainAxis.setLabel(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.velocity.chart.domainaxis.name")); domainAxis = accelerationChart.getDomainAxis(); domainAxis.setLabel(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.acceleration.chart.domainaxis.name")); domainAxis = headingChart.getDomainAxis(); domainAxis.setLabel(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.heading.chart.domainaxis.name")); // confing value axis ValueAxis rangeAxis = velocityChart.getRangeAxis(); rangeAxis.setLabel(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.velocity.chart.valueaxis.name")); rangeAxis = accelerationChart.getRangeAxis(); rangeAxis.setLabel(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.acceleration.chart.valueaxis.name")); rangeAxis = headingChart.getRangeAxis(); rangeAxis.setLabel(NbBundle.getMessage(GpxTrkSegAnalysizerTopComponent.class, "GpxTrkSegAnalysizerTopComponent.heading.chart.valueaxis.name")); }
From source file:wattsup.jsdk.ui.ChartPanelSupport.java
/** * Sets empty the chart's labels.//from w w w.j av a 2 s. c om */ public void cleanLabels() { this.getChart().setTitle(""); DateAxis localDateAxis = (DateAxis) ((XYPlot) this.chart_.getPlot()).getDomainAxis(); localDateAxis.setLabel(""); ValueAxis localValueAxis = ((XYPlot) this.chart_.getPlot()).getRangeAxis(); localValueAxis.setLabel(""); }
From source file:netplot.GenericPlotPanel.java
void genericConfig(JFreeChart chart, XYPlot plot, int plotIndex) { if (!enableLegend) { chart.removeLegend();/*from ww w .java 2s . c o m*/ } XYItemRenderer xyItemRenderer = plot.getRenderer(); //May also be XYBarRenderer if (xyItemRenderer instanceof XYLineAndShapeRenderer) { XYToolTipGenerator xyToolTipGenerator = xyItemRenderer.getBaseToolTipGenerator(); //If currently an XYLineAndShapeRenderer replace it so that we inc the colour for every plotIndex XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(linesEnabled, shapesEnabled); //Ensure we don't loose the tool tips on the new renderer renderer.setBaseToolTipGenerator(xyToolTipGenerator); renderer.setBasePaint(getPlotColour(plotIndex)); renderer.setSeriesStroke(0, new BasicStroke(lineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL), true); plot.setRenderer(plotIndex, renderer); } //If we have a new y axis then we need a new data set if (yAxisName != null && yAxisName.length() > 0) { if (logYAxis) { LogAxis yAxis = new LogAxis(yAxisName); yAxis.setAutoRange(false); yAxis.setNumberFormatOverride(new LogFormat(10, "10", true)); yAxis.setRange(minScaleValue, maxScaleValue); yAxis.setLowerBound(minScaleValue); yAxis.setUpperBound(maxScaleValue); plot.setRangeAxis(yAxisIndex, yAxis); plot.setRangeAxisLocation(yAxisIndex, AxisLocation.BOTTOM_OR_LEFT); } else { NumberAxis axis = new NumberAxis(yAxisName); axis.setAutoRangeIncludesZero(zeroOnYScale); if (autoScaleEnabled) { axis.setAutoRange(true); } else { Range range = new Range(minScaleValue, maxScaleValue); axis.setRangeWithMargins(range, true, true); } if (yAxisTickCount > 0) { NumberTickUnit tick = new NumberTickUnit(yAxisTickCount); axis.setTickUnit(tick); } plot.setRangeAxis(yAxisIndex, axis); plot.setRangeAxisLocation(yAxisIndex, AxisLocation.BOTTOM_OR_LEFT); } yAxisIndex++; } plot.mapDatasetToRangeAxis(plotIndex, yAxisIndex - 1); ValueAxis a = plot.getDomainAxis(); if (xAxisName.length() > 0) { a.setLabel(xAxisName); } //We can enable/disable zero on the axis if we have a NumberAxis if (a instanceof NumberAxis) { ((NumberAxis) a).setAutoRangeIncludesZero(zeroOnXScale); } }
From source file:telas.TelaGrafico.java
public void criaGrafico(ArrayList<Processo> listapronto) { JFreeChart chart = null;/*from w w w. ja v a2 s . c o m*/ XYSplineRenderer renderer = new XYSplineRenderer(); XYSeriesCollection dataset = new XYSeriesCollection(); ValueAxis x = new NumberAxis(); ValueAxis y = new NumberAxis(); XYSeries serie = new XYSeries("Processos"); XYPlot plot; for (int fila = 0; fila < listapronto.size(); fila++) { serie.add(listapronto.get(fila).getTsurto(), listapronto.get(fila).getTespera()); } dataset.addSeries(serie); x.setLabel("Processos"); y.setLabel("Tempo de espera"); plot = new XYPlot(dataset, x, y, renderer); chart = new JFreeChart(plot); chart.setTitle("Processos"); ChartPanel myChartPanel = new ChartPanel(chart, true); myChartPanel.setSize(jPanel1.getWidth(), jPanel1.getHeight()); myChartPanel.setVisible(true); jPanel1.removeAll(); jPanel1.add(myChartPanel); jPanel1.revalidate(); jPanel1.repaint(); }