haydenbbickerton / vue-charts

*UNSUPPORTED* Google Charts plugin for Vue.js
MIT License
191 stars 33 forks source link

convertOptions #22

Open seb-vial opened 7 years ago

seb-vial commented 7 years ago

Hello,

Is there a way to use convertOptions for charts that allow it; to use some 'beta' options like in the Bar chart for example

image

I'm guessing this could be added as an optional prop ?

rzb commented 7 years ago

I'm looking for the same thing. I don't think there's any way to do it other than forking the repo and placing checks in the buildWrapper method from the chart component. Something like:


methods: {
    buildWrapper (chartType, dataTable, options, containerId) {
        if (chartType == 'google.charts.Bar') {
            options = google.charts.Bar.coverOptions(options)
        } else if (chartType == 'google.charts.Line') {
            options = google.charts.Line.coverOptions(options)
        } else if (chartType == 'google.charts.Scatter') {
            options = google.charts.Scatter.coverOptions(options)
        }

        let wrapper = new google.visualization.ChartWrapper({
            chartType: chartType,
            dataTable: dataTable,
            options: options,
            containerId: containerId
        })

        return wrapper
    },