Socket
Book a DemoInstallSign in
Socket

@folkehelseinstituttet/angular-highcharts

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@folkehelseinstituttet/angular-highcharts

_An opinionated wrapper to the official minimal [Highcharts wrapper for Angular](https://github.com/highcharts/highcharts-angular)_

latest
Source
npmnpm
Version
6.4.0
Version published
Maintainers
4
Created
Source

FHI Angular Highcharts

An opinionated wrapper to the official minimal Highcharts wrapper for Angular

Dependencies

FHI Angular HighchartsFHI Angular ComponetsHighchartsHighcharts Angular
6611.44.0
5511.44.0
>4.1411.44.0
>=3.1 <=4.1411.44.0
34.011.14.0
23.111.14.0
1-11.14.0
0.7-11.13.1.2
0.6-10.3.33.1
0.5-10.3.33.1
0.4-10.3.33.1
0.3-10.3.33.1
0.2-10.3.33.1
0.1-10.33

For more dependencies see peerDependencies in fhi-angular-components/package.json

Get started

Install

Install with npm: npm install @folkehelseinstituttet/angular-highcharts

Add to app

After installing the package and all dependencies, add the following code to your app:

// In global css-file (usually style.scss)
@import '@folkehelseinstituttet/angular-highcharts/styles/import/all';
// In a standalone component or a shared module
import { FhiAngularHighchartsModule } from '@folkehelseinstituttet/angular-highcharts';
...
  imports: [FhiAngularHighchartsModule]
...
// In a component (.ts)
import { FhiDiagramOptions, FhiDiagramSerie, FhiDiagramTypeIds } from '@folkehelseinstituttet/angular-highcharts';
...
  data: FhiDiagramSerie[] = [...];
  diagramOptions: FhiDiagramOptions = {
    title: 'Diagram title',
    data: data,
    diagramTypeId: 'line'
  };
...
<!-- In a template -->
<fhi-angular-highcharts [diagramOptions]="diagramOptions"></fhi-angular-highcharts>

Remove warnings

Highcharts gives some warnings due to the use of CommonJs as described here: https://github.com/highcharts/highcharts/issues/14183

From one of the comments:

Highcharts uses the UMD pattern which includes AMD, and it is probably detected by angular. On the other hand, I don't think that using an ES6 module pattern will change anything in the performance matters, you would have to import the entire highcharts core anyway, so technically it will be the same package - I would suggest ignoring the warning by adding Highcharts to the allowedCommonJsDependencies property in the angular.json file.

This is where allowedCommonJsDependencies is located in angular.json

...
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "allowedCommonJsDependencies": ["highcharts"],
...

API

Inputs

InputTypeDefaultRequiredDescription
[diagramOptions]FhiDiagramOptions-yesAll properties used to configure the diagram. See FhiDiagramOptions for details. NB! The object sent in to @Input diagramOptions needs to be reassigned for change detection to kick in.

Outputs

OutputEvent typeDescription
(diagramTypeNavigation)FhiDiagramTypeIdsIf diagram type navigation i visible, this event will fire on every navigation. Outputs an existing diagram type id.
(metadataButtonClick)voidWhen link to "Om dataene" is clicked.
(tableOrientationChange)FhiTableOrientationsWhen table orientation is changed.

Interface FhiDiagramOptions

PropertyTypeDefaultRequiredDescription
activeDiagramTypestring-noID to specify default diagram type. Values defined by enum FhiDiagramTypeIds
categoryAxisFhiDiagramCategoryAxis-noProperties related to the categoryAxis (x-axis). See FhiDiagramCategoryAxis for details.
controlsFhiDiagramControls-noProperties related to controls like navigation. See FhiDiagramControls for details.
descriptionstring-noA description of the diagram below the title.
footerFhiDiagramFooter-noProperties related to the footer below the diagram. See FhiDiagramFooter for details.
openSourcebooleantruenoIf false; the link to Highcharts.com disappears, AND LICENSE IS REQUIRED!
seriesFhiDiagramSerie[]-yesThe data used to render a diagram. See FhiDiagramSerie for details.
tableOrientationstring-noTranspose table by setting preferd orientation. Values defined by enum FhiTableOrientations
titlestring-yesThe title above the diagram.
unitsFhiDiagramUnit[]-noDecimal count, and metadata for y-axis and tooltip. See FhiDiagramUnit for details. Currently only diagram type table and columnAndLine supports two units, and only table supports more than two units. All other diagram types supports max 1 unit. See below this table for more info about using two or more units.

Using two units

Only diagram type table and columnAndLine supports two units, and to make it work:

  • Both units must have an id (see FhiDiagramUnit for more info about unit id).
  • At least two series must have unitId (with two unique values), and those ids must be present in the units array.

If not both criteria is met, both units will be ignored.

Also nice to know:

  • the first "unit" in "units" will always represent the left y-axis in the columnAndLine-chart
  • and series associated with the first "unit" in "units" will always become columns in the columnAndLine-chart

Using more than two units

Only diagram type table supports two units, and to make it work:

  • All units must have an id (see FhiDiagramUnit for more info about unit id).
  • If n units, at least n series must have unitId (with n unique values), and those ids must be present in the units array.

If not all criteria is met, all units will be ignored.

Interface FhiDiagramCategoryAxis

PropertyTypeDefaultRequiredDescription
titlestring-noCustom title for the categoryAxis (x-axis). Has no effect on diagram types without a categoryAxis.

Interface FhiDiagramControls

PropertyTypeDefaultRequiredDescription
downloadButtonobject-noProperties related to downloadButton.
downloadButton.showbooleanfalseyesWhether to show a popover menu which shows menuitems for all download formats.
fullScreenButtonobject-noProperties related to fullScreenButton.
fullScreenButton.showbooleanfalseyesWhether to show a button which opens the diagram in full screen.
metadataButtonobject-noProperties related to metadata button.
metadataButton.showbooleanfalseyesWhether to show a button with an event for custom navigation to your metadata.
navigationobject-noProperties related to diagram type navigaton. PS. navigation.items will always contain table, therefore no navigation.items.table as part of the items interface.
navigation.items.chartTypesstring[]-noChart types to show in diagram type navigaton defined by enum ChartTypeIds.
navigation.items.mapTypesstring[]-noMap types to show in diagram type navigaton defined by enum MapTypeIds.
navigation.showbooleanfalseyesWhether to show diagram type navigaton.
navigation.typestring-noID to specify which type of navigation to use defined by enum DiagramTypeNavIds.
tableOrientationButtonobject-noProperties related to tableOrientationButton.
tableOrientationButton.showbooleanfalseyesWhether to show a button which toggles rows/columns in the diagram type table. Not implemented yet, so has no effect atm.

Interface FhiDiagramFooter

PropertyTypeDefaultRequiredDescription
creditsobject-noProperties related to source ref.
credits.hrefstring-noLink to source ref.
credits.textstring-yesText to source ref.
disclaimerstring-noText at the bottom of the footer used to say something about uncertainty in the data shown in a diagram.
flagsFhiDiagramFlag[]-noList of all flags used in FhiDiagramSerie[]. See FhiDiagramFlag for details.
lastUpdatedstring-noText after label Sist oppdatert in footer. Free format, but dd.mm.yyyy is the most common one.

Interface FhiDiagramSerie

PropertyTypeDefaultRequiredDescription
dataFhiDiagramSerieData[]-yesThe individual data points in a serie. See FhiDiagramSerieData for details.
namestring | string[]-yesThe name of the serie as shown in the legend. NB! The type string is an formatted string; pipe (|) is beeing used as seperator between category names if more than one category name is concatenated to one single serie name. To avoid dependency on a given separator, use an array of category names instead. NB! series can not contain duplicate serie.name
stackstring-yesThis option allows for grouping series in a stacked chart. Only applies to diagramTypeId barStacked and columnStacked.
unitIdnumber | string-noUsed to associate the serie with a unit. This only works if unit.id (FhiDiagramUnit) is set, and value is equal to serie.unitId.

Interface FhiDiagramSerieData

FhiDiagramSerieData is a custum type for FHI Angular Highcharts, but it is based on the smallest possible subset of the chart.series.[chart type].data object as described under nr 3. here (line chart used as example).

PropertyTypeDefaultRequiredDescription
namestring-yesThe name of the data point as shown in the tooltip.
ynumber | string-yesThe value of the data point. If type is string the data point is treated as a flagged value.
dataPointIdstring-noId for each data point, used specifically for maps, and follows the standard set for Fylker set by SSB.

Interface FhiDiagramFlag

PropertyTypeDefaultRequiredDescription
labelstring-yesDescription of the flag, ie. Anonymized
symbolstring-yesSymbol representing the flag, ie. :.

Interface FhiDiagramUnit

PropertyTypeDefaultRequiredDescription
idnumber | string-noUsed to associate the unit with a serie. This only works if a serie.unitId (FhiDiagramSerie) is set, and value is equal to unit.id.
decimalsnumber-noThe decimal count. If undefined: the decimal count is same as in the source data (limited to 9 decimals because Highcharts tooltips fails if 10 decimals or more). If 0: no decimals. If [1..9]: max decimal count, but limited to the decimal count in the source data. If 10 or more, a warning will be given in the console, and 9 decimals will be used.
labelstring-yesThe vertical y-axis label, showing next to the axis line.
symbolstring-noSymbol before or after the value in both tooltip and y-axis.
positionstring-noWether the symbol i placed before or after the numbers in the diagram. Possible values: 'start' | 'end'
yAxisMaxnumber-noThe maximum value of the y-axis. If not set, the max value is automatically calculated. NB! Highcharts may override the value in some edge cases.
yAxisMinnumber-noThe minimum value of the y-axis. If not set, the min value is automatically calculated. NB! Highcharts may override the value in some edge cases.

Changelog

You find the changelog here.

Contribute

Read about how to contribute here

Demo

FAQs

Package last updated on 12 Nov 2025

Did you know?

Socket

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.

Install

Related posts