You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/06/09 11:19:05 UTC
[GitHub] [superset] bonedi opened a new issue, #20332: BigNumberLine: Add difference to compare lag
bonedi opened a new issue, #20332:
URL: https://github.com/apache/superset/issues/20332
The Compare Lag of BigNumberLine Chart is calculating the percentage change. In some cases a difference is desired. For example if the number is an percantage allready. So it would be great if you can choose between percentage change and absolute change.
Currently the code for calulating the change is:
``` if (compareLag > 0) {
const compareIndex = compareLag;
if (compareIndex < sortedData.length) {
const compareValue = sortedData[compareIndex][1];
// compare values must both be non-nulls
if (bigNumber !== null && compareValue !== null && compareValue !== 0) {
percentChange = (bigNumber - compareValue) / Math.abs(compareValue);
formattedSubheader = `${formatPercentChange(
percentChange,
)} ${compareSuffix}`;
}
}
}
```
One way to change it, would be to create a radio button with value percentChangeDesired (=True or False). Then the Code would change to:
``` if (compareLag > 0) {
const compareIndex = compareLag;
if (compareIndex < sortedData.length) {
const compareValue = sortedData[compareIndex][1];
// compare values must both be non-nulls
if (bigNumber !== null && compareValue !== null && compareValue !== 0) {
if (percentChangeDesired){
percentChange = (bigNumber - compareValue) / Math.abs(compareValue);
formattedSubheader = `${formatPercentChange(
percentChange,
)} ${compareSuffix}`;
}
else {
absoluteChange = bigNumber - compareValue;
formattedSubheader = `${absoluteChange} ${compareSuffix}`;
}
}
}
}
```
I have no experiance in TypeScript, so the code won't work 100% for sure. But I think you get an Idea of what I was thinking of.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] rusackas commented on issue #20332: BigNumberLine: Add difference to compare lag
Posted by GitBox <gi...@apache.org>.
rusackas commented on issue #20332:
URL: https://github.com/apache/superset/issues/20332#issuecomment-1153423002
Since this is more feature request than bug report, I'll go ahead and move this over to a Discussion. I'm curious if @zhaoyongjie has feelings about this idea.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] rusackas closed issue #20332: BigNumberLine: Add difference to compare lag
Posted by GitBox <gi...@apache.org>.
rusackas closed issue #20332: BigNumberLine: Add difference to compare lag
URL: https://github.com/apache/superset/issues/20332
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org