Java Code Examples for org.jfree.ui.RectangleInsets#ZERO_INSETS

The following examples show how to use org.jfree.ui.RectangleInsets#ZERO_INSETS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractBlock.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new block.
 */
protected AbstractBlock() {
    this.id = null;
    this.width = 0.0;
    this.height = 0.0;
    this.bounds = new Rectangle2D.Float();
    this.margin = RectangleInsets.ZERO_INSETS;
    this.frame = BlockBorder.NONE;
    this.padding = RectangleInsets.ZERO_INSETS;
}
 
Example 2
Source File: AbstractBlock.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new block.
 */
protected AbstractBlock() {
    this.id = null;
    this.width = 0.0;
    this.height = 0.0;
    this.bounds = new Rectangle2D.Float();
    this.margin = RectangleInsets.ZERO_INSETS;
    this.frame = BlockBorder.NONE;
    this.padding = RectangleInsets.ZERO_INSETS;
}
 
Example 3
Source File: AbstractBlock.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new block.
 */
protected AbstractBlock() {
    this.id = null;
    this.width = 0.0;
    this.height = 0.0;
    this.bounds = new Rectangle2D.Float();
    this.margin = RectangleInsets.ZERO_INSETS;
    this.frame = BlockBorder.NONE;
    this.padding = RectangleInsets.ZERO_INSETS;
}
 
Example 4
Source File: AbstractBlock.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new block.
 */
protected AbstractBlock() {
    this.id = null;
    this.width = 0.0;
    this.height = 0.0;
    this.bounds = new Rectangle2D.Float();
    this.margin = RectangleInsets.ZERO_INSETS;
    this.frame = BlockBorder.NONE;
    this.padding = RectangleInsets.ZERO_INSETS;
}
 
Example 5
Source File: AbstractBlock.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new block.
 */
protected AbstractBlock() {
    this.id = null;
    this.width = 0.0;
    this.height = 0.0;
    this.bounds = new Rectangle2D.Float();
    this.margin = RectangleInsets.ZERO_INSETS;
    this.frame = BlockBorder.NONE;
    this.padding = RectangleInsets.ZERO_INSETS;
}
 
Example 6
Source File: AbstractBlock.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new block.
 */
protected AbstractBlock() {
    this.id = null;
    this.width = 0.0;
    this.height = 0.0;
    this.bounds = new Rectangle2D.Float();
    this.margin = RectangleInsets.ZERO_INSETS;
    this.frame = BlockBorder.NONE;
    this.padding = RectangleInsets.ZERO_INSETS;
}
 
Example 7
Source File: AbstractBlock.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new block.
 */
protected AbstractBlock() {
    this.id = null;
    this.width = 0.0;
    this.height = 0.0;
    this.bounds = new Rectangle2D.Float();
    this.margin = RectangleInsets.ZERO_INSETS;
    this.border = BlockBorder.NONE; 
    this.padding = RectangleInsets.ZERO_INSETS;
}
 
