question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

this.renderChart is not a function when using default example

See original GitHub issue

What other configurations or imports do I need to make, i get TypeError: this.renderChart is not a function when I use the example given as,

import { Bar } from 'vue-chartjs'

export default {
  extends: Bar,
  mounted () {
    // Overwriting base render method with actual data.
    this.renderChart({
      labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
      datasets: [
        {
          label: 'GitHub Commits',
          backgroundColor: '#f87979',
          data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11]
        }
      ]
    })
  }
}

do i need to define the function or what?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
pitometsyuriicommented, Jun 10, 2020

I have the same error, and using mixins doesn’t work too.

3reactions
aperturelesscommented, May 7, 2018

Can you post a reproduction? Generally this seems right.

You are extending the Bar component and like a mixin you have all methods and props defined in there. So this.renderChart() should be available.

You could try mixins: [Bar] instead of extends

Read more comments on GitHub >

github_iconTop Results From Across the Web

this.renderChart is not a function VueJs Chart.js - Stack Overflow
You are using V4 of vue-chart.js, the chart creation process has been changed as you can read here in the migration guide.
Read more >
How to use the vue-chartjs.mixins.reactiveProp function ... - Snyk
To help you get started, we've selected a few vue-chartjs.mixins.reactiveProp examples, based on popular ways it is used in public projects.
Read more >
Vue-chartjs error in BaseCharts.js renderChart - Get Help
I got trouble while trying to add chart using vue-chartjs on my application. Firstly I install vue-chartjs npm install vue-chartjs chart.js ...
Read more >
Getting Started - vue-chartjs
vue-chartjs lets you use Chart.js without much hassle inside Vue. ... charts have data change watcher and options change watcher by default.
Read more >
vue-chartjs | Yarn - Package Manager
_updateFromParent is not a function #72; Styling componement's surrounding <div> #70 ... mergeOptions to merge default options with user's options #5.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found