Skip to content

Instantly share code, notes, and snippets.

@clandau
Created August 14, 2020 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clandau/47b2bebdcbfac5d40937de34b6aa49d0 to your computer and use it in GitHub Desktop.
Save clandau/47b2bebdcbfac5d40937de34b6aa49d0 to your computer and use it in GitHub Desktop.
example of a Google Charts Timeline using vue-google-charts
<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