开发学院

您的位置:首页>教程>正文

教程正文

Angular Highcharts:散点图(Scatter Charts)

  下面给出了一个基本散点图的例子。

配置

series

  将图表类型配置为基于散点图。series.type决定图表的类型。这里,默认值是“line”。

var chart = {
   type: 'scatter',
   zoomType: 'xy'
};

 

例子

app.component.ts

import { Component } from '@angular/core';
import * as Highcharts from 'highcharts';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
   highcharts = Highcharts;
   chartOptions = {         
      title : {
         text: 'Scatter plot'   
      },      
      series : [{
         type: 'scatter',
         zoomType:'xy',
         name: 'Browser share',
         data: [ 1, 1.5, 2.8, 3.5, 3.9, 4.2 ]
      }]
   };
}

结果

angular_highcharts_scatter_basic.jpg