npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

highcharts-custom-events

v4.0.2

Published

Plugin that allows you to add extra events, like double / right click on each chart element, for Highcharts.

Readme

Custom Events – Highcharts Module

npm version

Custom Events is an official Black Label plugin for Highcharts, extending the charting library with DOM-like event binding (click, dblclick, contextmenu, etc.) for chart elements such as labels, titles, series, and crosshairs. The plugin is built as a separate add-on to the Highcharts library, owned and maintained by Highsoft AS.

This module is the result of our long-standing collaboration with Highsoft, where we’ve been a trusted partner since 2010 — helping build, maintain, and expand the Highcharts ecosystem. With custom events, you can easily create richer interactivity and deliver better user experiences, without relying on complex workarounds.

Live demo
GitHub repository

Demo

Table of Contents


Getting Started

Compatibility

| Custom Events Version | Highcharts Version | | --------------------- | ------------------ | | 4.0.0+ | >= 9.0.0 | | 3.x.x | < 9.0.0 |


Installation

Install via NPM:

npm install highcharts highcharts-custom-events
# or
yarn add highcharts highcharts-custom-events
# or
pnpm add highcharts highcharts-custom-events

Then import and initialize:

import Highcharts from "highcharts";
import HighchartsCustomEvents from "highcharts-custom-events";

HighchartsCustomEvents(Highcharts);

Or include via a tag after loading Highcharts:

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://blacklabel.github.io/custom_events/js/customEvents.js"></script>

Usage

Attach events in the same way you would with Highcharts’ built-in event handlers:

Highcharts.chart('container', {
  xAxis: {
    labels: {
        events: {
          click: function () {
            console.log('Click on xAxis label');
          },
          dblclick: function () {
            console.log('Double click on xAxis label');
          },
          contextmenu: function () {
            console.log('Right click on xAxis label');
          }
        }
    }    
  },
  crosshair: {
    enabled: true,
    events: {
      mouseover: function () {
        console.log('Mouse over crosshair');
      }
    }
  },
  series: [{
    data: [1, 2, 3, 4, 5]
  }]
});

Available Events

| Event | Description | | ------------- | ---------------------------------------- | | click | Fires on click | | dblclick | Fires on double click (desktop & mobile) | | contextmenu | Fires on right click | | mouseover | Fires when hovering over element | | mouseout | Fires when leaving element | | mousedown | Fires when mouse button pressed | | mousemove | Fires when moving cursor over element |

Supported Elements

| Element | Notes | | ------------- | ------------------ | | title | Chart title | | subtitle | Chart subtitle | | axis.labels | Axis labels | | axis.title | Axis title | | plotLines | Including labels | | plotBands | Including labels | | point | Single data point | | series | Entire series | | legend | Legend items | | dataLabels | Series data labels | | flags | Flags series | | crosshair | Crosshairs |


Development Setup

If you want to work on this plugin locally:

  1. Clone the repository
git clone https://github.com/blacklabel/custom_events.git
cd custom_events
  1. Install dependencies
npm install
# or
yarn install
  1. Start a local dev server
npm start

This will launch a local server (via http-server or similar) and open the demo page in your browser.

  1. Build the plugin
npm run build

The compiled file will be available in the dist/ folder.


Using the Plugin Locally in index.html

After building, include the plugin file after Highcharts in your index.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Highcharts Custom Events - Local Dev</title>
  <script src="https://code.highcharts.com/highcharts.js"></script>
  <script src="dist/custom_events.js"></script>
</head>
<body>
  <div id="container"></div>
  <script>
    Highcharts.chart('container', {
      series: [{
        data: [1, 2, 3, 4, 5]
      }]
    });
  </script>
</body>
</html>

Why Black Label Built This Plugin

At Black Label, we specialize in pushing the boundaries of data visualization. Over the past 15 years, we’ve worked with companies worldwide to build charting solutions that go beyond out-of-the-box libraries.

Highcharts is at the heart of much of our work, and this plugin grew directly out of real-world client needs:

  • Adding native-like event handling to chart elements
  • Enabling intuitive UX for interactive dashboards
  • Simplifying complex customization by extending the Highcharts core in a seamless way

Custom Events is one of many plugins we’ve created to make Highcharts more flexible, more powerful, and more developer-friendly.


About Black Label

We’re a Krakow-based team of data visualization experts, working closely with Highsoft and the global Highcharts community since 2010. Our expertise spans plugins, extensions, custom dashboards, and full-scale dataviz applications.

Custom Events is just one of the many innovations we’ve open-sourced. Explore more on our GitHub profile, read insights on our Blog, or connect with us at [email protected] to discuss how we can help bring your charts and dashboards to life.

➖ Learn more on our LinkedIn page.