This repository has been archived by the owner on Feb 3, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
2,102 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2020-05-29T10:20:37Z | ||
2020-05-29T15:38:38Z |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
const data = window.__data || {}; | ||
const dataKeys = Object.keys(data); | ||
const categories = dataKeys || []; | ||
const deviceMap = { desktop: 'd', mobile: 'm' }; | ||
const columns = ['tokopedia', 'lazada', 'shopee', 'bukalapak', 'blibli', 'jd', 'blanja']; | ||
const colors = ['#03AC0E', '#00ffff', '#fc5930', '#d71149', '#0095da', '#b67fd6', '#ef8888']; | ||
|
||
const getData = function(date, col) { | ||
return data[date].find(function(i) { | ||
return i.n === col; | ||
}); | ||
}; | ||
|
||
const getSeries = device => { | ||
const res = []; | ||
columns.forEach(col => { | ||
const dataSeries = []; | ||
categories.forEach(date => { | ||
const d = getData(date, col); | ||
if (d) { | ||
dataSeries.push(d[deviceMap[device]].r.perf); | ||
} | ||
}); | ||
res.push({ | ||
name: col, | ||
data: dataSeries, | ||
}); | ||
}); | ||
return res; | ||
}; | ||
|
||
const optionsChartLine = (title, device) => ({ | ||
title: { | ||
text: title, | ||
align: 'center', | ||
margin: 10, | ||
offsetX: 0, | ||
offsetY: 0, | ||
floating: false, | ||
style: { | ||
fontSize: '14px', | ||
fontWeight: 'bold', | ||
color: '#263238', | ||
}, | ||
}, | ||
chart: { | ||
height: 350, | ||
type: 'line', | ||
}, | ||
dataLabels: { | ||
enabled: false, | ||
}, | ||
stroke: { | ||
curve: 'smooth', | ||
}, | ||
colors, | ||
series: getSeries(device), | ||
legend: { | ||
labels: { | ||
colors: '#333', | ||
}, | ||
}, | ||
xaxis: { | ||
type: 'category', | ||
categories, | ||
labels: { | ||
style: { | ||
colors: '#333', | ||
}, | ||
}, | ||
}, | ||
yaxis: { | ||
show: true, | ||
labels: { | ||
show: true, | ||
style: { | ||
colors: ['#333'], | ||
}, | ||
}, | ||
crosshairs: { | ||
show: true, | ||
position: 'back', | ||
stroke: { | ||
color: '#333', | ||
width: 1, | ||
dashArray: 0, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
new ApexCharts(document.querySelector('#chartDesktop'), optionsChartLine('Perf Score Desktop', 'desktop')).render(); | ||
new ApexCharts(document.querySelector('#chartMobile'), optionsChartLine('Perf Score Mobile', 'mobile')).render(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters