File

src/app/analysis/preference/field/field.component.ts

Implements

OnInit

Metadata

selector analysis-preference-field
styleUrls ./field.component.scss
templateUrl ./field.component.html

Index

Properties
Methods
Inputs

Constructor

constructor()

Inputs

data
Type : any

Methods

ngOnInit
ngOnInit()
Returns : void
onSelect
onSelect(event)
Parameters :
Name Optional
event No
Returns : void

Properties

colorScheme
Type : object
Default value : { domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA'] }
gradient
Default value : false
showLegend
Default value : false
showXAxis
Default value : true
showXAxisLabel
Default value : true
showYAxis
Default value : true
showYAxisLabel
Default value : true
xAxisLabel
Type : string
Default value : 'Country'
yAxisLabel
Type : string
Default value : 'Population'
import { Component, OnInit, Input } from '@angular/core';

@Component({
  selector: 'analysis-preference-field',
  templateUrl: './field.component.html',
  styleUrls: ['./field.component.scss']
})
export class PreferenceFieldComponent implements OnInit {
  @Input()
  data: any;

  // options
  showXAxis = true;
  showYAxis = true;
  gradient = false;
  showLegend = false;
  showXAxisLabel = true;
  xAxisLabel = 'Country';
  showYAxisLabel = true;
  yAxisLabel = 'Population';

  colorScheme = {
    domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA']
  };

  constructor() {}

  ngOnInit() {}

  onSelect(event) {
    console.log(event);
  }
}
<mat-card>
  <mat-card-title>人群领域偏好</mat-card-title>
  <mat-card-content>
    <ngx-charts-bar-horizontal *ngIf="data?.length" [scheme]="colorScheme" [results]="data" [gradient]="gradient"
      [xAxis]="showXAxis" [yAxis]="showYAxis" [legend]="showLegend" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel"
      (select)="onSelect($event)">
    </ngx-charts-bar-horizontal>
  </mat-card-content>
</mat-card>

./field.component.scss

mat-card {
  margin: 5px;
  padding: 0;
}

mat-card-title {
  padding: 16px 24px;
}

mat-card-content {
  min-height: 400px;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""