3D Stacked Column Interactive Chart in Angular using HighChart

In this article, we saw how to draw 3d Stacked Column Interactive charts in angular using HighChart. In the last article, we saw a 3D Column Column chart in HighChart. In this article, we can create a stacked column rotate(Interactive) chart. In this article, we have taken an example of the consumption of the fruit by category men and women.
For drawing the chart First, we need to install High chart node modules in our application.

npm install highcharts --save
npm install highcharts-angular --save

After installing module lets add a module in our app.module.ts file.

import { HighchartsChartModule } from 'highcharts-angular';
imports:      [ ..., HighchartsChartModule],

After adding a module in the app.module file we can use it in our component to draw the chart. Let’s create app.component.ts file and add import highchat module using “import * as Highcharts from ‘highcharts’;” then assign options and values to the chart in this chart we need to chart type as “column” and adding series data we need to pass the categories fruits data and pass the stack name in json format to draw the data. In last article we show for 3D chart option enable we need to import “highcharts-3d” in our component. How to import “highcharts-3d” modules display in below code.

import highcharts3D from 'highcharts/highcharts-3d';

We need 3 parameters(alpha,beta,depth) to chnage the chart interactive chart.
Below is the full code for component and the html files.

import { Component, VERSION ,OnInit } from '@angular/core';
import * as Highcharts from 'highcharts';

declare var require: any;
const More = require('highcharts/highcharts-more');

import Histogram from 'highcharts/modules/histogram-bellcurve';

import highcharts3D from 'highcharts/highcharts-3d';

import Cylinder from 'highcharts/modules/cylinder';

const Exporting = require('highcharts/modules/exporting');

const ExportData = require('highcharts/modules/export-data');

const Accessibility = require('highcharts/modules/accessibility');
import * as newdata from './data';

  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
export class AppComponent  implements OnInit{

  public activity;
  public xData;
  public label;

  public alpha:number;
  public beta:number;
  public depth:number;
  constructor() {

  this.alpha = 15;
  this.beta = 15;
  this.depth = 40;

    this.options = {
    chart: {
        type: 'column',
        options3d: {
            enabled: true,
            alpha: this.alpha,
            beta: this.beta ,
            viewDistance: 25,
            depth: this.depth

    title: {
        text: 'Total fruit consumption, grouped by gender'

    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
        labels: {
            skew3d: true,
            style: {
                fontSize: '16px'

    yAxis: {
        allowDecimals: false,
        min: 0,
        title: {
            text: 'Number of fruits',
            skew3d: true

    tooltip: {
        headerFormat: '{point.key}
', pointFormat: '\u25CF {series.name}: {point.y} / {point.stackTotal}' }, plotOptions: { column: { stacking: 'normal', depth: 40 } }, series: [{ name: 'Jack', data: [5, 3, 4, 7, 2], stack: 'male' }, { name: 'Walter', data: [3, 4, 4, 2, 5], stack: 'male' }, { name: 'Jane', data: [2, 5, 6, 2, 1], stack: 'female' }, { name: 'Jill', data: [3, 0, 4, 4, 3], stack: 'female' }] }; } ngOnInit(){ Highcharts.chart('container', this.options); } onChange(val,type){ if(type == 'alpha'){ this.options.chart.options3d.alpha = val; } if(type == 'beta'){ this.options.chart.options3d.beta = val; } if(type == 'depth'){ this.options.chart.options3d.depth = val; } Highcharts.chart('container', this.options); } }

<h1 style="text-align:center">3D Interactive Stacked Chart in Angular</h1>
<div class="form-inline">
  <label for="email">Alpha:</label>
  <input type="number" class="form-control" [(ngModel)]="alpha" (ngModelChange)="onChange($event,'alpha')">
  <label for="pwd">Beta:</label>
  <input type="number" class="form-control" [(ngModel)]="beta" (ngModelChange)="onChange($event,'beta')">
   <label for="pwd">Depth:</label>
  <input type="number" class="form-control" [(ngModel)]="depth" (ngModelChange)="onChange($event,'depth')">
<div id="container"></div>

Below is the full embeded code for the 3D Stacked Column Interactive chart using Highchart you can easily used in your application.

Spread the love
  • 2