mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed up the full width bar and other bugs with Paid Mix for new Dashboard
refs: https://github.com/TryGhost/Team/issues/1531
This commit is contained in:
parent
47d6c17135
commit
f564943aa9
1 changed files with 13 additions and 23 deletions
|
@ -388,7 +388,7 @@ export default class PaidMix extends Component {
|
|||
|
||||
// this is for tiers...
|
||||
} else {
|
||||
let tierPercentages = [];
|
||||
if (!this.areTiersAllZero) {
|
||||
let data = this.dashboardStats.paidMembersByTier.map(stat => stat.members);
|
||||
let totalTiersAmount = 0;
|
||||
|
||||
|
@ -396,25 +396,15 @@ export default class PaidMix extends Component {
|
|||
totalTiersAmount += data[i];
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let tierPercentage = Math.round(data[i] / totalTiersAmount * 100);
|
||||
if (i === 0) {
|
||||
tierPercentage = -tierPercentage;
|
||||
}
|
||||
tierPercentages.push(tierPercentage);
|
||||
}
|
||||
|
||||
// sorting to ensure smallest to largest values in order always
|
||||
tierPercentages.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
let negativeTierPercentage = Math.round(data[0] / totalTiersAmount * 100);
|
||||
|
||||
ticksY = {
|
||||
display: false,
|
||||
min: tierPercentages[0],
|
||||
max: tierPercentages[tierPercentages.length - 1] // get the last (biggest) in array
|
||||
min: -negativeTierPercentage,
|
||||
max: 100 - negativeTierPercentage // take the negative away from 100 to create a full width bar
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
responsive: true,
|
||||
|
|
Loading…
Add table
Reference in a new issue