List of usage examples for org.jfree.ui RectangleAnchor CENTER
RectangleAnchor CENTER
To view the source code for org.jfree.ui RectangleAnchor CENTER.
Click Source Link
From source file:com.ivli.roim.controls.DomainMarker.java
public DomainMarker(double aV, XYSeries aS) { super(aV);/*from w w w . j a v a 2 s. c o m*/ iSeries = aS; iSeries.addChangeListener(this); setLabel(String.format(LABEL_FORMAT, aV)); setLabelAnchor(RectangleAnchor.CENTER); setLabelOffset(RectangleInsets.ZERO_INSETS); setAlpha(1.0f); setPaint(Color.BLACK); setStroke(new BasicStroke(1.0f)); setOutlinePaint(Color.CYAN); setOutlineStroke(new BasicStroke(.0f)); }
From source file:com.rapidminer.gui.plotter.charts.BlockChartPlotter.java
@Override public AbstractXYItemRenderer getItemRenderer(boolean nominal, int size, double minColor, double maxColor) { XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setPaintScale(new BlockPaintScale(minColor, maxColor)); renderer.setBlockAnchor(RectangleAnchor.CENTER); // if Block dimension is increased (e.g 1.2x1.2), the grid effect gets bigger // so it could be that blocks are overlapping a little // but if Block dimension is decreased (e.g. 0.9x0.9), each rectangle seems to have // a less-transparent border (you have to zoom-in to notice), and that could be the cause of // the grid effect. // renderer.setBlockHeight(1.0); // renderer.setBlockWidth(1.0); return renderer; }
From source file:org.jfree.experimental.chart.annotations.XYTitleAnnotation.java
/** * Creates a new annotation to be displayed at the specified (x, y) * location.//from w ww .j av a 2s .co m * * @param x the x-coordinate (in data space). * @param y the y-coordinate (in data space). * @param title the title (<code>null</code> not permitted). */ public XYTitleAnnotation(double x, double y, Title title) { this(x, y, title, RectangleAnchor.CENTER); }
From source file:org.jfree.experimental.chart.plot.dial.DialValueIndicator.java
/** * Creates a new instance of <code>DialValueIndicator</code>. * /*from www . j a v a2 s. co m*/ * @param datasetIndex the dataset index. * @param label the label. */ public DialValueIndicator(int datasetIndex, String label) { this.datasetIndex = datasetIndex; this.angle = -90.0; this.radius = 0.3; this.frameAnchor = RectangleAnchor.CENTER; this.templateValue = new Double(100.0); this.formatter = new DecimalFormat("0.0"); this.font = new Font("Dialog", Font.BOLD, 14); this.paint = Color.black; this.backgroundPaint = Color.white; this.outlineStroke = new BasicStroke(1.0f); this.outlinePaint = Color.blue; this.insets = new RectangleInsets(4, 4, 4, 4); this.valueAnchor = RectangleAnchor.RIGHT; this.textAnchor = TextAnchor.CENTER_RIGHT; }
From source file:com.xpn.xwiki.plugin.charts.params.DefaultChartParams2.java
protected DefaultChartParams2() throws ParamException { set(SERIES, "columns"); set(HEIGHT, new Integer(600)); set(WIDTH, new Integer(500)); set(LINK_ATTRIBUTES, new HashMap()); set(IMAGE_ATTRIBUTES, new HashMap()); set(RENDERER, (Class) null); // default renderer is chart type dependent set(RENDERER_COLOR, AbstractRenderer.DEFAULT_PAINT); set(RENDERER_STROKE, AbstractRenderer.DEFAULT_STROKE); set(RENDERER_SHAPE, AbstractRenderer.DEFAULT_SHAPE); set(RENDERER_FILL_COLOR, Color.white); set(RENDERER_OUTLINE_COLOR, AbstractRenderer.DEFAULT_OUTLINE_PAINT); set(RENDERER_OUTLINE_STROKE, AbstractRenderer.DEFAULT_OUTLINE_STROKE); set(RENDERER_ITEM_LABEL_VISIBLE, Boolean.FALSE); set(RENDERER_ITEM_LABEL_COLOR, AbstractRenderer.DEFAULT_VALUE_LABEL_PAINT); set(RENDERER_ITEM_LABEL_FONT, AbstractRenderer.DEFAULT_VALUE_LABEL_FONT); set(RENDERER_SERIES_VISIBLE, Boolean.TRUE); set(RENDERER_SERIES_VISIBLE_IN_LEGEND, Boolean.TRUE); set(BORDER_VISIBLE, Boolean.FALSE); set(BORDER_COLOR, Color.black); set(BORDER_STROKE, new BasicStroke(1.0f)); setTitle(TITLE_PREFIX);/*from w ww. jav a 2 s. com*/ set(TITLE_PREFIX + TITLE_FONT_SUFFIX, JFreeChart.DEFAULT_TITLE_FONT); setTitle(SUBTITLE_PREFIX); set(ANTI_ALIAS, Boolean.TRUE); set(BACKGROUND_COLOR, JFreeChart.DEFAULT_BACKGROUND_PAINT); set(PLOT_BACKGROUND_COLOR, Plot.DEFAULT_BACKGROUND_PAINT); set(PLOT_BACKGROUND_ALPHA, new Float(Plot.DEFAULT_BACKGROUND_ALPHA)); set(PLOT_FOREGROUND_ALPHA, new Float(Plot.DEFAULT_FOREGROUND_ALPHA)); set(PLOT_INSERTS, Plot.DEFAULT_INSETS); set(PLOT_OUTLINE_COLOR, Plot.DEFAULT_OUTLINE_PAINT); set(PLOT_OUTLINE_STROKE, Plot.DEFAULT_OUTLINE_STROKE); set(XYPLOT_ORIENTATION, PlotOrientation.VERTICAL); set(XYPLOT_QUADRANT_ORIGIN, new Point2D.Double(0.0, 0.0)); List colors = new LinkedList(); colors.add(null); colors.add(null); colors.add(null); colors.add(null); set(XYPLOT_QUADRANT_COLORS, colors); set(LEGEND_BACKGROUND_COLOR, (Color) null); set(LEGEND_ITEM_FONT, LegendTitle.DEFAULT_ITEM_FONT); set(LEGEND_ITEM_LABEL_PADDING, new RectangleInsets(2.0, 2.0, 2.0, 2.0)); set(LEGEND_ITEM_GRAPHIC_ANCHOR, RectangleAnchor.CENTER); set(LEGEND_ITEM_GRAPHIC_EDGE, RectangleEdge.LEFT); set(LEGEND_ITEM_GRAPHIC_LOCATION, RectangleAnchor.CENTER); set(LEGEND_ITEM_GRAPHIC_PADDING, new RectangleInsets(2.0, 2.0, 2.0, 2.0)); setAxis(AXIS_DOMAIN_PREFIX); setAxis(AXIS_RANGE_PREFIX); set(TIME_PERIOD_CLASS, Day.class); set(DATE_FORMAT, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")); }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.time.MarkerTimeChartDecorator.java
/** * Creates a legend item block.//from w ww .j a v a 2s. c om * * @param item * the legend item. * * @return The block. */ protected Block createLegendItemBlock(LegendItem item, int i) { BlockContainer result = null; LegendGraphic lg = new LegendGraphic(item.getShape(), item.getFillPaint()); lg.setFillPaintTransformer(item.getFillPaintTransformer()); lg.setShapeFilled(true); lg.setLine(item.getLine()); lg.setLineStroke(item.getLineStroke()); lg.setLinePaint(item.getFillPaint()); lg.setLineVisible(true); lg.setShapeVisible(true); lg.setShapeOutlineVisible(true); lg.setOutlinePaint(item.getFillPaint()); lg.setOutlineStroke(item.getOutlineStroke()); lg.setPadding(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); LegendItemBlockContainer legendItem = new LegendItemBlockContainer(new BorderArrangement(), 0, i); lg.setShapeAnchor(RectangleAnchor.CENTER); lg.setShapeLocation(RectangleAnchor.CENTER); legendItem.add(lg, RectangleEdge.LEFT); LabelBlock labelBlock = new LabelBlock(item.getLabel(), new Font("SansSerif", Font.BOLD, 10), Color.black); labelBlock.setPadding(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); legendItem.add(labelBlock); legendItem.setToolTipText(item.getToolTipText()); legendItem.setURLText(item.getURLText()); result = new BlockContainer(new CenterArrangement()); result.add(legendItem); return result; }
From source file:com.griddynamics.jagger.monitoring.reporting.SystemUnderTestPlotsGeneralProvider.java
public Map<String, List<MonitoringReporterData>> createTaskPlots() { log.info("BEGIN: Create general task plots"); Map<String, List<MonitoringReporterData>> taskPlots = new LinkedHashMap<String, List<MonitoringReporterData>>(); GeneralStatistics generalStatistics = getStatistics(); Set<String> taskIds = generalStatistics.findTaskIds(); Set<String> boxIdentifiers = generalStatistics.findBoxIdentifiers(); Set<String> sutUrls = generalStatistics.findSutUrls(); for (GroupKey groupName : plotGroups.getPlotGroups().keySet()) { log.info(" Create general task plots for group '{}'", groupName); if (showPlotsByGlobal) { log.info(" Create general global task plots"); List<MonitoringReporterData> plots = new LinkedList<MonitoringReporterData>(); XYSeriesCollection chartsCollection = new XYSeriesCollection(); LinkedHashMap<String, IntervalMarker> markers = new LinkedHashMap<String, IntervalMarker>(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create general global task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); if (generalStatistics.hasGlobalStatistics(param)) { XYSeries values = new XYSeries(param.getDescription()); long timeShift = 0; int taskNum = 0; for (String taskId : taskIds) { log.info(" Create general global task plots for task '{}'", taskId); long maxTime = 0; for (MonitoringStatistics monitoringStatistics : generalStatistics .findGlobalStatistics(taskId, param)) { long time = monitoringStatistics.getTime(); double t = timeShift + time; values.add(t, monitoringStatistics.getAverageValue()); if (time > maxTime) { maxTime = time; }//from w ww . j ava 2 s . c om if (showNumbers) { IntervalMarker marker = markers.get(taskId); if (marker == null) { marker = new IntervalMarker(t, t); marker.setLabel(monitoringStatistics.getTaskData().getNumber().toString()); marker.setAlpha((taskNum % 2 == 0) ? 0.2f : 0.4f); int mod = taskNum % 3; if (mod == 0) { marker.setLabelAnchor(RectangleAnchor.CENTER); } else if (mod == 1) { marker.setLabelAnchor(RectangleAnchor.TOP); } else if (mod == 2) { marker.setLabelAnchor(RectangleAnchor.BOTTOM); } marker.setLabelFont( marker.getLabelFont().deriveFont(10.0f).deriveFont(Font.BOLD)); markers.put(taskId, marker); } else { if (t < marker.getStartValue()) { marker.setStartValue(t); } if (t > marker.getEndValue()) { marker.setEndValue(t); } } } } timeShift += maxTime; taskNum++; } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, markers.values()); chartsCollection = pair.getSecond(); String name = groupName.getUpperName(); if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 0, 1, ChartHelper.ColorTheme.LIGHT); XYPlot plot = (XYPlot) chart.getPlot(); for (IntervalMarker marker : markers.values()) { plot.addDomainMarker(marker); } MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(name); monitoringReporterData.setTitle(name); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } if (!plots.isEmpty()) { taskPlots.put(name, plots); } } if (showPlotsByBox) { log.info(" Create general box task plots"); for (String boxIdentifier : boxIdentifiers) { log.info(" Create general box task plots for box '{}'", boxIdentifier); List<MonitoringReporterData> plots = new LinkedList<MonitoringReporterData>(); XYSeriesCollection chartsCollection = new XYSeriesCollection(); LinkedHashMap<String, IntervalMarker> markers = new LinkedHashMap<String, IntervalMarker>(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create general box task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); if (generalStatistics.hasBoxStatistics(param, boxIdentifier)) { XYSeries values = new XYSeries(param.getDescription()); long timeShift = 0; int taskNum = 0; for (String taskId : taskIds) { log.info(" Create general box task plots for task '{}'", taskId); long maxTime = 0; for (MonitoringStatistics monitoringStatistics : generalStatistics .findBoxStatistics(taskId, param, boxIdentifier)) { long time = monitoringStatistics.getTime(); double t = timeShift + time; values.add(t, monitoringStatistics.getAverageValue()); if (time > maxTime) { maxTime = time; } if (showNumbers) { IntervalMarker marker = markers.get(taskId); if (marker == null) { marker = new IntervalMarker(t, t); marker.setLabel( monitoringStatistics.getTaskData().getNumber().toString()); marker.setAlpha((taskNum % 2 == 0) ? 0.2f : 0.4f); int mod = taskNum % 3; if (mod == 0) { marker.setLabelAnchor(RectangleAnchor.CENTER); } else if (mod == 1) { marker.setLabelAnchor(RectangleAnchor.TOP); } else if (mod == 2) { marker.setLabelAnchor(RectangleAnchor.BOTTOM); } marker.setLabelFont( marker.getLabelFont().deriveFont(10.0f).deriveFont(Font.BOLD)); markers.put(taskId, marker); } else { if (t < marker.getStartValue()) { marker.setStartValue(t); } if (t > marker.getEndValue()) { marker.setEndValue(t); } } } } timeShift += maxTime; taskNum++; } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, markers.values()); chartsCollection = pair.getSecond(); String name = groupName.getUpperName() + " on " + boxIdentifier; if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 0, 1, ChartHelper.ColorTheme.LIGHT); XYPlot plot = (XYPlot) chart.getPlot(); for (IntervalMarker marker : markers.values()) { plot.addDomainMarker(marker); } MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(name); monitoringReporterData.setTitle(name); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } if (!plots.isEmpty()) { taskPlots.put(name, plots); } } } if (showPlotsBySuT) { log.info(" Create general sut task plots"); for (String sutUrl : sutUrls) { log.info(" Create general sut task plots for sut '{}'", sutUrl); List<MonitoringReporterData> plots = new LinkedList<MonitoringReporterData>(); XYSeriesCollection chartsCollection = new XYSeriesCollection(); LinkedHashMap<String, IntervalMarker> markers = new LinkedHashMap<String, IntervalMarker>(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create general sut task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); if (generalStatistics.hasSutStatistics(param, sutUrl)) { XYSeries values = new XYSeries(param.getDescription()); long timeShift = 0; int taskNum = 0; for (String taskId : taskIds) { log.info(" Create general sut task plots for task '{}'", taskId); long maxTime = 0; for (MonitoringStatistics monitoringStatistics : generalStatistics .findSutStatistics(taskId, param, sutUrl)) { long time = monitoringStatistics.getTime(); double t = timeShift + time; values.add(t, monitoringStatistics.getAverageValue()); if (time > maxTime) { maxTime = time; } if (showNumbers) { IntervalMarker marker = markers.get(taskId); if (marker == null) { marker = new IntervalMarker(t, t); marker.setLabel( monitoringStatistics.getTaskData().getNumber().toString()); marker.setAlpha((taskNum % 2 == 0) ? 0.2f : 0.4f); int mod = taskNum % 3; if (mod == 0) { marker.setLabelAnchor(RectangleAnchor.CENTER); } else if (mod == 1) { marker.setLabelAnchor(RectangleAnchor.TOP); } else if (mod == 2) { marker.setLabelAnchor(RectangleAnchor.BOTTOM); } marker.setLabelFont( marker.getLabelFont().deriveFont(10.0f).deriveFont(Font.BOLD)); markers.put(taskId, marker); } else { if (t < marker.getStartValue()) { marker.setStartValue(t); } if (t > marker.getEndValue()) { marker.setEndValue(t); } } } } timeShift += maxTime; taskNum++; } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, markers.values()); chartsCollection = pair.getSecond(); String name = groupName.getUpperName() + " on " + sutUrl; if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 0, 1, ChartHelper.ColorTheme.LIGHT); XYPlot plot = (XYPlot) chart.getPlot(); for (IntervalMarker marker : markers.values()) { plot.addDomainMarker(marker); } MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(name); monitoringReporterData.setTitle(name); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } if (!plots.isEmpty()) { taskPlots.put(name, plots); } } } } clearStatistics(); log.info("END: Create general task plots"); return taskPlots; }
From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHelper.java
public static RectangleAnchor getRectangleAnchor(ChartDataItem item) { RectangleAnchor ta;/* w w w. jav a 2 s . c om*/ switch (item.getIconPosition()) { case LEADING: case LEFT: ta = RectangleAnchor.LEFT; break; case TRAILING: case RIGHT: ta = RectangleAnchor.RIGHT; break; case TOP_CENTER: ta = RectangleAnchor.TOP; break; case BOTTOM_CENTER: ta = RectangleAnchor.BOTTOM; break; default: ta = RectangleAnchor.CENTER; break; } return ta; }
From source file:nl.vu.nat.jfreechartcustom.XYBlockRenderer.java
/** * Updates the offsets to take into account the block width, height and * anchor.//w ww .j a v a 2s.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.//from w w w. ja v a 2 s . c o m */ 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; } }