In this article, we saw how to draw 3d charts in angular using HighChart. We already discuss on how to create a simple pie chart and donut chart. In this article we draw the same chart but in 3d dimensions. For the pie, chart lets take a sample example we used browser stack over a year.
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'; ... @NgModule({ 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 “Pie” and adding series data we need to pass the browser name and percentage in json format to draw the data. 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';
highcharts3D(Highcharts);
Below is the full embeded code for the 3D pie chart using Highchart you can easily used in your application.
Below is code for the 3d donut chart.
Below is the full embeded code for the 3D Donut chart using Highchart you can easily used in your application.
6 2
No Responses