Utilizing the ApexCharts feature for cursor pointer functionality

I utilized apexcharts.js to create a bar chart in JavaScript and now I need help changing the cursor to a pointer. Any assistance would be greatly appreciated!

Here is my code:

var options = {
  series: [{
    name: 'series1',
    data: [60, 85, 75, 120, 100, 109, 97]
  }],
  toolbar: {
    show: false,
  },
  chart: {
    height: 350,
    type: 'area',
    fontFamily: 'Proxima Nova',

    toolbar: {
      show: false
    },
  },
  dataLabels: {
    enabled: false
  },
  stroke: {
    curve: 'smooth'
  },
  xaxis: {
    categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  },
  tooltip: {
    x: {
      format: 'dd/MM/yy HH:mm'
    },
  },
};

var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();

Answer №1

I encountered a similar issue and have come up with two possible solutions:

Method 1: Found on Github

To set the cursor to point, you can use the following code snippet:

chart: {
  ...
  events: {
    dataPointMouseEnter: function(event) {
      event.path[0].style.cursor = "pointer";
    }
  }
}

For more details, visit this GitHub link: https://github.com/apexcharts/apexcharts.js/issues/1466

Method 2: My custom method

You can target the class name of the apexchart component using Inspector and then add the following property to this class at the code level:

cursor: pointer

Here's an example:

// Change cursor on hover
.apexcharts-pie {
  cursor: pointer;
} 

Answer №2

I encountered a similar issue and found two potential solutions:

chart: {
            width: 320,
            type: ...,
            events: {
                dataPointMouseEnter: function(event) {
                    event.target.style.cursor = "pointer";
                    // alternatively
                    event.fromElement.style.cursor = "pointer";
                }
            },
        }

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

Minimize the gap between the input text and the lower border

Is there a way to bring the input text field and text closer together by reducing the space between the bottom border and the text? #a { padding: 1px 3px; background: transparent; border: 0; outline: 0; border-bottom: 0.8px soli ...

Enlarging the current division while reducing the size of the others when hovering

Currently, I am working on a school project that involves creating a slideshow on a webpage. However, I have reached a point where I am unsure of how to proceed. Here is the progress I have made so far: body { background-color: #252525; } #wrapper { ...

Creating a clickable link using a for loop to set the destination URL

I'm currently working on a project where I want to dynamically populate a set of buttons with the correct hrefs. However, the setLink() function is not returning the expected value (which should be something like localhost:44369/Timeline?d=2020/7/3). ...

Loop Through Mongoose to Retrieve Multiple Objects

I am currently facing an issue while trying to retrieve multiple objects from MongoDB using mongoose. In my database, I have two primary collections known as user and order. The user collection consists of an array called 'order history', which ...

Heroku Foreman unexpectedly stops while using Express.js bodyParser() function

After running foreman start, the following message is displayed: > foreman start 20:38:55 web.1 | started with pid 3896 20:38:55 web.1 | Development 20:38:56 web.1 | connect.multipart() will be removed in connect 3.0 20:38:56 web.1 | exited with co ...

Node interprets string as an object

I encountered the following code: <a class="btn-primary btn" href="/employer/booth/<%= user._id.toString() %>" <% console.log(typeof user._id, user._id) %> target="_blank"> Preview your booth </a> Upon running this ...

Hidden Document Scroll Offset

When CSS is used to hide scrollbar html, body { width: 100%; overflow-x: hidden } The above code snippet removes the scroll from the window but triggers it on the body element. To calculate the scroll values in such cases, you can use: pageOffset = ...

PHP query will execute even in the absence of clicking the button

I'm encountering an unusual issue. I've defined a query to insert two names into the database, and I've used Javascript(Jquery) to ensure it only runs when the create button is clicked. However, the script seems to be executing every time I ...

Encountering an issue while attempting to convert a string into JSON from a .json file within a Node.js environment

var jsonObject = collages; file.writeFile('collage.json', JSON.stringify(jsonObject), function(err){ if (err) throw err; console.log('Success'); }); var result = ''; result += file.readFile('collage.json', ...

Is THREE.js disregarding the line thickness when using a BufferGeometry with LineBasicMaterial in a THREE.Line object?

Here is a minimal test case I've put together that showcases my issue: http://pastebin.com/TPXFgxLj The desired outcome should be a set of red lines with a line width of 19. However, the current result shows a set of red lines with what appears to be ...

error displays stating that the module '../util/http_util' cannot be located

I'm currently using node and Notepad++ to develop a website that allows users to log in, save their details, and access the site. I've encountered an issue that I can't quite figure out even though everything seems fine in the code. Below yo ...

What causes the Error: ENOENT open error to occur when attempting to render a doT.js view?

My first experience with doT.js led me to create a basic server setup: 'use strict'; var express = require('express'); var app = express(); var doT = require('express-dot'); var pub = __dirname+'/public'; var vws ...

The innovative technique of using pure CSS to secure the bottom edge of a div to the viewport

Is there a way to keep two container divs positioned x pixels from the bottom of the viewport without using position absolute|fixed? I want them to remain as position: relative for proper DOM flow. Searching for a CSS-only solution that works in IE7+. Mos ...

What could be the reason I am unable to choose data properties from the dropdown options?

There are two different dropdowns for clothing types and colors. When a type of clothing is selected from the first dropdown, JSON data will fill the second dropdown with options based on the first dropdown selection. After selecting an option from the se ...

I am looking for guidance on removing the bottom line from the ionic 4 segment indicator. Any advice or tips on

.segment-button-indicator { -ms-flex-item-align: end; align-self: flex-end; width: 100%; height: 2px; background-color: var(--indicator-color); opacity: 1; } I am a beginner in hybrid app development and ...

Error: No route found at this location

I've been following a tutorial on integrating Evernote with IBM's DOORS Next Generation and I added the code highlighted below. // app.js app.get("/notebooks", function(req, res) { var client = new Evernote.Client({ token: req.session.oauth ...

The Vue.js reactivity system does not detect changes when a property is updated within a WebRTC callback

Is Vue.js component creation becoming a challenge for you? Imagine creating a small component that requires permissions for the camera and microphone from the user, displaying that stream on a canvas. Sounds simple, right? However, let's face reality ...

What are the steps for integrating an external API into a React project?

Apologies for any potential repetition, as this question may be commonly asked. I am currently working with React, Express, CORS, node, and postgres databases. My objective is to utilize the following API to retrieve real-time prices for metals: https://me ...

The colors of my SVG button remain constant and do not dynamically change when I hover over it

I am facing an issue with a button that contains an SVG element. In my CSS, I have defined styles to change the color of the icon and the SVG when hovered over. However, I noticed that I have to directly hover over the SVG itself for the color to fill. As ...

transforming array elements into properties of a React component

My text component contains the code below return ( <FormControl variant="outlined" className={classes.formControl}> <Grid container> <TextField id={props.id} label={props.label} d ...