English 中文(简体)
Table Chart
  • 时间:2024-12-22

Angular Google Charts - Table Charts


Previous Page Next Page  

Table chart helps in rendering a table which can be sorted and paged. Table cells can be formatted using format strings, or by directly inserting HTML as cell values. Numeric values are right-apgned by default; boolean values are displayed as check marks or cross marks. Users can select single rows either with the keyboard or the mouse. Column headers can be used for sorting. The header row remains fixed during scrolpng. The table fires events corresponding to user interaction.

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 Table Chart.

Configurations

We ve used Table class to show a Table chart.

type =  Table ;

Example

app.component.ts

import { Component } from  @angular/core ;
@Component({
   selector:  app-root ,
   templateUrl:  ./app.component.html ,
   styleUrls: [ ./app.component.css ]
})
export class AppComponent {
   title = "";
   type =  Table ;
   data = [
      [ Mike ,  {v: 10000, f:  $10,000 }, true],
      [ Jim ,   {v:8000,   f:  $8,000 },  false],
      [ Apce , {v: 12500, f:  $12,500 }, true],
      [ Bob ,   {v: 7000,  f:  $7,000 },  true]
   ];
   columnNames = ["Name", "Salary","Full Time Employee"];
   options = { 
     alternatingRowStyle:true,
     showRowNumber:true  
   };
   width = 550;
   height = 400;
}

Result

Verify the result.

Table Chart Advertisements