Example usage for org.jfree.chart.event ChartProgressEvent getType

List of usage examples for org.jfree.chart.event ChartProgressEvent getType

Introduction

In this page you can find the example usage for org.jfree.chart.event ChartProgressEvent getType.

Prototype

public int getType() 

Source Link

Document

Returns the event type.

Usage

From source file:org.fhcrc.cpl.toolbox.gui.chart.CrosshairChangeListener.java

public void chartProgress(ChartProgressEvent event) {
    if (event.getType() != ChartProgressEvent.DRAWING_FINISHED)
        return;//from  ww  w .  java2  s  .co m
    double newDomainValue = event.getChart().getXYPlot().getDomainCrosshairValue();
    double newRangeValue = event.getChart().getXYPlot().getRangeCrosshairValue();

    if (domainValue != newDomainValue || rangeValue != newRangeValue) {
        domainValue = newDomainValue;
        rangeValue = newRangeValue;
        crosshairValueChanged(event);
    }
}

From source file:gchisto.jfreechart.extensions.ChartLocker.java

public void chartProgress(ChartProgressEvent event) {
    switch (event.getType()) {
    case ChartProgressEvent.DRAWING_STARTED:
        lock();//from  www.j a  v a  2 s  . c  o m
        break;
    case ChartProgressEvent.DRAWING_FINISHED:
        unlock();
        break;
    }
}

From source file:ste.travian.gui.WorldChartPanel.java

@Override
public void chartProgress(ChartProgressEvent event) {

    if (event.getType() == ChartProgressEvent.DRAWING_STARTED) {
        mainWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    } else {/*w  ww  . j a  v a2s.  c o m*/
        mainWindow.setCursor(Cursor.getDefaultCursor());
    }
}

From source file:cgpanalyser.gui.chart.XYChartPanel.java

@Override
public void chartProgress(ChartProgressEvent event) {
    if (event.getType() != ChartProgressEvent.DRAWING_FINISHED)
        return;//  ww w. ja  v  a2 s .c o  m

    JFreeChart jfreechart = this.getChart();
    if (jfreechart != null) {
        int currentDomainCrosshairValue = getDomainCrosshairValue(jfreechart);
        if (domainCrosshairValue != currentDomainCrosshairValue) {
            domainCrosshairValue = currentDomainCrosshairValue;
            System.out.println("domainCrosshairValue:" + currentDomainCrosshairValue);
            panelMain.drawChromosomesOnCrosshairEvent(domainCrosshairValue);
        }
    }
}

From source file:com.intel.stl.ui.main.view.HealthHistoryView.java

public void setDataset(final IntervalXYDataset dataset) {
    JFreeChart chart = ComponentFactory.createStepAreaChart(dataset, new XYItemLabelGenerator() {
        @Override/*from w ww  .  jav a 2  s . c  o m*/
        public String generateLabel(XYDataset dataset, int series, int item) {
            Number val = dataset.getY(series, item);
            return UIConstants.INTEGER.format(val.intValue());
        }
    });
    chart.addProgressListener(new ChartProgressListener() {
        @Override
        public void chartProgress(ChartProgressEvent event) {
            if (event.getType() == ChartProgressEvent.DRAWING_STARTED && currentValue != null) {
                currentValue.setText(scoreString);
                currentValue.setPaint(scoreColor);
                currentValue.setToolTipText(scoreTip);
            }
        }
    });
    XYPlot plot = chart.getXYPlot();
    plot.getRangeAxis().setRange(0, 105);
    plot.getRenderer().setSeriesPaint(0, UIConstants.INTEL_BLUE);
    currentValue = new TextTitle(scoreString, scoreFont);
    currentValue.setPaint(scoreColor);
    currentValue.setToolTipText(scoreTip);
    // currentValue.setBackgroundPaint(new Color(255, 255, 255, 128));
    currentValue.setPosition(RectangleEdge.BOTTOM);
    XYTitleAnnotation xytitleannotation = new XYTitleAnnotation(0.49999999999999998D, 0.49999999999999998D,
            currentValue, RectangleAnchor.CENTER);
    // xytitleannotation.setMaxWidth(0.47999999999999998D);
    plot.addAnnotation(xytitleannotation);

    chartPanel.setChart(chart);
}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutput.java

@Override
public void chartProgress(final ChartProgressEvent event) {
    ready = event.getType() == ChartProgressEvent.DRAWING_FINISHED;
}

