vendredi 27 octobre 2017

How to apply based on condition check in reactjs?

RepresentationType: Table RepresentationType: Chart For both the C3 charts and Table I will be getting (temp.chartDataSo.chartLibraryType == 'C3') chartLibraryType as c3 only.

else if (temp.chartDataSo && (temp.chartDataSo.chartLibraryType == 'C3')){
        result.chartLib = 'C3';
        result.columns = temp.columns || [];
        result.axis = temp.axis || {};
    }else if (temp.chartDataSo && (temp.chartDataSo.chartLibraryType == 'D3')){
        result.chartLib = 'D3';
        result.x = temp.x;
        result.chartType =  temp.chartType.toLowerCase() || '';
        result.y = temp.y || [];
        result.title = temp.chartName;
        result.chartData = temp.chartData || [];
    }
    return result;

In the below logic i need to insert if else logic based on representation Type

else if (temp.chartDataSo && (temp.chartDataSo.chartLibraryType == 'C3')){
    result.chartLib = 'C3';
    result.columns = temp.columns || [];
    result.axis = temp.axis || {};
}

I need to check the temp.chartDataSo.representationType as shown in screenshot

If the representationType is chart then i need to load

            result.chartLib = 'C3';
           result.columns = temp.columns || [];
           result.axis = temp.axis || {};

If the representationType is Table then i need to load

           result.chartLib = 'Table';
           result.columns = temp.columns || [];

Aucun commentaire:

Enregistrer un commentaire