I'm using Vue.js and Vue's wrapper library for Google Charts, vue-google-charts, to draw a basic line graph. The data is in the form of a time-series, and I'm not happy with the display of the tooltip: for a point on the graph, the tooltip is of the format: "2,016.957 Price: $1025" (corresponding to Dec, 2016).
What I want is the tooltip to have either of the following format: "Dec, 2016 Price: $1025", or "2016.957 Price: $1025".
While I can achieve the displays of either of these formats with the standard Google Charts library, I can't seem to find a solution using vue-google-charts. The main problem is that google.visualization.DataTable() is created under the hood; all I can do is pass in an array to it, and there is no way to customize the columns or the datatable any further. So I cannot do as is described here: https://developers.google.com/chart/interactive/docs/customizing_tooltip_content#customizing-tooltip-content.
One other solution that I explored was using Date objects instead of decimals for the time axis. However, then the tooltip is of the format "Dec 1, 2016 Price: $1025", which is also not what I want. Again, this problem can be solved with the basic library (https://developers.google.com/chart/interactive/docs/reference#dateformatter) but not with Vue's wrapper library.
Does anyone know of a way that let's you customize tooltips in vue-google-charts library?
<GChart
type="LineChart"
:data="chartData"
:options="chartOptions"
/>
export default {
data () {
return {
// Array will be automatically processed with visualization.arrayToDataTable function
chartData: [
['Time', 'Price'],
['2014.042', 1000], //january 2014
['2014.125', 1170], //february 2014
['2014.208', 1170], //march 2014
['2014.292', 1170], //april 2014
['2014.375', 1170], ...
['2014.458', 660],
['2014.542', 1030],
['2014.625', 1170],
['2014.708', 1170],
['2014.792', 1170],
['2014.875', 1170],
['2014.958', 1170], //december 2014
['2015.042', 1170],
],
chartOptions: {
chart: {
title: 'Company Performance',
subtitle: 'Sales, Expenses, and Profit: 2014-2017',
}
}
}
}
}