walking_the_cow
walking_the_cow

Reputation: 491

Trouble importing Highcharts Gauge with NPM/Webpack

I have HighCharts inside a website using vanilla JS, I use webpack/npm to load and import modules. I am able to use the Spline and Column charts just fine. I tried adding the standard Gauge chart (shown here), and received the following error.

Uncaught Error: Highcharts error #17: www.highcharts.com/errors/17/?missingModuleFor=gauge

When searching for the module in the node_modules/highcarts/modules folder, I cannot find it.

Here is how I am importing HighCharts:

var Highcharts = require('highcharts');

Here is how I am calling the chart:

 $('#speedometerContainer').highcharts({
     chart: {
         type: 'gauge',
         plotBackgroundColor: null,
         plotBackgroundImage: null,
         plotBorderWidth: 0,
           plotShadow: false
     },...

This is working for both column and spline chart types.

Upvotes: 0

Views: 436

Answers (1)

walking_the_cow
walking_the_cow

Reputation: 491

I was able to import highcharts-more, which contained the Gauge I needed.

var Highcharts = require('highcharts');
require('highcharts/highcharts-more')(Highcharts);

Upvotes: 1

Related Questions