Search in sources :

Example 1 with SelectableXYDataset

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

the class XYPlot method findSelectionStateForDataset.

/**
 * Returns the selection state for the specified dataset.  This could be
 * <code>null</code> if the dataset hasn't been set up to support
 * selections.
 *
 * @param dataset  the dataset.
 * @param source  the selection source.
 *
 * @return The selection state (possibly <code>null</code>).
 */
private XYDatasetSelectionState findSelectionStateForDataset(XYDataset dataset, Object source) {
    if (dataset instanceof SelectableXYDataset) {
        SelectableXYDataset sd = (SelectableXYDataset) dataset;
        XYDatasetSelectionState s = sd.getSelectionState();
        return s;
    }
    throw new RuntimeException();
// return null;  // TODO: implement
}
Also used : SelectableXYDataset(org.jfree.data.xy.SelectableXYDataset) XYDatasetSelectionState(org.jfree.data.xy.XYDatasetSelectionState)

Example 2 with SelectableXYDataset

use of org.jfree.data.xy.SelectableXYDataset 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 3 with SelectableXYDataset

use of org.jfree.data.xy.SelectableXYDataset 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)3 XYDatasetSelectionState (org.jfree.data.xy.XYDatasetSelectionState)3 ChartRenderingInfo (org.jfree.chart.ChartRenderingInfo)2 RenderingSource (org.jfree.chart.RenderingSource)2 GeneralPath (java.awt.geom.GeneralPath)1 CrosshairState (org.jfree.chart.plot.CrosshairState)1