Skip to content

Instantly share code, notes, and snippets.

@miyamae
Created April 13, 2020 09:11
Show Gist options
  • Select an option

  • Save miyamae/dd674b5f43da726662b9d933147a866a to your computer and use it in GitHub Desktop.

Select an option

Save miyamae/dd674b5f43da726662b9d933147a866a to your computer and use it in GitHub Desktop.
Google Charts用に配列を合成
const mergeLineChartData = (head, dst, src) => {
dst[0].push(head)
let existed = false
for (const s of src) {
existed = false
for (const d of dst) {
if (d[0] === s[0]) {
d.push(s[1])
existed = true
}
}
if (!existed) {
dst.push(s)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment