Search in sources :

Example 16 with CustomerDefaultCategoryDataset

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

the class PieStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        if (unit.isExcuted()) {
            FrequencyExt[] frequencyExt = (FrequencyExt[]) unit.getValue();
            int numOfShown = PieStatisticsStateUtil.getNumberOfShown(unit, frequencyExt);
            for (int i = 0; i < numOfShown; i++) {
                FrequencyExt freqExt = frequencyExt[i];
                String keyLabel = PieStatisticsStateUtil.getkeyLabel(freqExt);
                customerdataset.addValue(freqExt.getValue(), PluginConstant.EMPTY_STRING, keyLabel);
                ChartDataEntity entity = PieStatisticsStateUtil.createDataEntity(unit, freqExt, keyLabel);
                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 17 with CustomerDefaultCategoryDataset

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

the class SimpleStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        String value = CommonStateUtil.getUnitValue(unit.getValue(), 0);
        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 18 with CustomerDefaultCategoryDataset

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

the class SimpleTextStatisticsState method getCustomerDataset.

@Override
public ICustomerDataset getCustomerDataset() {
    // sort these indicators.
    ComparatorsFactory.sort(units, ComparatorsFactory.TEXT_STATISTICS_COMPARATOR_ID);
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        double value = unit.getValue() != null ? Double.parseDouble(unit.getValue().toString()) : Double.NaN;
        String label = unit.getIndicatorName();
        // $NON-NLS-1$
        String type = "";
        switch(unit.getType()) {
            case MinLengthWithNullIndicatorEnum:
            case MinLengthWithBlankIndicatorEnum:
            case MinLengthWithBlankNullIndicatorEnum:
                // $NON-NLS-1$
                type = "Minimal";
                break;
            case MaxLengthWithBlankIndicatorEnum:
            case MaxLengthWithBlankNullIndicatorEnum:
            case MaxLengthWithNullIndicatorEnum:
                // $NON-NLS-1$
                type = "Maximal";
                break;
            case AverageLengthWithNullIndicatorEnum:
            case AverageLengthWithBlankIndicatorEnum:
            case AverageLengthWithNullBlankIndicatorEnum:
                // $NON-NLS-1$
                type = "Average";
                break;
            default:
                type = label;
                break;
        }
        customerdataset.addValue(value, type, label);
        ChartDataEntity entity = new ChartDataEntity();
        entity.setIndicator(unit.getIndicator());
        entity.setLabel(label);
        entity.setValue(String.valueOf(value));
        entity.setPercent(value / unit.getIndicator().getCount());
        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 19 with CustomerDefaultCategoryDataset

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

the class SummaryStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    Map<IndicatorEnum, Double> map = new HashMap<IndicatorEnum, Double>();
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        // MOD xqliu 2009-06-29 bug 7068
        String value = null;
        if (indicators2ValueMap.containsKey(unit)) {
            value = indicators2ValueMap.get(unit);
        } else {
            value = summaryUtil.getUnitValue(unit);
        }
        if (Java2SqlType.isNumbericInSQL(sqltype)) {
            try {
                map.put(unit.getType(), Double.parseDouble(value));
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
        ChartDataEntity entity = summaryUtil.createDataEntity(unit, value);
        customerdataset.addDataEntity(entity);
    }
    if (isIntact() && !isSupportDynamicChart) {
        CustomerDefaultBAWDataset dataset = new CustomerDefaultBAWDataset(map.get(IndicatorEnum.MeanIndicatorEnum), map.get(IndicatorEnum.MedianIndicatorEnum), map.get(IndicatorEnum.LowerQuartileIndicatorEnum), map.get(IndicatorEnum.UpperQuartileIndicatorEnum), map.get(IndicatorEnum.MinValueIndicatorEnum), map.get(IndicatorEnum.MaxValueIndicatorEnum), customerdataset);
        dataset.addDataEntity(customerdataset.getDataEntities());
        return dataset;
    } else {
        // MOD hcheng,Range indicator value should not appear in bar chart
        if (!isIntact()) {
            map.remove(IndicatorEnum.RangeIndicatorEnum);
            map.remove(IndicatorEnum.IQRIndicatorEnum);
        }
        for (IndicatorEnum indicatorEnum : map.keySet()) {
            customerdataset.addValue(map.get(indicatorEnum), indicatorEnum.getLabel(), indicatorEnum.getLabel());
        }
        return customerdataset;
    }
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) HashMap(java.util.HashMap) 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) CustomerDefaultBAWDataset(org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset)

Example 20 with CustomerDefaultCategoryDataset

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

the class WhereRuleStatisticsStateTable method getOptimizeShowDataset.

/**
 * DOC xqliu Comment method "getOptimizeShowDataset". ADD xqliu 2010-03-10 feature 10834
 *
 * @return
 */
private List<Object> getOptimizeShowDataset() {
    List<Object> result = new ArrayList<Object>();
    // get the page size
    int size = getSizeOfDQRulePerChart();
    // Add RowCountIndicator dataset
    CustomerDefaultCategoryDataset customerDatasetRownCount = new CustomerDefaultCategoryDataset();
    // MOD msjian TDQ-5119: fix a NPE
    if (units != null && units.size() > 0) {
        addRownCountDataEntity2CustomerDataset(customerDatasetRownCount, getRownCountUnit(units));
        result.add(customerDatasetRownCount);
        // MOD xqliu 2012-04-23 TDQ-5057: don't include RowCountUnit
        List<TableIndicatorUnit> whereRuleUnits = removeRowCountUnit(units);
        int totalNum = whereRuleUnits.size();
        int pageNum = totalNum % size == 0 ? totalNum / size : totalNum / size + 1;
        for (int i = 0; i < pageNum; i++) {
            CustomerDefaultCategoryDataset customerDataset = new CustomerDefaultCategoryDataset();
            for (int j = 0; j < size; ++j) {
                int index = i * size + j;
                if (index < totalNum) {
                    addDataEntity2CustomerDataset(customerDataset, whereRuleUnits.get(index));
                } else {
                    break;
                }
            }
            result.add(customerDataset);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

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