use of com.cubrid.cubridmanager.ui.monitoring.editor.count.Result in project cubrid-manager by CUBRID.
the class CombinedBarTimeSeriesChart method stuffedChart.
/**
* This method provides data from local fill for History chart showing
*
* @param file the instance of CounterFile, which includes data info
* @param types a array which includes one or more data type
* @param beginTime the begin time
* @param endTime the ending time
* @param maxType the type name representative of the proportion of the
* given types.
*/
private void stuffedChart(CounterFile file, List<String> types, long beginTime, long endTime, String maxType) {
List<String> fileTypes = new ArrayList<String>();
for (String type : types) {
fileTypes.add(type);
}
if (maxType != null) {
fileTypes.add(maxType);
}
long distance = endTime - beginTime;
// in milliseconds
int interval = file.getInterval() * 1000;
long quotient = distance / interval;
if (distance % interval != 0) {
quotient++;
}
int factor = (int) (quotient / SWITCH_VALUE);
if (quotient % SWITCH_VALUE != 0) {
factor++;
}
Result[] results = new Result[(int) (quotient / factor + 1L)];
int length = 0;
for (long time = beginTime; time < endTime; time += (interval * factor)) {
Result res;
try {
res = file.readData(time, fileTypes.toArray(new String[fileTypes.size()]));
results[length] = res;
for (String type : types) {
if (isAreaRender) {
double result = results[length].getAvgAsDouble(type);
timeTableXYCollection.add(new Second(new Date(time)), result, type);
} else {
double result = results[length].getAvgAsDouble(type);
seriesMap.get(type).addOrUpdate(new Second(new Date(time)), result);
if (maxType == null) {
if (barMax < result) {
barMax = result;
numberaxis.setRange(0 - 1, barMax + 1);
numberaxis.setVisible(isShowSeriesAxis);
}
} else {
double maxPercent = results[length].getAvgAsDouble(maxType);
double max = maxPercent <= 0 ? barMax : result / maxPercent * 10000;
if (barMax < max) {
barMax = max;
numberaxis.setRange(0 - 1, barMax + 1);
numberaxis.setVisible(isShowSeriesAxis);
}
}
}
}
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
}
length++;
}
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.count.Result in project cubrid-manager by CUBRID.
the class ChartCompositePart method stuffedChart.
/**
* This method provides data from local fill for History chart showing
*
* @param file the instance of CounterFile, which includes data info
* @param types a array which includes one or more data type
* @param beginTime the begin time
* @param endTime the ending time
*/
private void stuffedChart(CounterFile file, List<String> types, long beginTime, long endTime) {
List<String> fileTypes = new ArrayList<String>();
for (String type : types) {
fileTypes.add(type);
}
long distance = endTime - beginTime;
// in milliseconds
int interval = file.getInterval() * 1000;
long quotient = distance / interval;
if (distance % interval != 0) {
quotient++;
}
int factor = (int) (quotient / SWITCH_VALUE);
if (quotient % SWITCH_VALUE != 0) {
factor++;
}
Result[] results = new Result[(int) (quotient / factor + 1L)];
int length = 0;
for (long time = beginTime; time < endTime; time += (interval * factor)) {
Result res;
try {
res = file.readData(time, fileTypes.toArray(new String[fileTypes.size()]));
results[length] = res;
for (String type : types) {
double result = results[length].getAvgAsDouble(type);
if (result < 0) {
result = 0;
}
// if (result > 0) {
seriesMap.get(type).addOrUpdate(new Second(new Date(time)), result);
// }
}
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
}
length++;
}
}
Aggregations