The ApexChart Pie/Donut Chart appears to be missing from the display

Having trouble implementing ApexCharts in my Vue Project (using Vue3), specifically with the piechart/donut chart. Interestingly, the code below functions properly if I change the type under the template tag to "bar"

<template>
  <div>
    <apexchart v-if="loaded" width="500" type="pie" :options="chartOptions" :series="series"></apexchart>
  </div>
</template>

<script>
export default {
    data() {
      return {
        loaded:true,
        series: [{
            data:[23, 11, 54, 72, 12]
            }],
        chartOptions: {
            labels: ["Apple", "Mango", "Banana", "Papaya", "Orange"],
            dataLabels: {
                enabled: true
            },
            responsive: [{
                breakpoint: 480,
                options: {
                    chart: {
                        width: 200
                    },
                    legend: {
                        positon:'bottom',
                        show: false
                    }
                }
            }],
        }
      }
    }
};

</script>

When viewed in a browser, only the legend is displayed. https://i.sstatic.net/nabto.png

I am attempting to utilize Pie and Donut charts with dynamic data fetched from an API. However, even with static hard-coded data, I'm facing difficulties getting it to work.

Answer №1

series needs to be a scalar array:

//series: [{ data:[23, 11, 54, 72, 12] }],
series: [23, 11, 54, 72, 12]

see live demo here

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

The dynamic form functionality is experiencing issues when incorporating ng-container and ng-template

I'm currently working on a dynamic form that fetches form fields from an API. I've attempted to use ng-container & ng-template to reuse the formgroup multiple times, but it's not functioning as anticipated. Interestingly, when I revert b ...

Unable to retrieve JSON data from converting TXT using JavaScript, resulting in undefined output

After converting txt to JSON, I encountered an issue. const txt = JSON.stringify(`{ ErrorList: [{ 80: 'Prepared' }], Reference: [ { 'Rule Name': 'Missing 3', 'Rule ID': 1, 'Rule Des& ...

What could be causing the delay in $q.all(promises).then() not waiting for the promises to complete?

Currently, I am tasked with utilizing AngularJS 1.5.5. My task involves making calls to multiple Rest-Services and handling the results simultaneously. $scope.callWebservices = function(){ let promises = { first: callFirstWebservice(), ...

Retrieving embedded documents from Mongoose collections

I am currently facing challenges in caching friends from social media in the user's document. Initially, I attempted to clear out the existing friends cache and replace it with fresh data fetched from the social media platform. However, I encountered ...

The class is failing to be applied to the parent div that holds an id starting with the letter x

I have been attempting to assign a class to the parent container when the child element has the 'hidden' class. If not, then a different class should be added. function tagMissions() { if ($('span[id^="mission_participant_new"]').h ...

Whenever canvas.toDataURL() is called, it will always provide the identical data

Greetings! I am currently in the process of developing an Ionic app with Firebase. My main goal is to upload multiple files while resizing them. I have encountered a strange issue where, when I call the resize method, the input image appears different. Ho ...

What is the process for generating a 3D polygon using a sequence of 3D points in three.js?

I'm curious about the optimal method for creating a custom 3D polygon using an array of 3D points in three.js. This polygon doesn't have any holes and the points are arranged in a way that they connect to adjacent vertices smoothly. I've bee ...

Creating a Circular Cropping Tool with jQuery

Can anyone help with a jQuery/javascript script that can be used to select a circle on an image and then provide the coordinates to a PHP/GD script for cropping or blurring that image? Appreciate any assistance. Thank you. ...

Instructions for adding and removing a class when a Bootstrap modal is scrolled past 300 pixels

Having trouble getting the scroll to top function to work on a specific div. I'm using window.scroll function but it's not functioning correctly. Can someone please assist? $(window).scroll(function() { var scroll = $(window).scrollTop ...

Adjusting the extrusion height in three.js: A beginner's guide

I have a trapezoid shape created with the code below. I am trying to extrude this geometry to a specific height of 2800, but I'm having trouble figuring out where to set the height parameter. Any suggestions on how to achieve this? //Create Trapezoid ...

Display all information associated with the class that matches the clicked ID

Can anyone help me with a Jquery question? I am trying to display all data with the same class when I click on it. I have created a list of clickable items. When I click on an item, the corresponding data should be shown. However, the code I wrote is not ...

Is there a way to access the variable value chosen from a select dropdown inside a function and then assign it to a JavaScript variable outside of the function?

Below is the HTML and JavaScript code that I am working with: function changeResult() { x = document.getElementById("dropdown-list").value; console.log((x)); } var qq; <select id="dropdown-list" onchange="changeResult()"> <option value="4 ...

Guide to using the Strapi Upload Plugin: Uploading a file from a remote source using a scheduled task

Utilizing the strapi upload plugin with s3 as the provider has been a seamless experience when making API calls to the upload endpoint on my strapi instance (/upload). However, I am facing a dilemma with a cron job within our repository that monitors image ...

How does the use of jQuery-style syntax impact Vue.js development?

While reviewing some Vue.js code on GitHub, I stumbled upon the following line of code: .svg-icon.streak(v-html="icons.streak", v-b-tooltip.hover.bottom="$t('streakCounter')") Within this code, there is a jQuery-like syntax $t() that I am unfam ...

Can you explain the meaning of `<%= something %>` to me?

I've been working on a javascript project and I'm curious about the purpose of surrounding a variable with this syntax? <%= variable %> I attempted to research it myself but didn't come across any helpful information, so my apologies ...

Having trouble retrieving the data property from the parent component within the child component slot

I am facing an issue with my Vue components. I have a rad-list component and a rad-card component. In the rad-list component, I have placed a slot element where I intend to place instances of rad-card. The rad-card component needs to receive objects from t ...

Experiencing a bug in the production build of my application involving Webpack, React, postCSS, and potentially other JavaScript code not injecting correctly

I've encountered an issue with my webpack.prod.config when building my assets, which may also be related to the JS Babel configuration. While I can successfully get it to work in the development build by inline CSS, the problem arises when attempting ...

Intellisense not working with express

After using the command npm install --save @types/express to install, I imported in my ts file as follows: import * as express from "express"; var app = express(); Despite this setup, I am not able to get intelisense on the app variable. Additionally ...

Ways to verify a correct email address using ReactJS

I'm currently working on a project using React.js and Next.js. I'm encountering an issue with handling the Axios response in Next.js as it's displaying "[object Object]" instead of the actual response data. How can I properly handle the resp ...

Guide on utilizing two separate collections to store different types of data for an application's users

I am looking to create a database collection similar to {username : "jack", password : "pass"} for storing doctors' login information. I believe I can achieve this during signup by implementing the following code: var Doctor = mongoose.model("doctor" ...