📢 重要更新: 这是一个维护版本,修复了 TypeScript 定义文件中的 JSDoc 注释格式问题。原仓库请访问:wuxudong/react-native-charts-wrapper
This library is React Native wrapper of popular Native charting library MPAndroidChart and Charts
- ✅ 更新BarChart组件,新增圆角半径属性并优化数据提取逻辑
- ✅ 新增BaseBarRenderer类以支持自定义条形图的高亮和绘制功能
- ✅ 优化CustomMarker的布局参数,调整边距和内边距以改善外观
- ✅ 增强LineChart和BarChart组件的新功能
- ✅ 新增自定义markerview及高亮整组功能
- ✅ Fixed JSDoc comment format in
index.d.ts
- ✅ Corrected
@platform
tag syntax from{ios}
toios
- ✅ Updated comment blocks from
/* */
to/** */
format - ✅ Improved TypeScript definition documentation
Inspired by react-native-mp-android-chart and react-native-ios-charts
React Native Charts Wrapper is built on MPAndroidChart(v3.1.0) & Charts(v3.3.0), support both android & iOS.
- 安装依赖:
npm install @see_you/react-native-charts-wrapper
# 或者
yarn add @see_you/react-native-charts-wrapper
- 重要: 在您的 iOS 项目的 Podfile 中指定 DGCharts 的 git 源:
# 在 Podfile 中添加以下行
pod 'DGCharts', :git => 'https://github.com/web-iou/Charts.git', :branch => 'master'
⚠️ 重要说明: 由于本库覆写了 DGCharts 的高亮方法,必须使用我们修改过的 Charts 仓库版本,该版本已开放类下的方法覆写权限。请务必使用指定的 git 源,不要使用官方版本。
- 运行 pod install:
cd ios && pod install
在您的 iOS 项目的 Podfile 中添加以下行(建议放在 target 块之前):
# 指定 DGCharts 的 git 源
pod 'DGCharts', :git => 'https://github.com/web-iou/Charts.git', :branch => 'master'
本库对 DGCharts 进行了以下重要修改:
- 开放方法覆写权限: 修改了类的访问控制,允许子类覆写高亮相关方法
- 自定义高亮逻辑: 实现了自定义的高亮显示功能
- 增强交互体验: 提供了更丰富的图表交互功能
如果使用官方 DGCharts 版本,将会出现编译错误或功能异常。
- 必须使用指定的 git 源: 由于覆写了高亮方法,必须使用我们修改过的 Charts 仓库版本
- 确保您的网络连接正常,因为需要从 GitHub 下载 Charts 仓库
- 如果下载速度较慢,可以考虑使用镜像源或 VPN
- 建议使用
:branch => 'master'
来获取最新版本,或者指定具体的 tag 来确保版本一致性 - 如果遇到编译错误,请检查是否正确配置了 DGCharts 的 git 源
Android 配置保持不变,无需额外配置。