MCPcopy Create free account
hub / github.com/codecombat/codecombat / addRevenueChartLine

Method addRevenueChartLine

app/views/admin/AnalyticsView.js:1411–1444  ·  view source on GitHub ↗
(days, eventPrefix, lines)

Source from the content-addressed store, hash-verified

1409 }
1410
1411 const addRevenueChartLine = (days, eventPrefix, lines) => {
1412 let colorIndex = 0
1413 let dailyMax = 0
1414 return (() => {
1415 const result = []
1416 for (const group in groupDayMap) {
1417 const entries = groupDayMap[group]
1418 if (!(group.indexOf(eventPrefix) >= 0)) { continue }
1419 const data = []
1420 for (const day in entries) {
1421 count = entries[day]
1422 data.push({
1423 day,
1424 value: count / 100
1425 })
1426 }
1427 data.reverse()
1428 const points = this.createLineChartPoints(days, data)
1429 lines.push({
1430 points,
1431 description: group.replace(eventPrefix + ' ', 'Daily '),
1432 lineColor: this.lineColors[colorIndex++ % this.lineColors.length],
1433 strokeWidth: 1,
1434 min: 0,
1435 max: _.max(points, 'y').y,
1436 showYScale: group === (eventPrefix + ' Total')
1437 })
1438 if (group === (eventPrefix + ' Total')) { dailyMax = _.max(points, 'y').y }
1439 result.push(Array.from(lines).map((line) =>
1440 (line.max = dailyMax)))
1441 }
1442 return result
1443 })()
1444 }
1445
1446 addRevenueChartLine(d3Utils.createContiguousDays(90), 'DRR', this.revenueDailyChartLines90Days)
1447 addRevenueChartLine(d3Utils.createContiguousDays(90), 'MRR', this.revenueMonthlyChartLines90Days)

Callers

nothing calls this directly

Calls 1

createLineChartPointsMethod · 0.95

Tested by

no test coverage detected