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

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

Introduction

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

Prototype

public void setDomainCrosshairVisible(boolean flag) 

Source Link

Document

Sets the flag indicating whether or not the domain crosshair is visible and, if the flag changes, sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.ChartFactory.java

/**
 * Creates a stepped XY plot with default settings.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param xAxisLabel  a label for the X-axis ({@code null} permitted).
 * @param yAxisLabel  a label for the Y-axis ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 *
 * @return A chart./*w w w.j  a  va2  s . com*/
 */
public static JFreeChart createXYStepChart(String title, String xAxisLabel, String yAxisLabel,
        XYDataset dataset) {

    DateAxis xAxis = new DateAxis(xAxisLabel);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator();
    XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, null);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart(title, plot);
    currentTheme.apply(chart);
    return chart;

}

From source file:org.jfree.chart.ChartFactory.java

/**
 * Creates a filled stepped XY plot with default settings.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param xAxisLabel  a label for the X-axis ({@code null} permitted).
 * @param yAxisLabel  a label for the Y-axis ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 *
 * @return A chart.//from  w  w w.  j  a  v  a2  s. c  o m
 */
public static JFreeChart createXYStepAreaChart(String title, String xAxisLabel, String yAxisLabel,
        XYDataset dataset) {

    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);

    XYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator();
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator,
            null);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart(title, plot);
    currentTheme.apply(chart);
    return chart;
}