Angular使用PrimeNGCharJS时字体颜色问题的解决方法。
创始人
2024-10-29 13:00:44
0

解决这个问题的方法是使用CharJS的配置选项来更改字体颜色。下面是一个示例组件,它通过设置“options”属性来更改图表的字体颜色:

import { Component } from '@angular/core';
import { ChartDataSets, ChartType, ChartOptions } from 'chart.js';
import { Color, Label } from 'ng2-charts';

@Component({
  selector: 'app-chart',
  templateUrl: './chart.component.html',
  styleUrls: ['./chart.component.css']
})
export class ChartComponent {
  public lineChartData: ChartDataSets[] = [
    { data: [85, 72, 78, 75, 77, 75], label: 'Series A' }
  ];
  public lineChartLabels: Label[] = ['January', 'February', 'March', 'April', 'May', 'June'];
  public lineChartOptions: (ChartOptions & { annotation: any }) = {
    responsive: true,
    scales: {
      xAxes: [{
        ticks: {
          fontColor: 'red',
        },
      }],
      yAxes: [{
        ticks: {
          fontColor: 'blue',
        },
      }]
    },
    annotation: {
      annotations: [
        {
          type: 'line',
          mode: 'vertical',
          scaleID: 'x-axis-0',
          value: 'March',
          borderColor: 'orange',
          borderWidth: 2,
          label: {
            enabled: true,
            fontColor: 'green',
            content: 'LineAnno'
          }
        },
      ],
    },
  };
  public lineChartColors: Color[] = [
    {
      borderColor: 'black',
      backgroundColor: 'rgba(255,255,0,0.28)',
    },
  ];
  public lineChartLegend = true;
  public lineChartType: ChartType = 'line';
  public lineChartPlugins = [];
}

在这个示例中,我们更改了 X 轴和 Y 轴上的字体颜色。我们还使用“annotation”选项来添加一个基线,并更改对应的标签字体颜色。

相关内容

热门资讯

开挂辅助!吉安中至小程序微信辅... 开挂辅助!吉安中至小程序微信辅助,wepokerplus万能挂(透视)开挂辅助脚本(有挂教程);相信...
开挂辅助!雀友会广东潮汕麻雀万... 开挂辅助!雀友会广东潮汕麻雀万能辅助器,wepoker免费脚本咨询(透视)开挂辅助下载(有挂秘籍);...
开挂辅助!琼崖海南麻将辅助器,... 开挂辅助!琼崖海南麻将辅助器,poker world辅助(透视)开挂辅助下载(有挂解惑);琼崖海南麻...
辅助开挂!微乐小程序辅助脚本,... 辅助开挂!微乐小程序辅助脚本,cloudpoker辅助(透视)开挂辅助软件(有挂工具);1、很好的微...
辅助开挂!微信牵手跑辅助,wp... 【福星临门,好运相随】;辅助开挂!微信牵手跑辅助,wpk辅助插件(透视)开挂辅助下载(有挂秘诀);暗...
辅助开挂!四川乐易麻将辅助脚本... 辅助开挂!四川乐易麻将辅助脚本,wepoker辅助器下载(透视)开挂辅助工具(有挂方略);四川乐易麻...
辅助开挂!微信微乐跑得快游戏辅... 辅助开挂!微信微乐跑得快游戏辅助脚本,wejoker辅助软件价格(透视)开挂辅助工具(有挂透视);相...
辅助开挂!福建兄弟十三水挂件去... 辅助开挂!福建兄弟十三水挂件去那买,wepoker亲友圈有用吗(透视)开挂辅助神器(存在有挂);1....
今日公布“wepoker开挂辅... >>>您好:,软件加微信【添加136704302】确实是有挂的,很多玩家在这款游戏中打牌都会发现很多...
推荐攻略“wepoker能开挂... 推荐攻略“wepoker能开挂吗”开挂辅助挂(透视)解说技巧是一款可以让一直输的玩家,快速成为一个“...