use of org.netxms.ui.android.main.activities.helpers.ChartDciConfig in project netxms by netxms.
the class PieChartElement method buildDataset.
/**
* @return
*/
private CategorySeries buildDataset() {
CategorySeries series = new CategorySeries(config.getTitle());
ChartDciConfig[] items = config.getDciList();
for (int i = 0; i < items.length; i++) {
series.add(items[i].getName(), 0);
}
return series;
}
use of org.netxms.ui.android.main.activities.helpers.ChartDciConfig in project netxms by netxms.
the class PieChartElement method buildRenderer.
/**
* @return
*/
private DefaultRenderer buildRenderer() {
DefaultRenderer renderer = new DefaultRenderer();
renderer.setLabelsTextSize(15);
renderer.setLegendTextSize(15);
renderer.setShowLegend(config.isShowLegend());
renderer.setMargins(new int[] { 20, 30, 15, 0 });
renderer.setPanEnabled(false);
renderer.setZoomEnabled(false);
renderer.setAntialiasing(true);
renderer.setChartTitle(config.getTitle());
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Colors.BACKGROUND_COLOR);
renderer.setAxesColor(Colors.LABEL_COLOR);
renderer.setLabelsColor(Colors.LABEL_COLOR);
ChartDciConfig[] items = config.getDciList();
for (int i = 0; i < items.length && i < Colors.DEFAULT_ITEM_COLORS.length; i++) {
XYSeriesRenderer r = new XYSeriesRenderer();
int color = items[i].getColorAsInt();
if (color == -1)
color = Colors.DEFAULT_ITEM_COLORS[i];
else
color = swapRGB(color);
r.setColor(color | 0xFF000000);
renderer.addSeriesRenderer(r);
// r.setDisplayChartValues(true);
}
return renderer;
}
use of org.netxms.ui.android.main.activities.helpers.ChartDciConfig in project netxms by netxms.
the class PieChartElement method refresh.
/* (non-Javadoc)
* @see org.netxms.ui.android.main.dashboards.elements.AbstractDashboardElement#refresh()
*/
@Override
public void refresh() {
final ChartDciConfig[] items = config.getDciList();
if (items.length == 0)
return;
try {
final DciData[] dciData = new DciData[items.length];
for (int i = 0; i < dciData.length; i++) {
dciData[i] = new DciData(0, 0);
dciData[i] = service.getSession().getCollectedData(items[i].nodeId, items[i].dciId, null, null, 1);
}
post(new Runnable() {
@Override
public void run() {
for (int i = 0; i < dciData.length; i++) {
dataset.set(i, items[i].getName(), dciData[i].getLastValue().getValueAsDouble());
}
chartView.repaint();
}
});
} catch (Exception e) {
Log.e(TAG, "Exception while reading data from server", e);
}
}
use of org.netxms.ui.android.main.activities.helpers.ChartDciConfig in project netxms by netxms.
the class BarChartElement method refresh.
/* (non-Javadoc)
* @see org.netxms.ui.android.main.dashboards.elements.AbstractDashboardElement#refresh()
*/
@Override
public void refresh() {
final ChartDciConfig[] items = config.getDciList();
if (items.length == 0)
return;
try {
final DciData[] dciData = new DciData[items.length];
for (int i = 0; i < dciData.length; i++) {
dciData[i] = new DciData(0, 0);
dciData[i] = service.getSession().getCollectedData(items[i].nodeId, items[i].dciId, null, null, 1);
}
post(new Runnable() {
@Override
public void run() {
XYMultipleSeriesDataset dataset = chart.getDataset();
for (int i = 0; i < dciData.length; i++) {
dataset.removeSeries(i);
XYSeries series = new XYSeries(items[i].getName());
for (int j = 0; j < items.length; j++) {
series.add(j + 1, (i == j) ? dciData[i].getLastValue().getValueAsDouble() : 0);
}
dataset.addSeries(i, series);
}
chartView.repaint();
}
});
} catch (Exception e) {
Log.e(TAG, "Exception while reading data from server", e);
}
}
use of org.netxms.ui.android.main.activities.helpers.ChartDciConfig in project netxms by netxms.
the class BarChartElement method buildDataset.
/**
* @return
*/
private XYMultipleSeriesDataset buildDataset() {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
ChartDciConfig[] items = config.getDciList();
for (int i = 0; i < items.length; i++) {
XYSeries series = new XYSeries(items[i].getName());
for (int j = 0; j < items.length; j++) {
series.add(j + 1, 0);
}
dataset.addSeries(series);
}
return dataset;
}
Aggregations