typescript 隐藏ngx高级饼图图例

sbdsn5lh  于 2022-12-14  发布在  TypeScript
关注(0)|答案(2)|浏览(122)

我想隐藏ngx高级饼图的图例并在圆圈中间显示图像
问题陈述:无法隐藏进阶圆形图的图例
我想隐藏图例,并显示带有数据的圆形图像。
plnkr code
密码:

//our root app component
import {Component, NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser-animations';
import {NgxChartsModule} from '@swimlane/ngx-charts';
import {single, multi} from '../data.ts';

@Component({
  selector: 'my-app',
  template: `
    <ngx-charts-advanced-pie-chart
      [view]="view"
      [scheme]="colorScheme"
      [results]="single"
      [gradient]="gradient"
      (select)="onSelect($event)">
    </ngx-charts-advanced-pie-chart>
  `
})
export class App {
  single: any[];
  multi: any[];

  view: any[] = [700, 400];

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

  constructor() {
    Object.assign(this, {single, multi})   
  }

  onSelect(event) {
    console.log(event);
  }

}

@NgModule({
  imports: [ BrowserModule, BrowserAnimationsModule, NgxChartsModule ],
  declarations: [ App ],
  bootstrap: [ App ]
})
export class AppModule {}
fzwojiic

fzwojiic1#

可以通过在style.css文件中添加以下样式来隐藏图例

.advanced-pie-legend-wrapper{
   display: none !important;
}
31moq8wy

31moq8wy2#

我做的是我的css

ngx-charts-advanced-pie-chart {
::ng-deep {
  .advanced-pie-legend-wrapper {
    display: none;
  }
}

}

相关问题