Angular Highcharts:3D饼状图(3D Pie Chart)
现在我们来看一个3D饼状图的例子
配置
option3D
将饼图类型配置为基于3D,Options3D设置启用的3D选项。
chart: { options3d: { enabled: true, alpha: 15, beta: 15, depth: 50, viewDistance: 25 } }
例子
app.component.ts
import { Component } from '@angular/core'; import * as Highcharts from 'highcharts'; import highcharts3D from 'highcharts/highcharts-3d.src'; highcharts3D(Highcharts); @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { highcharts = Highcharts; chartOptions = { chart : { type:'pie', options3d: { enabled: true, alpha: 45, beta: 0 } }, title : { text: 'Browser market shares at a specific website, 2014' }, tooltip : { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions : { pie: { allowPointSelect: true, cursor: 'pointer', depth: 35, dataLabels: { enabled: true, format: '<b>{point.name}%</b>: {point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor)|| 'black' } } } }, series : [{ type: 'pie', name: 'Browser share', data: [ ['Firefox', 45.0], ['IE', 26.8], { name: 'Chrome', y: 12.8, sliced: true, selected: true }, ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ] }] }; }
结果