The issue with the fill colors gradient not being applied to the last three colors of the pie chart in apexchart has been noticed

Why is the fill color gradient not applying to the last three colors?

Does anyone have a solution for this issue?

Perhaps some changes need to be made to the file.

https://cdnjs.cloudflare.com/ajax/libs/apexcharts/3.35.3/apexcharts.min.js

optionsos = {

    chart: {
        height: 225,
        type: "pie"
    },
    stroke: {
        curve: "smooth",
        width: 0
    },
    series: [30, 15, 25, 18, 20, 13, 15, 10, 23, 25],
    labels: ["Series 1", "Series 2", "Series 3", "Series 4", "Series 5", "Series 6", "Series 7", "Series 8", "Series 9", "Series 10"],
    colors: ["#99b3ff", "#4ca6ff", "#0080ff", "#006cd9", "#00468c", "#6c00d9", "#ffbfff", "#7396ff", "#3600d9", "#ff99ff"],
    plotOptions: {
      pie: {
        expandOnClick: true,
      }
    },
    fill: {
      type: 'gradient',
      gradient: {
        shade: 'dark',
        type: "horizontal",
        shadeIntensity: 0.5,
        gradientToColors: '#5c26ff',
        inverseColors: true,
        opacityFrom: 1,
        opacityTo: 1,
        stops: [2, 18, 28, 100, 60, 150],
        colorStops: []
      }
    },
    legend: {
        show: !1,
    },
};
chartart = new ApexCharts(document.querySelector("#pie_chart"), optionsos).render();
<div class="col-xl-4">
<div class="card text-center" style="max-height: 280px; min-height: 280px;">
    <div class="card-body">
        <h4 class="card-title mb-4">Top 10</h4>


        <div id="pie_chart" height="300"></div>
    </div>
</div>


</div> 

        <script src="https://cdnjs.cloudflare.com/ajax/libs/apexcharts/3.35.3/apexcharts.min.js
"></script>

Answer №1

One simple fix is to modify the gradientToColors property by setting it as an array, which is clearly outlined in the documentation as follows:

gradientToColors: [
        "#000000",
        "#000000",
        "#000000",
        "#000000",
        "#000000",
        "#000000",
        "#000000",
        "#000000",
        "#000000",
        "#000000",
        "#000000"
      ],

Check out the Codesandbox Solution for more details

View the result of this solution in the image below:

https://i.sstatic.net/C79qF.png

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

Implementation of Oriented Bounding Box (OBB) in THREE

After utilizing the Yuka_OBB implementation to create an oriented bounding box, I have some inquiries about the results achieved: Bed (AABB) https://i.sstatic.net/OgZBU.png Bed (OBB) https://i.sstatic.net/fzOOW.png Wall (AABB) https://i.sstatic.net/R ...

After entering just one character, the focus on the input field in Vue.js is lost

Currently, I am facing an issue with a view that contains an input field. When a character is entered, the input field loses focus, requiring an additional click to resume typing. Does anybody have any insight into what might be causing this problem? Here ...

Distinguishing Between Model and View State Management in AngularJS

As I work on a complex single page application in Angular, I find myself needing to manage two types of data. First, there is the Model data which pertains to information retrieved from and sent to the backend API server. Second, there is ViewState data wh ...

Display content exclusively within a modal specifically designed for mobile devices

I want to implement a feature where a button triggers a modal displaying content, but only on mobile devices. On desktop, the same content should be displayed in a div without the need for a button or modal. For instance: <div class="container&quo ...

Similar functionality available in Vue and React, however, it seems to be malfunctioning in React

Working on the same login function in React/Vue, I have encountered an issue where it works fine on VueJS but not on ReactJS. Vue working smoothly: async EnvioLogin() { try { const response = await axios.post("api/auth/login", { emai ...

Unable to invoke modal popup from master page on child page

Incorporating a modal popup to display a login box has brought up an interesting challenge. The modal popup is situated in the master page and connected to a LogIn link. However, now there is a need to invoke the same modal popup from a child page using a ...

`Launch link in new browser window`

Seeking assistance with a coding issue. I'm attempting to have links open in a new tab, but I haven't been successful using the href attribute. Below is the code snippet from src/utils/menu.js: const menu = [ { name: 'App& ...

Creating a sticky footer with CSS: A step-by-step guide

Struggling to keep my footer at the bottom of the page, I attempted this code: position: absolute; left: 0; bottom: 0; height: 100px; width: 100%; Unfortunately, my footer ended up looking messy. My website runs on WordPress, and ideally, I'd like t ...

Creating Dynamic Form Element Names in JavaScript - A Step-by-Step Guide

Currently, I am working on scripting an HTML form within a PHP environment. The layout of the form is structured as a table, with each row representing a set of submitted items that will be stored in a $_POST double array. In this array, the first identifi ...

JavaScript swap, change strings using a comma

My problem involves replacing occurrences of the string ],[ with ]@[ I've attempted different methods but haven't found a successful solution. var find = '],['; var regex = new RegExp(find, "g"); mytext.re ...

Replace the instances of "foo" with "bar" in the phrases "foo bar" and "bar foo."

Using a regular expression, I am able to locate specific words and then manipulate them in some way. For example: I want to surround all the words I find with <strong> tags: $string = 'Hello, there is foo, after there is bar but now I need fo ...

Ensure that the columns are consistently displayed on a single row

On larger screens, everything displays correctly. However, when viewing on a phone, the issue arises. I want these two columns to always stay on one row, but currently they stack on mobile devices. How can I ensure that they resize and remain on the same ...

Retrieve the parent document for every item within a Firebase collection group

Transitioning from an SQL background to document storage, I am currently navigating through a Firebase database structure that looks like this: John (doc) Restaurant Reviews (collection) Review 1 (doc) Review 2 (doc) Paul (doc) Restaurant Reviews ...

Tips on implementing smooth-scroll scrollLeft in Vue3 with JavaScript

Currently, I am in the process of creating a horizontal scroll menu for displaying images. The navigation functionality includes arrow buttons for scrolling: <template> <section id="artwork" class="artwork"> <div cl ...

The webpage fails to return to its original position after the script has been executed

My website has a sticky div that stays at the top when scrolling down, but does not return to its original position when scrolling back up. Check out this example function fixDiv() { var $div = $("#navwrap"); if ($(window).scrollTop() > $div.data("top ...

iterate through all the items in the radioButton collection

Hello, I am looking to iterate through this object and display checkbox values along with their indices. data: [ { key1: 'last 6 months' }, { key2: 'last 30 days' } ] I would like to creat ...

Can an image be coded to follow the cursor once it reaches the image itself?

I'm in the process of developing a game where an image follows the cursor. I want to prevent players from cheating by moving the cursor outside the designated area and then reaching the finish line. Currently, the image moves wherever my cursor goes. ...

What are some effective ways of using the parent, before, and children selectors?

<table> <tr><td><input type="text" value="123"></td><td><input class="here" type="text"></td></tr> <tr><td><input type="text" value="333"></td><td><input class=" ...

Sending a Django form using AJAX and jQuery: A step-by-step guide

After researching various tutorials on django AJAX forms, I've found that each one offers a different method, but none of them seem simple. Being new to AJAX, I'm feeling a bit confused by the complexity involved. In my specific case, I have a m ...

Navigational points and never-ending scrolling

I am currently working on implementing an infinite scroll page for my Wordpress website using the Ajax Load More plugin from Ajax Load More. The issue I am facing is related to the utilization of waypoints to display and hide a sticky navbar containing the ...