use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.
the class StackedBarChartWidget method setupListeners.
@Override
@SuppressWarnings("unchecked")
protected void setupListeners(DataManager dataMgr) {
for (String key : _SeriesOrder) {
SeriesSet objSeriesSet = _SeriesMap.get(key);
if (null == objSeriesSet) {
LOGGER.severe("Invalid Key in setupListeners");
return;
}
XYChart.Series objSeries = new XYChart.Series<>();
String strTitle = objSeriesSet.getTitle();
if (null == strTitle) {
strTitle = "untitled";
}
objSeries.setName(strTitle);
for (SeriesDataSet objDs : objSeriesSet.getSeriesList()) {
XYChart.Data objData;
if (isHorizontal()) {
objData = new XYChart.Data(0, objDs.getTitle());
} else {
objData = new XYChart.Data(objDs.getTitle(), 0);
}
objSeries.getData().add(objData);
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 (Exception ex) {
LOGGER.severe("Invalid data for Line Chart received: " + strVal);
return;
}
if (isHorizontal()) {
objData.XValueProperty().set(newValue);
} else {
objData.YValueProperty().set(newValue);
}
}
});
}
((StackedBarChart) getChart()).getData().add(objSeries);
}
}
Aggregations