Search in sources :

Example 6 with CustomerDefaultCategoryDataset

use of org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset in project tdq-studio-se by Talend.

the class TextStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    // sort these indicators.
    ComparatorsFactory.sort(units, ComparatorsFactory.TEXT_STATISTICS_COMPARATOR_ID);
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        String value = CommonStateUtil.getUnitValue(unit.getValue(), StringFormatUtil.DOUBLE_NUMBER);
        String label = unit.getIndicatorName();
        customerdataset.addValue(Double.parseDouble(value), label, label);
        ChartDataEntity entity = CommonStateUtil.createDataEntity(unit, value, label);
        customerdataset.addDataEntity(entity);
    }
    return customerdataset;
}
Also used : IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Example 7 with CustomerDefaultCategoryDataset

use of org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset in project tdq-studio-se by Talend.

the class FrequencyTypeStates method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    boolean withRowCountIndicator = isWithRowCountIndicator();
    for (IndicatorUnit unit : units) {
        if (unit.isExcuted() && !this.isSupportDynamicChart) {
            FrequencyExt[] frequencyExt = (FrequencyExt[]) unit.getValue();
            sortIndicator(frequencyExt);
            int numOfShown = FrequencyTypeStateUtil.getNumberOfShown(unit, frequencyExt);
            for (int i = 0; i < numOfShown; i++) {
                FrequencyExt freqExt = frequencyExt[i];
                String keyLabel = FrequencyTypeStateUtil.getKeyLabel(freqExt, 200);
                setValueToDataset(customerdataset, freqExt, keyLabel);
                ChartDataEntity entity = FrequencyTypeStateUtil.createChartEntity(unit.getIndicator(), freqExt, keyLabel, withRowCountIndicator);
                customerdataset.addDataEntity(entity);
            }
        } else {
            ChartDataEntity entity = FrequencyTypeStateUtil.createChartEntity(unit.getIndicator(), null, SpecialValueDisplay.EMPTY_FIELD, false);
            FrequencyExt fre = new FrequencyExt();
            fre.setValue(0l);
            fre.setFrequency(0d);
            setValueToDataset(customerdataset, fre, unit.getIndicatorName());
            customerdataset.addDataEntity(entity);
        }
    }
    return customerdataset;
}
Also used : IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) FrequencyExt(org.talend.dq.indicators.ext.FrequencyExt)

Example 8 with CustomerDefaultCategoryDataset

use of org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset in project tdq-studio-se by Talend.

the class WhereRuleStatisticsStateTable method getCustomerDatasetRownCount.

/**
 * DOC xqliu Comment method "getCustomerDatasetRownCount".
 *
 * @return
 */
public ICustomerDataset getCustomerDatasetRownCount() {
    CustomerDefaultCategoryDataset customerDataset = new CustomerDefaultCategoryDataset();
    TableIndicatorUnit rownCountUnit = getRownCountUnit(units);
    if (rownCountUnit != null) {
        addRownCountDataEntity2CustomerDataset(customerDataset, rownCountUnit);
    }
    return customerDataset;
}
Also used : TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Example 9 with CustomerDefaultCategoryDataset

use of org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset in project tdq-studio-se by Talend.

the class PatternStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        String label = unit.getIndicator().getName();
        PatternMatchingExt patternExt = PatternStatisticeStateUtil.getUnitValue(unit.getIndicator(), unit.getValue());
        String notMathCount = PatternStatisticeStateUtil.getNotMatchCount(patternExt);
        String machCount = PatternStatisticeStateUtil.getMatchCount(patternExt);
        customerdataset.addValue(Double.parseDouble(notMathCount), DefaultMessagesImpl.getString("PatternStatisticsState.NotMatching"), // $NON-NLS-1$
        label);
        customerdataset.addValue(Double.parseDouble(machCount), DefaultMessagesImpl.getString("PatternStatisticsState.Matching"), // $NON-NLS-1$
        label);
        PatternChartDataEntity patternEntity = PatternStatisticeStateUtil.createDataEntity(unit, label, notMathCount, machCount);
        customerdataset.addDataEntity(patternEntity);
    }
    return customerdataset;
}
Also used : PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Example 10 with CustomerDefaultCategoryDataset

use of org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset 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);
            }
        }
    }
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) ArrayList(java.util.ArrayList) List(java.util.List) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) FrequencyExt(org.talend.dq.indicators.ext.FrequencyExt) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) ICustomerDataset(org.talend.dataprofiler.common.ui.editor.preview.ICustomerDataset)

Aggregations

CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)20 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)12 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)10 FrequencyExt (org.talend.dq.indicators.ext.FrequencyExt)5 PatternChartDataEntity (org.talend.dq.indicators.preview.table.PatternChartDataEntity)4 TableIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)3 ArrayList (java.util.ArrayList)2 ColumnDependencyExplorer (org.talend.dq.analysis.explore.ColumnDependencyExplorer)2 HashMap (java.util.HashMap)1 List (java.util.List)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 GridData (org.eclipse.swt.layout.GridData)1 Table (org.eclipse.swt.widgets.Table)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 TableItem (org.eclipse.swt.widgets.TableItem)1 Test (org.junit.Test)1 ICustomerDataset (org.talend.dataprofiler.common.ui.editor.preview.ICustomerDataset)1 TableWithData (org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData)1 CustomerDefaultBAWDataset (org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset)1 TableStructureEntity (org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity)1