Example usage for org.jfree.chart.axis ValueAxis setPositiveArrowVisible

List of usage examples for org.jfree.chart.axis ValueAxis setPositiveArrowVisible

Introduction

In this page you can find the example usage for org.jfree.chart.axis ValueAxis setPositiveArrowVisible.

Prototype

public void setPositiveArrowVisible(boolean visible) 

Source Link

Document

Sets a flag that controls whether or not the axis lines has an arrow drawn that points in the positive direction for the axis, and sends an AxisChangeEvent to all registered listeners.

Usage

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JFreeChart createXYAreaSparkline(XYDataset dataset) {
    JFreeChart jfreechart = ChartFactory.createXYAreaChart(null, null, null, dataset, PlotOrientation.VERTICAL,
            false, false, false);/*from   w  w  w.ja  v a  2s  .  c  o  m*/
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setDomainPannable(true);
    xyplot.setBackgroundPaint(null);
    xyplot.setOutlinePaint(null);
    xyplot.setForegroundAlpha(0.8F);
    xyplot.setDomainGridlinesVisible(false);
    xyplot.setDomainCrosshairVisible(false);
    xyplot.setRangeGridlinesVisible(false);
    xyplot.setRangeCrosshairVisible(false);

    DateAxis dateaxis = new DateAxis("");
    dateaxis.setTickLabelsVisible(false);
    dateaxis.setTickMarksVisible(false);
    dateaxis.setAxisLineVisible(false);
    dateaxis.setNegativeArrowVisible(false);
    dateaxis.setPositiveArrowVisible(false);
    dateaxis.setVisible(false);
    xyplot.setDomainAxis(dateaxis);

    ValueAxis rangeAxis = xyplot.getRangeAxis();
    rangeAxis.setTickLabelsVisible(false);
    rangeAxis.setTickMarksVisible(false);
    rangeAxis.setAxisLineVisible(false);
    rangeAxis.setNegativeArrowVisible(false);
    rangeAxis.setPositiveArrowVisible(false);
    rangeAxis.setVisible(false);

    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(1, UIConstants.INTEL_DARK_GRAY);
    xyitemrenderer.setSeriesPaint(0, NodeTypeViz.SWITCH.getColor());
    return jfreechart;
}

From source file:org.jivesoftware.openfire.reporting.graph.GraphEngine.java

/**
 * Generates a Sparkline Bar Graph./*from  www  . j a v a2 s .  c o  m*/
 *
 * @param def the key of the statistic object.
 * @return the generated chart.
 */
public JFreeChart generateSparklineBarGraph(String key, String color, Statistic[] def, long startTime,
        long endTime, int dataPoints) {
    Color backgroundColor = getBackgroundColor();

    IntervalXYDataset dataset = (IntervalXYDataset) populateData(key, def, startTime, endTime, dataPoints);
    JFreeChart chart = ChartFactory.createXYBarChart(null, // chart title
            null, // domain axis label
            true, null, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            false, // tooltips?
            false // URLs?
    );

    chart.setBackgroundPaint(backgroundColor);
    chart.setBorderVisible(false);
    chart.setBorderPaint(null);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainGridlinesVisible(false);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setBackgroundPaint(backgroundColor);
    plot.setRangeGridlinesVisible(false);

    GraphDefinition graphDef = GraphDefinition.getDefinition(color);
    Color plotColor = graphDef.getInlineColor(0);
    plot.getRenderer().setSeriesPaint(0, plotColor);
    plot.getRenderer().setBaseItemLabelsVisible(false);
    plot.getRenderer().setBaseOutlinePaint(backgroundColor);
    plot.setOutlineStroke(null);
    plot.setDomainGridlinePaint(null);

    ValueAxis xAxis = chart.getXYPlot().getDomainAxis();

    xAxis.setLabel(null);
    xAxis.setTickLabelsVisible(true);
    xAxis.setTickMarksVisible(true);
    xAxis.setAxisLineVisible(false);
    xAxis.setNegativeArrowVisible(false);
    xAxis.setPositiveArrowVisible(false);
    xAxis.setVisible(false);

    ValueAxis yAxis = chart.getXYPlot().getRangeAxis();
    yAxis.setTickLabelsVisible(false);
    yAxis.setTickMarksVisible(false);
    yAxis.setAxisLineVisible(false);
    yAxis.setNegativeArrowVisible(false);
    yAxis.setPositiveArrowVisible(false);
    yAxis.setVisible(false);

    return chart;
}