List of usage examples for org.jfree.chart.plot XYPlot addRangeMarker
public void addRangeMarker(Marker marker)
From source file:org.gwaspi.reports.GenericReportGenerator.java
private static void appendToCombinedRangeManhattanPlot(CombinedRangeXYPlot combinedPlot, String chromosome, XYSeriesCollection currChrSC, boolean showlables, double threshold, Color background, Color backgroundAlternative, Color main) { XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); // Set dot shape of the currently appended Series renderer.setSeriesPaint(currChrSC.getSeriesCount() - 1, main); renderer.setSeriesVisibleInLegend(currChrSC.getSeriesCount() - 1, showlables); renderer.setSeriesShape(currChrSC.getSeriesCount() - 1, new Rectangle2D.Double(-1.0, -1.0, 2.0, 2.0)); // Set range axis if (combinedPlot.getSubplots().isEmpty()) { LogAxis rangeAxis = new LogAxis("P value"); rangeAxis.setBase(10);//from w w w.ja v a 2s .c o m rangeAxis.setInverted(true); rangeAxis.setNumberFormatOverride(FORMAT_P_VALUE); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickCount(2); rangeAxis.setMinorTickMarksVisible(true); rangeAxis.setAxisLineVisible(true); rangeAxis.setUpperMargin(0); TickUnitSource units = NumberAxis.createIntegerTickUnits(); rangeAxis.setStandardTickUnits(units); combinedPlot.setRangeAxis(0, rangeAxis); } // Build subchart JFreeChart subchart = ChartFactory.createScatterPlot("", "Chr " + chromosome, "", currChrSC, PlotOrientation.VERTICAL, false, false, false); // Get subplot from subchart XYPlot subplot = (XYPlot) subchart.getPlot(); subplot.setRenderer(renderer); subplot.setBackgroundPaint(null); // CHART BACKGROUD COLOR if (combinedPlot.getSubplots().size() % 2 == 0) { subplot.setBackgroundPaint(background); // Hue, saturation, brightness } else { subplot.setBackgroundPaint(backgroundAlternative); // Hue, saturation, brightness } // Add significance Threshold to subplot final Marker thresholdLine = new ValueMarker(threshold); thresholdLine.setPaint(Color.red); // Add legend to hetzyThreshold if (showlables) { thresholdLine.setLabel("P = " + FORMAT_P_VALUE.format(threshold)); } thresholdLine.setLabelAnchor(RectangleAnchor.TOP_RIGHT); thresholdLine.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); subplot.addRangeMarker(thresholdLine); // Chromosome Axis Labels NumberAxis chrAxis = (NumberAxis) subplot.getDomainAxis(); chrAxis.setLabelAngle(1.0); chrAxis.setAutoRangeIncludesZero(false); chrAxis.setAxisLineVisible(true); chrAxis.setTickLabelsVisible(false); chrAxis.setTickMarksVisible(false); // chrAxis.setNumberFormatOverride(Report_Analysis.FORMAT_SCIENTIFIC); // TickUnitSource units = NumberAxis.createIntegerTickUnits(); // chrAxis.setStandardTickUnits(units); //combinedPlot.setGap(0); combinedPlot.add(subplot, 1); }
From source file:grafix.graficos.eixos.Eixo.java
protected void incluirMarcaIntraday(final XYPlot plot, final JanelaGraficos janela) { if (Controle.getConfiguracoesVolateis().isIntraday()) { MarcaGrafica m = new MarcaGrafica("", "INTRADAY", janela.getAcao().getRegistro(janela.getAcao().getNumeroRegistros() - 1).getData(), Color.BLUE); if (m.isRangeMarker()) { if (getNomeEixo().equals(m.getNomeEixo())) { plot.addRangeMarker(gerarRangeMarker(m)); }//from ww w .j ava 2 s. c om } else { plot.addDomainMarker(gerarIntervalMarker(m, janela)); } } }
From source file:Business.Chart.ChartBP.java
public ChartBP(final String applicationTitle, String chartTitle, HospitalWorkRequest workRequest) { super(applicationTitle); series6 = new TimeSeries("Blood Pressure"); this.chartTitle = chartTitle; this.workRequest = workRequest; final XYDataset dataset1 = createDatasetBP(workRequest); final JFreeChart chart1 = createChart1(dataset1); final XYPlot plot = chart1.getXYPlot(); HospitalWorkRequest hos1 = (HospitalWorkRequest) workRequest; int age = hos1.getPerson().getAge(); int a = hos1.getPerson().getAboveBPMarker(age); int b = hos1.getPerson().getBelowBPMarker(age); ValueMarker valueMarker = new ValueMarker(a); valueMarker.setLabel("ALERT"); valueMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker.setPaint(Color.blue); ValueMarker valueMarker1 = new ValueMarker(b); valueMarker1.setLabel("ALERT"); valueMarker1.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker1.setPaint(Color.BLUE); plot.addRangeMarker(valueMarker); plot.addRangeMarker(valueMarker1);//from w w w. j av a 2s . com }
From source file:Business.Chart.ChartBloodPressure.java
public ChartBloodPressure(final String applicationTitle, String chartTitle, HospitalWorkRequest workRequest) { super(applicationTitle); series6 = new TimeSeries("Blood Pressure"); this.workRequest = workRequest; this.chartTitle = chartTitle; final XYDataset dataset6 = createDatasetBloodPressure(workRequest); final JFreeChart chart6 = createChart(dataset6); //final XYDataset dataset1 = createDatasetBloodPressure(workRequest ); //final JFreeChart chart1 = createChart1( dataset1 ); final XYPlot plot = chart6.getXYPlot(); HospitalWorkRequest hos1 = (HospitalWorkRequest) workRequest; int age = hos1.getPerson().getAge(); int a = hos1.getPerson().getAboveBPMarker(age); int b = hos1.getPerson().getBelowBPMarker(age); ValueMarker valueMarker = new ValueMarker(a); valueMarker.setLabel("ALERT"); valueMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker.setPaint(Color.blue); ValueMarker valueMarker1 = new ValueMarker(b); valueMarker1.setLabel("ALERT"); valueMarker1.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker1.setPaint(Color.BLUE); plot.addRangeMarker(valueMarker); plot.addRangeMarker(valueMarker1);/* ww w . j a v a2 s . c om*/ //ChartFrame frame = new ChartFrame("series chart", chart); // frame.setVisible(true); // frame.setSize(450, 350); final ChartPanel chartPanel6 = new ChartPanel(chart6); chartPanel6.setPreferredSize(new java.awt.Dimension(560, 370)); chartPanel6.setMouseZoomable(true, false); setContentPane(chartPanel6); getContentPane().repaint(); }
From source file:bicat.gui.GraphicPane.java
public void updateGraphic() { // this.remove(chartPanel); org.jfree.data.xy.XYSeries[] series = new org.jfree.data.xy.XYSeries[graphDataList.size()]; // = new org.jfree.data.xy.XYSeries("Gene // Profile",true,false); gProfiles = new org.jfree.data.xy.DefaultTableXYDataset(); System.out.println("Created empty gene expressions...." + graphDataList.size()); ///*from w ww . j a va 2 s. c o m*/ for (int j = 0; j < graphDataList.size(); j++) { if (MethodConstants.debug) System.out.println("\n\nNew profile: "); series[j] = new org.jfree.data.xy.XYSeries("Gene Profile " + j + "", true, false); float[] expressions = (float[]) graphDataList.get(j); for (int i = 0; i < expressions.length; i++) { /* * if(chipList.contains(new Integer(i))) series[j].add(i, * expressions[i] - 1); //-owner.CONTRAST_VALUE); else */ series[j].add(i, expressions[i]); if (MethodConstants.debug) System.out.print(expressions[i] + ", "); } gProfiles.addSeries(series[j]); // series.clear(); expressions = null; } // System.out.println("Added gene profiles"); chart = null; double[] chips = new double[chipList.size()]; for (int p = 0; p < chips.length; p++) chips[p] = ((Integer) chipList.get(p)).doubleValue(); chart = myCreateXYLineChart("Expression profiles of Biclusters", "conditions", "gene expression", gProfiles, chips, org.jfree.chart.plot.PlotOrientation.VERTICAL, // HORIZONTAL, true, true, false); // chart.draw(); // chart.draw(); org.jfree.chart.plot.XYPlot xyPlot = (org.jfree.chart.plot.XYPlot) chart.getPlot(); xyPlot.addRangeMarker(new org.jfree.chart.plot.ValueMarker(10.0)); // chart.plotChanged(null); chartPanel = new org.jfree.chart.ChartPanel(chart); // ChartPanel(chart); this.removeAll(); this.add(chartPanel); this.setVisible(true); owner.getGraphScrollPane().repaint(); }
From source file:Business.Chart.ChartHeartRate.java
public ChartHeartRate(final String applicationTitle, String chartTitle, HospitalWorkRequest workRequest) { super(applicationTitle); series = new TimeSeries("Heart Rate"); this.workRequest = workRequest; this.chartTitle = chartTitle; final XYDataset dataset = createDatasetHeartRate(workRequest); final JFreeChart chart = createChart(dataset); //final XYDataset dataset1 = createDatasetBloodPressure(workRequest ); //final JFreeChart chart1 = createChart1( dataset1 ); final XYPlot plot = chart.getXYPlot(); HospitalWorkRequest hos1 = (HospitalWorkRequest) workRequest; int age = hos1.getPerson().getAge(); int a = hos1.getPerson().getAboveHeartRateMarker(age); int b = hos1.getPerson().getBelowHeartRateMarker(age); ValueMarker valueMarker = new ValueMarker(a); valueMarker.setLabel("ALERT"); valueMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker.setPaint(Color.blue); ValueMarker valueMarker1 = new ValueMarker(b); valueMarker1.setLabel("ALERT"); valueMarker1.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker1.setPaint(Color.BLUE); plot.addRangeMarker(valueMarker); plot.addRangeMarker(valueMarker1);// w w w. j av a 2 s . co m //ChartFrame frame = new ChartFrame("series chart", chart); // frame.setVisible(true); // frame.setSize(450, 350); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 370)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); getContentPane().repaint(); }
From source file:Business.Chart.Temperature.java
public Temperature(final String applicationTitle, String chartTitle, HospitalWorkRequest workRequest) { super(applicationTitle); series3 = new TimeSeries("Temperature"); this.workRequest = workRequest; this.chartTitle = chartTitle; final XYDataset dataset3 = createDatasetTemperature(workRequest); final JFreeChart chart3 = createChart(dataset3); final XYPlot plot = chart3.getXYPlot(); HospitalWorkRequest hos1 = (HospitalWorkRequest) workRequest; int age = hos1.getPerson().getAge(); int a = hos1.getPerson().getAboveTemperatureRateMarker(age); int b = hos1.getPerson().getBelowTemperatureRateMarker(age); ValueMarker valueMarker = new ValueMarker(a); valueMarker.setLabel("ALERT"); valueMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker.setPaint(Color.blue); ValueMarker valueMarker1 = new ValueMarker(b); valueMarker1.setLabel("ALERT"); valueMarker1.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker1.setPaint(Color.BLUE); plot.addRangeMarker(valueMarker); plot.addRangeMarker(valueMarker1);/*from w w w.j a v a 2 s . c o m*/ final ChartPanel chartPanel = new ChartPanel(chart3); chartPanel.setPreferredSize(new java.awt.Dimension(560, 370)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); getContentPane().repaint(); }
From source file:Business.Chart.ChartRespiratory.java
public ChartRespiratory(final String applicationTitle, String chartTitle, HospitalWorkRequest workRequest) { super(applicationTitle); repaint();//from w w w .j a v a2 s. c om series2 = new TimeSeries("Respiratory Rate"); this.workRequest = workRequest; this.chartTitle = chartTitle; final XYDataset dataset2 = createDatasetRespiratoryRate(workRequest); final JFreeChart chart2 = createChart(dataset2); final XYPlot plot = chart2.getXYPlot(); HospitalWorkRequest hos1 = (HospitalWorkRequest) workRequest; int age = hos1.getPerson().getAge(); int a = hos1.getPerson().getAboveRespirationRateMarker(age); int b = hos1.getPerson().getBelowRespirationRateMarker(age); ValueMarker valueMarker = new ValueMarker(a); valueMarker.setLabel("ALERT"); valueMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker.setPaint(Color.blue); ValueMarker valueMarker1 = new ValueMarker(b); valueMarker1.setLabel("ALERT"); valueMarker1.setLabelTextAnchor(TextAnchor.TOP_CENTER); valueMarker1.setPaint(Color.BLUE); plot.addRangeMarker(valueMarker); plot.addRangeMarker(valueMarker1); final ChartPanel chartPanel = new ChartPanel(chart2); chartPanel.setPreferredSize(new java.awt.Dimension(560, 370)); chartPanel.setMouseZoomable(true, false); setContentPane(chartPanel); getContentPane().repaint(); }
From source file:org.jfree.chart.demo.MarkerDemo2.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("Marker Demo 2", "X", "Temperature", xydataset, PlotOrientation.VERTICAL, false, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainGridlinePaint(Color.lightGray); xyplot.setDomainGridlineStroke(new BasicStroke(1.0F)); xyplot.setRangeGridlinePaint(Color.lightGray); xyplot.setRangeGridlineStroke(new BasicStroke(1.0F)); xyplot.setRangeTickBandPaint(new Color(240, 240, 240)); PeriodAxis periodaxis = new PeriodAxis(null, new Hour(0, 30, 6, 2005), new Hour(23, 30, 6, 2005)); PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Hour.class, new SimpleDateFormat("HH")); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("dd-MMM")); periodaxis.setLabelInfo(aperiodaxislabelinfo); xyplot.setDomainAxis(periodaxis);/*from w w w .j a v a2 s. c o m*/ ValueAxis valueaxis = xyplot.getRangeAxis(); valueaxis.setRange(0.0D, 100D); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(0, Color.green); xyitemrenderer.setSeriesStroke(0, new BasicStroke(2.0F)); ValueMarker valuemarker = new ValueMarker(80D); valuemarker.setLabelOffsetType(LengthAdjustmentType.EXPAND); valuemarker.setPaint(Color.red); valuemarker.setStroke(new BasicStroke(2.0F)); valuemarker.setLabel("Temperature Threshold"); valuemarker.setLabelFont(new Font("SansSerif", 0, 11)); valuemarker.setLabelPaint(Color.red); valuemarker.setLabelAnchor(RectangleAnchor.TOP_LEFT); valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT); xyplot.addRangeMarker(valuemarker); Hour hour = new Hour(18, 30, 6, 2005); Hour hour1 = new Hour(20, 30, 6, 2005); double d = hour.getFirstMillisecond(); double d1 = hour1.getFirstMillisecond(); IntervalMarker intervalmarker = new IntervalMarker(d, d1); intervalmarker.setLabelOffsetType(LengthAdjustmentType.EXPAND); intervalmarker.setPaint(new Color(150, 150, 255)); intervalmarker.setLabel("Automatic Cooling"); intervalmarker.setLabelFont(new Font("SansSerif", 0, 11)); intervalmarker.setLabelPaint(Color.blue); intervalmarker.setLabelAnchor(RectangleAnchor.TOP_LEFT); intervalmarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); xyplot.addDomainMarker(intervalmarker, Layer.BACKGROUND); ValueMarker valuemarker1 = new ValueMarker(d, Color.blue, new BasicStroke(2.0F)); ValueMarker valuemarker2 = new ValueMarker(d1, Color.blue, new BasicStroke(2.0F)); xyplot.addDomainMarker(valuemarker1, Layer.BACKGROUND); xyplot.addDomainMarker(valuemarker2, Layer.BACKGROUND); return jfreechart; }
From source file:ec.ui.view.AutoCorrelationsView.java
protected void onDataChange() { chartPanel.getChart().setTitle(ACKind.Normal == kind ? "Autocorrelations" : "Partial autocorrelations"); NumberAxis domainAxis = (NumberAxis) chartPanel.getChart().getXYPlot().getDomainAxis(); domainAxis.setRange(0, length);//from ww w .ja va 2s. c om domainAxis.setTickUnit(new NumberTickUnit(length / 6)); if (ac == DEFAULT_AUTO_CORRELATIONS) { chartPanel.getChart().getXYPlot().setDataset(Charts.emptyXYDataset()); } else { ac.setCorrectedForMean(meanCorrection); ac.setKMax(length); double[] vals = ACKind.Normal == kind ? ac.getAC() : ac.getPAC(); XYSeries series = new XYSeries(""); for (int i = 0; i < vals.length; ++i) { series.add(i + 1, vals[i]); } XYPlot plot = chartPanel.getChart().getXYPlot(); plot.clearRangeMarkers(); plot.setDataset(new XYBarDataset(new XYSeriesCollection(series), 1)); double z = 2.0d / Math .sqrt(ac.getUnderlyingData().getDataCount() - ac.getUnderlyingData().getMissingValuesCount()); for (double o : new double[] { z, -z }) { ValueMarker marker = new ValueMarker(o); marker.setStroke(MARKER_STROKE); marker.setAlpha(MARKER_ALPHA); plot.addRangeMarker(marker); } onColorSchemeChange(); } }