Search in sources :

Example 41 with ChartDataEntity

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;
}
Also used : ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 42 with ChartDataEntity

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()]);
}
Also used : ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 43 with ChartDataEntity

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;
}
Also used : ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 44 with ChartDataEntity

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;
}
Also used : ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 45 with ChartDataEntity

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);
        }
    }
}
Also used : TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Aggregations

ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)61 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)17 ArrayList (java.util.ArrayList)16 Test (org.junit.Test)13 TdColumn (org.talend.cwm.relational.TdColumn)13 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)12 Analysis (org.talend.dataquality.analysis.Analysis)11 IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)10 TdTable (org.talend.cwm.relational.TdTable)9 TdExpression (org.talend.cwm.relational.TdExpression)8 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)8 FrequencyExt (org.talend.dq.indicators.ext.FrequencyExt)8 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)7 TableWithData (org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData)7 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)6 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)6 Expression (orgomg.cwm.objectmodel.core.Expression)6 Domain (org.talend.dataquality.domain.Domain)5 Pattern (org.talend.dataquality.domain.pattern.Pattern)5 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)5