use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.
the class StackedAreaChartWidget_MS 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());
}
}
use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.
the class StackedBarChartWidget method CreateChartObject.
@Override
protected Chart CreateChartObject() {
ArrayList<String> list = new ArrayList<>();
for (String key : _SeriesOrder) {
if (null == _SeriesMap.get(key)) {
LOGGER.severe("Unexpected probelm in CreateChartObject");
break;
}
ArrayList<SeriesDataSet> setList = _SeriesMap.get(key).getSeriesList();
if (null == setList) {
LOGGER.severe("Unexpected probelm in CreateChartObject");
break;
}
for (SeriesDataSet set : setList) {
list.add(set.getTitle());
}
break;
}
getAxis_X().setCategories(FXCollections.observableArrayList(list));
return new StackedBarChart<String, Number>(getAxis_X(), getyAxis());
}
use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.
the class BaseChartWidget method ReadSeriesSet.
protected boolean ReadSeriesSet(FrameworkNode setNode) {
String title = "";
if (setNode.hasAttributes()) {
Utility.ValidateAttributes(new String[] { "Title" }, setNode);
if (setNode.hasAttribute("Title")) {
title = setNode.getAttribute("Title");
}
}
for (FrameworkNode node : setNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("MinionSrc")) {
Utility.ValidateAttributes(new String[] { "ID", "Namespace", "SeriesID" }, node);
String ID, Namespace, SeriesID;
if (node.hasAttribute("ID")) {
ID = node.getAttribute("ID");
} else {
LOGGER.severe("Chart SeriesSet defined with invalid MinionSrc - no ID");
return false;
}
if (node.hasAttribute("Namespace")) {
Namespace = node.getAttribute("Namespace");
} else {
LOGGER.severe("hart SeriesSedefined with invalid MinionSrc - no Namespace");
return false;
}
if (node.hasAttribute("SeriesID")) {
SeriesID = node.getAttribute("SeriesID");
} else {
LOGGER.severe("Chart SeriesSet defined with invalid MinionSrc - no SeriesID");
return false;
}
if (false == _SeriesMap.containsKey(SeriesID.toUpperCase())) {
LOGGER.severe("Chart SeriesSet defined with invalid MinionSrc - the Series ID has not been defined in a <Series> section. SeriesID=" + SeriesID);
return false;
}
SeriesDataSet objDS = new SeriesDataSet(title, ID, Namespace);
_SeriesMap.get(SeriesID.toUpperCase()).AddSeries(objDS);
}
}
return true;
}
use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.
the class LineChartWidget method Create.
@Override
@SuppressWarnings("unchecked")
public boolean Create(GridPane pane, DataManager dataMgr) {
SetParent(pane);
if (getSeries().isEmpty()) {
if (getyAxisMaxCount() > 0) {
for (int iLoop = 0; iLoop < getyAxisMaxCount(); iLoop++) {
SeriesDataSet objDS = new SeriesDataSet(Integer.toString(iLoop), "", "");
getSeries().add(objDS);
}
} else {
LOGGER.severe("Chart created with no series defined and no count defined for yAxis");
return false;
}
}
_CreateChart();
ConfigureDimentions();
ConfigureAlignment();
SetupPeekaboo(dataMgr);
pane.add(getChart(), getColumn(), getRow(), getColumnSpan(), getRowSpan());
// hmm, only get called if different, that could be a problem for a chart
dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener() {
@Override
@SuppressWarnings("unchecked")
public void changed(ObservableValue o, Object oldVal, Object newVal) {
if (IsPaused()) {
return;
}
String[] strList = newVal.toString().split(",");
int iIndex = 0;
for (String strValue : strList) {
double newValue;
try {
newValue = Double.parseDouble(strValue);
} catch (NumberFormatException ex) {
LOGGER.severe("Invalid data for Line Chart received: " + strValue);
return;
}
if (iIndex < getSeries().size()) {
SeriesDataSet ds = getSeries().get(iIndex++);
ShiftSeries(ds.getSeries(), getxAxisMaxCount());
ds.getSeries().getData().add(new XYChart.Data<>(ds.getSeries().getData().size(), newValue));
} else {
LOGGER.severe("Received More datapoints for Line Chart than was defined in application definition file. Received " + Integer.toString(strList.length) + " expecting " + Integer.toString(getSeries().size()));
return;
}
}
}
});
SetupTaskAction();
return ApplyCSS();
}
use of kutch.biff.marvin.utility.SeriesDataSet in project Board-Instrumentation-Framework by intel.
the class LineChartWidget method HandleWidgetSpecificSettings.
/**
* @param node
* @return
*/
@Override
public boolean HandleWidgetSpecificSettings(FrameworkNode node) {
if (true == HandleChartSpecificAppSettings(node)) {
return true;
}
if (node.getNodeName().equalsIgnoreCase("Series")) {
String Label;
if (node.hasAttribute("Label")) {
Label = node.getAttribute("Label");
} else {
Label = "";
}
SeriesDataSet objDS = new SeriesDataSet(Label, "", "");
getSeries().add(objDS);
return true;
}
return false;
}
Aggregations