Example usage for org.jfree.data.general HeatMapUtilities extractRowFromHeatMapDataset

List of usage examples for org.jfree.data.general HeatMapUtilities extractRowFromHeatMapDataset

Introduction

In this page you can find the example usage for org.jfree.data.general HeatMapUtilities extractRowFromHeatMapDataset.

Prototype

public static XYDataset extractRowFromHeatMapDataset(HeatMapDataset dataset, int row, Comparable seriesName) 

Source Link

Document

Returns a dataset containing one series that holds a copy of the (x, z) data from one row (y-index) of the specified dataset.

Usage

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

public void stateChanged(ChangeEvent e) {
    // handles both slider events

    if (e.getSource() == PortSlider) {
        //System.err.println("Port Slider is changing " + PortSlider.getValue());
        // this is the vertical slider (moves the horizontal xhair), which moves through ports on vertical axis
        PortXhair.setValue(PortSlider.getValue());
        int xIndex = PortSlider.getValue() - PortSlider.getMinimum();
        if (pHeatMap != null) {
            // extract this slice from the heatmap, and display it
            XYDataset d = HeatMapUtilities.extractRowFromHeatMapDataset(pHeatMap, xIndex, "Y1");
            SinglePortChart.getXYPlot().setDataset(d);
            SinglePortChart.setTitle(pHeatMap.getPortId(xIndex) + " (port " + xIndex + ")");
        }//from w w w . ja  v a  2s .c  om
    } else if (e.getSource() == TimeSlider) {
        //System.err.println("Time Slider is changing " + TimeSlider.getValue());
        // this is the horizontal slider (moves vertical xhair), which moves through time on the horizontal axis
        TimeXhair.setValue(TimeSlider.getValue());
        int xIndex = TimeSlider.getValue() - TimeSlider.getMinimum();
        if (pHeatMap != null) {
            // extract this slice from the heatmap, and display it
            XYDataset d = HeatMapUtilities.extractColumnFromHeatMapDataset(pHeatMap, xIndex, "Y2");
            SingleTimeChart.getXYPlot().setDataset(d);
            SingleTimeChart.setTitle(new TimeStamp(pHeatMap.getXTimeValue(xIndex)).toString());
        }
    }
}