fix purple pie chart with single pool
This commit is contained in:
parent
cb49f9d929
commit
c1d17dac43
@ -76,15 +76,21 @@ export class ActiveAccelerationBox implements OnChanges {
|
|||||||
acceleratingPools.forEach((poolId, index) => {
|
acceleratingPools.forEach((poolId, index) => {
|
||||||
const pool = pools[poolId];
|
const pool = pools[poolId];
|
||||||
const poolShare = ((pool.lastEstimatedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1);
|
const poolShare = ((pool.lastEstimatedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1);
|
||||||
|
let color = 'white';
|
||||||
|
if (index >= firstSignificantPool) {
|
||||||
|
if (numSignificantPools > 1) {
|
||||||
|
color = toRGB(lighten({ r: 147, g: 57, b: 244 }, 1 - (index - firstSignificantPool) / Math.max((numSignificantPools - 1), 1)));
|
||||||
|
} else {
|
||||||
|
color = toRGB({ r: 147, g: 57, b: 244 });
|
||||||
|
}
|
||||||
|
}
|
||||||
data.push(getDataItem(
|
data.push(getDataItem(
|
||||||
pool.lastEstimatedHashrate,
|
pool.lastEstimatedHashrate,
|
||||||
index >= firstSignificantPool
|
color,
|
||||||
? toRGB(lighten({ r: 147, g: 57, b: 244 }, 1 - (index - firstSignificantPool) / (numSignificantPools - 1)))
|
|
||||||
: 'white',
|
|
||||||
`<b style="color: white">${pool.name} (${poolShare}%)</b>`,
|
`<b style="color: white">${pool.name} (${poolShare}%)</b>`,
|
||||||
true,
|
true,
|
||||||
) as PieSeriesOption);
|
) as PieSeriesOption);
|
||||||
})
|
});
|
||||||
this.acceleratedByPercentage = ((totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1) + '%';
|
this.acceleratedByPercentage = ((totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1) + '%';
|
||||||
const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%';
|
const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%';
|
||||||
data.push(getDataItem(
|
data.push(getDataItem(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user