score:27
The highcharts-more
npm package is deprecated - there's no need to install it. Just make sure highcharts
is installed.
Solution:
import * as Highcharts from 'highcharts';
import more from 'highcharts/highcharts-more';
more(Highcharts);
score:-1
Using add-highcharts-modules and I have updated it to spider chart
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { NgModule, Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ChartModule } from 'angular2-highcharts';
@Component({
selector: 'my-app',
styles: [`
chart {
display: block;
}
`],
template: `<chart [options]="options"></chart>`
})
class AppComponent {
constructor() {
this.options = {
chart: {
polar: true,
type: 'line'
},
title: {
text: 'Budget vs spending',
x: -80
},
pane: {
size: window.innerWidth * .80
},
xAxis: {
categories: ['Sales', 'Marketing', 'Development', 'Customer Support',
'Information Technology', 'Administration'],
tickmarkPlacement: 'on',
lineWidth: 0
},
yAxis: {
gridLineInterpolation: 'polygon',
lineWidth: 0,
min: 0
},
tooltip: {
shared: true,
pointFormat: '<span style="color:{series.color}">{series.name}: <b>${point.y:,.0f}</b><br/>'
},
legend: {
align: 'right',
verticalAlign: 'top',
y: 70,
layout: 'vertical'
},
series: [{
name: 'Allocated Budget',
data: [43000, 19000, 60000, 35000, 17000, 10000],
pointPlacement: 'on'
}, {
name: 'Actual Spending',
data: [50000, 39000, 42000, 31000, 26000, 14000],
pointPlacement: 'on'
}]
};
};
options: Object;
}
@NgModule({
imports: [
BrowserModule,
ChartModule.forRoot(
require('highcharts'),
require('highcharts/modules/exporting'),
require('highcharts/highcharts-more'),
)
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);
score:32
You don't need to use an external module to use highcharts or any of the extension packages in your Angular app. All you need to do npm install --save highcharts
and then in your component along with the other imports include:
// HIGHCHARTS
import * as Highcharts from 'highcharts';
declare var require: any;
require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts);
require('highcharts/modules/heatmap')(Highcharts);
require('highcharts/modules/treemap')(Highcharts);
require('highcharts/modules/funnel')(Highcharts);
let chartHolder;
and example usage:
ngOnInit() {
chartHolder = Highcharts.chart('container', newOptions);
}
and you can update the chart options:
updateChart(newOptions) {
chartHolder.update(newOptions);
}
Source: stackoverflow.com
Related Query
- how to import highcharts with webpack and babel
- how to import highcharts offline-exporting in typescript
- How do i add mouse wheel code in Angular2 highcharts in typescript
- how to display 2 same highcharts without duplicate the code
- How to edit tooltip in Highcharts C# code
- How to properly import HighCharts with Backbone-boilerplate in an ECMAScript 2015 way?
- How to Load More Than One CSV Using Highcharts Data Module
- how to use highcharts tooltip formatter in python code
- how to import highcharts sub modules in React app
- How do you get Highcharts to scale up image contents rather than add more details?
- how do you put more granular labels on yAxis in highcharts
- Angular 11 - How to import array data into highcharts
- How to select columns (across more panes) in Highcharts / Highstocks
- How to use highcharts bubble to display more than 3 columns data?
- How do you change the height value when more items are added to highcharts dynamically?
- Highcharts Heatmap - How to get blocks next to each other when separated by more then '1' in value
- How to have multiple highcharts with different series data in vuejs without repeating code
- How to change HighCharts tooltop to show more details
- Highcharts Highmaps How to import data from google spreadsheet
- Highcharts - How to show more than 30 columns side by side
- How to make this code more simple or shorten?
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- how do i link my sqlite(PDO) databse data to highcharts code
- how can I use rangeselector and navigation in highcharts in the given code
- How to change code in "Pie Chart" in HighCharts
- how to import JSON data into VS2012 to plot highcharts
- How to get highcharts dates in the x axis?
- How to create a column range chart in Highcharts using range and navigator functions?
- How to remove button from Highcharts
- How can I get access to a Highcharts chart through a DOM-Container?
More Query from same tag
- Draw vertical line when two lines cross in Highcharts
- Start x axis at minimum value
- Highcharts drilldown json from php mysql
- Highstock Series Compare To Previous Day
- Highcharts: How to make Tooltip position to be visible in the Viewport
- Convert datetime to timestamp milliseconds adding +1 month
- Trouble parsing XML into JSON - Javascript
- Javascript - How do I get the first element in an array?
- HIghcharts column tickmarks not aligned to column
- High charts Tool tip is not supporting in IE10 and IE8 and Mozilla with more data
- HighCharts Axis Label Encoding
- Dynamic High Charts in Angular
- Highchart chart synchronisation showing console error while using highstock.js
- how do I pass the Ajax response data in my highcharts
- How to fix this error Type 'number' has no properties in common with type 'XrangePointOptionsObject'
- Highchart save chart image using cURL
- How to create a canonical 3d plot in Highcharts?
- How to use jQuery when redrawing a chart?
- Scope not updating UI inside the success function of http.get
- Highcharts in angular scope problem with passing class reference
- Chart series point added not sync with X axis
- Highcharts Stacked Area: legend hover event
- Highstock tooltip Formatter not able to display extra data
- How to add annotation text to x and y axis in Highcharts?
- Shrink browser content to browser window size
- Reduce the number of data points on X axis in highcharts
- Download image from SVG with Jersey
- HighStock: data series missing when zoom to larger range
- Second Y-Axis in Highcharts linked to specific data series
- Changing month names of a highchart plot