Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
@uplab/highcharts
Advanced tools
Highcharts JS is a JavaScript charting library based on SVG, with fallbacks to VML and canvas for old browsers.
This is the working repo for Highcharts. If you simply want to include Highcharts into a project, use the distribution package instead, or read the download page. Please note that there are several ways to use Highcharts. For general installation instructions, see the docs.
Instead of downloading, you can use our CDN to access files directly. See code.highcharts.com for details.
<script src="https://code.highcharts.com/highcharts.js"></script>
See npm documentation on how to get started with npm.
npm install --save highcharts
Bower is deprecated, but to install, run:
bower install highcharts
Starting with v6.1.0, Highcharts is available on our CDN as ECMAScript modules. You can import ES modules directly in modern browsers
without any bundling tools by using <script type="module">
(demo):
<script type="module">
import Highcharts from 'https://code.highcharts.com/es-modules/masters/highcharts.src.js';
Highcharts.chart('container', {
...
});
</script>
The following example shows dynamic import with lazy-loading:
import('https://code.highcharts.com/es-modules/masters/highcharts.src.js')
.then(imported => imported.default)
.then(Highcharts => import('https://code.highcharts.com/es-modules/masters/modules/exporting.src.js').then(() => Highcharts))
.then(Highcharts => import('https://code.highcharts.com/es-modules/masters/modules/accessibility.src.js').then(() => Highcharts))
.then(Highcharts => {
Highcharts.chart('container', {
...
});
});
Highcharts is compatible with AMD module loaders (such as RequireJS). The following example demonstrates loading Highcharts along with two modules from our CDN using RequireJS.
<html>
<head>
<script src="require.js"></script>
<script>
require.config({
packages: [{
name: 'highcharts',
main: 'highcharts'
}],
paths: {
// Change this to your server if you do not wish to use our CDN.
'highcharts': 'https://code.highcharts.com'
}
});
</script>
</head>
<body>
<div id="container"></div>
<script>
require([
'highcharts',
'highcharts/modules/exporting',
'highcharts/modules/accessibility'
], function (Highcharts) {
// This function runs when the above files have been loaded.
// Create a test chart.
Highcharts.chart('container', {
series: [{
data: [1,2,3,4,5]
}]
});
});
</script>
</body>
</html>
Highcharts is using an UMD module pattern, as a result it has support for CommonJS. The following examples presumes you are using npm to install Highcharts, see Download and install Highcharts for more details.
// Load Highcharts
var Highcharts = require('highcharts');
// Alternatively, this is how to load Highstock. Highmaps and Highcharts Gantt are similar.
// var Highcharts = require('highcharts/highstock');
// Load the exporting module, and initialize it.
require('highcharts/modules/exporting')(Highcharts);
// Generate the chart
Highcharts.chart('container', {
// options - see https://api.highcharts.com/highcharts
});
Since Highcharts supports ES6 (ESM - ECMAScript modules) and UMD (AMD, CommonJS), it can be also loaded as a module with the use of transpilers. Two common transpilers are Babel and TypeScript. The following examples presumes you are using npm to install Highcharts, see Download and install Highcharts for more details.
import Highcharts from 'highcharts';
// Alternatively, this is how to load Highstock. Highmaps and Highcharts Gantt are similar.
// import Highcharts from 'highcharts/highstock';
// Load the exporting module.
import Exporting from 'highcharts/modules/exporting';
// Initialize exporting module. (CommonJS only)
Exporting(Highcharts);
// Generate the chart
Highcharts.chart('container', {
// options - see https://api.highcharts.com/highcharts
});
import Highcharts from 'highcharts';
// Alternatively, this is how to load Highstock. Highmaps and Highcharts Gantt are similar.
// import Highcharts from 'highcharts/highstock';
// Load the exporting module.
import Exporting from 'highcharts/modules/exporting';
// Initialize exporting module. (CommonJS only)
Exporting(Highcharts);
// Generate the chart
Highcharts.chart('container', {
// options - see https://api.highcharts.com/highcharts
});
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "umd",
"moduleResolution": "node"
}
}
// Load modules the ES6 way
import Highcharts from 'https://code.highcharts.com/es-modules/masters/highcharts.src.js';
import 'https://code.highcharts.com/es-modules/masters/modules/exporting.src.js';
// Generate the chart
Highcharts.chart('container', {
// options - see https://api.highcharts.com/highcharts
});
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"baseUrl": "./",
"module": "es6",
"moduleResolution": "node",
"target": "es6",
"paths": {
"https://code.highcharts.com/es-modules/masters/*.src.js": [
"node_modules/highcharts/*.src"
]
}
}
}
If you want to do modifications to Highcharts or fix issues, you may build your own files. Highcharts uses Gulp as the build system. After npm install
in the root folder, run gulp
, which will set up a watch task for the JavaScript and SCSS files. Now any changes in the files of the /js
or /css
folders will result in new files being built and saved in the code
folder. Other tasks are also available, like gulp lint
.
npm install
gulp
Run in this highcharts
repository the doc generator with
npx gulp jsdoc-watch
, which also starts a new server with the generated API
documentation.
FAQs
JavaScript charting framework
We found that @uplab/highcharts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.