protected void configurePlot(CategoryPlot plot) { plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(null); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); configureRenderer((LineAndShapeRenderer) plot.getRenderer()); configureDomainAxis(plot); }
plot.setOutlinePaint(null); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black);
plot.setRangeGridlinePaint(Color.black);
chart.setBackgroundPaint(Color.yellow); // Set the background colour of the chart chart.getTitle().setPaint(Color.blue); // Adjust the colour of the title CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); // Modify the plot background p.setRangeGridlinePaint(Color.red); // Modify the colour of the plot gridlines
java.awt.EventQueue.invokeLater(() -> { DefaultCategoryDataset barchartdata = new DefaultCategoryDataset(); barchartdata.setValue(100000, "", "Name"); barchartdata.setValue(200000, "", "Name"); barchartdata.setValue(500000, "", "Name"); JFreeChart barChart = ChartFactory.createAreaChart("Instructor Name", "", "", barchartdata, PlotOrientation.VERTICAL, true, true, true); CategoryPlot barchrt = barChart.getCategoryPlot(); barchrt.setRangeGridlinePaint(Color.ORANGE); ChartPanel barPanel = new ChartPanel(barChart); JPanel jPanel11 = new JPanel(); jPanel11.removeAll(); jPanel11.add(barPanel, BorderLayout.CENTER); jPanel11.validate(); JFrame frame = new JFrame(); frame.add(jPanel11); frame.pack(); frame.setVisible(true); });
@Override public Plot getPlot(ChartParameters params) { CategoryPlot plot = generateJFreeChart(params); plot.setOutlinePaint(OUTLINE_COLOR); plot.setDomainGridlinePaint(GRID_COLOR); plot.setRangeGridlinePaint(GRID_COLOR); return plot; }
@Override public Plot getPlot(ChartParameters params) { CategoryPlot plot = generateJFreeChart(params); plot.setOutlinePaint(OUTLINE_COLOR); plot.setDomainGridlinePaint(GRID_COLOR); plot.setRangeGridlinePaint(GRID_COLOR); return plot; }
public OverallRelativeAreaPlot(String title , int sizes[] ) { // createAreaChart chart = ChartFactory.createStackedAreaChart( title, // chart title "Size", // domain axis label "Relative Average Speed", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false ); chart.addSubtitle(new TextTitle("Weighted by Operation Speed. Larger is Better.",new Font("SansSerif", Font.ITALIC, 12))); plot = chart.getCategoryPlot(); sizeNames = new String[sizes.length]; for( int i = 0; i < sizes.length; i++ ) { sizeNames[i] = Integer.toString(sizes[i]); } plot.setRangeGridlinePaint(Color.WHITE); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinesVisible(true); }
private static CategoryPlot createChartFrame(CategoryDataset dataSet) { JFreeChart chart = ChartFactory.createBarChart( "Trading Volume", "Stock", "Volume, USD", dataSet, PlotOrientation.HORIZONTAL, true, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.getRenderer().setSeriesPaint(0, Color.BLUE); final JFrame frame = new JFrame(); frame.setBackground(Color.WHITE); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setTitle("Hazelcast Jet Source Builder Sample"); frame.setBounds(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLayout(new BorderLayout()); frame.add(new ChartPanel(chart)); frame.setVisible(true); return plot; } }
static private void configureLineChart(JFreeChart chart) { CategoryPlot plot = chart.getCategoryPlot(); final DrawingSupplier supplier = new DefaultDrawingSupplier( DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, // Draw a small diamond new Shape[] { new Polygon(new int[] {3, 0, -3, 0}, new int[] {0, 3, 0, -3}, 4) } ); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDrawingSupplier(supplier); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setStroke(new BasicStroke(2.0f)); }
static protected void configureLineChart(JFreeChart chart) { CategoryPlot plot = chart.getCategoryPlot(); final DrawingSupplier supplier = new DefaultDrawingSupplier( DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, // Draw a small diamond new Shape[] { new Polygon(new int[] {3, 0, -3, 0}, new int[] {0, 3, 0, -3}, 4) } ); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDrawingSupplier(supplier); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setStroke(new BasicStroke(2.0f)); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); }
int hist[]=new int[11]; int val[]=new int[11]; for(int ii=0;ii<11;ii++) hist[ii]=ii-5;//to get negative indeces I used an array to save them for(int kk=0;kk<coeff.length;kk++) if(coeff[kk]<=5 &coeff[kk]>=-5) val[coeff[kk]+5]++; DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for(int ii=0;ii<hist.length;ii++) dataset.setValue(val[ii], "Coefficient value",""+hist[ii]); JFreeChart chart = ChartFactory.createBarChart("Original Histogram", "Coefficient value", "", dataset, PlotOrientation.VERTICAL, false,true, false); //chart.setBackgroundPaint(Color.yellow); chart.getTitle().setPaint(Color.blue); CategoryPlot p = chart.getCategoryPlot(); p.setOutlinePaint(Color.BLUE); p.setRangeGridlinePaint(Color.blue); orgim=chart.createBufferedImage(400,400); Image im1= orgim.getScaledInstance(jLabel12.getWidth(),jLabel12.getHeight(),1); jLabel12.setIcon(new ImageIcon(im1)); ///
protected void configurePlot(CategoryPlot plot) { plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(null); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); configureRenderer((LineAndShapeRenderer) plot.getRenderer()); configureDomainAxis(plot); }
public static void setupPlot(CategoryPlot plot) { plot.setBackgroundPaint(ChartDefaults.transparent); plot.setOutlinePaint(ChartDefaults.transparent); plot.setRangeGridlinePaint(ChartDefaults.gridLineColor); plot.setRangeGridlineStroke(new BasicStroke(0.5f)); plot.setRangeGridlinesVisible(true); plot.setRangeAxisLocation(ChartDefaults.rangeAxisLocation); plot.setDomainGridlinesVisible(false); ChartUtil.setupRangeAxis(plot.getRangeAxis()); ChartUtil.setupDomainAxis(plot.getDomainAxis()); }
public static void setupPlot(CategoryPlot plot) { plot.setBackgroundPaint(ChartDefaults.transparent); plot.setOutlinePaint(ChartDefaults.transparent); plot.setRangeGridlinePaint(ChartDefaults.gridLineColor); plot.setRangeGridlineStroke(new BasicStroke(0.5f)); plot.setRangeGridlinesVisible(true); plot.setRangeAxisLocation(ChartDefaults.rangeAxisLocation); plot.setDomainGridlinesVisible(false); ChartUtil.setupRangeAxis(plot.getRangeAxis()); ChartUtil.setupDomainAxis(plot.getDomainAxis()); }
private JFreeChart createChart(final DefaultStatisticalCategoryDataset dataset) { final CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(true, true); //CategoryItemRenderer renderer = new StatisticalBarRenderer(); for (int i = 0; i < dataset.getRowCount(); i++) { renderer.setSeriesStroke(i, new BasicStroke(5f)); } final String numberAxisLabel = _menu._time.getSelectedIndex() == 0 ? "Execution Time (s)" : "Used Memory (%)"; final CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Release"), new NumberAxis(numberAxisLabel), renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); plot.setForegroundAlpha(0.8f); return new JFreeChart((String) _menu._ontology.getSelectedItem(), plot); }
static private void setBackgroundDefault(final JFreeChart chart) { BasicStroke gridStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[]{2.0f, 1.0f}, 0.0f); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeGridlineStroke(gridStroke); plot.setDomainGridlineStroke(gridStroke); plot.setBackgroundPaint(new Color(235, 235, 235)); plot.setRangeGridlinePaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setOutlineVisible(false); plot.getDomainAxis().setAxisLineVisible(false); plot.getRangeAxis().setAxisLineVisible(false); plot.getDomainAxis().setLabelPaint(Color.gray); plot.getRangeAxis().setLabelPaint(Color.gray); plot.getDomainAxis().setTickLabelPaint(Color.gray); plot.getRangeAxis().setTickLabelPaint(Color.gray); chart.getTitle().setPaint(Color.gray); }
public static JFreeChart doCreateSummarizerChart(CategoryDataset dataset, String yAxis, String chartTitle) { final JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart // title null, // unused yAxis, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips true // urls ); chart.setBackgroundPaint(Color.WHITE); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setBaseStroke(new BasicStroke(4.0f)); renderer.setItemMargin(0); renderer.setMaximumBarWidth(0.05); return chart; }
/** * Sets properties common to all category graphs of this plug-in. * * @param plot * the chart to set the properties for */ protected void setCategoryPlotProperties(final CategoryPlot plot) { plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); CategoryAxis domainAxis = new ShiftedCategoryAxis(null); plot.setDomainAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); setPlotProperties(plot); }
/** * Sets properties common to all category graphs of this plug-in. * * @param plot * the chart to set the properties for */ protected void setCategoryPlotProperties(final CategoryPlot plot) { plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); CategoryAxis domainAxis = new ShiftedCategoryAxis(null); plot.setDomainAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); setPlotProperties(plot); }