use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class CommonStateUtil method createDataEntity.
/**
* create the data entity
*
* @param unit
* @param value: String type: maybe Double or integer
* @param label
* @return
*/
public static ChartDataEntity createDataEntity(IndicatorUnit unit, String value, String label) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(label);
entity.setValue(value);
entity.setPercent(Double.valueOf(value) / unit.getIndicator().getCount());
return entity;
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class CommonStateUtil method getDataEntity.
public static ChartDataEntity[] getDataEntity(List<IndicatorUnit> units, int style) {
List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
for (IndicatorUnit unit : units) {
String value = getUnitValue(unit.getValue(), style);
ChartDataEntity entity = createDataEntity(unit, value, unit.getIndicatorName());
dataEnities.add(entity);
}
return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class PieStatisticsStateUtil method createDataEntity.
/**
* DOC yyin Comment method "createDataEntity".
*
* @param unit
* @param freqExt
* @param keyLabel
* @return
*/
public static ChartDataEntity createDataEntity(IndicatorUnit unit, FrequencyExt freqExt, String keyLabel) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setKey(freqExt.getKey());
entity.setLabelNull(freqExt.getKey() == null);
entity.setLabel(keyLabel);
entity.setValue(String.valueOf(freqExt.getValue()));
Double percent = freqExt.getFrequency();
entity.setPercent(percent);
return entity;
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class SummaryStatisticsStateUtil method createDataEntity.
/**
* DOC yyin Comment method "createDataEntity".
*
* @param unit
* @param value
* @return
*/
public ChartDataEntity createDataEntity(IndicatorUnit unit, String value) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(unit.getIndicatorName());
entity.setValue(value);
return entity;
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class DynamicChartEventReceiver method refreshTable.
public void refreshTable(String value) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
if (dataEntities != null && dataEntities.length > entityIndex) {
dataEntities[entityIndex].setValue(value);
dataEntities[entityIndex].setPercent(Double.NaN);
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
Aggregations