Example 8
Source File: JFreeChart.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new chart with the given title and plot.  The
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    ParamChecks.nullNotPermitted(plot, "plot");

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
    // added the following hint because of 
    // http://stackoverflow.com/questions/7785082/
    this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
            RenderingHints.VALUE_STROKE_PURE);
    
    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    this.subtitles = new ArrayList();

    // create a legend, if requested...
    if (createLegend) {
        LegendTitle legend = new LegendTitle(this.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);
        this.subtitles.add(legend);
        legend.addChangeListener(this);
    }

    // add the chart title, if one has been specified...
    if (title != null) {
        if (titleFont == null) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
Example 9
Source File: CategoryPlot.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the item renderer (<code>null</code> permitted).
 *
 */
public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;

    // allocate storage for dataset, axes and renderers
    this.domainAxes = new HashMap<Integer, CategoryAxis>();
    this.domainAxisLocations = new HashMap<Integer, AxisLocation>();
    this.rangeAxes = new HashMap<Integer, ValueAxis>();
    this.rangeAxisLocations = new HashMap<Integer, AxisLocation>();

    this.datasetToDomainAxesMap = new TreeMap();
    this.datasetToRangeAxesMap = new TreeMap();

    this.renderers = new HashMap<Integer, CategoryItemRenderer>();

    this.datasets = new HashMap<Integer, CategoryDataset>();
    this.datasets.put(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.axisOffset = RectangleInsets.ZERO_INSETS;
    this.domainAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT);
    this.rangeAxisLocations.put(0, AxisLocation.TOP_OR_LEFT);

    this.renderers.put(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.put(0, domainAxis);
    mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.drawSharedDomainAxis = false;

    this.rangeAxes.put(0, rangeAxis);
    mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = DEFAULT_DOMAIN_GRIDLINES_VISIBLE;
    this.domainGridlinePosition = CategoryAnchor.MIDDLE;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = DEFAULT_RANGE_GRIDLINES_VISIBLE;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeMinorGridlinesVisible = false;
    this.rangeMinorGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeMinorGridlinePaint = Color.white;

    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.anchorValue = 0.0;

    this.domainCrosshairVisible = false;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = DEFAULT_CROSSHAIR_VISIBLE;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

    this.rangePannable = false;
    this.shadowGenerator = null;
}
 
Example 10
Source File: JFreeChart.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new chart with the given title and plot.  The 
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.  
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range 
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title 
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data 
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should   
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot, 
                  boolean createLegend) {

    if (plot == null) {
        throw new NullPointerException("Null 'plot' argument.");
    }

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the 
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING, 
            RenderingHints.VALUE_ANTIALIAS_ON);

    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;
    
    this.plot = plot;
    plot.addChangeListener(this);

    this.subtitles = new ArrayList();

    // create a legend, if requested...
    if (createLegend) {
        LegendTitle legend = new LegendTitle(this.plot);
        legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
        legend.setBorder(new BlockBorder());
        legend.setBackgroundPaint(Color.white);
        legend.setPosition(RectangleEdge.BOTTOM);
        this.subtitles.add(legend);
    }

    // add the chart title, if one has been specified...
    if (title != null) {
        if (titleFont == null) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
Example 11
Source File: CategoryPlot.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the item renderer (<code>null</code> permitted).
 *
 */
public CategoryPlot(CategoryDataset dataset,
                    CategoryAxis domainAxis,
                    ValueAxis rangeAxis,
                    CategoryItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;

    // allocate storage for dataset, axes and renderers
    this.domainAxes = new ObjectList();
    this.domainAxisLocations = new ObjectList();
    this.rangeAxes = new ObjectList();
    this.rangeAxisLocations = new ObjectList();
    
    this.datasetToDomainAxisMap = new ObjectList();
    this.datasetToRangeAxisMap = new ObjectList();

    this.renderers = new ObjectList();

    this.datasets = new ObjectList();
    this.datasets.set(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.axisOffset = RectangleInsets.ZERO_INSETS;

    setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT, false);
    setRangeAxisLocation(AxisLocation.TOP_OR_LEFT, false);

    this.renderers.set(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.set(0, domainAxis);
    this.mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.drawSharedDomainAxis = false;

    this.rangeAxes.set(0, rangeAxis);
    this.mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }
    
    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = DEFAULT_DOMAIN_GRIDLINES_VISIBLE;
    this.domainGridlinePosition = CategoryAnchor.MIDDLE;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeGridlinesVisible = DEFAULT_RANGE_GRIDLINES_VISIBLE;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    Marker baseline = new ValueMarker(0.0, new Color(0.8f, 0.8f, 0.8f, 
            0.5f), new BasicStroke(1.0f), new Color(0.85f, 0.85f, 0.95f, 
            0.5f), new BasicStroke(1.0f), 0.6f);
    addRangeMarker(baseline, Layer.BACKGROUND);

    this.anchorValue = 0.0;
    this.annotations = new java.util.ArrayList();

}
 
Example 12
Source File: XYPlot.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new plot with the specified dataset, axes and renderer.  Any
 * of the arguments can be <code>null</code>, but in that case you should
 * take care to specify the value before using the plot (otherwise a
 * <code>NullPointerException</code> may be thrown).
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the renderer (<code>null</code> permitted).
 */
public XYPlot(XYDataset dataset,
              ValueAxis domainAxis,
              ValueAxis rangeAxis,
              XYItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;
    this.weight = 1;  // only relevant when this is a subplot
    this.axisOffset = RectangleInsets.ZERO_INSETS;

    // allocate storage for datasets, axes and renderers (all optional)
    this.domainAxes = new ObjectList();
    this.domainAxisLocations = new ObjectList();
    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();

    this.rangeAxes = new ObjectList();
    this.rangeAxisLocations = new ObjectList();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.datasets = new ObjectList();
    this.renderers = new ObjectList();

    this.datasetToDomainAxisMap = new TreeMap();
    this.datasetToRangeAxisMap = new TreeMap();

    this.datasets.set(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.renderers.set(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.set(0, domainAxis);
    this.mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.domainAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    this.rangeAxes.set(0, rangeAxis);
    this.mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }
    this.rangeAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT);

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = true;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeGridlinesVisible = true;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.domainCrosshairVisible = false;
    this.domainCrosshairValue = 0.0;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = false;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

}
 
Example 13
Source File: JFreeChart.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new chart with the given title and plot.  The
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    ParamChecks.nullNotPermitted(plot, "plot");

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
    // added the following hint because of 
    // http://stackoverflow.com/questions/7785082/
    this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
            RenderingHints.VALUE_STROKE_PURE);
    
    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    this.subtitles = new ArrayList();

    // create a legend, if requested...
    if (createLegend) {
        LegendTitle legend = new LegendTitle(this.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);
        this.subtitles.add(legend);
        legend.addChangeListener(this);
    }

    // add the chart title, if one has been specified...
    if (title != null) {
        if (titleFont == null) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
Example 14
Source File: CategoryPlot.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the item renderer (<code>null</code> permitted).
 *
 */
public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;

    // allocate storage for dataset, axes and renderers
    this.domainAxes = new HashMap<Integer, CategoryAxis>();
    this.domainAxisLocations = new HashMap<Integer, AxisLocation>();
    this.rangeAxes = new HashMap<Integer, ValueAxis>();
    this.rangeAxisLocations = new HashMap<Integer, AxisLocation>();

    this.datasetToDomainAxesMap = new TreeMap();
    this.datasetToRangeAxesMap = new TreeMap();

    this.renderers = new HashMap<Integer, CategoryItemRenderer>();

    this.datasets = new HashMap<Integer, CategoryDataset>();
    this.datasets.put(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.axisOffset = RectangleInsets.ZERO_INSETS;
    this.domainAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT);
    this.rangeAxisLocations.put(0, AxisLocation.TOP_OR_LEFT);

    this.renderers.put(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.put(0, domainAxis);
    mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.drawSharedDomainAxis = false;

    this.rangeAxes.put(0, rangeAxis);
    mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = DEFAULT_DOMAIN_GRIDLINES_VISIBLE;
    this.domainGridlinePosition = CategoryAnchor.MIDDLE;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = DEFAULT_RANGE_GRIDLINES_VISIBLE;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeMinorGridlinesVisible = false;
    this.rangeMinorGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeMinorGridlinePaint = Color.white;

    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.anchorValue = 0.0;

    this.domainCrosshairVisible = false;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = DEFAULT_CROSSHAIR_VISIBLE;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

    this.rangePannable = false;
    this.shadowGenerator = null;
}
 
Example 15
Source File: JFreeChart.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new chart with the given title and plot.  The
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    ParamChecks.nullNotPermitted(plot, "plot");

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
    // added the following hint because of 
    // http://stackoverflow.com/questions/7785082/
    this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
            RenderingHints.VALUE_STROKE_PURE);
    
    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    this.subtitles = new ArrayList();

    // create a legend, if requested...
    if (createLegend) {
        LegendTitle legend = new LegendTitle(this.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);
        this.subtitles.add(legend);
        legend.addChangeListener(this);
    }

    // add the chart title, if one has been specified...
    if (title != null) {
        if (titleFont == null) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
Example 16
Source File: CategoryPlot.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the item renderer (<code>null</code> permitted).
 *
 */
public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;

    // allocate storage for dataset, axes and renderers
    this.domainAxes = new HashMap<Integer, CategoryAxis>();
    this.domainAxisLocations = new HashMap<Integer, AxisLocation>();
    this.rangeAxes = new HashMap<Integer, ValueAxis>();
    this.rangeAxisLocations = new HashMap<Integer, AxisLocation>();

    this.datasetToDomainAxesMap = new TreeMap();
    this.datasetToRangeAxesMap = new TreeMap();

    this.renderers = new HashMap<Integer, CategoryItemRenderer>();

    this.datasets = new HashMap<Integer, CategoryDataset>();
    this.datasets.put(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.axisOffset = RectangleInsets.ZERO_INSETS;
    this.domainAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT);
    this.rangeAxisLocations.put(0, AxisLocation.TOP_OR_LEFT);

    this.renderers.put(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.put(0, domainAxis);
    mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.drawSharedDomainAxis = false;

    this.rangeAxes.put(0, rangeAxis);
    mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = DEFAULT_DOMAIN_GRIDLINES_VISIBLE;
    this.domainGridlinePosition = CategoryAnchor.MIDDLE;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = DEFAULT_RANGE_GRIDLINES_VISIBLE;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeMinorGridlinesVisible = false;
    this.rangeMinorGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeMinorGridlinePaint = Color.white;

    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.anchorValue = 0.0;

    this.domainCrosshairVisible = false;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = DEFAULT_CROSSHAIR_VISIBLE;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

    this.rangePannable = false;
    this.shadowGenerator = null;
}
 
Example 17
Source File: CategoryPlot.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the item renderer (<code>null</code> permitted).
 *
 */
public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;

    // allocate storage for dataset, axes and renderers
    this.domainAxes = new HashMap<Integer, CategoryAxis>();
    this.domainAxisLocations = new HashMap<Integer, AxisLocation>();
    this.rangeAxes = new HashMap<Integer, ValueAxis>();
    this.rangeAxisLocations = new HashMap<Integer, AxisLocation>();

    this.datasetToDomainAxesMap = new TreeMap();
    this.datasetToRangeAxesMap = new TreeMap();

    this.renderers = new HashMap<Integer, CategoryItemRenderer>();

    this.datasets = new HashMap<Integer, CategoryDataset>();
    this.datasets.put(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.axisOffset = RectangleInsets.ZERO_INSETS;
    this.domainAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT);
    this.rangeAxisLocations.put(0, AxisLocation.TOP_OR_LEFT);

    this.renderers.put(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.put(0, domainAxis);
    mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.drawSharedDomainAxis = false;

    this.rangeAxes.put(0, rangeAxis);
    mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = DEFAULT_DOMAIN_GRIDLINES_VISIBLE;
    this.domainGridlinePosition = CategoryAnchor.MIDDLE;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = DEFAULT_RANGE_GRIDLINES_VISIBLE;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeMinorGridlinesVisible = false;
    this.rangeMinorGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeMinorGridlinePaint = Color.white;

    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.anchorValue = 0.0;

    this.domainCrosshairVisible = false;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = DEFAULT_CROSSHAIR_VISIBLE;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

    this.rangePannable = false;
    this.shadowGenerator = null;
}
 
Example 18
Source File: LineChart.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
public JFreeChart createChart(){
	
	logger.debug("IN");
	CategoryPlot plot = new CategoryPlot();

	
	NumberAxis rangeAxis = new NumberAxis("Kpi Values");
	rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 12 ));
	Color colorLabel= Color.decode("#000000");
	rangeAxis.setLabelPaint(colorLabel);
	rangeAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10 ));
	rangeAxis.setTickLabelPaint(colorLabel);
	plot.setRangeAxis(rangeAxis);
	
	CategoryAxis domainAxis = new CategoryAxis();
	domainAxis.setLabelFont(new Font("Arial", Font.PLAIN, 10 ));
       domainAxis.setLabelPaint(colorLabel);
       domainAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10 ));
       domainAxis.setTickLabelPaint(colorLabel);
	plot.setDomainAxis(domainAxis);

	plot.setOrientation(PlotOrientation.VERTICAL);
	plot.setRangeGridlinesVisible(true);
	plot.setDomainGridlinesVisible(true);


	//I create a line renderer 
	MyStandardCategoryItemLabelGenerator generator=null;

		LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer();
		lineRenderer.setShapesFilled(true);
		lineRenderer.setBaseItemLabelGenerator(generator);
		lineRenderer.setBaseItemLabelFont(new Font("Arial", Font.PLAIN, 12 ));
		lineRenderer.setBaseItemLabelPaint(colorLabel);
		lineRenderer.setBaseItemLabelsVisible(true);

		DefaultCategoryDataset datasetLine=(DefaultCategoryDataset)datasetMap.getDatasets().get("line");

			for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) {
				String serName = (String) iterator.next();
				String labelName = "";
				int index=-1;
				index=datasetLine.getRowIndex(serName);
				
				Color color=Color.decode("#990200");
				lineRenderer.setSeriesPaint(index, color);	
			}

		plot.setDataset(0,datasetLine);
		plot.setRenderer(0,lineRenderer);

	plot.getDomainAxis().setCategoryLabelPositions(
			CategoryLabelPositions.UP_45);
	JFreeChart chart = new JFreeChart(plot);
	logger.debug("Chart created");
	TextTitle title=new TextTitle(name,new Font("Arial", Font.BOLD, 16 ),Color.decode("#990200"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
	chart.setTitle(title);
	TextTitle subTitle =new TextTitle(subName,new Font("Arial", Font.PLAIN, 12 ),Color.decode("#000000"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
	chart.addSubtitle(subTitle);
	TextTitle subTitle2 =new TextTitle(subName,new Font("Arial", Font.PLAIN, 8 ),Color.decode("#FFFFFF"), RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
	chart.addSubtitle(subTitle2);
	chart.removeLegend();
	
	chart.setBackgroundPaint(Color.white);
	logger.debug("OUT");
	return chart;
}
 
Example 19
Source File: JFreeChart.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new chart with the given title and plot.  The
 * <code>createLegend</code> argument specifies whether or not a legend
 * should be added to the chart.
 * <br><br>
 * Note that the  {@link ChartFactory} class contains a range
 * of static methods that will return ready-made charts, and often this
 * is a more convenient way to create charts than using this constructor.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param titleFont  the font for displaying the chart title
 *                   (<code>null</code> permitted).
 * @param plot  controller of the visual representation of the data
 *              (<code>null</code> not permitted).
 * @param createLegend  a flag indicating whether or not a legend should
 *                      be created for the chart.
 */
public JFreeChart(String title, Font titleFont, Plot plot,
                  boolean createLegend) {

    ParamChecks.nullNotPermitted(plot, "plot");

    // create storage for listeners...
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.notify = true;  // default is to notify listeners when the
                         // chart changes

    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
    // added the following hint because of 
    // http://stackoverflow.com/questions/7785082/
    this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
            RenderingHints.VALUE_STROKE_PURE);
    
    this.borderVisible = false;
    this.borderStroke = new BasicStroke(1.0f);
    this.borderPaint = Color.black;

    this.padding = RectangleInsets.ZERO_INSETS;

    this.plot = plot;
    plot.addChangeListener(this);

    this.subtitles = new ArrayList();

    // create a legend, if requested...
    if (createLegend) {
        LegendTitle legend = new LegendTitle(this.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);
        this.subtitles.add(legend);
        legend.addChangeListener(this);
    }

    // add the chart title, if one has been specified...
    if (title != null) {
        if (titleFont == null) {
            titleFont = DEFAULT_TITLE_FONT;
        }
        this.title = new TextTitle(title, titleFont);
        this.title.addChangeListener(this);
    }

    this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;

    this.backgroundImage = DEFAULT_BACKGROUND_IMAGE;
    this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT;
    this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA;

}
 
Example 20
Source File: CategoryPlot.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param domainAxis  the domain axis (<code>null</code> permitted).
 * @param rangeAxis  the range axis (<code>null</code> permitted).
 * @param renderer  the item renderer (<code>null</code> permitted).
 *
 */
public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;

    // allocate storage for dataset, axes and renderers
    this.domainAxes = new HashMap<Integer, CategoryAxis>();
    this.domainAxisLocations = new HashMap<Integer, AxisLocation>();
    this.rangeAxes = new HashMap<Integer, ValueAxis>();
    this.rangeAxisLocations = new HashMap<Integer, AxisLocation>();

    this.datasetToDomainAxesMap = new TreeMap();
    this.datasetToRangeAxesMap = new TreeMap();

    this.renderers = new HashMap<Integer, CategoryItemRenderer>();

    this.datasets = new HashMap<Integer, CategoryDataset>();
    this.datasets.put(0, dataset);
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.axisOffset = RectangleInsets.ZERO_INSETS;
    this.domainAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT);
    this.rangeAxisLocations.put(0, AxisLocation.TOP_OR_LEFT);

    this.renderers.put(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.put(0, domainAxis);
    mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }
    this.drawSharedDomainAxis = false;

    this.rangeAxes.put(0, rangeAxis);
    mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = DEFAULT_DOMAIN_GRIDLINES_VISIBLE;
    this.domainGridlinePosition = CategoryAnchor.MIDDLE;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    this.rangeZeroBaselinePaint = Color.black;
    this.rangeZeroBaselineStroke = new BasicStroke(0.5f);

    this.rangeGridlinesVisible = DEFAULT_RANGE_GRIDLINES_VISIBLE;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeMinorGridlinesVisible = false;
    this.rangeMinorGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeMinorGridlinePaint = Color.white;

    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.anchorValue = 0.0;

    this.domainCrosshairVisible = false;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = DEFAULT_CROSSHAIR_VISIBLE;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

    this.rangePannable = false;
    this.shadowGenerator = null;
}