LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT);
legend.setPosition(RectangleEdge.BOTTOM); return legend;
private void setPosition(int pixelX, int pixelY, int level, boolean pixelPosInRasterBounds) { chartUpdater.setPosition(pixelX, pixelY, level, pixelPosInRasterBounds); }
LegendTitle legend= localJFreeChart.getLegend(); legend.setPosition(RectangleEdge.RIGHT);
private void setPosition(int pixelX, int pixelY) { chartUpdater.setPosition(pixelX, pixelY); }
chart.removeLegend(); FlowArrangement hlayout = new FlowArrangement( HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 20, 2); LegendTitle legend = new LegendTitle(r, hlayout, new ColumnArrangement()); legend.setPosition(RectangleEdge.BOTTOM); chart.addLegend(legend);
// remove default legend chart.removeLegend(); // create and add legend LegendTitle legend = new LegendTitle(plot, new GridArrangement(dataset.getItemCount(), 1), new GridArrangement(1, 1)); legend.setPosition(RectangleEdge.BOTTOM); chart.addLegend(legend); // add text title after the legend
private JFreeChart createMonthlyChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "", // title resourceMap.getString("graphDate.text"), // x-axis label resourceMap.getString("graphCBills.text"), // y-axis label dataset); chart.setBackgroundPaint(Color.WHITE); chart.getLegend().setPosition(RectangleEdge.TOP); return chart; }
public static JFreeChart createJFreeChart(String title, XYPlot result, int imageHeight) { JFreeChart chart = new JFreeChart(title, result); chart.getLegend().setPosition(RectangleEdge.TOP); chart.getLegend().setHorizontalAlignment(HorizontalAlignment.LEFT); chart.getLegend().setFrame(BlockBorder.NONE); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, imageHeight, new Color(229, 236, 246))); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN | Font.BOLD, 16)); chart.getTitle().setPaint(Color.GRAY); return chart; } }
private void setLegend(JFreeChart chart) { chart.removeLegend(); final LegendTitle legend = new LegendTitle(new SpectrumLegendItemSource()); legend.setPosition(RectangleEdge.BOTTOM); LineBorder border = new LineBorder(Color.BLACK, new BasicStroke(), new RectangleInsets(2, 2, 2, 2)); legend.setFrame(border); chart.addLegend(legend); }
private void setLegend(JFreeChart chart) { chart.removeLegend(); final LegendTitle legend = new LegendTitle(new SpectrumLegendItemSource()); legend.setPosition(RectangleEdge.BOTTOM); LineBorder border = new LineBorder(Color.BLACK, new BasicStroke(), new RectangleInsets(2, 2, 2, 2)); legend.setFrame(border); chart.addLegend(legend); }
/** * Creates a legend for the specified plot. * * @param plot The plot. * @return The legend for the plot. */ private LegendTitle createLegend(Plot plot) { LegendTitle legend = new LegendTitle(plot); legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); legend.setFrame(new LineBorder()); legend.setBackgroundPaint(Color.white); legend.setPosition(RectangleEdge.BOTTOM); return legend; }
public ChartPanel getOutputPanel() { //we return a copy of the chart because we only want to show the //legend in the larger view of the graph //not the small runtime graph block view JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output = new ChartPanel(newChart); return output; }
public ChartPanel getOutputPanel() { //we return a copy of the chart because we only want to show the //legend in the larger view of the graph //not the small runtime graph block view JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output = new ChartPanel(newChart); return output; }
private Component createChartPanel() { PiePlot plot = new PiePlot(pieDataset); JFreeChart chart = new JFreeChart( I18n.get("statistic.pieChartPanel.title"), null, plot, true); chart.getLegend().setPosition(RectangleEdge.RIGHT); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(CHART_BORDER); chartPanel.setMinimumDrawHeight(0); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); return chartPanel; }
public void clearChart() { if (!lock) { this.chart = chartData.makeChart(); this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
public void clearChart() { if (!lock) { this.chart = chartData.makeChart(); this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
public void updateDomain(String title, int seriesNum, Color background) { if (!lock) { this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
public void updateDomain(String title, int seriesNum, Color background) { if (!lock) { this.chartData.setSeriesNum(seriesNum); this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
private Component createChartPanel() { NumberAxis xaxis = new NumberAxis(I18n.get("statistic.operationTimeLineChartPanel.executionInstant")); NumberAxis yaxis = new NumberAxis(I18n.get("statistic.operationTimeLineChartPanel.qTime")); XYPlot plot = new XYPlot(xyDataset, xaxis, yaxis, new XYLineAndShapeRenderer(true, true)); JFreeChart chart = new JFreeChart(I18n.get("statistic.operationTimeLineChartPanel.title"), null, plot, true); chart.getLegend().setPosition(RectangleEdge.RIGHT); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(CHART_BORDER); chartPanel.setMinimumDrawHeight(0); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); return chartPanel; }