添加 Echarts bi库
2024-09-18 15:27:08
1.安装库和依赖
npm i echarts --save
npm i ngx-echarts --save
npm i resize-observer-polyfill --save-dev
2.相关配置
在module添加
import { NgxEchartsModule } from 'ngx-echarts';
import * as echarts from 'echarts'; imports: [
NgxEchartsModule.forRoot({ echarts }),
],
3.页面
ts
import { Component, OnInit } from '@angular/core';
import { EChartsOption } from 'echarts'; @Component({
selector: 'app-demo001',
templateUrl: './demo001.component.html',
styleUrls: ['./demo001.component.scss']
})
export class Demo001Component implements OnInit {
data: EChartsOption = {};
constructor() { } ngOnInit(): void {
this.data = {
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
xAxis: {
data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
}
} }
html
<div echarts [options] = "data"></div>
最新文章
- C#体检套餐项目
- (译)利用ASP.NET加密和解密Web.config中连接字符串
- terminator终端工具
- 如何写出安全的API接口
- angularJS推荐显示注入写法
- To and Fro
- merry Christmas
- 【ASP.NET】获取网站目录的方法
- C# 玩家昵称屏蔽敏感字眼
- centos 端口开放及关闭
- 微信开放JS-SDK,助力网页开发
- js的两种数据类型
- CPP之内存分配
- yum list失败
- win8下Source Insight has not been installed completely问题的解决
- Linux 设置程序开机自启动 (命令systemctl 和 chkconfig用法区别比较)
- openssl https 单向认证连接成功示例
- 写几个简单用artTemplate的例子
- Cmake编译opencv下载不了ffmpeg时的解决办法
- wamp-php 集成环境的基础配置
热门文章
- Hexo博客搭建和简单部署
- 使用命令行运行用例时提示python.exe: Error while finding module specification for &#39;testcase_1.Test&#39;.....
- 关于 MySQL 嵌套子查询中,无法关联主表字段问题的折中解决方法
- 使用time.Time数据类型获取时间报错
- Java学习笔记:2022年1月9日(其二)
- C++获取含有中文字符的string长度
- react系列-从0开始搭建一个react项目
- postgresql添加mysql_fdw测试过程
- MyBatis的使用七(处理表与表之间的关系)
- Windows/office常用的激活工具有哪些