Angular中ng2charts柱状图中的相邻两个柱状条之间需要留有间距
创始人
2024-10-31 15:00:58
0

在ng2 charts的柱状图组件中,可以通过设置options属性中的barPercentage和barThickness来调整相邻两个柱状条之间的间距。具体代码示例如下:

html文件:


ts文件:

import { Component } from '@angular/core';

@Component({
  selector: 'app-bar-chart',
  templateUrl: './bar-chart.component.html',
  styleUrls: ['./bar-chart.component.css']
})

export class BarChartComponent {
  public barChartOptions: any = {
    scaleShowVerticalLines: false,
    responsive: true,
    barPercentage: 0.5, // 设置相邻两个柱状条之间的间距
    barThickness: 20 // 设置柱状条的宽度
  };
  public barChartLabels: string[] = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
  public barChartType = 'bar';
  public barChartLegend = true;

  public barChartData: any[] = [
    {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'},
    {data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B'}
  ];

  public chartClicked(e: any): void {
    console.log(e);
  }

  public chartHovered(e: any): void {
    console.log(e);
  }
}

相关内容

热门资讯

开挂透视!hhpkoer辅助器... 开挂透视!hhpkoer辅助器视频,微乐广西麻辣辅助器,方式教程(真是有挂)-哔哩哔哩1)hhpko...
开挂透视!wepoker私人局... 开挂透视!wepoker私人局俱乐部怎么进,微信小程序微乐辅助器ios,秘籍教程(有挂方式)-哔哩哔...
科普透视!pokemmo修改器... 科普透视!pokemmo修改器手机版,微乐小程序自建房辅助,攻略教程(的确有挂)-哔哩哔哩科普透视!...
解谜透视!hhpoker透视工... 解谜透视!hhpoker透视工具,微信小程序微乐辅助器教程,秘籍教程(有挂解密)-哔哩哔哩所有人都在...
解迷透视!wepoker轻量版... 解迷透视!wepoker轻量版透视方法,小程序微乐辅助器免费版,指引教程(有挂功能)-哔哩哔哩wep...
普及透视!wepoker怎么拿... 普及透视!wepoker怎么拿到好牌,小程序微乐陕西挖坑辅助器,阶段教程(有挂功能)-哔哩哔哩暗藏猫...
必备透视!智星德州插件2024... 必备透视!智星德州插件2024最新版,微乐小程序自建房辅助下载,方式教程(有挂猫腻)-哔哩哔哩1、每...
了解透视!wepoker插件程... 了解透视!wepoker插件程序激活码,微乐麻将自建房app,教材教程(有人有挂)-哔哩哔哩1、很好...
有挂透视!sohoo poke... 有挂透视!sohoo poker辅助器,微乐小程游戏破解器下载,积累教程(证实有挂)-哔哩哔哩所有人...
开挂透视!约局吧是否有挂,万能... 开挂透视!约局吧是否有挂,万能透视辅助器免费版,绝活儿教程(有挂秘诀)-哔哩哔哩1、每一步都需要思考...