Created
December 2, 2016 04:42
-
-
Save DragorWW/1ab2ff8e67fe7891f83ab695195f0993 to your computer and use it in GitHub Desktop.
highstock highlight weekend
This file contains hidden or 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
| /** | |
| * xAxis: { | |
| * plotBands: getPlotBandsWeekends([<timestamp>, ...]) | |
| * }, | |
| */ | |
| function getPlotBandsWeekends (dayList) { | |
| return dayList | |
| .filter((t) => { | |
| let day = (new Date(t)).getDay(); | |
| let isWeekend = (day == 6) || (day == 0); | |
| return isWeekend; | |
| }) | |
| .map((t) => { | |
| let date = new Date(t); | |
| date.setHours(0,0,0,0); | |
| let startDate = +date; | |
| date.setHours(23,59,59,999); | |
| let endData = +date; | |
| return { | |
| from: startDate, | |
| to: endData, | |
| color: 'rgba(68, 170, 213, 0.2)', | |
| }; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment