Example usage for org.jfree.chart.plot XYPlot setRangeGridlinePaint

List of usage examples for org.jfree.chart.plot XYPlot setRangeGridlinePaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setRangeGridlinePaint.

Prototype

public void setRangeGridlinePaint(Paint paint) 

Source Link

Document

Sets the paint for the grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:ws.moor.bt.gui.charts.RawDownloadRate.java

private JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createTimeSeriesChart("Download Rate", "Time", "KB/s", dataset, false,
            false, false);// w  w  w  . ja  v a 2s. co  m
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

    return chart;
}

From source file:app.Plot.java

public void plotDesign(JFreeChart chart) {
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesShapesVisible(0, false);
    renderer.setSeriesPaint(0, Color.black);
    plot.setRenderer(renderer);//from   w  w  w.ja  v  a  2s.  co m
}

From source file:ws.moor.bt.gui.charts.RemotePeerCompletion.java

private JFreeChart createChart(HistogramDataset dataset) {

    JFreeChart chart = ChartFactory.createHistogram("Remote Peer Completion", "Completion %", "Peers", dataset,
            PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setRangeCrosshairVisible(true);

    plot.getDomainAxis().setAutoRange(false);
    plot.getDomainAxis().setRange(0.0, 100.0);

    return chart;
}

From source file:ws.moor.bt.gui.charts.ConnectionTypes.java

private JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createTimeSeriesChart("Connection Types", "Time", "Connections", dataset,
            true, false, false);/*from   w  w w  . j  a v  a 2  s . c om*/
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

    return chart;
}

From source file:com.graphhopper.jsprit.analysis.toolbox.XYLineChartBuilder.java

/**
 * Builds and returns JFreeChart./*from  w  ww.  jav  a2  s.c om*/
 *
 * @return
 */
public JFreeChart build() {
    XYSeriesCollection collection = new XYSeriesCollection();
    for (XYSeries s : seriesMap.values()) {
        collection.addSeries(s);
    }
    JFreeChart chart = ChartFactory.createXYLineChart(chartName, xDomain, yDomain, collection,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    return chart;
}

From source file:ws.moor.bt.grapher.ChartBuilder.java

public JFreeChart getChart() {
    JFreeChart chart = ChartFactory.createTimeSeriesChart(chartName, timeAxisLabel, valueAxisLabel, timeSeries,
            showLegend && (timeSeries.getSeriesCount() > 1), false, false);
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    plot.getRenderer().setSeriesPaint(0, Color.black);
    plot.getRenderer().setSeriesStroke(0, new BasicStroke(1.0f));
    plot.getRenderer().setSeriesPaint(1, Color.black);
    plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f));
    plot.getRenderer().setSeriesPaint(2, Color.black);
    plot.getRenderer().setSeriesStroke(2, new BasicStroke(0.1f));

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

    return chart;
}

From source file:ws.moor.bt.gui.charts.PiecesStats.java

private JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createTimeSeriesChart("Pieces", "Time", "Pieces", dataset, true, false,
            false);/*from w  w w.j  av a2s  . com*/
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

    return chart;
}

From source file:ws.moor.bt.gui.charts.OpenConnections.java

private JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createTimeSeriesChart("Open Connections", "Time", "Connections", dataset,
            true, false, false);//  w w  w .j  a v a  2s  .  co  m
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

    return chart;
}

From source file:com.waitwha.nessus.trendanalyzer.gui.TimeChartPanel.java

/**
 * Constructor//  w  w w  .  j  a  va 2s.c  o m
 *
 * @param title            String title of the chart.
 * @param xaxisLabel   String x-axis label of the chart.
 * @param yaxisLabel   String y-axis label of the chart (time).
 * @param dataset         XYDataset to use within the chart.
 */
public TimeChartPanel(String title, String xaxisLabel, String yaxisLabel, XYDataset dataset) {
    super(new BorderLayout());
    JFreeChart chart = ChartFactory.createTimeSeriesChart(title, xaxisLabel, yaxisLabel, dataset, true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd HH:mm"));

    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    this.add(panel, BorderLayout.CENTER);
    this.validate();
}

From source file:support.SystemMonitorGui.java

private XYPlot createChartFrame(XYSeries series) {
    XYSeriesCollection dataSet = new XYSeriesCollection();
    dataSet.addSeries(series);// ww w  .  j  a va2s .c o  m
    JFreeChart chart = ChartFactory.createXYLineChart("Memory Allocation Rate", "Time (ms)",
            "Allocation Rate (MB/s)", dataSet, PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    plot.getRenderer().setSeriesPaint(0, Color.BLUE);

    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.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent windowEvent) {
            hzMap.removeEntryListener(entryListenerId);
        }
    });
    frame.setVisible(true);
    return plot;
}