
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@highcharts/controls
Advanced tools
GUI controls for manipulating Highcharts charts, Grid, and Dashboards options on the fly.
Load the module file from a CDN or your own server
<script type="module" src="https://cdn.jsdelivr.net/npm/@highcharts/controls@0.7.0"></script>
Or
import Controls from 'https://cdn.jsdelivr.net/npm/@highcharts/controls@0.7.0';
<!DOCTYPE html>
<html>
<head>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@highcharts/controls@0.7.0"></script>
</head>
<body>
<div id="container"></div>
<script>
Highcharts.chart('container', {
title: { text: 'My Chart' },
series: [{
data: [1, 2, 3, 4, 5]
}]
});
</script>
<highcharts-controls target="#container">
<highcharts-group header="Legend Settings">
<highcharts-control
type="boolean"
path="legend.enabled"
value="true">
</highcharts-control>
<highcharts-control
type="select"
path="legend.align"
options="left,center,right"
value="center">
</highcharts-control>
<highcharts-control
type="number"
path="legend.x">
</highcharts-control>
<highcharts-control
type="color"
path="legend.backgroundColor"
value="#FFEEAA">
</highcharts-control>
</highcharts-group>
</highcharts-controls>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@highcharts/controls@0.7.0"></script>
</head>
<body>
<div id="container"></div>
<div id="controls-container"></div>
<script type="module">
// Create a chart
Highcharts.chart('container', {
title: { text: 'My Chart' },
series: [{
data: [1, 2, 3, 4, 5]
}]
});
// Add controls
HighchartsControls.controls('controls-container', {
controls: [
{
group: 'Legend Settings',
controls: [
{
// Type is optional - automatically deduced from value
path: 'legend.enabled',
value: true
},
{
path: 'legend.align',
options: ['left', 'center', 'right'],
value: 'center'
},
{
path: 'legend.x',
min: -100,
max: 100,
step: 10,
value: 0
},
{
path: 'legend.backgroundColor',
value: '#FFEEAA'
}
]
}
]
});
</script>
</body>
</html>
By default, the Highcharts Controls renders in an inline-block element, shrinking
to fit its content. This works well for compact controls. For wider layouts that
should take 100% of the parent's width, set the display option to 'block'.
Web Components:
<highcharts-controls display="block">
<!-- controls here -->
</highcharts-controls>
JavaScript API:
HighchartsControls.controls('controls-container', {
display: 'block', // or 'inline-block' (default)
controls: [
// ...
]
});
HighchartsControls.controls(container, options)Creates a controls instance.
Parameters:
container (string | HTMLElement) - The container element or element ID where controls will be renderedoptions (ControlsOptionsObject) - Configuration optionsReturns: Controls instance
interface ControlsOptionsObject {
target?: ControlTarget; // Target chart/grid (defaults to first chart)
injectCSS?: boolean; // Auto-inject CSS (defaults to true)
display?: 'block' | 'inline-block'; // Display mode (defaults to 'inline-block')
controls: Array<ControlParams | GroupParams>; // Array of control or group configurations
}
Controls can be organized into collapsible groups with headers:
interface GroupParams {
group: string; // Group header text
description?: string; // Optional description text
controls: ControlParams[]; // Controls within the group
collapsed?: boolean; // Initial collapsed state (default: false)
collapsible?: boolean; // Allow expand/collapse (default: false)
className?: string; // Custom CSS class
}
Example:
HighchartsControls.controls('controls-container', {
controls: [
{
group: 'Legend Settings',
description: 'Control the appearance and behavior of the chart legend.',
collapsible: true, // Enable expand/collapse
collapsed: false, // Start expanded
controls: [
{ path: 'legend.enabled', value: true },
{ path: 'legend.align', options: ['left', 'center', 'right'] }
]
},
{
group: 'Chart Settings',
collapsible: true, // Enable expand/collapse
collapsed: true, // Start collapsed
controls: [
{ path: 'chart.backgroundColor', value: '#FFFFFF' }
]
},
// Ungrouped controls can be mixed with groups
{ path: 'title.text', value: 'My Chart' }
]
});
Note: The type parameter is optional. If omitted, the library will automatically deduce the control type based on the value and other parameters:
boolean controlnumber controloptions array → select controlcolor controltext control (fallback)Toggle chart options on/off with a styled checkbox.
{
type: 'boolean',
path: 'legend.enabled', // Dot-separated path to option
value: true // Initial value (optional)
}
Select from predefined options with button group.
{
type: 'select',
path: 'legend.align',
options: ['left', 'center', 'right'], // Available options
value: 'center' // Initial selection (optional)
}
Adjust numeric values with a range slider. Supports length units like px, em, rem, and %.
{
type: 'number',
path: 'legend.x',
min: -100, // Minimum value (optional)
max: 100, // Maximum value (optional)
step: 10, // Step increment (optional, defaults to 1)
value: 0 // Initial value (optional, can be number or string with unit)
}
Unit Support:
The number control seamlessly handles length units commonly used in Highcharts:
// With em units (step defaults to 0.1 for em/rem)
{
type: 'number',
path: 'title.style.fontSize',
min: 0.5,
max: 3,
value: '1.5em' // Unit extracted from string value
}
// With percentage units
{
type: 'number',
path: 'chart.height',
min: 50,
max: 100,
value: '80%'
}
Default min/max (when not specified):
lineWidth or borderWidth: min: 0, max: 5x, y, offsetX, offsetY, or offset: min: -100, max: 100Unit behavior:
value string (e.g., '1.5em', '60px', '80%')em and rem units, step defaults to 0.1 if not specifiedChoose colors with a color picker and opacity control.
{
type: 'color',
path: 'chart.backgroundColor',
value: '#FFFFFF' // Initial color (optional)
}
Edit text values with a text input field.
{
type: 'text',
path: 'title.text',
value: 'My Chart Title' // Initial text (optional)
}
Add a visual separator (horizontal rule) between controls to group related functionality.
JavaScript API:
HighchartsControls.controls('controls-container', {
controls: [
{ path: 'legend.enabled', value: true },
{ path: 'legend.align', options: ['left', 'center', 'right'] },
{ type: 'separator' }, // Add separator
{ path: 'chart.backgroundColor', value: '#FFFFFF' }
]
});
Web Components:
<highcharts-controls>
<highcharts-control path="legend.enabled" value="true"></highcharts-control>
<highcharts-control path="legend.align" options="left,center,right"></highcharts-control>
<highcharts-separator></highcharts-separator>
<highcharts-control path="chart.backgroundColor" value="#FFFFFF"></highcharts-control>
</highcharts-controls>
Within groups:
{
group: 'Settings',
controls: [
{ path: 'legend.enabled', value: true },
{ type: 'separator' },
{ path: 'chart.backgroundColor', value: '#FFFFFF' }
]
}
When a control's value is null or undefined, each control type displays a distinct visual state to clearly indicate that no value has been set:
Note: Select controls automatically render as a dropdown when there are more than 3 options or the total string length of all options exceeds 24 characters. Otherwise, they display as a button group.
This typically happens if the value is not set, and the Controls are unable to
read the value from the target chart or grid. In some cases, chart or grid
defaults are null or undefined, indicating the behavior depends on other states.
<highcharts-controls>
<highcharts-control path="chart.inverted" type="boolean"></highcharts-control>
<highcharts-control path="legend.backgroundColor" type="color"></highcharts-control>
</highcharts-control>
When a user interacts with a control in nullish state (types text, clicks toggle, changes color, moves slider, or selects option), the visual nullish indicators are automatically removed and the control behaves normally.
CSS Classes:
hcc-control-nullish classhcc-control-boolean, hcc-control-color, hcc-control-number, hcc-control-select, hcc-control-text) for targeted styling<highcharts-controls>Container element for controls.
Attributes:
target (optional) - CSS selector for target chart container (e.g., "#container")inject-css (optional) - Set to "false" to disable automatic CSS injectiondisplay (optional) - Display mode: "block" or "inline-block" (default: "inline-block")Example:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@highcharts/controls@0.7.0/css/controls.css" />
<highcharts-controls target="#my-chart" inject-css="false">
<!-- controls here -->
</highcharts-controls>
<highcharts-group>Group controls under a collapsible header. Must be a child of <highcharts-controls>.
Attributes:
header (required) - Header text for the groupcollapsed (optional) - Set to "true" to start collapsedcollapsible (optional) - Set to "true" to enable expand/collapse (default: false)class (optional) - Custom CSS classChild Elements:
<highcharts-group-description> (optional) - Description text displayed below the header. Supports HTML markup.<highcharts-control> - Individual controls within the group<highcharts-separator> - Visual separator between controlsNote: When using <highcharts-group-description> and injectCSS is set to true (default), it's recommended to add this to your page CSS to avoid a flash of unstyled content (FOUC):
highcharts-group-description,
highcharts-separator {
display: none;
}
Example:
<highcharts-controls target="#container">
<highcharts-group header="Legend Settings" collapsible="true">
<highcharts-group-description>
Control the appearance and behavior of the chart legend.
</highcharts-group-description>
<highcharts-control path="legend.enabled" value="true"></highcharts-control>
<highcharts-control path="legend.align" options="left,center,right"></highcharts-control>
</highcharts-group>
<highcharts-group header="Chart Settings" collapsible="true" collapsed="true">
<highcharts-control path="chart.backgroundColor" value="#FFFFFF"></highcharts-control>
</highcharts-group>
<!-- Ungrouped controls -->
<highcharts-control path="title.text" value="My Chart"></highcharts-control>
</highcharts-controls>
<highcharts-separator>Insert a horizontal separator line between controls. Must be a child of <highcharts-controls> or <highcharts-group>.
Attributes: None
Example:
<highcharts-controls target="#container">
<highcharts-control path="legend.enabled" value="true"></highcharts-control>
<highcharts-control path="legend.align" options="left,center,right"></highcharts-control>
<highcharts-separator></highcharts-separator>
<highcharts-control path="chart.backgroundColor" value="#FFFFFF"></highcharts-control>
<highcharts-control path="title.text" value="My Chart"></highcharts-control>
</highcharts-controls>
<highcharts-control>Individual control element. Must be a child of <highcharts-controls>.
Attributes:
type (required) - Control type: "boolean", "select", "number", "color", or "text"path (required) - Dot-separated path to chart option (e.g., "legend.enabled")value (optional) - Initial valueoptions (required for select) - Comma-separated list of optionsmin (optional for number) - Minimum value for range slidermax (optional for number) - Maximum value for range sliderstep (optional for number) - Step increment for range sliderExamples:
<!-- Boolean -->
<highcharts-control
type="boolean"
path="legend.enabled"
value="true">
</highcharts-control>
<!-- Select -->
<highcharts-control
type="select"
path="legend.align"
options="left,center,right"
value="center">
</highcharts-control>
<!-- Number -->
<highcharts-control
type="number"
path="legend.x"
min="-100"
max="100"
step="10">
</highcharts-control>
<!-- Number with units -->
<highcharts-control
type="number"
path="title.style.fontSize"
min="0.5"
max="3"
value="1.5em">
</highcharts-control>
<highcharts-control
type="number"
path="chart.marginTop"
min="0"
max="200"
value="60px">
</highcharts-control>
<!-- Color -->
<highcharts-control
type="color"
path="chart.backgroundColor"
value="#FFFFFF">
</highcharts-control>
<!-- Text -->
<highcharts-control
type="text"
path="title.text"
value="My Chart Title">
</highcharts-control>
ISC
Torstein Hønsi
FAQs
GUI controls for Highcharts charts, Grid and Dashboards options
The npm package @highcharts/controls receives a total of 6 weekly downloads. As such, @highcharts/controls popularity was classified as not popular.
We found that @highcharts/controls demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.