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

@pxblue/highcharts

v2.1.0

Published

Base configurations for assorted HighCharts graph types for PX Blue.

Downloads

22

Readme

Highcharts Configurations

This package contains basic support for basic HighCharts line, pie, bar, and donut graphs for use with PX Blue.

Installation

Install with npm:

npm install --save @pxblue/highcharts

or yarn

yarn add @pxblue/highcharts

Basic Usage

To use this library, import the chart generator functions from the package:

import { 
    createLineGraph, 
    createPieGraph, 
    createDonutGraph, 
    createBarGraph 
} from '@pxblue/highcharts'; 

and then use them as placeholders in your application.

For Angular:

import { Chart } from 'angular-highcharts';
...
let lineChart = new Chart(createLineGraph());

For React:

import ReactHighcharts from 'react-highcharts';
...
<ReactHighcharts config={createLineGraph()}/>

This will use the default sample data to render a chart in your application. Read the following section for instructions on specifying your own configuration/data.

Advanced Usage

When you are ready to customize charts of your own, you can pass a configuration object into the chart generator functions.

import { createPieChart } from '@pxblue/highcharts';
...
let myPieConfig = {
    series: [{
        name: 'Browsers',
        data:[
            {name: 'Chrome', y: 61.41},
            { name: 'Internet Explorer', y: 11.84 }, 
            { name: 'Firefox', y: 10.85 }
        ]
    }],
    colors: ['red', 'orange', 'yellow']
};
let myChart = createPieChart(myPieConfig);

This configuration object will accept any property than can be supplied to a standard Highcharts config object (API Reference). Additionally, you may supply a colors property which is an array of colors to be used in the chart.

Additional Utilities

This package also includes several utility functions and style variables to make it easier for users to customize certain parts of the chart configuration. Specific documentation for these functions/variables can be found in the source files.

import {
    OpenSans,       
    pxblueColors,
    sizes
} from '@pxblue/highcharts/styles';

import {
    getRandomData,       
    sharedTooltipFormatter,
    sharedTimeTooltipFormatter,
    simpleTooltipFormatter
} from '@pxblue/highcharts/utilities';

Translations

Several functions are provided that will translate the language and format of chart labels. These functions can be imported from the i18n file and accept a language locale string as their argument.

import { getChartsLanguage, getChartsAxisDateTimeLabelFormats, getChartsTooltipDateTimeLabelFormats } from '@pxblue/highcharts';
...
const langOptions = getChartsLanguage('fr');
const axisFormats = getChartsAxisDateTimeLabelFormats('fr');
const tooltipFormats = getChartsTooltipDateTimeLabelFormats('fr');
  • getChartsLanguage: (i18nLanguage: string) => Highcharts.LangOptions | undefined)
  • getChartsAxisDateTimeLabelFormats: (i18nLanguage: string) => Highcharts.AxisDateTimeLabelFormatsOptions | undefined)
  • getChartsTooltipDateTimeLabelFormats: (i18nLanguage: string) => FormatStrings | undefined)

FormatStrings

  • day: string
  • hour: string
  • millisecond: string
  • second: string
  • minute: string
  • month: string
  • year: string
  • week: string

Demos

| Framework | Live Examples | |-----------|--------------------------------------------------------------------------------------------------| | Angular | View on Stackblitz | | React | View on Code Sandbox |