Search in sources :

Example 1 with RenderingSource

use of org.jfree.chart.RenderingSource in project graphcode2vec by graphcode2vec.

the class AbstractCategoryItemRenderer method initialise.

/**
 * Initialises the renderer and returns a state object that will be used
 * for the remainder of the drawing process for a single chart.  The state
 * object allows for the fact that the renderer may be used simultaneously
 * by multiple threads (each thread will work with a separate state object).
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param info  an object for returning information about the structure of
 *              the plot (<code>null</code> permitted).
 *
 * @return The renderer state.
 */
public CategoryItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, CategoryDataset dataset, PlotRenderingInfo info) {
    setPlot(plot);
    if (dataset != null) {
        this.rowCount = dataset.getRowCount();
        this.columnCount = dataset.getColumnCount();
    } else {
        this.rowCount = 0;
        this.columnCount = 0;
    }
    CategoryItemRendererState state = createState(info);
    // determine if there is any selection state for the dataset
    CategoryDatasetSelectionState selectionState = null;
    if (dataset instanceof SelectableCategoryDataset) {
        SelectableCategoryDataset scd = (SelectableCategoryDataset) dataset;
        selectionState = scd.getSelectionState();
    }
    // and ask if it has state...
    if (selectionState == null && info != null) {
        ChartRenderingInfo cri = info.getOwner();
        if (cri != null) {
            RenderingSource rs = cri.getRenderingSource();
            selectionState = (CategoryDatasetSelectionState) rs.getSelectionState(dataset);
        }
    }
    state.setSelectionState(selectionState);
    return state;
}
Also used : CategoryDatasetSelectionState(org.jfree.data.category.CategoryDatasetSelectionState) RenderingSource(org.jfree.chart.RenderingSource) SelectableCategoryDataset(org.jfree.data.category.SelectableCategoryDataset) ChartRenderingInfo(org.jfree.chart.ChartRenderingInfo)

Example 2 with RenderingSource

use of org.jfree.chart.RenderingSource 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 RenderingSource

use of org.jfree.chart.RenderingSource 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

ChartRenderingInfo (org.jfree.chart.ChartRenderingInfo)3 RenderingSource (org.jfree.chart.RenderingSource)3 SelectableXYDataset (org.jfree.data.xy.SelectableXYDataset)2 XYDatasetSelectionState (org.jfree.data.xy.XYDatasetSelectionState)2 GeneralPath (java.awt.geom.GeneralPath)1 CrosshairState (org.jfree.chart.plot.CrosshairState)1 CategoryDatasetSelectionState (org.jfree.data.category.CategoryDatasetSelectionState)1 SelectableCategoryDataset (org.jfree.data.category.SelectableCategoryDataset)1