Search in sources :

Example 6 with SeriesDataSet

use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.

the class LineChartWidget_MS method HandleWidgetSpecificSettings.

@Override
public boolean HandleWidgetSpecificSettings(FrameworkNode node) {
    if (true == HandleChartSpecificAppSettings(node)) {
        return true;
    }
    if (node.getNodeName().equalsIgnoreCase("Series")) {
        String ID, Namespace, Label;
        if (node.hasAttribute("Label")) {
            Label = node.getAttribute("Label");
        } else {
            Label = "";
        }
        for (FrameworkNode newNode : node.getChildNodes()) {
            if (newNode.getNodeName().equalsIgnoreCase("MinionSrc")) {
                Utility.ValidateAttributes(new String[] { "ID", "Namespace" }, newNode);
                if (newNode.hasAttribute("ID")) {
                    ID = newNode.getAttribute("ID");
                } else {
                    LOGGER.severe("Series defined with invalid MinionSrc - no ID");
                    return false;
                }
                if (newNode.hasAttribute("Namespace")) {
                    Namespace = newNode.getAttribute("Namespace");
                } else {
                    LOGGER.severe("Series defined with invalid MinionSrc - no Namespace");
                    return false;
                }
                SeriesDataSet objDS = new SeriesDataSet(Label, ID, Namespace);
                getSeries().add(objDS);
            }
        }
        return true;
    }
    return false;
}
Also used : SeriesDataSet(kutch.biff.marvin.utility.SeriesDataSet) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Example 7 with SeriesDataSet

use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.

the class LineChartWidget_MS method _CreateMSChart.

/**
 * @param pane
 * @param dataMgr
 * @return
 */
@SuppressWarnings("unchecked")
protected boolean _CreateMSChart(GridPane pane, DataManager dataMgr) {
    _CreateChart();
    ConfigureDimentions();
    ConfigureAlignment();
    SetupPeekaboo(dataMgr);
    ConfigureSynchronizationForMultiSource();
    pane.add(getChart(), getColumn(), getRow(), getColumnSpan(), getRowSpan());
    if (0 == _SeriesOrder.size()) {
        for (SeriesDataSet ds : getSeries()) {
            dataMgr.AddListener(ds.getID(), ds.getNamespace(), new ChangeListener() {

                @Override
                public void changed(ObservableValue o, Object oldVal, Object newVal) {
                    if (IsPaused()) {
                        return;
                    }
                    String strVal = newVal.toString();
                    double newValue = 0;
                    try {
                        newValue = Double.parseDouble(strVal);
                    } catch (Exception ex) {
                        LOGGER.severe("Invalid data for Chart received: " + strVal);
                        return;
                    }
                    OnDataArrived(ds, strVal);
                }
            });
        }
    } else {
        SetupSeriesSets(dataMgr);
    }
    SetupTaskAction();
    return ApplyCSS();
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) SeriesDataSet(kutch.biff.marvin.utility.SeriesDataSet)

Example 8 with SeriesDataSet

use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.

the class BaseChartWidget method SetupSeriesSets.

protected void SetupSeriesSets(DataManager dataMgr) {
    for (String key : _SeriesOrder) {
        SeriesSet objSeriesSet = _SeriesMap.get(key);
        if (null == objSeriesSet) {
            return;
        }
        XYChart.Series objSeries = new XYChart.Series();
        String strTitle = objSeriesSet.getTitle();
        if (null == strTitle) {
            return;
        }
        objSeries.setName(strTitle);
        for (SeriesDataSet objDs : objSeriesSet.getSeriesList()) {
            XYChart.Data objChartDataSet;
            if (isHorizontal()) {
                objChartDataSet = new XYChart.Data<>(0, objDs.getTitle());
            } else {
                objChartDataSet = new XYChart.Data<>(objDs.getTitle(), 0);
            }
            objSeries.getData().add(objChartDataSet);
            dataMgr.AddListener(objDs.getID(), objDs.getNamespace(), new ChangeListener() {

                @Override
                public void changed(ObservableValue o, Object oldVal, Object newVal) {
                    if (IsPaused()) {
                        return;
                    }
                    String strVal = newVal.toString();
                    double newValue;
                    try {
                        newValue = Double.parseDouble(strVal);
                    } catch (NumberFormatException ex) {
                        LOGGER.severe("Invalid data for Line Chart received: " + strVal);
                        return;
                    }
                    if (isHorizontal()) {
                        objChartDataSet.XValueProperty().set(newValue);
                    } else {
                        objChartDataSet.YValueProperty().set(newValue);
                    }
                }
            });
        }
        boolean fReturn = ((XYChart) getChart()).getData().add(objSeries);
    }
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) SeriesDataSet(kutch.biff.marvin.utility.SeriesDataSet) SeriesSet(kutch.biff.marvin.utility.SeriesSet) XYChart(javafx.scene.chart.XYChart) ChangeListener(javafx.beans.value.ChangeListener)

Example 9 with SeriesDataSet

use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.

the class BaseChartWidget method PushSynchronizedData.

protected void PushSynchronizedData() {
    String strVal;
    for (// create an entry for all
    SeriesDataSet ds : // create an entry for all
    getSeries()) {
        strVal = SyncronizeDataSetsMap.put(ds, null);
        AddNewData(ds, strVal);
    }
}
Also used : SeriesDataSet(kutch.biff.marvin.utility.SeriesDataSet)

Example 10 with SeriesDataSet

use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.

the class StackedAreaChartWidget method _CreateChart.

@Override
@SuppressWarnings("unchecked")
protected void _CreateChart() {
    CreateChart();
    for (SeriesDataSet ds : getSeries()) {
        // Stacked Charts will crash if you don't have any data in a series.
        ds.getSeries().getData().add(new XYChart.Data<>(0, 0));
        ((StackedAreaChart) (getChart())).getData().add(ds.getSeries());
    }
}
Also used : XYChart(javafx.scene.chart.XYChart) SeriesDataSet(kutch.biff.marvin.utility.SeriesDataSet)

Aggregations

SeriesDataSet (kutch.biff.marvin.utility.SeriesDataSet)11 ChangeListener (javafx.beans.value.ChangeListener)4 ObservableValue (javafx.beans.value.ObservableValue)4 XYChart (javafx.scene.chart.XYChart)4 FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)2 SeriesSet (kutch.biff.marvin.utility.SeriesSet)2 ArrayList (java.util.ArrayList)1 StackedBarChart (javafx.scene.chart.StackedBarChart)1