0

Im using react type script for viser chart, colour is not undefind any solution for this

Type '"#e21c1a"' is not assignable to type 'undefined'.

code part

const eachView = function (view:any, facet:any) {
        var data = facet.data;
        var color = void 0;
        if (data[0].type === 'PolicyIssued') {

            color = '#e21c1a';
        }
        data.push({
            type: 'Customer',
            value: 100 - data[0].value
        });
        view.source(data);
        view.coord('theta', {
            radius: 0.8,
            innerRadius: 0.5
        });
        view.intervalStack().position('value').color('type', [color, '#eceef1']).opacity(1);
        view.guide().html({
            position: ['50%', '50%'],
            html: '<div class="g2s-guide-html" ><p class="title" style=" font-size: 12px;\n' +
                '    color: #8c8c8c;\n' +
                '    text-align: center;\n' +
                '    font-weight: 300;" >' + data[0].type + '</p><p class="value" style=" font-size: 18px;\n' +
                '    text-align: center;\n' +
                '    color: #000;\n' +
                '    font-weight: bold;">' + (data[0].value + '%') + '</p></div>'
        });
    }
core114
  • 5,155
  • 16
  • 92
  • 189

1 Answers1

0

I found the solution i replaced var color = void 0; to var color = '#e21c1a';

core114
  • 5,155
  • 16
  • 92
  • 189