Primevue Chart not rendered

UI Components for Vue
Post Reply
piotrowicki
Posts: 2
Joined: 31 Aug 2021, 18:22

31 Aug 2021, 18:27

Im stuck with rendering Chart from Primevue components. It's based on chart.js library. At this moment I have simple vue component created:

Code: Select all

<template>
  <div class="p-chart">
    <h2>Chart:</h2>
    <chart type="line" :data="chartData" />
  </div>
</template>

<script>

import Chart from "primevue/chart";

export default {
  data() {
    return {
      chartData: {
        labels: ["Label"],
        datasets: [
          {
            label: "Dataset",
            backgroundColor: "#5F5F5F",
            data: [99],
          },
        ],
      },
    };
  },
  components: {
    Chart,
  },
};
</script>
Unfortunately the chart does not appear moreover I don't see any js erros in brwoser console. Can someone help what I'm missing here? Any additional setup needed?

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

17 Nov 2021, 12:03

It seems there is a wrong typing. Could you try to use 'Chart' instead of 'chart' in the template?

piotrowicki
Posts: 2
Joined: 31 Aug 2021, 18:22

21 Dec 2021, 22:00

It helped when downgraded chart.js to 2.9.4 version. Topic can be closed.

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests