Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gauge charts are not working #59

Closed
gridknight opened this issue Sep 4, 2019 · 5 comments
Closed

Gauge charts are not working #59

gridknight opened this issue Sep 4, 2019 · 5 comments

Comments

@gridknight
Copy link

Unfortunately, the "Gauge" type is not implemented or missing:

 <GChart
      type="Gauge"
      :packages="packages"
      :data="chartData"
      :options="chartOptions"
    />    

as well as:

 <GChart
      type="gauge"
      :packages="packages"
      :data="chartData"
    />    

are not working. If I change the type to BarChart everything works.

On the console I get:

vue-google-charts.common.js?757f:1 Uncaught (in promise) TypeError: google.visualization[type] is not a constructor
    at createChart (vue-google-charts.common.js?757f:1)
    at VueComponent.createChartObject (vue-google-charts.common.js?757f:1)
    at eval (vue-google-charts.common.js?757f:1)

Therefore it looks like this type is missing.

@steveDL
Copy link

steveDL commented Jun 18, 2020

I believe you have to use the load additional packages
https://www.npmjs.com/package/vue-google-charts#load-additional-packages

However having used the :settings="{ packages: ['guage'] }" I am getting the following error.

The resource from “https://www.gstatic.com/charts/48.1/js/jsapi_compiled_guage_module.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

@alexxlagutin
Copy link
Collaborator

alexxlagutin commented Jun 18, 2020

Working example

<template>
  <div>
    <GChart
      type="Gauge"
      :settings="{ packages: ['gauge'] }"
      :data="chartData"
      :options="chartOptions"
    />
  </div>
</template>

<script>
import { GChart } from 'vue-google-charts'
export default {
  name: 'App',
  components: {
    GChart
  },
  data () {
    return {
      chartData: [
        ['Label', 'Value'],
        ['Memory', 80],
        ['CPU', 55],
        ['Network', 68]
      ],
      chartOptions: {
        width: 400,
        height: 120,
        redFrom: 90,
        redTo: 100,
        yellowFrom: 75,
        yellowTo: 90,
        minorTicks: 5
      }
    }
  }
}
</script>

@alexxlagutin
Copy link
Collaborator

@steveDL #82

@steveDL
Copy link

steveDL commented Jun 18, 2020

@alexxlagutin Than you very much for taking the time to get back to me so swiftly! I am using the exact example you posted. Somehow the mime error is gone not sure why but its working anyway thanks again!!

@alexxlagutin
Copy link
Collaborator

@steveDL Check my comment in #82
You had misprint in package name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants