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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-jsx-highmaps

v3.0.4

Published

Highmaps built using React components

Downloads

8,723

Readme

React JSX Highmaps

Build Status npm version dependencies Status

Introduction

A project for integrating Highmaps into a React app, with proper React components for each Highmaps component. Inspired by Recharts, but for Highmaps, obviously.

Installation

npm install --save react-jsx-highmaps

You'll need the peer dependencies too

npm install --save react react-dom highcharts@^11.0.0

Licensing

React JSX Highmaps is free to use, however Highcharts itself requires a license for commercial use. Highcharts license FAQs.

Getting started

The intention of this library is to provide a very thin abstraction of Highmaps using React components. This has been achieved by passing configuration options as component props.

In the vast majority of cases, the name of the configuration option, and the name of the component prop are the same.

Example

<Tooltip /> component

<Tooltip padding={10} hideDelay={250} shape="square" split />

This corresponds to the Highcharts' tooltip configuration of

tooltip: {
  enabled: true, // This is assumed when component is mounted
  padding: 10,
  hideDelay: 250,
  shape: 'square',
  split: true
}

We aim to pass all configuration options using the same name, so we use Highcharts' documentation to figure out how to achieve the same with React JSX Highcharts.

Note:

There are two exceptions to the above;

Exception 1

Where Highcharts events are concerned - instead of passing events as an object, we use the React convention onEventName.

Example

<MapBubbleSeries
  id="my-series"
  data={myData}
  onHide={this.handleHide}
  onShow={this.handleShow}
/>

This would correspond to the Highcharts configuration

series: [
  {
    type: 'mapbubble',
    id: 'my-series',
    data: myData,
    events: { hide: this.handleHide, show: this.handleShow }
  }
];

Exception 2

text configuration options are passed as a React child

Example

<Title>Some Text Here</Title>

This would correspond to the Highcharts configuration

title: {
  text: 'Some Text Here';
}

Example

// import Highmaps from 'highcharts/highmaps' - Import Highmaps from Highcharts
// import { Fetch } from 'react-request'

const MyMapChart = (props) => (
  <HighmapsProvider Highcharts={Highmaps}>
    <Fetch url="https://code.highcharts.com/mapdata/custom/europe.geo.json">
      {({ fetching, failed, data }) => {
        if (fetching) return <div>Loading…</div>
        if (failed) return <div>Failed to load map.</div>

        if (data) {
          return (
            <HighchartsMapChart map={data}>
              <Title>Nordic countries</Title>

              <MapSeries
                data={[
                  ['is', 1],
                  ['no', 1],
                  ['se', 1],
                  ['dk', 1],
                  ['fi', 1]
                ]}
                dataLabels={{
                  enabled: true,
                  color: '#FFFFFF',
                  format: '{point.name}'
                }}
              />

              <MapNavigation>
                <MapNavigation.ZoomIn/>
                <MapNavigation.ZoomOut/>
              </MapNavigation>

              <Tooltip/>

              <Credits/>
            </HighchartsMapChart>
          )
        }

        return null
      }}
    </Fetch>
  </HighmapsProvider>
);

More info

See here