Skip to content

Commit

Permalink
Make decay chart arrows/lines opacity dynamic, when br is less than 0…
Browse files Browse the repository at this point in the history
….001.

As suggested in issue #40.
  • Loading branch information
wcjohns committed Feb 7, 2025
1 parent c2e3b13 commit d41974c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions InterSpec_resources/DecayChainChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,19 @@ DecayChainChart.prototype.redraw = function() {
return 0;
return (d.parent===self.selectedNuclide ? 1.35 : 1)*strokew;
} )
.attr("stroke-opacity", function(d){
if( (d.parent!==self.selectedNuclide) && (d.br <= 1.0E-5) )
return 0.35;
.attr("opacity", function(d){
//If less than `start_opacity_br`, reduce opacity to kinda indicate its a weak B.R.
const start_opacity_br = 1.0E-3, end_opacity_br = 1.0E-13;
if( (d.parent !== self.selectedNuclide) && (d.br <= start_opacity_br) )
{
const min_opacity = 0.2, max_opacity = 0.9; //limits of opacity; anything less than `end_opacity_br`, we'll use min opacity
const log_start_opacity_br = -Math.log10(start_opacity_br), log_end_opacity_br = -Math.log10(end_opacity_br); // We'll scale opacity on log scale
const magnitude = -Math.log10(d.br);
const frac = (magnitude - log_start_opacity_br) / (log_end_opacity_br - log_start_opacity_br);
const opacity = max_opacity - frac*(max_opacity - min_opacity);

return Math.max( min_opacity, opacity );
}
return 1;
})
;
Expand Down

0 comments on commit d41974c

Please sign in to comment.