mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added net line to paid breakdown graph
refs https://github.com/TryGhost/Team/issues/1522
This commit is contained in:
parent
0bfc402090
commit
2cbe7b763e
1 changed files with 24 additions and 7 deletions
|
@ -171,14 +171,31 @@ export default class Anchor extends Component {
|
||||||
let returnable = {};
|
let returnable = {};
|
||||||
|
|
||||||
if (this.chartDisplay === 'paid-breakdown') {
|
if (this.chartDisplay === 'paid-breakdown') {
|
||||||
let stats = this.dashboardStats.filledMemberCountStats;
|
const stats = this.dashboardStats.filledMemberCountStats;
|
||||||
let labels = stats.map(stat => stat.date);
|
const labels = stats.map(stat => stat.date);
|
||||||
let newData = stats.map(stat => stat.paidSubscribed);
|
const newData = stats.map(stat => stat.paidSubscribed);
|
||||||
let canceledData = stats.map(stat => -stat.paidCanceled);
|
const canceledData = stats.map(stat => -stat.paidCanceled);
|
||||||
|
const netData = stats.map(stat => stat.paidSubscribed - stat.paidCanceled);
|
||||||
|
|
||||||
returnable = {
|
return {
|
||||||
labels: labels,
|
labels: labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
|
{
|
||||||
|
type: 'line',
|
||||||
|
data: netData,
|
||||||
|
tension: 0,
|
||||||
|
cubicInterpolationMode: 'monotone',
|
||||||
|
fill: false,
|
||||||
|
pointRadius: 0,
|
||||||
|
pointHitRadius: 10,
|
||||||
|
pointBorderColor: '#14B8FF',
|
||||||
|
pointBackgroundColor: '#14B8FF',
|
||||||
|
pointHoverBackgroundColor: '#14B8FF',
|
||||||
|
pointHoverBorderColor: '#14B8FF',
|
||||||
|
pointHoverRadius: 0,
|
||||||
|
borderColor: '#14B8FF',
|
||||||
|
borderJoinStyle: 'miter'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
data: newData,
|
data: newData,
|
||||||
fill: false,
|
fill: false,
|
||||||
|
@ -355,7 +372,7 @@ export default class Anchor extends Component {
|
||||||
zeroLineBorderDash: [4,4]
|
zeroLineBorderDash: [4,4]
|
||||||
},
|
},
|
||||||
ticks: {
|
ticks: {
|
||||||
display: false,
|
padding: 20,
|
||||||
callback: function (value, index, values) {
|
callback: function (value, index, values) {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
document.getElementById('gh-dashboard5-anchor-date-start').innerHTML = moment(value).format(DATE_FORMAT);
|
document.getElementById('gh-dashboard5-anchor-date-start').innerHTML = moment(value).format(DATE_FORMAT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue