use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class DateFrequencyStateUtil method createDataEntity.
public static ChartDataEntity createDataEntity(IndicatorUnit unit, FrequencyExt freqExt, String keyLabel) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setKey(freqExt == null ? null : freqExt.getKey());
entity.setLabelNull(freqExt == null || freqExt.getKey() == null);
entity.setLabel(keyLabel);
entity.setValue(String.valueOf(freqExt == null ? StringUtils.EMPTY : freqExt.getValue()));
if (freqExt == null) {
entity.setPercent(0.0);
} else {
entity.setPercent(freqExt.getFrequency());
}
return entity;
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class DateFrequencyStateUtil method getDataEntity.
public static ChartDataEntity[] getDataEntity(List<IndicatorUnit> units, int sortType) {
List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
for (IndicatorUnit unit : units) {
if (unit.isExcuted()) {
FrequencyExt[] frequencyExt = (FrequencyExt[]) unit.getValue();
ComparatorsFactory.sort(frequencyExt, sortType);
int numOfShown = FrequencyTypeStateUtil.getNumberOfShown(unit, frequencyExt);
for (int i = 0; i < numOfShown; i++) {
FrequencyExt freqExt = frequencyExt[i];
String keyLabel = FrequencyTypeStateUtil.getKeyLabel(freqExt, 30);
dataEnities.add(DateFrequencyStateUtil.createDataEntity(unit, freqExt, keyLabel));
}
}
}
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 PatternStatisticsTableState method getDataEntity.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
*/
@Override
public ChartDataEntity[] getDataEntity() {
List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
for (IndicatorUnit unit : units) {
PatternMatchingExt patternExt = PatternStatisticeStateUtil.getUnitValue(unit.getIndicator(), unit.getValue());
String notMathCount = PatternStatisticeStateUtil.getNotMatchCount(patternExt);
String machCount = PatternStatisticeStateUtil.getMatchCount(patternExt);
PatternChartDataEntity patternEntity = PatternStatisticeStateUtil.createDataEntity(unit, unit.getIndicator().getName(), notMathCount, machCount);
dataEnities.add(patternEntity);
}
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 FrequencyDynamicChartEventReceiver method setFrequecyToDataset.
private void setFrequecyToDataset(Object customerdataset, FrequencyExt[] frequencyExt, Indicator indicator) {
int numOfShown = frequencyExt.length;
IndicatorParameters parameters = indicator.getParameters();
if (parameters != null) {
if (parameters.getTopN() < numOfShown) {
numOfShown = parameters.getTopN();
}
}
FrequencyExt[] tempFreq = handleFrequency(frequencyExt);
clearDataEntity(customerdataset);
boolean withRowCountIndicator = FrequencyTypeStateUtil.isWithRowCountIndicator(indicator);
// Added TDQ-12870
List columnKeys = TOPChartUtils.getInstance().getColumnKeys(customerdataset);
FrequencyExt freqE = tempFreq[0];
if (!columnKeys.contains(String.valueOf(freqE.getKey()))) {
// columnKeys.clear();
TOPChartUtils.getInstance().clearDataset(customerdataset);
ICustomerDataset customerDataset = TOPChartUtils.getInstance().getCustomerDataset(customerdataset);
if (customerDataset != null && customerDataset instanceof CustomerDefaultCategoryDataset) {
((CustomerDefaultCategoryDataset) customerDataset).clearAll();
}
}
for (int i = 0; i < numOfShown; i++) {
FrequencyExt freqExt = tempFreq[i];
String keyLabel = String.valueOf(freqExt.getKey());
if ("null".equals(keyLabel)) {
// $NON-NLS-1$
keyLabel = SpecialValueDisplay.NULL_FIELD;
}
if ("".equals(keyLabel)) {
// $NON-NLS-1$
keyLabel = SpecialValueDisplay.EMPTY_FIELD;
}
ChartDataEntity entity = FrequencyTypeStateUtil.createChartEntity(indicator, freqExt, keyLabel, withRowCountIndicator);
if (customerdataset instanceof CustomerDefaultCategoryDataset) {
((CustomerDefaultCategoryDataset) customerdataset).addDataEntity(entity);
addValueToDataset(((CustomerDefaultCategoryDataset) customerdataset).getDataset(), freqExt, keyLabel);
} else {
ICustomerDataset customerDataset = TOPChartUtils.getInstance().getCustomerDataset(customerdataset);
if (customerDataset != null && customerDataset instanceof CustomerDefaultCategoryDataset) {
customerDataset.addDataEntity(entity);
addValueToDataset(((CustomerDefaultCategoryDataset) customerDataset).getDataset(), freqExt, keyLabel);
}
}
}
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class PatternDynamicChartEventReceiver method refreshPatternTable.
private void refreshPatternTable(PatternMatchingExt matchExt) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
if (dataEntities != null && dataEntities.length > getIndexInDataset()) {
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumMatch(String.valueOf(matchExt.getMatchingValueCount()));
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumNoMatch(String.valueOf(matchExt.getNotMatchingValueCount()));
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
Aggregations