From source file:net.sf.mzmine.modules.visualization.neutralloss.NeutralLossPlot.java

/**
 * @see org.jfree.chart.event.ChartProgressListener#chartProgress(org.jfree.chart.event.ChartProgressEvent)
 *//*from  w ww  .j a  v a2  s  .c o m*/
public void chartProgress(ChartProgressEvent event) {

    super.chartProgress(event);

    if (event.getType() == ChartProgressEvent.DRAWING_FINISHED) {

        visualizer.updateTitle();

        if (showSpectrumRequest) {
            showSpectrumRequest = false;
            visualizer.actionPerformed(
                    new ActionEvent(event.getSource(), ActionEvent.ACTION_PERFORMED, "SHOW_SPECTRUM"));
        }
    }

}

From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.AdvancedXY_PlotPanel.java

@Override
public void chartProgress(ChartProgressEvent event) {
    if (event.getType() != ChartProgressEvent.DRAWING_FINISHED) {
        return;//from  ww  w .j a  va2 s .  c o  m
    }

    // update the table model

    if (this.chartPanel != null) {
        JFreeChart c = this.getChart();
        if (c != null) {
            XYPlot plot = (XYPlot) c.getPlot();

            int ndex = this.getCrossHairDomainIndex();

            // update the table from the value at the crosshair

            for (int pnum = 0; pnum < NumDataSets; pnum++) {
                XYDataset dataset = plot.getDataset(pnum);
                String seriesName = "Unknown";
                if ((dataset != null) && (dataset.getSeriesKey(0) != null)) {
                    int ds_size = dataset.getItemCount(0);
                    if (dataset.getSeriesKey(0) instanceof String)
                        seriesName = (String) dataset.getSeriesKey(0);

                    // the name
                    this.model.setValueAt(seriesName, pnum, 0);

                    // the deltas are one smaller than the counters, so make sure the
                    // crosshair index is valid
                    if (ndex < ds_size) {
                        // the time
                        this.model.setValueAt(dataset.getXValue(0, ndex), pnum, 1);

                        // the value
                        this.model.setValueAt(dataset.getYValue(0, ndex), pnum, 2);
                    }

                    // the units (key off the series name)
                    PortCounterAxisLabel label = PortCounterAxisLabel.getByName(seriesName);
                    if (label != null)
                        this.model.setValueAt(label.getUnits(), pnum, 3);
                    else
                        this.model.setValueAt(PortCounterAxisLabel.DELTA.getUnits(), pnum, 3);
                }
            }
        } else
            System.err.println("Its NULL, Jim!");
    }
}

From source file:tw.edu.sju.ee.eea.module.iepe.file.IepeVoltageElement.java

private JFreeChart createChart() {

    SampledChart sampledChart = new SampledChart("Voltage Oscillogram");
    sampledChart.addData(0, SampledChart.createSampledSeriesCollection("Ch_0", info.getInputStream(), index,
            info.getSamplerate(), length));
    sampledChart.addMarker(cursor);/*from   w w  w. ja v  a 2s  . com*/
    sampledChart.addProgressListener(new ChartProgressListener() {

        @Override
        public void chartProgress(ChartProgressEvent event) {
            if (event.getType() == ChartProgressEvent.DRAWING_FINISHED) {
                if (chartMouseClicked) {
                    info.getCursor().setTime((int) event.getChart().getXYPlot().getDomainCrosshairValue());
                    chartMouseClicked = false;
                }
            }
        }
    });
    return sampledChart;
}

From source file:net.sf.mzmine.modules.visualization.scatterplot.scatterplotchart.ScatterPlotChart.java

/**
 * @see org.jfree.chart.event.ChartProgressListener#chartProgress(org.jfree.chart.event.ChartProgressEvent)
 *//*from   ww  w  . j ava  2 s .  c o m*/
@Override
public void chartProgress(ChartProgressEvent event) {
    super.chartProgress(event);

    // Whenever chart is repainted (e.g. after crosshair position changed),
    // we update the selected item name
    if (event.getType() == ChartProgressEvent.DRAWING_FINISHED) {
        double valueX = plot.getDomainCrosshairValue();
        double valueY = plot.getRangeCrosshairValue();
        PeakListRow selectedRow = mainDataSet.getRow(valueX, valueY);
        topPanel.updateItemNameText(selectedRow);
    }
}