Search in sources :

Example 6 with XYDatasetSelectionState

use of org.jfree.data.xy.XYDatasetSelectionState in project graphcode2vec by graphcode2vec.

the class AbstractXYItemRenderer method initialise.

/**
 * Initialises the renderer and returns a state object that should be
 * passed to all subsequent calls to the drawItem() method.
 * <P>
 * This method will be called before the first item is rendered, giving the
 * renderer an opportunity to initialise any state information it wants to
 * maintain.  The renderer can do nothing if it chooses.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @param plot  the plot.
 * @param dataset  the dataset.
 * @param info  an optional info collection object to return data back to
 *              the caller.
 *
 * @return The renderer state (never <code>null</code>).
 */
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {
    XYItemRendererState state = createState(info);
    // determine if there is any selection state for the dataset
    XYDatasetSelectionState selectionState = null;
    if (dataset instanceof SelectableXYDataset) {
        SelectableXYDataset sxyd = (SelectableXYDataset) dataset;
        selectionState = sxyd.getSelectionState();
    }
    // and ask if it has state...
    if (selectionState == null && info != null) {
        ChartRenderingInfo cri = info.getOwner();
        if (cri != null) {
            RenderingSource rs = cri.getRenderingSource();
            selectionState = (XYDatasetSelectionState) rs.getSelectionState(dataset);
        }
    }
    state.setSelectionState(selectionState);
    return state;
}
Also used : SelectableXYDataset(org.jfree.data.xy.SelectableXYDataset) RenderingSource(org.jfree.chart.RenderingSource) XYDatasetSelectionState(org.jfree.data.xy.XYDatasetSelectionState) ChartRenderingInfo(org.jfree.chart.ChartRenderingInfo)

Example 7 with XYDatasetSelectionState

use of org.jfree.data.xy.XYDatasetSelectionState in project graphcode2vec by graphcode2vec.

the class XYLineAndShapeRenderer method initialise.

/**
 * Initialises the renderer.
 * <P>
 * This method will be called before the first item is rendered, giving the
 * renderer an opportunity to initialise any state information it wants to
 * maintain.  The renderer can do nothing if it chooses.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @param plot  the plot.
 * @param dataset  the dataset.
 * @param info  an optional info collection object to return data back to
 *              the caller.
 *
 * @return The renderer state.
 */
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {
    State state = new State(info);
    state.seriesPath = new GeneralPath();
    // determine if there is any selection state for the dataset
    XYDatasetSelectionState selectionState = null;
    if (dataset instanceof SelectableXYDataset) {
        SelectableXYDataset sxyd = (SelectableXYDataset) dataset;
        selectionState = sxyd.getSelectionState();
    }
    // and ask if it has state...
    if (selectionState == null && info != null) {
        ChartRenderingInfo cri = info.getOwner();
        if (cri != null) {
            RenderingSource rs = cri.getRenderingSource();
            if (rs != null) {
                selectionState = (XYDatasetSelectionState) rs.getSelectionState(dataset);
            }
        }
    }
    state.setSelectionState(selectionState);
    return state;
}
Also used : GeneralPath(java.awt.geom.GeneralPath) SelectableXYDataset(org.jfree.data.xy.SelectableXYDataset) RenderingSource(org.jfree.chart.RenderingSource) XYDatasetSelectionState(org.jfree.data.xy.XYDatasetSelectionState) CrosshairState(org.jfree.chart.plot.CrosshairState) XYDatasetSelectionState(org.jfree.data.xy.XYDatasetSelectionState) ChartRenderingInfo(org.jfree.chart.ChartRenderingInfo)

Aggregations

SelectableXYDataset (org.jfree.data.xy.SelectableXYDataset)7 XYDatasetSelectionState (org.jfree.data.xy.XYDatasetSelectionState)7 Paint (java.awt.Paint)4 AbstractXYDataset (org.jfree.data.xy.AbstractXYDataset)4 XYDataset (org.jfree.data.xy.XYDataset)4 GeneralPath (java.awt.geom.GeneralPath)2 ChartRenderingInfo (org.jfree.chart.ChartRenderingInfo)2 RenderingSource (org.jfree.chart.RenderingSource)2 AbstractXYItemRenderer (org.jfree.chart.renderer.xy.AbstractXYItemRenderer)2 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)2 XYItemRendererState (org.jfree.chart.renderer.xy.XYItemRendererState)2 Graphics2D (java.awt.Graphics2D)1 ValueAxis (org.jfree.chart.axis.ValueAxis)1 CrosshairState (org.jfree.chart.plot.CrosshairState)1