常用 ant组件 地址
来源:互联网 发布:最优化第二版课后答案 编辑:程序博客网 时间:2024/06/05 10:07
chart antv G2 地址https://github.com/antvis/g2-react/blob/master/src/index.js
import G2 from 'g2';import React from 'react';import PropTypes from 'prop-types';let uniqueId = 0;function generateUniqueId() { return `rc-g2-${uniqueId++}`;}export default function createG2(__operation) { class Component extends React.Component { static propTypes = { data: PropTypes.arrayOf(PropTypes.object).isRequired, width: PropTypes.number.isRequired, height: PropTypes.number.isRequired, plotCfg: PropTypes.object, forceFit: PropTypes.bool, configs: PropTypes.object, }; constructor(props, context) { super(props, context); this.chart = null; this.chartId = generateUniqueId(); } componentDidMount() { this.initChart(this.props); } componentWillReceiveProps(newProps) { const { data: newData, width: newWidth, height: newHeight, plotCfg: newPlotCfg } = newProps; const { data: oldData, width: oldWidth, height: oldHeight, plotCfg: oldPlotCfg } = this.props; if (newPlotCfg !== oldPlotCfg) { console.warn('plotCfg 不支持修改'); } if (newData !== oldData) { this.chart.changeData(newData); } if (newWidth !== oldWidth || newHeight !== oldHeight) { this.chart.changeSize(newWidth, newHeight); } } shouldComponentUpdate() { return false; } componentWillUnmount() { this.chart.destroy(); this.chart = null; this.chartId = null; } initChart(props) { const { width, height, data, plotCfg, forceFit, configs } = props; const chart = new G2.Chart({ id: this.chartId, width, height, plotCfg, forceFit, }); chart.source(data); __operation(chart, configs); this.chart = chart; } render() { return (<div id={this.chartId} />); } } return Component;}
阅读全文
0 0
- 常用 ant组件 地址
- java常用组件下载地址
- Java 常用组件 及下载地址
- Android常用组件地址分享(开源和应用)
- Android常用组件地址分享(开源和应用)
- Andorid开发常用牛逼组件下载地址
- ant 翻译地址
- ant 说明地址
- ant-design antd 地址
- ant 缺少文件根组件
- ant的常用设置
- Ant 常用Task
- Ant 常用任务
- 常用ant的操作
- Ant常用模板(转)
- ant常用task
- Ant [常用方法]
- ANT常用标签
- PAT a1062题解
- UVA11059MaximumProduct
- chrome.runtime.sendMessage 回调函数参数为undefined
- linux---rhel6.5虚拟机安装及封装
- PAT a1063题解
- 常用 ant组件 地址
- PAT a1064题解
- JUC锁-04之 公平锁(二)
- PAT a1065题解
- PAT a1066题解
- java设计模式---装饰模式篇
- Java ArrayList和LinkedList的区别
- Android事件分发流程
- <划重点的Unity2017>事件系统