Created
August 14, 2020 11:46
-
-
Save clandau/47b2bebdcbfac5d40937de34b6aa49d0 to your computer and use it in GitHub Desktop.
example of a Google Charts Timeline using vue-google-charts
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
<template> | |
<div id="timeline"> | |
<GChart | |
type="Timeline" | |
:settings="{ packages: ['timeline'] }" | |
:data="timelineData" | |
:options="timelineOptions" | |
/> | |
</div> | |
</template> | |
<script> | |
import { GChart } from "vue-google-charts"; | |
export default { | |
name: "App", | |
components: { | |
GChart | |
}, | |
data() { | |
return { | |
timelineData: [ | |
["name", "start", "end"], | |
["Washington", new Date(1789, 3, 30), new Date(1797, 2, 4)], | |
["Adams", new Date(1797, 2, 4), new Date(1801, 2, 4)], | |
["Jefferson", new Date(1801, 2, 4), new Date(1809, 2, 4)] | |
], | |
timelineOptions: { | |
timeline: { | |
rowLabelStyle: { fontName: "Ariel" } | |
}, | |
colors: ["#E74C3C", "#2C3E50", "#2980B9"], | |
tooltip: { textStyle: { fontName: "Ariel", fontSize: 14 } } | |
} | |
}; | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment