I need to concat two values to pass them as argument on the Y axis value of my plot. I was able to concat them but when I pass it to my 'y' value it doesn't work. What I'm doing wrong? This code work:
switch (statement) {
//CashFlow
case 'changeInOperatingLiabilities':
return (
<Fragment><Plot data={[{type: 'bar', x: financialItem.fiscalDateEndingValues, y: financialItem.changeInOperatingLiabilitiesValues},]}
layout={{width: 900, height: 640, title: financialItemName}} options ={ {displaylogo: 'false'} }/></Fragment>
);
This code doesn't work:
switch (statement) {
//CashFlow
case 'changeInOperatingLiabilities':
return (
<Fragment><Plot data={[{type: 'bar', x: financialItem.fiscalDateEndingValues, y:''.concat('financialItem.',statement,'Values')},]}
layout={{width: 900, height: 640, title: financialItemName}} options ={ {displaylogo: 'false'} }/></Fragment>
);
console.log(''.concat('financialItem.',statement,'Values')) returns exactly what I expected:
financialItem.changeInOperatingLiabilitiesValues
I'm trying to do this because my switch is getting too long. Thanks very much for helping