Search in sources :

Example 21 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project openblocks by mikaelhg.

the class CLineGraph method clearValues.

/**
     * Clear the graph starting from the startTime.
     * @param startTime an x-value on the graph
     */
public void clearValues(int index, double startTime) {
    if (!lock) {
        XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
        int i = s.indexOf(startTime);
        if (i >= 0) {
            int total = s.getItemCount();
            for (; i < total; total--) {
                s.remove(i);
            }
        }
    }
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection)

Example 22 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project openblocks by mikaelhg.

the class CLineGraph method updateValues.

/**
     * Updates the values for the specified seriesName with the given values
     * @param seriesName the name a series in the graph
     * @param index the index of the desired series to update
     * @param time the time at which to update
     * @param value the value to update
     */
public void updateValues(String seriesName, int index, double time, double value) {
    if (!lock) {
        XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
        s.setKey(seriesName);
        s.addOrUpdate(time, value);
    }
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection)

Example 23 with XYSeriesCollection

use of org.jfree.data.xy.XYSeriesCollection in project openblocks by mikaelhg.

the class CLineGraph method updateSeriesNameAt.

/**
     * Updates the series name at the specified index
     * @param seriesName the new seriesName to set at the specified index
     * @param index the desired index to set the new seriesName to
     */
public void updateSeriesNameAt(String seriesName, int index) {
    if (!lock) {
        XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
        s.setKey(seriesName);
    }
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection)

Aggregations

XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)23 XYSeries (org.jfree.data.xy.XYSeries)22 JFreeChart (org.jfree.chart.JFreeChart)17 DecimalFormat (java.text.DecimalFormat)11 NumberFormat (java.text.NumberFormat)11 HashMap (java.util.HashMap)6 XYPlot (org.jfree.chart.plot.XYPlot)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Node (org.gephi.graph.api.Node)1 StandardXYItemRenderer (org.jfree.chart.renderer.xy.StandardXYItemRenderer)1 XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)1 XYSplineRenderer (org.jfree.chart.renderer.xy.XYSplineRenderer)1 XYDataItem (org.jfree.data.xy.XYDataItem)1