Issue with Vue-Google-Charts rendering calendar chart in Vue framework

I am trying to utilize the vue-google-charts package for displaying Google charts, but I'm encountering difficulties when attempting to incorporate the Calendar chart.

This is how my HTML template looks:

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

Here is my script setup:

<script>
  import { GChart } from "vue-google-charts";
  export default {
    name: "App",
    components: {
     GChart
    },
    data() {
      return {
       chartData: [
      ['a','b'],
      [ new Date(2012, 3, 13), 37032 ],
      [ new Date(2012, 3, 14), 38024 ],
      [ new Date(2012, 3, 15), 38024 ],
      [ new Date(2012, 3, 16), 38108 ],
      [ new Date(2012, 3, 17), 38229 ]
  ],
  chartOptions: {
    chart: {
     title: "Red Sox Attendance",
     height: 350,
   }
  }
};
}
};

The error message I receive is:

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

What steps can I take to address this issue? Thank you.

Answer №1

It appears that there is a :settings property for the chart. It works well with it.

<GChart
  :settings="{packages: ['calendar']}"
  type="Calendar"
  :data="chartData"
  :options="chartOptions"
/>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for showcasing images retrieved from a REST API on the frontend, with the condition that only one image should be displayed using multer

I am experiencing an issue where only the image logo is being displayed in my frontend, rather than the entire image that I uploaded in string format on my backend. Can someone please help me troubleshoot this error and identify what may be wrong with my c ...

Detecting the existence of a scrollbar within the document object model using JavaScript - a guide

Could someone provide a JavaScript syntax for detecting the presence of a scrollbar in the DOM by measuring the body height and window height? ...

Using a JavaScript file within a webpage that has already been loaded

Seeking assistance as I encounter a dilemma: providing code would be overwhelming, but perhaps someone can assist me in brainstorming a solution. Here's the issue: I have an index.php file with a div that dynamically loads (via jQuery .load()) another ...

Conceal the parent div from its sibling within the same parent container

My goal is to conceal a parent component from its child element. I attempted to achieve this by using the parent component as a background while adding additional backgrounds to the child elements for overriding purposes. However, this method did not work ...

Is it possible to initiate an animation in a child component using an input variable?

I have a specific animation that I would like to trigger once an *ngFor loop completes ngAfterViewInit(): void { this.items.changes.subscribe(() =>{ Promise.resolve().then(() => { this.everythingLoaded(); }) }) } After the loop fini ...

Is it possible to animate the innerHTML of a div using CSS?

In my HTML file, I have these "cell" divs: <div data-spaces class="cell"></div> When clicked, the innerHTML of these divs changes dynamically from "" to "X". const gridSpaces = document.querySelectorAll("[data-spaces]"); f ...

Having difficulty with collapsing Bootstrap side navigation menu levels

I've been searching high and low for an example that matches my current issue, but so far, no luck. I'm attempting to design a collapsible side navigation with multiple levels in bootstrap using bootstrap.js. The problem I'm facing is that ...

Leveraging Angular 2 for incorporating jQuery-based JavaScript ajax functionality

It seems like I'm attempting to force a square peg into a round hole as I work with Angular2 and Typescript. I've created a Javascript module that serves as an API client library for the API I'm utilizing. This library simplifies tasks such ...

Unable to transmit information to PHP file using AJAX

I am working with a php file called graph.php. $host = $_POST['hostname']; echo $type=$_POST['type_char']; include('rrdtools.inc.php'); include('graphs/'.$type.'.inc.php'); and I attempting to send data t ...

Create a JavaScript function without attaching it to the global window object

Can someone please help me with defining a function and using it inside Jquery within the $(document).ready block? function addLeadingZero(number) { return (number < 10 ? '0' : '') + number } I'm not confident that I ha ...

What is the correct way to chain promises within Promise.all?

Essentially, I retrieve all the rows from a schedule table and then process each individual row. If the row is already in the command table, I skip it. Otherwise, I insert it. Within Promise.all(rows.map(function(row){ I have 2 chained promises: return ...

NodeJS continuing to trigger setInterval() even after clearInterval() has been called

I need some help with my NodeJS script that sets and clears an interval. The starting interval works fine, but when I try to clear it, the console shows "stopping interval" yet the interval keeps firing every minute. app.get("/api", async (req, res) => ...

Instructions on utilizing the signUp() function in Supabase for including extra user details during the registration process

My latest project involves building a Vue.js application with authentication using Supabase. I've been trying to implement the signUp() method from Supabase in order to collect extra user data during the sign-up process. In my code, I added a property ...

Is it possible to generate an interactive HTML form using JSON information?

When the user clicks the "get Form" button, a request is sent to the form API to retrieve information for rendering the form. Once the form is rendered, the user can then submit the form. This process can be repeated as needed. HTML: <body ng-app="Json ...

Turn off Vuetify's v-touch functionality within a specific nested element

Currently, I am utilizing Vuetify and seeking a way to trigger certain code when the user swipes either left or right. Within my project, there is a container structured as follows: <div v-touch="{ left: () => performActionA(), right ...

The calculator I designed using HTML, CSS, and JavaScript is experiencing difficulty adjusting to various screen sizes

I recently built a calculator using HTML, CSS, and JavaScript. It works perfectly on PC or big screens, but when viewed on smaller devices like phones or tablets, the display gets cut off and does not adjust properly. Here are some example pictures for ref ...

Turn off Chrome 69's autofill functionality

I've recently encountered an issue with Chrome's password autofill feature that has been troubling me for a few days now. This problem began when I was using Chrome version 69. After much trial and error, I found a solution by removing the id an ...

Extract all objects from an array where a specific field contains an array

data:[ { id:1, tags:['TagA','TagB','TagC'] }, { id:2, tags:['TagB','TagD'] }, { id:3, tags:[&a ...

I encountered a console issue that I am struggling with. It is showing the error message "TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'"

When running this code, I encountered an error in the console (TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'). Can someone help me identify where I made a mistake and provide guidance ...

Executing onClick event in RiotJS upon page load

As I develop a table application using RiotJS, I consistently encounter an issue with the onclick event. Whenever I attempt to utilize the <tag onclick={somefunction}> I face unpredictable behavior. Sometimes, it will excessively call the function ...