Angular Google Charts - Basic Sankey Chart



Following is an example of a basic Sankey Chart.

We have already seen the configurations used to draw a chart in Google Charts Configuration Syntax chapter. Now, let us see an example of a basic Sankey Chart.

Configurations

We've used Sankey value to show Sankey based chart.

type = ChartType.Sankey;

Example - Usage of Sankey Chart

app.ts

import { Component, signal } from '@angular/core';
import { ChartType, GoogleChart } from 'angular-google-charts';

@Component({
   selector: 'app-root',
   imports: [GoogleChart],
   templateUrl: './app.html',
   styleUrl: './app.css'
})
export class App {
   protected readonly title = signal('google-charts-app');
   type = ChartType.Sankey;
   data = [
      ["Brazil","Portugal",5],
      ["Brazil","France",1],
      ["Brazil","Spain",1],
      ["Brazil","England",1],
      ["Canada","Portugal",1],
      ["Canada","France",5],
      ["Canada","England",1],
      ["Mexico","Portugal",1], 
      ["Mexico","France",1],
      ["Mexico","Spain",5],
      ["Mexico","England",1], 
      ["USA","Portugal",1], 
      ["USA","France",1],
      ["USA","Spain",1],
      ["USA","England",5]
   ];
   columnNames = ['From', 'To','Weight'];
   options = {
   };
   width = 550;
   height = 400;
}

Result

Verify the result.

Basic Sankey Chart
angular_googlecharts_sankey_charts.htm
Advertisements