Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
highcharts
Advanced tools
The highcharts npm package is a charting library that allows developers to create interactive and responsive charts for web applications. It supports a wide range of chart types and features, including line, area, bar, pie, scatter, and more complex types like stock, maps, and Gantt charts. Highcharts is designed to work across all modern browsers and is compatible with various frameworks and platforms.
Line Charts
This code sample demonstrates how to create a basic line chart using Highcharts, showing the growth of solar employment in various sectors over time.
{"title": {"text": 'Solar Employment Growth by Sector, 2010-2016'},"subtitle": {"text": 'Source: thesolarfoundation.com'},"yAxis": {"title": {"text": 'Number of Employees'}},"legend": {"layout": 'vertical',"align": 'right',"verticalAlign": 'middle'},"plotOptions": {"series": {"label": {"connectorAllowed": false},"pointStart": 2010}},"series": [{"name": 'Installation',"data": [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]},{"name": 'Manufacturing',"data": [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]},{"name": 'Sales & Distribution',"data": [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]},{"name": 'Project Development',"data": [null, null, 7988, 12169, 15112, 22452, 34400, 34227]},{"name": 'Other',"data": [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]}],"responsive": {"rules": [{"condition": {"maxWidth": 500},"chartOptions": {"legend": {"layout": 'horizontal',"align": 'center',"verticalAlign": 'bottom'}}}]}}
Pie Charts
This code sample shows how to create an interactive pie chart with Highcharts, displaying browser market shares with options for selecting and slicing portions of the pie.
{"chart": {"plotBackgroundColor": null,"plotBorderWidth": null,"plotShadow": false,"type": 'pie'},"title": {"text": 'Browser market shares in January, 2018'},"tooltip": {"pointFormat": '{series.name}: <b>{point.percentage:.1f}%</b>'},"accessibility": {"point": {"valueSuffix": '%'}},"plotOptions": {"pie": {"allowPointSelect": true,"cursor": 'pointer',"dataLabels": {"enabled": true,"format": '<b>{point.name}</b>: {point.percentage:.1f} %'}}},"series": [{"name": 'Brands',"colorByPoint": true,"data": [{"name": 'Chrome',"y": 61.41,"sliced": true,"selected": true},{"name": 'Internet Explorer',"y": 11.84},{"name": 'Firefox',"y": 10.85},{"name": 'Edge',"y": 4.67},{"name": 'Safari',"y": 4.18},{"name": 'Other',"y": 7.05}]}]}
3D Charts
This code sample illustrates how to create a 3D column chart using Highcharts, which adds a new dimension to the data visualization for better analysis and presentation.
{"chart": {"type": 'column',"options3d": {"enabled": true,"alpha": 15,"beta": 15,"viewDistance": 25,"depth": 40}},"title": {"text": 'Total fruit consumption, grouped by gender'},"plotOptions": {"column": {"depth": 25}},"series": [{"name": 'John',"data": [2, 3, 0, 4, 5]},{"name": 'Joe',"data": [1, 1, 4, 7, 2]}]}
Chart.js is a popular open-source charting library that is lightweight and offers a simple API. It supports eight chart types, including line, bar, radar, doughnut, pie, polar area, bubble, and scatter. Compared to Highcharts, Chart.js is more focused on simplicity and ease of use, but it may not offer as many features or as much flexibility for complex visualizations.
D3.js is a powerful and flexible library for creating custom data visualizations using web standards. It provides a low-level approach, giving developers more control over the final visualization. While Highcharts offers a high-level API for creating standard chart types easily, D3.js requires more coding but allows for more unique and intricate visualizations.
ECharts is an open-source charting library that offers a rich set of chart types and options. It is capable of producing interactive and complex charts and maps. ECharts is similar to Highcharts in terms of functionality but is known for its strong support for mobile devices and ease of integration with the Baidu Map service.
amCharts is a comprehensive charting library that provides a wide array of chart types and features, including 3D charts, gauge charts, and timelines. It is comparable to Highcharts in terms of its feature set and is known for its user-friendly interface and extensive documentation. However, amCharts uses a different licensing model, which may be a consideration for some projects.
Highcharts is a JavaScript charting library based on SVG rendering. This project includes Stock, the financial charting package, the Maps package for geo maps and the Gantt package.
This package is intended for supporting client-side JavaScript charting through bundlers like Parcel or Webpack and environments like Babel or TypeScript. If you intend to generate static charts on the server side, use the Highcharts node.js Export Server instead.
Please note that commercial use of Highcharts requires a commercial license. For testing and demonstration purposes (POC), Highcharts can be used free of charge. Educational and personal projects are qualified for a free license. Read more about licenses in the Highcharts shop.
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
See highcharts documentation for installing the nightly build.
Note that we do not recommend the use of the nightly build in production environments as it may contain bugs and is not considered stable.
npm install --save highcharts/highcharts-dist#nightly
See Bower documentation on how to get started with Bower.
bower install highcharts
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 Highcharts Stock. The Maps and Gantt
// packages 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 CommonJS, it can be loaded as an ES6 module with the use of transpilers. Two common transpilers are Babel and TypeScript. These have different interpretations of a CommonJS module, which affects your syntax. 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 Highcharts Stock. The Maps and Gantt
// packages are similar.
// import Highcharts from 'highcharts/highstock';
// Load the exporting module.
import Exporting from 'highcharts/modules/exporting';
// Initialize exporting module.
Exporting(Highcharts);
// Generate the chart
Highcharts.chart('container', {
// options - see https://api.highcharts.com/highcharts
});
import * as Highcharts from 'highcharts';
// Alternatively, this is how to load Highcharts Stock. The Maps and Gantt
// packages are similar.
// import Highcharts from 'highcharts/highstock';
// Load the exporting module.
import * as Exporting from 'highcharts/modules/exporting';
// Initialize exporting module.
Exporting(Highcharts);
// Generate the chart
Highcharts.chart('container', {
// options - see https://api.highcharts.com/highcharts
});
FAQs
JavaScript charting framework
The npm package highcharts receives a total of 1,034,746 weekly downloads. As such, highcharts popularity was classified as popular.
We found that highcharts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.