jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/393927 )
Change subject: Fix labels on BE derivative charts, fix amt needed
......................................................................
Fix labels on BE derivative charts, fix amt needed
Change-Id: Ie565c0d440d3c8dbf5c1ff1efbcd4d6f21087e5a
---
M src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
M src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
M src/components/widgets/totals-earned-chart/totals-earned-chart.js
3 files changed, 11 insertions(+), 14 deletions(-)
Approvals:
XenoRyet: Looks good to me, approved
jenkins-bot: Verified
diff --git
a/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
b/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
index b9fcae0..a1bd3b6 100644
--- a/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
+++ b/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
@@ -42,8 +42,7 @@
if ( remainingNeeded < 0 ) {
remainingNeeded = 0;
}
- // FIXME: hardcoded 31 day campaign
- hoursLeft = ( 31 - d ) * 24 + ( 24 - h
);
+ hoursLeft = (
params.sharedContext.campaignLength - d ) * 24 + ( 24 - h );
xs[ index ] = index;
self.needPerSecond[ index ] = (
hoursLeft > 0 ) ?
( remainingNeeded / hoursLeft )
/ 3600
@@ -82,9 +81,9 @@
axis: {
x: {
tick: {
- count: 31,
+ count:
params.sharedContext.campaignLength,
format: function ( x ) {
- return 'Day ' +
( Math.floor( x / 24 ) + 1 );
+ return
params.sharedContext.getDay( Math.floor( x / 24 ) );
}
}
},
@@ -99,9 +98,9 @@
tooltip: {
format: {
title: function ( x ) {
- var day = Math.floor( x
/ 24 ) + 1,
+ var day =
params.sharedContext.getDay( Math.floor( x / 24 ) ),
hour = x % 24;
- return 'Day ' + day + '
' + hour + ':00 – ' + hour + ':59 UTC';
+ return day + ' ' + hour
+ ':00 – ' + hour + ':59 UTC';
}
}
}
diff --git
a/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
b/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
index 94ea10d..3fc3456 100644
--- a/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
+++ b/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
@@ -46,9 +46,7 @@
axis: {
x: {
tick: {
- format: function ( x ) {
- return 'Day ' +
( x + 1 );
- }
+ format:
params.sharedContext.getDay
}
},
y: {
diff --git a/src/components/widgets/totals-earned-chart/totals-earned-chart.js
b/src/components/widgets/totals-earned-chart/totals-earned-chart.js
index 8a12dbf..edb3276 100644
--- a/src/components/widgets/totals-earned-chart/totals-earned-chart.js
+++ b/src/components/widgets/totals-earned-chart/totals-earned-chart.js
@@ -22,7 +22,6 @@
var self = this,
timeFormat = 'dddd, MMMM Do YYYY, h:mm:ss a',
- getDay,
localUtcOffset = moment().utcOffset();
WidgetBase.call( this, params );
@@ -144,6 +143,7 @@
self.displayDate( moment( currentDate ).format(
timeFormat ) );
for ( d = 1; d < days + 1; d++ ) {
+ params.sharedContext.campaignLength = days;
params.sharedContext.dailyDataArray[ d ] = 0;
params.sharedContext.dailyCountArray[ d ] = 0;
if ( !params.sharedContext.dayObj[ d ] ) {
@@ -238,7 +238,7 @@
self.showChart( 'daily' );
};
- getDay = function ( dayNum ) {
+ params.sharedContext.getDay = function ( dayNum ) {
var result = moment( self.campaign().getStartDate() );
result.subtract( localUtcOffset, 'm' );
result.add( dayNum, 'd' );
@@ -285,7 +285,7 @@
axis: {
x: {
label: {
- text: getDay( d.x ),
+ text:
params.sharedContext.getDay( d.x ),
position: 'outer-left'
},
tick: {
@@ -358,7 +358,7 @@
axis: {
x: {
tick: {
- format: function ( x )
{ return getDay( x ); }
+ format:
params.sharedContext.getDay
}
},
y: {
@@ -375,7 +375,7 @@
},
tooltip: {
format: {
- title: function ( d ) { return
getDay( d ); },
+ title:
params.sharedContext.getDay,
value: function ( value, ratio,
id ) {
var display;
if ( id === 'Daily
Total' ) {
--
To view, visit https://gerrit.wikimedia.org/r/393927
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie565c0d440d3c8dbf5c1ff1efbcd4d6f21087e5a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/dash
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits