List of usage examples for org.jfree.ui RectangleAnchor BOTTOM_LEFT
RectangleAnchor BOTTOM_LEFT
To view the source code for org.jfree.ui RectangleAnchor BOTTOM_LEFT.
Click Source Link
From source file:org.jfree.chart.demo.XYBlockChartDemo2.java
private static JFreeChart createChart(XYZDataset xyzdataset) { DateAxis dateaxis = new DateAxis("Date"); dateaxis.setLowerMargin(0.0D);/*from w ww .ja va 2 s . c om*/ dateaxis.setUpperMargin(0.0D); dateaxis.setInverted(true); NumberAxis numberaxis = new NumberAxis("Hour"); numberaxis.setUpperMargin(0.0D); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYBlockRenderer xyblockrenderer = new XYBlockRenderer(); xyblockrenderer.setBlockWidth(86400000D); xyblockrenderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT); LookupPaintScale lookuppaintscale = new LookupPaintScale(0.5D, 4.5D, Color.white); lookuppaintscale.add(0.5D, Color.red); lookuppaintscale.add(1.5D, Color.green); lookuppaintscale.add(2.5D, Color.blue); lookuppaintscale.add(3.5D, Color.yellow); xyblockrenderer.setPaintScale(lookuppaintscale); XYPlot xyplot = new XYPlot(xyzdataset, dateaxis, numberaxis, xyblockrenderer); xyplot.setOrientation(PlotOrientation.HORIZONTAL); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo2", xyplot); jfreechart.removeLegend(); jfreechart.setBackgroundPaint(Color.white); SymbolAxis symbolaxis = new SymbolAxis(null, new String[] { "", "Unavailable", "Free", "Group 1", "Group 2" }); symbolaxis.setRange(0.5D, 4.5D); symbolaxis.setPlot(new PiePlot()); symbolaxis.setGridBandsVisible(false); PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, symbolaxis); paintscalelegend.setMargin(new RectangleInsets(3D, 10D, 3D, 10D)); paintscalelegend.setPosition(RectangleEdge.BOTTOM); paintscalelegend.setAxisOffset(5D); jfreechart.addSubtitle(paintscalelegend); return jfreechart; }
From source file:org.geopublishing.atlasStyler.classification.RasterClassification.java
@Override public BufferedImage createHistogramImage(boolean showMean, boolean showSd, int histogramBins, String label_xachsis) throws InterruptedException, IOException { HistogramDataset hds = new HistogramDataset(); DoubleArrayList valuesAL;/*w w w. ja va 2 s .c o m*/ valuesAL = getStatistics().elements(); double[] elements = Arrays.copyOf(valuesAL.elements(), getStatistics().size()); hds.addSeries(1, elements, histogramBins); /** Statically label the Y Axis **/ String label_yachsis = ASUtil.R("QuantitiesClassificationGUI.Histogram.YAxisLabel"); JFreeChart chart = org.jfree.chart.ChartFactory.createHistogram(null, label_xachsis, label_yachsis, hds, PlotOrientation.VERTICAL, false, true, true); /*********************************************************************** * Paint the classes into the JFreeChart */ int countLimits = 0; for (Double cLimit : getClassLimits()) { ValueMarker marker = new ValueMarker(cLimit); XYPlot plot = chart.getXYPlot(); marker.setPaint(Color.orange); marker.setLabel(String.valueOf(countLimits)); marker.setLabelAnchor(RectangleAnchor.TOP_LEFT); marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); plot.addDomainMarker(marker); countLimits++; } /*********************************************************************** * Optionally painting SD and MEAN into the histogram */ try { if (showSd) { ValueMarker marker; marker = new ValueMarker(getSD(), Color.green.brighter(), new BasicStroke(1.5f)); XYPlot plot = chart.getXYPlot(); marker.setLabel(ASUtil.R("QuantitiesClassificationGUI.Histogram.SD.ShortLabel")); marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); plot.addDomainMarker(marker); } if (showMean) { ValueMarker marker; marker = new ValueMarker(getMean(), Color.green.darker(), new BasicStroke(1.5f)); XYPlot plot = chart.getXYPlot(); marker.setLabel(ASUtil.R("QuantitiesClassificationGUI.Histogram.Mean.ShortLabel")); marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); plot.addDomainMarker(marker); } } catch (Exception e) { LOGGER.error("Painting SD and MEAN into the histogram", e); } /*********************************************************************** * Render the Chart */ BufferedImage image = chart.createBufferedImage(400, 200); return image; }
From source file:inflor.core.plots.DensityPlot.java
private XYBlockRenderer updateRenderer(Histogram2D histogram) { BitSet nonEmptyMask = histogram.getNonEmptyBins(); double[] z = FCSUtilities.filterColumn(nonEmptyMask, histogram.getZValues()); LookupPaintScale paintScale = PlotUtils.createPaintScale(Doubles.max(z), colorScheme); // Renderer configuration XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setBlockWidth(histogram.getXBinWidth()); renderer.setBlockHeight(histogram.getYBinWidth()); renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT); renderer.setSeriesVisible(0, true);/*from w ww. j a v a2s .c o m*/ renderer.setPaintScale(paintScale); return renderer; }
From source file:net.sf.maltcms.chromaui.foldChangeViewer.tasks.FoldChangeViewLoaderWorker.java
@Override public void run() { ProgressHandle handle = ProgressHandleFactory.createHandle("Creating fold change plot"); try {/*from w w w . ja v a2s . c o m*/ handle.setDisplayName("Loading fold change elements");//+new File(this.files.getResourceLocation()).getName()); handle.start(5); handle.progress("Reading settings", 1); RTUnit rtAxisUnit = RTUnit.valueOf(sp.getProperty("rtAxisUnit", "SECONDS")); handle.progress("Retrieving data", 2); XYShapeRenderer renderer = new XYShapeRenderer() { @Override protected Paint getPaint(XYDataset dataset, int series, int item) { double x = dataset.getXValue(series, item); double y = dataset.getYValue(series, item); if (Math.abs(x) < 1.0) { Paint p = super.getPaint(dataset, series, item); if (p instanceof Color) { Color color = (Color) p; float[] values = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); Color hsb = new Color( Color.HSBtoRGB(values[0], (float) Math.max(0.1, values[1] - 0.9), values[2])); return new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue(), 64); } } return super.getPaint(dataset, series, item); } }; renderer.setAutoPopulateSeriesFillPaint(true); renderer.setAutoPopulateSeriesOutlinePaint(true); renderer.setBaseCreateEntities(true); handle.progress("Building plot", 3); XYPlot plot = new XYPlot(dataset, new NumberAxis("log2 fold change"), new NumberAxis("-log10 p-value"), renderer); BasicStroke dashed = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] { 5.0f }, 0.0f); ValueMarker marker = new ValueMarker(-Math.log10(0.05), Color.RED, dashed); marker.setLabel("p-value=0.05"); marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); marker.setLabelOffset(new RectangleInsets(UnitType.ABSOLUTE, 0, 50, 10, 0)); marker.setLabelOffsetType(LengthAdjustmentType.EXPAND); marker.setLabelPaint(Color.LIGHT_GRAY); plot.addRangeMarker(marker); Font font1 = new Font("SansSerif", Font.PLAIN, 12); SelectionAwareXYTooltipGenerator tooltipGenerator = cvtc.getLookup() .lookup(SelectionAwareXYTooltipGenerator.class); if (tooltipGenerator == null) { tooltipGenerator = new SelectionAwareXYTooltipGenerator(tooltipGenerator) { @Override public String createSelectionAwareTooltip(XYDataset xyd, int i, int i1) { FoldChangeDataset dataset = (FoldChangeDataset) xyd; FoldChangeElement fce = dataset.getNamedElementProvider().get(i).get(i1); StringBuilder sb = new StringBuilder(); sb.append("<html>"); sb.append(fce.getPeakGroup().getMajorityDisplayName()); sb.append("<br>"); sb.append("log2 fold change="); sb.append(fce.getFoldChange()); sb.append("<br>"); sb.append("p-value="); sb.append(Math.pow(10, -fce.getPvalue())); sb.append("</html>"); return sb.toString(); } }; } tooltipGenerator.setXYToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset xyd, int i, int i1) { Comparable comp = xyd.getSeriesKey(i); double x = xyd.getXValue(i, i1); double y = xyd.getYValue(i, i1); StringBuilder sb = new StringBuilder(); sb.append("<html>"); sb.append(comp); sb.append("<br>"); sb.append("log2 fold change="); sb.append(x); sb.append("<br>"); sb.append("p-value="); sb.append(sb.append(Math.pow(10, -y))); sb.append("</html>"); return sb.toString(); } }); plot.getRenderer().setBaseToolTipGenerator(tooltipGenerator); handle.progress("Configuring plot", 4); configurePlot(plot, rtAxisUnit); final FoldChangeViewPanel cmhp = cvtc.getLookup().lookup(FoldChangeViewPanel.class); Range domainRange = null; Range valueRange = null; if (cmhp != null) { XYPlot xyplot = cmhp.getPlot(); if (xyplot != null) { ValueAxis domain = xyplot.getDomainAxis(); domainRange = domain.getRange(); ValueAxis range = xyplot.getRangeAxis(); valueRange = range.getRange(); } } if (domainRange != null) { plot.getDomainAxis().setRange(domainRange); } if (valueRange != null) { Logger.getLogger(getClass().getName()).info("Setting previous value range!"); } handle.progress("Adding plot to panel", 5); final XYPlot targetPlot = plot; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final FoldChangeViewPanel cmhp = cvtc.getLookup().lookup(FoldChangeViewPanel.class); cmhp.setPlot(targetPlot); cvtc.requestActive(); } }); } finally { handle.finish(); } }
From source file:org.geopublishing.atlasStyler.classification.FeatureClassification.java
@Override public BufferedImage createHistogramImage(boolean showMean, boolean showSd, int histogramBins, String label_xachsis) throws InterruptedException, IOException { HistogramDataset hds = new HistogramDataset(); DoubleArrayList valuesAL;/*from w ww. j av a2s .com*/ valuesAL = getStatistics().elements(); // new double[] {0.4,3,4,2,5.,22.,4.,2.,33.,12.} double[] elements = Arrays.copyOf(valuesAL.elements(), getStatistics().size()); hds.addSeries(1, elements, histogramBins); /** Statically label the Y Axis **/ String label_yachsis = ASUtil.R("QuantitiesClassificationGUI.Histogram.YAxisLabel"); JFreeChart chart = org.jfree.chart.ChartFactory.createHistogram(null, label_xachsis, label_yachsis, hds, PlotOrientation.VERTICAL, false, true, true); /*********************************************************************** * Paint the classes into the JFreeChart */ int countLimits = 0; for (Double cLimit : getClassLimits()) { ValueMarker marker = new ValueMarker(cLimit); XYPlot plot = chart.getXYPlot(); marker.setPaint(Color.orange); marker.setLabel(String.valueOf(countLimits)); marker.setLabelAnchor(RectangleAnchor.TOP_LEFT); marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); plot.addDomainMarker(marker); countLimits++; } /*********************************************************************** * Optionally painting SD and MEAN into the histogram */ try { if (showSd) { ValueMarker marker; marker = new ValueMarker(getStatistics().standardDeviation(), Color.green.brighter(), new BasicStroke(1.5f)); XYPlot plot = chart.getXYPlot(); marker.setLabel(ASUtil.R("QuantitiesClassificationGUI.Histogram.SD.ShortLabel")); marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); plot.addDomainMarker(marker); } if (showMean) { ValueMarker marker; marker = new ValueMarker(getStatistics().mean(), Color.green.darker(), new BasicStroke(1.5f)); XYPlot plot = chart.getXYPlot(); marker.setLabel(ASUtil.R("QuantitiesClassificationGUI.Histogram.Mean.ShortLabel")); marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); plot.addDomainMarker(marker); } } catch (Exception e) { LOGGER.error("Painting SD and MEAN into the histogram", e); } /*********************************************************************** * Render the Chart */ BufferedImage image = chart.createBufferedImage(400, 200); return image; }
From source file:nl.vu.nat.jfreechartcustom.XYBlockRenderer.java
/** * Updates the offsets to take into account the block width, height and * anchor.//from ww w. j a va2 s . co m */ private void updateOffsets() { if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_LEFT)) { this.xOffset = 0.0; this.yOffset = 0.0; } else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM)) { this.xOffset = -this.blockWidth / 2.0; this.yOffset = 0.0; } else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { this.xOffset = -this.blockWidth; this.yOffset = 0.0; } else if (this.blockAnchor.equals(RectangleAnchor.LEFT)) { this.xOffset = 0.0; this.yOffset = -this.blockHeight / 2.0; } else if (this.blockAnchor.equals(RectangleAnchor.CENTER)) { this.xOffset = -this.blockWidth / 2.0; this.yOffset = -this.blockHeight / 2.0; } else if (this.blockAnchor.equals(RectangleAnchor.RIGHT)) { this.xOffset = -this.blockWidth; this.yOffset = -this.blockHeight / 2.0; } else if (this.blockAnchor.equals(RectangleAnchor.TOP_LEFT)) { this.xOffset = 0.0; this.yOffset = -this.blockHeight; } else if (this.blockAnchor.equals(RectangleAnchor.TOP)) { this.xOffset = -this.blockWidth / 2.0; this.yOffset = -this.blockHeight; } else if (this.blockAnchor.equals(RectangleAnchor.TOP_RIGHT)) { this.xOffset = -this.blockWidth; this.yOffset = -this.blockHeight; } }
From source file:anl.verdi.plot.jfree.XYBlockRenderer.java
/** * Updates the offsets to take into account the block width, height and * anchor.// ww w . j ava2 s .c om */ private void updateOffsets() { if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_LEFT)) { xOffset = 0.0; yOffset = 0.0; } else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM)) { xOffset = -this.blockWidth / 2.0; yOffset = 0.0; } else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { xOffset = -this.blockWidth; yOffset = 0.0; } else if (this.blockAnchor.equals(RectangleAnchor.LEFT)) { xOffset = 0.0; yOffset = -this.blockHeight / 2.0; } else if (this.blockAnchor.equals(RectangleAnchor.CENTER)) { xOffset = -this.blockWidth / 2.0; yOffset = -this.blockHeight / 2.0; } else if (this.blockAnchor.equals(RectangleAnchor.RIGHT)) { xOffset = -this.blockWidth; yOffset = -this.blockHeight / 2.0; } else if (this.blockAnchor.equals(RectangleAnchor.TOP_LEFT)) { xOffset = 0.0; yOffset = -this.blockHeight; } else if (this.blockAnchor.equals(RectangleAnchor.TOP)) { xOffset = -this.blockWidth / 2.0; yOffset = -this.blockHeight; } else if (this.blockAnchor.equals(RectangleAnchor.TOP_RIGHT)) { xOffset = -this.blockWidth; yOffset = -this.blockHeight; } }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.blockcharts.TimeBlockChart.java
@Override public JFreeChart createChart(DatasetMap datasets) { logger.debug("IN"); super.createChart(datasets); DefaultXYZDataset dataset = (DefaultXYZDataset) datasets.getDatasets().get("1"); DateAxis xAxis = new DateAxis(yLabel); xAxis.setLowerMargin(0.0);//from www . ja v a 2 s .c o m xAxis.setUpperMargin(0.0); xAxis.setInverted(false); xAxis.setDateFormatOverride(new SimpleDateFormat("dd/MM/yyyy")); if (dateAutoRange) { xAxis.setAutoRange(true); } else { DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); DateTickUnit unit = new DateTickUnit(DateTickUnit.DAY, 1, formatter); xAxis.setTickUnit(unit); } if (dateMin != null && dateMax != null) { xAxis.setRange(dateMin, addDay(dateMax)); } else { xAxis.setRange(minDateFound, addDay(maxDateFound)); } // Calendar c=new GregorianCalendar(); // c.set(9 + 2000, Calendar.JANUARY, 1); // java.util.Date minima=c.getTime(); // Calendar c1=new GregorianCalendar(); // c1.set(9 + 2000, Calendar.FEBRUARY, 1); // java.util.Date massima=c1.getTime(); NumberAxis yAxis = new NumberAxis(xLabel); yAxis.setUpperMargin(0.0); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); yAxis.setRange(hourMin, hourMax); XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setBlockWidth(BLOCK_HEIGHT); // one block for each minute! renderer.setBlockHeight(0.017); //renderer.setBlockWidth(1); renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT); // MyXYItemLabelGenerator my=new MyXYItemLabelGenerator(); // renderer.setItemLabelsVisible(null); // renderer.setSeriesItemLabelGenerator(0, my); // renderer.setSeriesItemLabelsVisible(0, true); // XYTextAnnotation annotation1 = new XYTextAnnotation( // "P_",1.2309372E12, 14.3); // XYTextAnnotation annotation2 = new XYTextAnnotation( // "P_",1.2308508E12, 16.3); for (Iterator iterator = annotations.keySet().iterator(); iterator.hasNext();) { String annotationCode = (String) iterator.next(); AnnotationBlock annotationBlock = annotations.get(annotationCode); XYTextAnnotation xyAnnotation = new XYTextAnnotation(annotationBlock.getAnnotation(), annotationBlock.getXPosition() + ANNOTATION_HEIGHT, annotationBlock.getYPosition()); if (styleAnnotation != null) { xyAnnotation.setFont(new Font(styleAnnotation.getFontName(), Font.BOLD, styleAnnotation.getSize())); xyAnnotation.setPaint(styleAnnotation.getColor()); } else { xyAnnotation.setFont(new Font("Nome", Font.BOLD, 8)); xyAnnotation.setPaint(Color.BLACK); } xyAnnotation.setTextAnchor(TextAnchor.BOTTOM_LEFT); renderer.addAnnotation(xyAnnotation); } logger.debug("Annotation set"); LookupPaintScale paintScale = new LookupPaintScale(0.5, ranges.size() + 0.5, color); String[] labels = new String[ranges.size() + 1]; labels[0] = ""; // ******************** SCALE **************************** for (Iterator iterator = ranges.iterator(); iterator.hasNext();) { RangeBlocks range = (RangeBlocks) iterator.next(); Integer index = patternRangeIndex.get(range.getPattern()); Color color = range.getColor(); if (color != null) { //Paint colorTransparent=new Color(color.getRed(), color.getGreen(), color.getBlue(), 50); Paint colorTransparent = null; if (addTransparency == true) { colorTransparent = new Color(color.getRed(), color.getGreen(), color.getBlue(), 50); } else { colorTransparent = new Color(color.getRed(), color.getGreen(), color.getBlue()); } paintScale.add(index + 0.5, colorTransparent); } //String insertLabel=" "+range.getLabel(); String insertLabel = range.getLabel(); labels[index + 1] = insertLabel; } renderer.setPaintScale(paintScale); SymbolAxis scaleAxis = new SymbolAxis(null, labels); scaleAxis.setRange(0.5, ranges.size() + 0.5); scaleAxis.setPlot(new PiePlot()); scaleAxis.setGridBandsVisible(false); org.jfree.chart.title.PaintScaleLegend psl = new PaintScaleLegend(paintScale, scaleAxis); psl.setMargin(new RectangleInsets(3, 10, 3, 10)); psl.setPosition(RectangleEdge.BOTTOM); psl.setAxisOffset(5.0); // ******************** END SCALE **************************** logger.debug("Scale Painted"); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.HORIZONTAL); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); logger.debug("Plot set"); JFreeChart chart = new JFreeChart(name, plot); if (styleTitle != null) { TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); } chart.removeLegend(); chart.setBackgroundPaint(Color.white); chart.addSubtitle(psl); logger.debug("OUT"); return chart; }
From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java
private void _drawSelectedPoint(XYPlot xyplot, int position) { TrackPoint point = this.getTrack().getPointAt(position); // Strelicu crtamo samo ako je samo jedna tocka oznacena: if (this.startSelectedPoints < 0 || this.endSelectedPoints < 0 || this.startSelectedPoints == this.endSelectedPoints) { double angle = point.getAngle(); XYPointerAnnotation xypointerannotation = new XYPointerAnnotation("", point.getPosition(), //$NON-NLS-1$ point.getElevation(), Math.PI - angle); xypointerannotation.setTipRadius(3.0D); xypointerannotation.setBaseRadius(30); xypointerannotation.setTextAnchor(TextAnchor.BASELINE_RIGHT); xypointerannotation.setFont(GUIConstants.SANS_SERIF_11); if (angle > 0) { xypointerannotation.setPaint(Color.red); } else if (angle < 0) { xypointerannotation.setPaint(Color.green); } else {// www . j ava 2s . c o m xypointerannotation.setPaint(Color.gray); } xypointerannotation.setText((TrackProfilerMath.round(100 * angle, 1)) + " %"); //$NON-NLS-1$ xyplot.addAnnotation(xypointerannotation); } ValueMarker valuemarker = new ValueMarker(point.getPosition()); valuemarker.setLabelOffsetType(LengthAdjustmentType.NO_CHANGE); valuemarker.setStroke(new BasicStroke(1.0F)); if (this.startSelectedPoints != this.endSelectedPoints && position == this.startSelectedPoints) { valuemarker.setLabelPaint(Color.blue); valuemarker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT); // Ispisuje udaljenost i kut: TrackPoint t1 = this.getTrack().getPointAt(this.startSelectedPoints); TrackPoint t2 = this.getTrack().getPointAt(this.endSelectedPoints); double distance3D = TrackProfilerMath.round(t1.getPosition() - t2.getPosition(), 1); String angle = Math.abs(TrackProfilerMath.round(t1.getAngle(t2) * 100, 1)) + "%"; //$NON-NLS-1$ String label = Message.get(Messages.SELECTED_DISTANCE_LABEL) + distance3D + ", " //$NON-NLS-1$ + Message.get(Messages.SELECTED_ANGLE_LABEL) + angle; valuemarker.setLabel(" " + label); //$NON-NLS-1$ valuemarker.setLabelFont(GUIConstants.SANS_SERIF_11); } xyplot.addDomainMarker(valuemarker); }
From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java
private void prepareWaypontOnChart(XYPlot xyplot, Waypoint waypoint) { Vector positions = waypoint.getPositionsOnTrack(); for (int i = 0; i < positions.size(); i++) { double position = ((Double) positions.get(i)).doubleValue(); double elevation = waypoint.getElevation(); if (position > 0 && waypoint.isVisible()) { String waypointLabel; if (TrackProfilerAppContext.getInstance().isWaypointLabelFromTitle()) { waypointLabel = waypoint.getTitle(); } else { waypointLabel = waypoint.getDescription(); }//from w w w . j a va 2 s .c o m double arrowAngle = Math.PI * 1.5; if (waypoint.getArrowLength() < 0) { arrowAngle += Math.PI; } XYPointerAnnotation xypointerannotation = new XYPointerAnnotation(waypointLabel, position, elevation, arrowAngle); xypointerannotation.setTipRadius(3.0D); xypointerannotation.setBaseRadius(Math.abs(waypoint.getArrowLength())); xypointerannotation.setFont(GUIConstants.SANS_SERIF_11); xypointerannotation.setPaint(Color.blue); xypointerannotation.setTextAnchor(TextAnchor.BASELINE_CENTER); xyplot.addAnnotation(xypointerannotation); ValueMarker valuemarker = new ValueMarker(position); valuemarker.setLabelOffsetType(LengthAdjustmentType.NO_CHANGE); valuemarker.setStroke(new BasicStroke(1.0F)); // TODO: u postavke da li ispisivati ovdje if (false) { valuemarker.setLabel(waypoint.getTitle()); } valuemarker.setLabelFont(GUIConstants.SANS_SERIF_11); if (waypoint instanceof TrackExtreeme) { valuemarker.setPaint(Color.blue); } else { valuemarker.setPaint(new Color(220, 220, 220)); } valuemarker.setLabelPaint(Color.red); valuemarker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT); // xyplot.addRangeMarker(valuemarker); xyplot.addDomainMarker(valuemarker); } } }