question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to display a gauge

See original GitHub issue

Hi all,

I’m trying to display a highcharts solidgauge and I’m getting error #17.

My typescript looks like this

import {CHART_DIRECTIVES} from "angular2-highcharts/index";constructor() { this.options = { chart: { type: 'solidgauge' }, series: [ { name: 'test', data: [1] } ] }; }

and my html look like that

<chart [options]="options"></chart>

so nothing fancy.

BTW running these options in a JSFiddle from the Highcharts website works.

Any idea what I’m missing or doing wrong? Thanks for the help!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
PhilippeOberticommented, May 20, 2016

so after a long fight I found a way to get it working. here is how (for those that would be in the same situation):

in the vendor.ts file you need to add those 2 lines

import 'highcharts/highcharts-more';
import 'highcharts/modules/solid-gauge';

right after the line where you import highchart (or highstock in my case)

import 'highcharts/highstock';

then in my main.ts file (angular2) I needed to require those 2:

require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts);

in the component ts you want to run the gauge import the CHART_DIRECTIVES as explained in the readme in the component html use it as follow (no type):

<chart [options]="options"></chart>

I’m having some position issues (I think due to the fact I’m using css flex and hightchart is in relative position) but at least it is displayed with no errors!

hope this helps someone!

1reaction
khraibanicommented, Jan 24, 2017

@dndam thanks for pointing me into the right direction the above didn’t work with webpack.

I had to use the below:

declare var require: any;
import { ChartModule } from 'angular2-highcharts';
import * as ChartModuleMore from 'highcharts/highcharts-more';
const HCSoldGauge = require('highcharts/modules/solid-gauge');
import * as Highcharts from "highcharts";
ChartModuleMore(Highcharts);
HCSoldGauge(Highcharts);

Hope that help someone else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visualization: Gauge | Charts - Google Developers
Overview. A gauge with a dial, rendered within the browser using SVG or VML. ... In the example above, simple HTML is used...
Read more >
What is A Gauge Chart? Definition, Best Practices & Examples
A gauge chart, also known as dial or speedometer chart, is a data visualization type used to display a single value of data...
Read more >
How to Create a SPEEDOMETER Chart [Gauge] in Excel
Steps to Create a SPEEDOMETER in Excel · First of all, go to Insert Tab ➜ Charts ➜ Doughnut Chart (with this you'll...
Read more >
Working with gauges | Data Visualizations | Documentation
To set up states for a gauge on a dashboard or other view, select the gauge on the canvas, go to the toolbar,...
Read more >
Advanced Excel - Gauge Chart - Tutorialspoint
A Gauge Chart shows the minimum, the maximum and the current value depicting how far from the maximum you are. Alternatively, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found