FEATURE: adds a new chart report to track pageviews (#6913)

This commit is contained in:
Joffrey JAFFEUX
2019-01-21 15:17:04 +01:00
committed by GitHub
parent 52f2e0d6b9
commit b95165b838
11 changed files with 283 additions and 16 deletions

View File

@ -34,6 +34,7 @@ function collapseWeekly(data, average) {
bucket = bucket || { x: data[i].x, y: 0 };
bucket.y += data[i].y;
}
return aggregate;
}
@ -389,7 +390,19 @@ export default Ember.Component.extend({
_loadReport(jsonReport) {
Report.fillMissingDates(jsonReport, { filledField: "chartData" });
if (jsonReport.chartData && jsonReport.chartData.length > 40) {
if (jsonReport.chartData && jsonReport.modes[0] === "stacked_chart") {
jsonReport.chartData = jsonReport.chartData.map(chartData => {
if (chartData.length > 40) {
return {
data: collapseWeekly(chartData.data),
req: chartData.req,
color: chartData.color
};
} else {
return chartData;
}
});
} else if (jsonReport.chartData && jsonReport.chartData.length > 40) {
jsonReport.chartData = collapseWeekly(
jsonReport.chartData,
jsonReport.average