Compare commits

..

22 Commits

Author SHA1 Message Date
monitor1394
220b829279 v2.0.1 2021-02-26 01:03:47 +08:00
monitor1394
c507771cff 修复HeatmapChartTooltip指示的位置不准的问题 #123 2021-02-26 00:54:43 +08:00
monitor1394
09daa2f027 修复Unity版本兼容问题 2021-02-22 11:02:54 +08:00
monitor1394
4ea5168e9a 修复Unity版本兼容问题 2021-02-21 22:15:07 +08:00
monitor1394
2fdd554751 update doc 2021-02-21 03:43:32 +08:00
monitor1394
b96e1dcf4d 增加TooltipignoreDataShow参数 2021-02-21 02:42:45 +08:00
monitor1394
80b000ed32 修复创建图表时的空报错 2021-02-21 02:26:36 +08:00
monitor1394
f0c553b0b7 修复图表在LayoutGroup控制下时可能显示错乱的问题 #121 2021-02-19 22:01:56 +08:00
monitor1394
f7b8f2f76f Fixed an issue where the Radar could not refresh itself after parameter changing 2021-02-18 09:47:03 +08:00
monitor1394
04efcf3959 Fixed an issue where the Radar could not refresh itself after parameter changing #122 2021-02-18 09:24:01 +08:00
monitor1394
3a02f66d9e v2.0.0 2021-02-05 21:53:46 +08:00
monitor1394
69c830c520 v2.0.0 2021-02-05 21:52:11 +08:00
monitor1394
49fe5fdb70 v2.0.0 2021-02-05 21:46:31 +08:00
monitor1394
15da731cfe 调整2.0的upm分支 2021-02-04 13:10:30 +08:00
monitor1394
3e1b84029f 修复AxisLineOnZeroYAxis不生效的问题 #116 2021-02-03 12:51:50 +08:00
monitor1394
0a427de273 修复日志内部无法跳转的问题 2021-01-29 21:36:49 +08:00
monitor1394
b4cd770c8d 调整更新日志格式 2021-01-29 21:31:04 +08:00
monitor1394
3b697edd09 调整更新日志格式 2021-01-29 21:24:29 +08:00
monitor1394
9f7ec8be64 调整更新日志格式 2021-01-29 21:16:41 +08:00
monitor1394
7f23cd4676 修复Category轴在BoundaryGapAlignWithLabelTrueTick显示效果不对的问题 #115 2021-01-29 20:55:58 +08:00
monitor1394
82d1bed46b Optimize some details 2021-01-25 09:12:22 +08:00
monitor1394
e9df74ec3c Fixed a Inpsector displayed error 2021-01-22 09:08:52 +08:00
49 changed files with 4693 additions and 19652 deletions

View File

@@ -1,14 +1,72 @@
# 更新日志
[Latest](#Latest)
[v2.0.1](#v2.0.1)
[v2.0.0](#v2.0.0)
[v2.0.0-preview.2](#v2.0.0-preview.2)
[v2.0.0-preview.1](#v2.0.0-preview.1)
[v1.6.3](#v1.6.3)
[v1.6.1](#v1.6.1)
[v1.6.0](#v1.6.0)
[v1.5.2](#v1.5.2)
[v1.5.1](#v1.5.1)
[v1.5.0](#v1.5.0)
[v1.4.0](#v1.4.0)
[v1.3.1](#v1.3.1)
[v1.3.0](#v1.3.0)
[v1.2.0](#v1.2.0)
[v1.1.0](#v1.1.0)
[v1.0.5](#v1.0.5)
[v1.0.4](#v1.0.4)
[v1.0.3](#v1.0.3)
[v1.0.2](#v1.0.2)
[v1.0.1](#v1.0.1)
[v1.0.0](#v1.0.0)
[v0.8.3](#v0.8.3)
[v0.8.2](#v0.8.2)
[v0.8.1](#v0.8.1)
[v0.8.0](#v0.8.0)
[v0.5.0](#v0.5.0)
[v0.1.0](#v0.1.0)
## Latest
## v2.0.1
* (2021.02.26) Fixed incorrect position of `Tooltip` in `HeatmapChart` #123
* (2021.02.22) Fixed compatibility issues with `Unity` version
* (2021.02.21) Added `Tooltip` parameter `ignoreDataShow`
* (2021.02.19) Fixed an issue where charts could appear abnormal when under `LayoutGroup` control #121
* (2021.02.18) Fixed an issue where the `Radar` could not refresh itself after parameter changing #122
## v2.0.0
* (2021.02.05) Release `v2.0.0` version
* (2021.02.03) Fixed an issue where `Axisline` `OnZero` did not work on `YAxis` #116
* (2021.01.29) Fixed incorrect display of `Tick` on `Category` axis when `BoundaryGap` and `alignWithLabel` are `True` #115
* (2021.01.25) Optimize some details
* (2021.01.22) Fixed a `Inpsector` displayed error
## v2.0.0-preview.2
* (2021.01.21) Release `v2.0.0-preview.2` version
* (2021.01.21) Fixed an error about `AxisTick` in `Inpsector`
* (2021.01.21) Fixed a build compatibility error
* (2021.01.19) Add `XChartsSettings` `editorShowAllListData` parameter to configure whether to display all the list's data in Inspector
* (2021.01.19) Added `XChartsSettings` `editorShowAllListData` parameter to configure whether to display all the list's data in Inspector
## v2.0.0-preview.1
* (2021.01.19) Release `v2.0.0-preview.1` version
## v1.6.3
* (2021.01.02) Release `v1.6.3` version
* (2020.12.18) fixed an issue where updating data when `Animation` was not enabled caused the chart to keep refreshing
* (2020.12.01) fixed an issue where a newly created chart on `Unity2020` could not be drawn properly
## v1.6.2
* (2020.11.22) Release `v1.6.2` version
* (2020.11.22) Fixed an issue where `LineChart` draws an exception when the data is too dense #99
* (2020.11.21) Fixed an issue where the scale position of `LineChart` could be abnormal if `alignWithLabel` was `true`
@@ -26,6 +84,9 @@
* (2020.08.29) Added `toColor` and `toColor2` of `LineStyle` to set the horizontal gradient of `LineChart`. Cancel `ItemStyle` to set the horizontal gradient of `LineChart`.
* (2020.08.29) Added the `onPointerClickPie` of `PieChart`, a callback function of click pie area.
* (2020.08.29) Added the `onPointerClickBar` of `BarChart`, a callback function of click bar.
## v1.6.0
* (2020.08.24) Release `v1.6.0` version
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md) to upgrade)
* (2020.08.15) Optimize `PieChart` drawing performance effect #85
@@ -46,6 +107,9 @@
* (2020.07.07) 增加`Tooltip``offset`参数配置偏移
* (2020.07.06) 增加`LiquidChart`水位图
* (2020.07.01) 增加`PolarChart`极坐标图表
## v1.5.2
* (2020.06.25) 发布`v1.5.2`版本
* (2020.06.25) 修复`BarChart`在数值为`0`时还会绘制一小部分柱条的问题
* (2020.06.24) 修复`PieChart`在设置`clockwise`后绘制异常的问题#65
@@ -64,6 +128,9 @@
* (2020.06.04) 增加`Tooltip``alwayShow`参数设置触发后一直显示
* (2020.06.04) 优化`Tooltip``formatter`支持`{.1}`通配符
* (2020.06.04) 优化`Legend`数量过多时自动换行显示#53
## v1.5.1
* (2020.06.03) 发布`v1.5.1`版本
* (2020.06.02) 增加`Radar``ceilRate`,设置最大最小值的取整倍率
* (2020.06.02) 优化`Tooltip``formatter`,支持`{c1:1-1:f1}`格式配置
@@ -76,6 +143,9 @@
* (2020.05.27) 优化`柱状图`的渐变色效果
* (2020.05.24) 修复`Axis`同时设置`boundaryGap``alignWithLabel``Tick`绘制异常的问题
* (2020.05.24) 优化版本更新检测
## v1.5.0
* (2020.05.22) 发布`v1.5.0`版本
* (2020.05.21) 增加`圆角柱图`支持渐变
* (2020.05.21) 增加`Background`背景组件
@@ -97,6 +167,9 @@
* (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转
* (2020.04.16) 修复`Check warning``Unity2019.3`上的显示问题
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
## v1.4.0
* (2020.04.11) 发布`v1.4.0`版本
* (2020.04.11) 增加`Check warning`检测功能
* (2020.04.09) 修复`Legend`初始化异常的问题
@@ -117,9 +190,15 @@
* (2020.03.17) 增加`SerieData``ItemStyle``Emphasis`可单独配置数据项样式的支持
* (2020.03.15) 重构`EmptyCricle`类型的`Symbol`边宽取自`ItemStyle``borderWidth`参数
* (2020.03.15) 重构`SerieSymbol`,去掉`color``opacity`参数,取自`ItemStyle`
## v1.3.1
* (2020.03.14) 发布`v1.3.1`版本
* (2020.03.14) 修复`LineChart`开启`ingore`时部分数据可能绘制异常的问题
* (2020.03.13) 修复`LineChart``label`偏移显示异常的问题
## v1.3.0
* (2020.03.11) 发布`v1.3.0`版本
* (2020.03.11) 优化`LineChart``label`偏移显示
* (2020.03.11) 优化清空并重新添加数据后的自动刷新问题
@@ -143,6 +222,9 @@
* (2020.01.26) 增加`TextLimit`组件可以设置`AxisLabel`的文本自适应
* (2020.01.20) 优化`Tooltip`设置`itemFormatter`时显示系列颜色
* (2020.01.20) 增加`Radar`雷达图在`inspector`配置`areaStyle`的支持
## v1.2.0
* (2020.01.15) 发布`v1.2.0`版本
* (2020.01.15) 增加`AxisLabel`格式化为整数的支持(`{value:f0}`
* (2020.01.15) 增加折线图对数轴`Log`的支持
@@ -153,6 +235,9 @@
* (2019.12.21) 增加`DataZoom`的最小显示数据个数`minShowNum`
* (2019.12.20) 增加`Demo40_Radar.cs`雷达图代码操作`Demo`
* (2019.12.20) 添加`RadarChart`相关API接口
## v1.1.0
* (2019.12.17) 发布`v1.1.0`版本
* (2019.12.16) 修复`Overlay`模式下不显示`Tooltip`的问题
* (2019.12.15) 增加`Title``TextStyle`支持
@@ -165,6 +250,9 @@
* (2019.11.30) 增加`GaugeChart`仪表盘
* (2019.11.22) 修复`BarChart`清空数据重新赋值后`SerieLabel`显示异常的问题
* (2019.11.16) 修复`SerieLabel`设置`color`等参数不生效的问题
## v1.0.5
* (2019.11.12) 发布`v1.0.5`版本
* (2019.11.12) 修复`2018.3`以下版本打开项目报错的问题
* (2019.11.12) 增加`IconStyle`子组件,优化`SerieData`的图标配置
@@ -172,21 +260,36 @@
* (2019.11.11) 修复饼图当数据过小时视觉引导线会穿透的的问题
* (2019.11.09) 修复饼图添加数据时`Label`异常的问题
* (2019.11.09) 优化结构,分离为`XCharts``XChartsDemo`两部分
## v1.0.4
* (2019.11.05) 发布`v1.0.4`版本
* (2019.11.05) 增加`Radar`雷达组件文本样式参数配置支持
* (2019.11.04) 修复`Unity2018.3`以下版本代码不兼容的问题
* (2019.11.04) 优化`SerieLabel`过多时引起的性能问题
## v1.0.3
* (2019.11.03) 发布`v1.0.3`版本
* (2019.11.03) 增加`Editor`快捷添加图表:`Hierarchy`试图下右键`XCharts->LineChart`
* (2019.11.02) 优化非配置参数变量命名和访问权限,简化`API`
## v1.0.2
* (2019.10.31) 发布`v1.0.2`版本
* (2019.10.31) 修复`prefab`预设制作报错的问题
* (2019.10.31) 增加访问主题组件API`BaseChart.theme`
## v1.0.1
* (2019.10.26) 发布`v1.0.1`版本
* (2019.10.26) 修复版本检查功能在非运行时异常的问题
* (2019.10.26) 增加科学计数法显示数值的支持(查阅`forceENotation`参数)
* (2019.10.26) 增加`Axis`类目轴数据为空时的默认显示支持
* (2019.10.26) 增加`Axis`数值轴的最大最小值可设置为小数的支持,优化极小数图表的表现效果
## v1.0.0
* (2019.10.25) 发布`v1.0.0`版本
* (2019.10.23) 增加版本检测功能:`Component -> XCharts -> Check For Update`
* (2019.10.22) 增加`Package Manager`安装的支持
@@ -250,16 +353,28 @@
* (2019.08.15) 增加`LineChart``Label`配置
* (2019.08.15) 重构`BarChart`,移除`Bar`组件,相关参数统一放到`Serie`中配置
* (2019.08.15) 重构`LineChart`,移除`Line`组件,相关参数统一放到`Serie`中配置
## v0.8.3
* (2019.08.15) 发布`v0.8.3`版本
* (2019.08.14) 修复`PieChart``Label`无法自动更新的问题
* (2019.08.13) 修复`UpdateData`接口无法更新数据的问题
* (2019.08.07) 增加`SerieSymbol``Color``Opacity`配置
## v0.8.2
* (2019.08.07) 发布`v0.8.2`版本
* (2019.08.07) 修复区域平滑折线图显示异常的问题
* (2019.08.06) 修复`serie`系列数超过调色盘颜色数时获取的颜色异常的问题
* (2019.08.06) 修复当`Axis``minMaxType``Custom``max`设置为`100`不生效的问题
## v0.8.1
* (2019.08.04) 发布`v0.8.1`版本
* (2019.08.04) 修复Inspector中修改数据不生效的问题
* (2019.08.04) 修复`Inspector`中修改数据不生效的问题
## v0.8.0
* (2019.08.04) 发布`v0.8.0`版本
* (2019.08.04) 优化`RadarChart`雷达图,增加多雷达图支持
* (2019.08.01) 增加代码API注释文档整理代码
@@ -278,6 +393,9 @@
* (2019.07.15) 增加`Size`设置图表尺寸
* (2019.07.14) 增加`二维数据`支持XY轴都可以设置为数值轴
* (2019.07.13) 增加`双坐标轴`支持,代码改动较大
## v0.5.0
* (2019.07.10) 发布`v0.5.0`版本
* (2019.07.09) 增加`AxisLine`配置坐标轴轴线和箭头
* (2019.07.03) 增加`AxisLabel`配置坐标轴`刻度标签`
@@ -297,4 +415,7 @@
* (2019.05.11) 增加自定义`Editor`编辑
* (2019.03.21) 增加`Tooltip`
* (2018.11.01) 增加`Default``Light``Dark`三种默认主题
## v0.1.0
* (2018.09.05) 发布`v0.1.0`版本

View File

@@ -1,11 +1,66 @@
# 更新日志
[Latest](#Latest)
[v2.0.1](#v2.0.1)
[v2.0.0](#v2.0.0)
[v2.0.0-preview.2](#v2.0.0-preview.2)
[v2.0.0-preview.1](#v2.0.0-preview.1)
[v1.6.3](#v1.6.3)
[v1.6.1](#v1.6.1)
[v1.6.0](#v1.6.0)
[v1.5.2](#v1.5.2)
[v1.5.1](#v1.5.1)
[v1.5.0](#v1.5.0)
[v1.4.0](#v1.4.0)
[v1.3.1](#v1.3.1)
[v1.3.0](#v1.3.0)
[v1.2.0](#v1.2.0)
[v1.1.0](#v1.1.0)
[v1.0.5](#v1.0.5)
[v1.0.4](#v1.0.4)
[v1.0.3](#v1.0.3)
[v1.0.2](#v1.0.2)
[v1.0.1](#v1.0.1)
[v1.0.0](#v1.0.0)
[v0.8.3](#v0.8.3)
[v0.8.2](#v0.8.2)
[v0.8.1](#v0.8.1)
[v0.8.0](#v0.8.0)
[v0.5.0](#v0.5.0)
[v0.1.0](#v0.1.0)
## Latest
## v2.0.1
* (2021.02.26) 修复`HeatmapChart``Tooltip`指示的位置不准的问题 #123
* (2021.02.22) 修复`Unity`版本兼容问题
* (2021.02.21) 增加`Tooltip``ignoreDataShow`参数
* (2021.02.19) 修复图表在`LayoutGroup`控制下时可能显示错乱的问题 #121
* (2021.02.18) 修复`Radar`参数变更后无法自刷新的问题 #122
## v2.0.0
* (2021.02.05) 发布`v2.0.0`版本
* (2021.02.03) 修复`AxisLine``OnZero``YAxis`不生效的问题 #116
* (2021.01.29) 修复`Category`轴在`BoundaryGap``AlignWithLabel``True``Tick`显示效果不对的问题 #115
* (2021.01.25) 优化一些细节
* (2021.01.22) 修复`Inpsector`上部分属性显示异常的问题
## v2.0.0-preview.2
* (2021.01.21) 发布`v2.0.0-preview.2`版本
* (2021.01.21) 修复`Inpsector`上展开`AxisTick`时报错问题
* (2021.01.21) 修复打包兼容报错问题
* (2021.01.19) 增加`XChartsSettings``editorShowAllListData`参数配置是否在`Inspector`中显示列表的所有数据
## v2.0.0-preview.1
* (2021.01.19) 发布`v2.0.0-preview.1`版本
## v1.6.3
* (2021.01.02) 发布`v1.6.3`版本
* (2020.12.18) 修复`Animation`不启用时更新数据会导致图表一直刷新的问题
* (2020.12.01) 修复`Unity2020`上新创建的图表无法正常绘制的问题
@@ -17,6 +72,9 @@
* (2020.11.12) 修复`LineChart`当类型为`Smooth`时数据过密情况下报错的问题 #100
* (2020.10.22) 完善`HeatmapChart``VisualMap``Piecewise`的支持
* (2020.09.22) 修复`PieChart`边框大小不一致的问题
## v1.6.1
* (2020.09.19) 发布`v1.6.1`版本
* (2020.09.19) 增加`Remove All Chart Object`移除图表下的所有子节点(会自动重新初始化)
* (2020.09.18) 修复`SerieLabel`在点击图例隐藏`Serie`后还显示的问题#94
@@ -27,6 +85,9 @@
* (2020.08.29) 增加`LineStyle``toColor``toColor2`设置`LineChart`的水平渐变,取消通过`ItemStyle`设置`LineChart`的水平渐变
* (2020.08.29) 增加`PieChart``onPointerClickPie`点击扇形图扇区回调
* (2020.08.29) 增加`BarChart``onPointerClickBar`点击柱形图柱条回调
## v1.6.0
* (2020.08.24) 发布`v1.6.0`版本
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
* (2020.08.15) 优化`PieChart`绘制表现效果#85
@@ -47,6 +108,9 @@
* (2020.07.07) 增加`Tooltip``offset`参数配置偏移
* (2020.07.06) 增加`LiquidChart`水位图
* (2020.07.01) 增加`PolarChart`极坐标图表
## v1.5.2
* (2020.06.25) 发布`v1.5.2`版本
* (2020.06.25) 修复`BarChart`在数值为`0`时还会绘制一小部分柱条的问题
* (2020.06.24) 修复`PieChart`在设置`clockwise`后绘制异常的问题#65
@@ -65,6 +129,9 @@
* (2020.06.04) 增加`Tooltip``alwayShow`参数设置触发后一直显示
* (2020.06.04) 优化`Tooltip``formatter`支持`{.1}`通配符
* (2020.06.04) 优化`Legend`数量过多时自动换行显示#53
## v1.5.1
* (2020.06.03) 发布`v1.5.1`版本
* (2020.06.02) 增加`Radar``ceilRate`,设置最大最小值的取整倍率
* (2020.06.02) 优化`Tooltip``formatter`,支持`{c1:1-1:f1}`格式配置
@@ -77,6 +144,9 @@
* (2020.05.27) 优化`柱状图`的渐变色效果
* (2020.05.24) 修复`Axis`同时设置`boundaryGap``alignWithLabel``Tick`绘制异常的问题
* (2020.05.24) 优化版本更新检测
## v1.5.0
* (2020.05.22) 发布`v1.5.0`版本
* (2020.05.21) 增加`圆角柱图`支持渐变
* (2020.05.21) 增加`Background`背景组件
@@ -98,6 +168,9 @@
* (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转
* (2020.04.16) 修复`Check warning``Unity2019.3`上的显示问题
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
## v1.4.0
* (2020.04.11) 发布`v1.4.0`版本
* (2020.04.11) 增加`Check warning`检测功能
* (2020.04.09) 修复`Legend`初始化异常的问题
@@ -118,9 +191,15 @@
* (2020.03.17) 增加`SerieData``ItemStyle``Emphasis`可单独配置数据项样式的支持
* (2020.03.15) 重构`EmptyCricle`类型的`Symbol`边宽取自`ItemStyle``borderWidth`参数
* (2020.03.15) 重构`SerieSymbol`,去掉`color``opacity`参数,取自`ItemStyle`
## v1.3.1
* (2020.03.14) 发布`v1.3.1`版本
* (2020.03.14) 修复`LineChart`开启`ingore`时部分数据可能绘制异常的问题
* (2020.03.13) 修复`LineChart``label`偏移显示异常的问题
## v1.3.0
* (2020.03.11) 发布`v1.3.0`版本
* (2020.03.11) 优化`LineChart``label`偏移显示
* (2020.03.11) 优化清空并重新添加数据后的自动刷新问题
@@ -144,6 +223,9 @@
* (2020.01.26) 增加`TextLimit`组件可以设置`AxisLabel`的文本自适应
* (2020.01.20) 优化`Tooltip`设置`itemFormatter`时显示系列颜色
* (2020.01.20) 增加`Radar`雷达图在`inspector`配置`areaStyle`的支持
## v1.2.0
* (2020.01.15) 发布`v1.2.0`版本
* (2020.01.15) 增加`AxisLabel`格式化为整数的支持(`{value:f0}`
* (2020.01.15) 增加折线图对数轴`Log`的支持
@@ -154,6 +236,9 @@
* (2019.12.21) 增加`DataZoom`的最小显示数据个数`minShowNum`
* (2019.12.20) 增加`Demo40_Radar.cs`雷达图代码操作`Demo`
* (2019.12.20) 添加`RadarChart`相关API接口
## v1.1.0
* (2019.12.17) 发布`v1.1.0`版本
* (2019.12.16) 修复`Overlay`模式下不显示`Tooltip`的问题
* (2019.12.15) 增加`Title``TextStyle`支持
@@ -166,6 +251,9 @@
* (2019.11.30) 增加`GaugeChart`仪表盘
* (2019.11.22) 修复`BarChart`清空数据重新赋值后`SerieLabel`显示异常的问题
* (2019.11.16) 修复`SerieLabel`设置`color`等参数不生效的问题
## v1.0.5
* (2019.11.12) 发布`v1.0.5`版本
* (2019.11.12) 修复`2018.3`以下版本打开项目报错的问题
* (2019.11.12) 增加`IconStyle`子组件,优化`SerieData`的图标配置
@@ -173,21 +261,36 @@
* (2019.11.11) 修复饼图当数据过小时视觉引导线会穿透的的问题
* (2019.11.09) 修复饼图添加数据时`Label`异常的问题
* (2019.11.09) 优化结构,分离为`XCharts``XChartsDemo`两部分
## v1.0.4
* (2019.11.05) 发布`v1.0.4`版本
* (2019.11.05) 增加`Radar`雷达组件文本样式参数配置支持
* (2019.11.04) 修复`Unity2018.3`以下版本代码不兼容的问题
* (2019.11.04) 优化`SerieLabel`过多时引起的性能问题
## v1.0.3
* (2019.11.03) 发布`v1.0.3`版本
* (2019.11.03) 增加`Editor`快捷添加图表:`Hierarchy`试图下右键`XCharts->LineChart`
* (2019.11.02) 优化非配置参数变量命名和访问权限,简化`API`
## v1.0.2
* (2019.10.31) 发布`v1.0.2`版本
* (2019.10.31) 修复`prefab`预设制作报错的问题
* (2019.10.31) 增加访问主题组件API`BaseChart.theme`
## v1.0.1
* (2019.10.26) 发布`v1.0.1`版本
* (2019.10.26) 修复版本检查功能在非运行时异常的问题
* (2019.10.26) 增加科学计数法显示数值的支持(查阅`forceENotation`参数)
* (2019.10.26) 增加`Axis`类目轴数据为空时的默认显示支持
* (2019.10.26) 增加`Axis`数值轴的最大最小值可设置为小数的支持,优化极小数图表的表现效果
## v1.0.0
* (2019.10.25) 发布`v1.0.0`版本
* (2019.10.23) 增加版本检测功能:`Component -> XCharts -> Check For Update`
* (2019.10.22) 增加`Package Manager`安装的支持
@@ -251,16 +354,28 @@
* (2019.08.15) 增加`LineChart``Label`配置
* (2019.08.15) 重构`BarChart`,移除`Bar`组件,相关参数统一放到`Serie`中配置
* (2019.08.15) 重构`LineChart`,移除`Line`组件,相关参数统一放到`Serie`中配置
## v0.8.3
* (2019.08.15) 发布`v0.8.3`版本
* (2019.08.14) 修复`PieChart``Label`无法自动更新的问题
* (2019.08.13) 修复`UpdateData`接口无法更新数据的问题
* (2019.08.07) 增加`SerieSymbol``Color``Opacity`配置
## v0.8.2
* (2019.08.07) 发布`v0.8.2`版本
* (2019.08.07) 修复区域平滑折线图显示异常的问题
* (2019.08.06) 修复`serie`系列数超过调色盘颜色数时获取的颜色异常的问题
* (2019.08.06) 修复当`Axis``minMaxType``Custom``max`设置为`100`不生效的问题
## v0.8.1
* (2019.08.04) 发布`v0.8.1`版本
* (2019.08.04) 修复`Inspector`中修改数据不生效的问题
## v0.8.0
* (2019.08.04) 发布`v0.8.0`版本
* (2019.08.04) 优化`RadarChart`雷达图,增加多雷达图支持
* (2019.08.01) 增加代码API注释文档整理代码
@@ -279,6 +394,9 @@
* (2019.07.15) 增加`Size`设置图表尺寸
* (2019.07.14) 增加`二维数据`支持XY轴都可以设置为数值轴
* (2019.07.13) 增加`双坐标轴`支持,代码改动较大
## v0.5.0
* (2019.07.10) 发布`v0.5.0`版本
* (2019.07.09) 增加`AxisLine`配置坐标轴轴线和箭头
* (2019.07.03) 增加`AxisLabel`配置坐标轴`刻度标签`
@@ -298,4 +416,7 @@
* (2019.05.11) 增加自定义`Editor`编辑
* (2019.03.21) 增加`Tooltip`
* (2018.11.01) 增加`Default``Light``Dark`三种默认主题
## v0.1.0
* (2018.09.05) 发布`v0.1.0`版本

View File

@@ -231,7 +231,8 @@
* `paddingLeftRight`:文字和边框的左右边距。
* `paddingTopBottom`:文字和边框的上下边距。
* `backgroundImage`:提示框的背景图。
* `ignoreDataDefaultContent`:被忽略数据的默认显示字符信息
* `ignoreDataShow``(since v2.0.1)`是否显示忽略数据在`tooltip`上。 [defaut: `false`]
* `ignoreDataDefaultContent`:忽略数据的默认显示字符信息。
* `alwayShow`:是否触发后一直显示。
* `offset``(since v1.5.3)`提示框相对于鼠标位置的偏移。

View File

@@ -235,6 +235,7 @@ Tooltip component.
* `paddingLeftRight`: the text padding of left and right. [defaut: `5f`].
* `paddingTopBottom`: the text padding of top and bottom. [defaut: `5f`].
* `backgroundImage`: The image of icon.
* `ignoreDataShow`: Whether to show ignored data on tooltip. [defaut: `false`].
* `ignoreDataDefaultContent`: The default display character information for ignored data.
* `alwayShow`: Whether to trigger after always display.
* `offset`: `(since v1.5.3)`The position offset of tooltip relative to the mouse position.

View File

@@ -18,10 +18,17 @@ namespace XCharts
[CustomEditor(typeof(BaseChart), false)]
public class BaseChartEditor : Editor
{
#if UNITY_2019_3_OR_NEWER
private const float k_IconWidth = 14;
private const float k_IconGap = 0f;
private const float k_IconXOffset = 10f;
private const float k_IconYOffset = -5f;
private const float k_IconXOffset = 7f;
private const float k_IconYOffset = -1f;
#else
private const float k_IconWidth = 14;
private const float k_IconGap = 0f;
private const float k_IconXOffset = 4f;
private const float k_IconYOffset = -3f;
#endif
protected BaseChart m_Chart;
protected SerializedProperty m_Script;
@@ -101,7 +108,7 @@ namespace XCharts
{
BlockStart();
EditorGUILayout.BeginHorizontal();
var version = string.Format("V{0}_{1}", XChartsMgr.version, XChartsMgr.versionDate);
var version = string.Format("v{0}_{1}", XChartsMgr.version, XChartsMgr.versionDate);
if (m_EnableTextMeshPro.boolValue)
{
version += " TMP";
@@ -197,12 +204,13 @@ namespace XCharts
for (int i = 0; i < prop.arraySize; i++)
{
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
EditorGUILayout.Space(-EditorGUIUtility.singleLineHeight - EditorGUIUtility.standardVerticalSpacing);
var currRect = EditorGUILayout.GetControlRect();
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
currRect.y -= EditorGUI.GetPropertyHeight(prop.GetArrayElementAtIndex(i));
var rect1 = new Rect(currRect.width + k_IconXOffset,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconRemove, ChartEditorHelper.Styles.invisibleButton))
{
if (i < prop.arraySize && i >= 0) prop.DeleteArrayElementAtIndex(i);
@@ -221,7 +229,7 @@ namespace XCharts
{
if (i > 0) prop.MoveArrayElement(i, i - 1);
}
GUI.contentColor = oldColor;
}
EditorGUI.indentLevel--;
}
@@ -243,10 +251,10 @@ namespace XCharts
{
m_Chart.RemoveChartObject();
}
if (GUILayout.Button("Check XCharts Update"))
{
CheckVersionEditor.ShowWindow();
}
// if (GUILayout.Button("Check XCharts Update"))
// {
// CheckVersionEditor.ShowWindow();
// }
if (m_CheckWarning)
{
EditorGUILayout.BeginHorizontal();

View File

@@ -22,7 +22,6 @@ namespace XCharts
{
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
SerializedProperty m_LogBase = prop.FindPropertyRelative("m_LogBase");
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
var chart = prop.serializedObject.targetObject as BaseChart;
@@ -138,8 +137,6 @@ namespace XCharts
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_TextLimit");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_OnZero");
--EditorGUI.indentLevel;
}
}

View File

@@ -86,6 +86,12 @@ namespace XCharts
m_DrawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected void AddHeight(float height)
{
m_Heights[m_KeyName] += height;
m_DrawRect.y += height;
}
protected void PropertyListField(SerializedProperty prop, string relativePropName, bool showOrder = true)
{
if (IngorePropertys.Contains(relativePropName)) return;
@@ -100,17 +106,31 @@ namespace XCharts
protected void PropertyField(SerializedProperty prop, string relativePropName)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (prop.FindPropertyRelative(relativePropName).isArray)
{
PropertyListField(prop, relativePropName);
return;
}
if (!ChartEditorHelper.PropertyField(ref m_DrawRect, m_Heights, m_KeyName, prop, relativePropName))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyFieldLimitMin(SerializedProperty prop, string relativePropName, float minValue)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyFieldWithMinValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
relativePropName, minValue))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyFieldLimitMax(SerializedProperty prop, string relativePropName, float maxValue)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyFieldWithMaxValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
relativePropName, maxValue))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyField(SerializedProperty prop, SerializedProperty relativeProp)
{
if (!ChartEditorHelper.PropertyField(ref m_DrawRect, m_Heights, m_KeyName, relativeProp))
@@ -123,7 +143,8 @@ namespace XCharts
{
PropertyTwoFiled(prop, prop.FindPropertyRelative(relativeListProp), labelName);
}
protected void PropertyTwoFiled(SerializedProperty prop, SerializedProperty relativeListProp, string labelName = null)
protected void PropertyTwoFiled(SerializedProperty prop, SerializedProperty relativeListProp,
string labelName = null)
{
if (string.IsNullOrEmpty(labelName))
{
@@ -137,12 +158,14 @@ namespace XCharts
{
if (string.IsNullOrEmpty(relativePropName))
{
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName, m_DisplayName, null);
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, null);
}
else
{
var relativeProp = prop.FindPropertyRelative(relativePropName);
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName, m_DisplayName, relativeProp);
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, relativeProp);
}
}

View File

@@ -12,94 +12,24 @@ using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Serie), true)]
public class SerieDrawer : PropertyDrawer
public class SerieDrawer : BasePropertyDrawer
{
private Dictionary<string, bool> m_SerieModuleToggle = new Dictionary<string, bool>();
private List<bool> m_DataFoldout = new List<bool>();
private bool m_ShowJsonDataArea = false;
private string m_JsonDataAreaText;
private bool m_IsPolar = false;
private List<bool> m_DataFoldout = new List<bool>();
public override string ClassName { get { return "Serie"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty show = prop.FindPropertyRelative("m_Show");
SerializedProperty type = prop.FindPropertyRelative("m_Type");
SerializedProperty name = prop.FindPropertyRelative("m_Name");
SerializedProperty stack = prop.FindPropertyRelative("m_Stack");
SerializedProperty m_AxisIndex = prop.FindPropertyRelative("m_AxisIndex");
SerializedProperty m_XAxisIndex = prop.FindPropertyRelative("m_XAxisIndex");
SerializedProperty m_YAxisIndex = prop.FindPropertyRelative("m_YAxisIndex");
SerializedProperty m_RadarType = prop.FindPropertyRelative("m_RadarType");
SerializedProperty m_RadarIndex = prop.FindPropertyRelative("m_RadarIndex");
SerializedProperty m_VesselIndex = prop.FindPropertyRelative("m_VesselIndex");
SerializedProperty m_PolarIndex = prop.FindPropertyRelative("m_PolarIndex");
SerializedProperty m_MinShow = prop.FindPropertyRelative("m_MinShow");
SerializedProperty m_MaxShow = prop.FindPropertyRelative("m_MaxShow");
SerializedProperty m_MaxCache = prop.FindPropertyRelative("m_MaxCache");
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
SerializedProperty m_ItemStyle = prop.FindPropertyRelative("m_ItemStyle");
SerializedProperty m_LineArrow = prop.FindPropertyRelative("m_LineArrow");
SerializedProperty m_LineType = prop.FindPropertyRelative("m_LineType");
SerializedProperty m_SampleDist = prop.FindPropertyRelative("m_SampleDist");
SerializedProperty m_SampleType = prop.FindPropertyRelative("m_SampleType");
SerializedProperty m_SampleAverage = prop.FindPropertyRelative("m_SampleAverage");
SerializedProperty m_BarType = prop.FindPropertyRelative("m_BarType");
SerializedProperty m_BarPercentStack = prop.FindPropertyRelative("m_BarPercentStack");
SerializedProperty m_BarWidth = prop.FindPropertyRelative("m_BarWidth");
SerializedProperty m_BarGap = prop.FindPropertyRelative("m_BarGap");
SerializedProperty m_BarZebraWidth = prop.FindPropertyRelative("m_BarZebraWidth");
SerializedProperty m_BarZebraGap = prop.FindPropertyRelative("m_BarZebraGap");
SerializedProperty m_AreaStyle = prop.FindPropertyRelative("m_AreaStyle");
SerializedProperty m_Symbol = prop.FindPropertyRelative("m_Symbol");
SerializedProperty m_RoseType = prop.FindPropertyRelative("m_RoseType");
SerializedProperty m_Space = prop.FindPropertyRelative("m_Space");
SerializedProperty m_Center = prop.FindPropertyRelative("m_Center");
SerializedProperty m_Radius = prop.FindPropertyRelative("m_Radius");
SerializedProperty m_Label = prop.FindPropertyRelative("m_Label");
SerializedProperty m_Emphasis = prop.FindPropertyRelative("m_Emphasis");
SerializedProperty m_Animation = prop.FindPropertyRelative("m_Animation");
SerializedProperty m_DataDimension = prop.FindPropertyRelative("m_ShowDataDimension");
SerializedProperty m_ShowDataName = prop.FindPropertyRelative("m_ShowDataName");
SerializedProperty m_ShowDataIcon = prop.FindPropertyRelative("m_ShowDataIcon");
SerializedProperty m_Min = prop.FindPropertyRelative("m_Min");
SerializedProperty m_Max = prop.FindPropertyRelative("m_Max");
SerializedProperty m_StartAngle = prop.FindPropertyRelative("m_StartAngle");
SerializedProperty m_EndAngle = prop.FindPropertyRelative("m_EndAngle");
SerializedProperty m_RingGap = prop.FindPropertyRelative("m_RingGap");
SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
SerializedProperty m_Clockwise = prop.FindPropertyRelative("m_Clockwise");
SerializedProperty m_RoundCap = prop.FindPropertyRelative("m_RoundCap");
SerializedProperty m_GaugeType = prop.FindPropertyRelative("m_GaugeType");
SerializedProperty m_GaugeAxis = prop.FindPropertyRelative("m_GaugeAxis");
SerializedProperty m_GaugePointer = prop.FindPropertyRelative("m_GaugePointer");
SerializedProperty m_TitleStyle = prop.FindPropertyRelative("m_TitleStyle");
SerializedProperty m_Clip = prop.FindPropertyRelative("m_Clip");
SerializedProperty m_Ignore = prop.FindPropertyRelative("m_Ignore");
SerializedProperty m_IgnoreValue = prop.FindPropertyRelative("m_IgnoreValue");
SerializedProperty m_ShowAsPositiveNumber = prop.FindPropertyRelative("m_ShowAsPositiveNumber");
SerializedProperty m_Large = prop.FindPropertyRelative("m_Large");
SerializedProperty m_LargeThreshold = prop.FindPropertyRelative("m_LargeThreshold");
SerializedProperty m_AvoidLabelOverlap = prop.FindPropertyRelative("m_AvoidLabelOverlap");
SerializedProperty m_WaveHeight = prop.FindPropertyRelative("m_WaveHeight");
SerializedProperty m_WaveLength = prop.FindPropertyRelative("m_WaveLength");
SerializedProperty m_WaveSpeed = prop.FindPropertyRelative("m_WaveSpeed");
SerializedProperty m_WaveOffset = prop.FindPropertyRelative("m_WaveOffset");
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
int index = InitToggle(prop);
string moduleName = "Serie " + index;
var toggle = ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieModuleToggle, prop, moduleName, show);
if (!toggle)
pos.width -= 9;
base.OnGUI(pos, prop, label);
var type = prop.FindPropertyRelative("m_Type");
if (!MakeFoldout(prop, "m_Show"))
{
var orderButton = 48;
var gap = 4;
var drawRect = pos;
drawRect.x += EditorGUIUtility.labelWidth + gap;
drawRect.width = pos.width - drawRect.x + ChartEditorHelper.BOOL_WIDTH - orderButton;
EditorGUI.PropertyField(drawRect, type, GUIContent.none);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
else
{
@@ -107,351 +37,240 @@ namespace XCharts
m_IsPolar = chart is PolarChart;
var serieType = (SerieType)type.enumValueIndex;
++EditorGUI.indentLevel;
drawRect.x = pos.x;
drawRect.width = pos.width;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, type);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, name);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Name");
switch (serieType)
{
case SerieType.Line:
EditorGUI.PropertyField(drawRect, stack);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
PropertyField(prop, "m_Stack");
if (m_IsPolar)
{
EditorGUI.PropertyField(drawRect, m_PolarIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
PropertyField(prop, "m_PolarIndex");
}
else
{
EditorGUI.PropertyField(drawRect, m_XAxisIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_YAxisIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
}
EditorGUI.PropertyField(drawRect, m_MinShow);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_MaxShow);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_MaxCache);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_MinShow.intValue < 0) m_MinShow.intValue = 0;
if (m_MinShow.intValue < 0) m_MinShow.intValue = 0;
if (m_MaxCache.intValue < 0) m_MaxCache.intValue = 0;
EditorGUI.PropertyField(drawRect, m_LineType);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SampleDist);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SampleType);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SampleAverage);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Clip);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Ignore);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_IgnoreValue);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ShowAsPositiveNumber);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Large);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_LargeThreshold);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Symbol);
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
EditorGUI.PropertyField(drawRect, m_LineStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
EditorGUI.PropertyField(drawRect, m_LineArrow);
drawRect.y += EditorGUI.GetPropertyHeight(m_LineArrow);
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_AreaStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_AreaStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyFieldLimitMin(prop, "m_MinShow", 0);
PropertyFieldLimitMin(prop, "m_MaxShow", 0);
PropertyFieldLimitMin(prop, "m_MaxCache", 0);
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_SampleDist");
PropertyField(prop, "m_SampleType");
PropertyField(prop, "m_SampleAverage");
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_Large");
PropertyField(prop, "m_LargeThreshold");
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_LineArrow");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_AreaStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Bar:
EditorGUI.PropertyField(drawRect, stack);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
PropertyField(prop, "m_Stack");
if (m_IsPolar)
{
EditorGUI.PropertyField(drawRect, m_PolarIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
PropertyField(prop, "m_PolarIndex");
}
else
{
EditorGUI.PropertyField(drawRect, m_XAxisIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_YAxisIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
}
EditorGUI.PropertyField(drawRect, m_MinShow);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_MaxShow);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_MaxCache);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_MinShow.intValue < 0) m_MinShow.intValue = 0;
if (m_MinShow.intValue < 0) m_MinShow.intValue = 0;
if (m_MaxCache.intValue < 0) m_MaxCache.intValue = 0;
EditorGUI.PropertyField(drawRect, m_BarType);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BarPercentStack);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BarWidth);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BarGap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BarZebraWidth);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BarZebraGap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Clip);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Ignore);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_IgnoreValue);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ShowAsPositiveNumber);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Large);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_LargeThreshold);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyFieldLimitMin(prop, "m_MinShow", 0);
PropertyFieldLimitMin(prop, "m_MaxShow", 0);
PropertyFieldLimitMin(prop, "m_MaxCache", 0);
PropertyField(prop, "m_BarType");
PropertyField(prop, "m_BarPercentStack");
PropertyField(prop, "m_BarWidth");
PropertyField(prop, "m_BarGap");
PropertyField(prop, "m_BarZebraWidth");
PropertyField(prop, "m_BarZebraGap");
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_Large");
PropertyField(prop, "m_LargeThreshold");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Pie:
EditorGUI.PropertyField(drawRect, m_RoseType);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Space);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Radius, "Radius");
EditorGUI.PropertyField(drawRect, m_RoundCap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Ignore);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_IgnoreValue);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_AvoidLabelOverlap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyField(prop, "m_RoseType");
PropertyField(prop, "m_Space");
PropertyTwoFiled(prop, "m_Center");
PropertyTwoFiled(prop, "m_Radius");
PropertyField(prop, "m_RoundCap");
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_AvoidLabelOverlap");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Ring:
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Radius, "Radius");
EditorGUI.PropertyField(drawRect, m_StartAngle);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_RingGap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_RoundCap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Clockwise);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_TitleStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_TitleStyle);
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyTwoFiled(prop, "m_Center");
PropertyTwoFiled(prop, "m_Radius");
PropertyField(prop, "m_StartAngle");
PropertyField(prop, "m_RingGap");
PropertyField(prop, "m_RoundCap");
PropertyField(prop, "m_Clockwise");
PropertyField(prop, "m_TitleStyle");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Radar:
EditorGUI.PropertyField(drawRect, m_RadarType);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_RadarIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Symbol);
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
EditorGUI.PropertyField(drawRect, m_LineStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_AreaStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_AreaStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyField(prop, "m_RadarType");
PropertyField(prop, "m_RadarIndex");
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_AreaStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Scatter:
case SerieType.EffectScatter:
EditorGUI.PropertyField(drawRect, m_Clip);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Symbol);
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Heatmap:
EditorGUI.PropertyField(drawRect, m_Ignore);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_IgnoreValue);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Gauge:
EditorGUI.PropertyField(drawRect, m_GaugeType);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
//ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Radius, "Radius");
EditorGUI.PropertyField(drawRect, m_Radius.GetArrayElementAtIndex(0), new GUIContent("Radius"));
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Min);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Max);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_StartAngle);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_EndAngle);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SplitNumber);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_SplitNumber.intValue > 36)
{
m_SplitNumber.intValue = 36;
}
EditorGUI.PropertyField(drawRect, m_RoundCap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_TitleStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_TitleStyle);
EditorGUI.PropertyField(drawRect, m_GaugeAxis);
drawRect.y += EditorGUI.GetPropertyHeight(m_GaugeAxis);
EditorGUI.PropertyField(drawRect, m_GaugePointer);
drawRect.y += EditorGUI.GetPropertyHeight(m_GaugePointer);
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
PropertyField(prop, "m_GaugeType");
PropertyTwoFiled(prop, "m_Center");
PropertyTwoFiled(prop, "m_Radius");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyField(prop, "m_StartAngle");
PropertyField(prop, "m_EndAngle");
PropertyFieldLimitMax(prop, "m_SplitNumber", 36);
PropertyField(prop, "m_RoundCap");
PropertyField(prop, "m_TitleStyle");
PropertyField(prop, "m_GaugeAxis");
PropertyField(prop, "m_GaugePointer");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Liquid:
EditorGUI.PropertyField(drawRect, m_VesselIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Min);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Max);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveLength);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveHeight);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveSpeed);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveOffset);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
PropertyField(prop, "m_VesselIndex");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyField(prop, "m_WaveLength");
PropertyField(prop, "m_WaveHeight");
PropertyField(prop, "m_WaveSpeed");
PropertyField(prop, "m_WaveOffset");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
break;
}
EditorGUI.PropertyField(drawRect, m_Animation);
drawRect.y += EditorGUI.GetPropertyHeight(m_Animation);
drawRect.width = EditorGUIUtility.labelWidth + 10;
m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data");
drawRect.width = pos.width;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_DataFoldout[index])
{
EditorGUI.indentLevel++;
PropertyField(prop, "m_Animation");
//PropertyListField(prop, "m_Data");
DrawData(pos, prop, serieType, ref m_DrawRect);
--EditorGUI.indentLevel;
}
}
float nameWid = 45;
private void DrawData(Rect pos, SerializedProperty prop, SerieType serieType, ref Rect drawRect)
{
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
SerializedProperty m_DataDimension = prop.FindPropertyRelative("m_ShowDataDimension");
SerializedProperty m_ShowDataName = prop.FindPropertyRelative("m_ShowDataName");
SerializedProperty m_ShowDataIcon = prop.FindPropertyRelative("m_ShowDataIcon");
int index = InitToggle(prop);
drawRect.width = EditorGUIUtility.labelWidth + 10;
m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data");
drawRect.width = pos.width;
AddSingleLineHeight();
if (m_DataFoldout[index])
{
EditorGUI.indentLevel++;
float nameWid = 45;
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
#else
var gap = 0;
var namegap = 0;
var gap = 0;
var namegap = 0;
#endif
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height), m_DataDimension);
var nameRect = new Rect(pos.width - 2 * nameWid + 14 + gap, drawRect.y, nameWid - gap, pos.height);
if (XChartsSettings.editorBlockEnable)
{
nameRect.x += ChartEditorHelper.BLOCK_WIDTH;
}
if (GUI.Button(nameRect, new GUIContent("Name")))
{
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
}
var iconRect = new Rect(pos.width - nameWid + 14, drawRect.y, nameWid + namegap, pos.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += ChartEditorHelper.BLOCK_WIDTH;
}
if (GUI.Button(iconRect, new GUIContent("More...")))
{
m_ShowDataIcon.boolValue = !m_ShowDataIcon.boolValue;
}
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
var listSize = m_Datas.arraySize;
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (listSize < 0) listSize = 0;
if (m_DataDimension.intValue < 1) m_DataDimension.intValue = 1;
int dimension = m_DataDimension.intValue;
bool showName = m_ShowDataName.boolValue;
bool showIcon = m_ShowDataIcon.boolValue;
bool showSelected = (serieType == SerieType.Pie);
if (listSize != m_Datas.arraySize)
{
while (listSize > m_Datas.arraySize) m_Datas.arraySize++;
while (listSize < m_Datas.arraySize) m_Datas.arraySize--;
}
if (listSize > 30 && !XChartsSettings.editorShowAllListData)
{
int num = listSize > 10 ? 10 : listSize;
for (int i = 0; i < num; i++)
{
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
}
if (num >= 10)
{
EditorGUI.LabelField(drawRect, "...");
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, listSize - 1, pos.width);
}
}
else
{
for (int i = 0; i < m_Datas.arraySize; i++)
{
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
}
}
drawRect.y += EditorGUIUtility.standardVerticalSpacing;
EditorGUI.indentLevel--;
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height), m_DataDimension);
var nameRect = new Rect(pos.width - 2 * nameWid + 14 + gap, drawRect.y, nameWid - gap, pos.height);
if (XChartsSettings.editorBlockEnable)
{
nameRect.x += ChartEditorHelper.BLOCK_WIDTH;
}
--EditorGUI.indentLevel;
if (GUI.Button(nameRect, new GUIContent("Name")))
{
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
}
var iconRect = new Rect(pos.width - nameWid + 14, drawRect.y, nameWid + namegap, pos.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += ChartEditorHelper.BLOCK_WIDTH;
}
if (GUI.Button(iconRect, new GUIContent("More...")))
{
m_ShowDataIcon.boolValue = !m_ShowDataIcon.boolValue;
}
AddSingleLineHeight();
var listSize = m_Datas.arraySize;
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
AddSingleLineHeight();
if (listSize < 0) listSize = 0;
if (m_DataDimension.intValue < 1) m_DataDimension.intValue = 1;
int dimension = m_DataDimension.intValue;
bool showName = m_ShowDataName.boolValue;
bool showIcon = m_ShowDataIcon.boolValue;
bool showSelected = (serieType == SerieType.Pie);
if (listSize != m_Datas.arraySize)
{
while (listSize > m_Datas.arraySize) m_Datas.arraySize++;
while (listSize < m_Datas.arraySize) m_Datas.arraySize--;
}
if (listSize > 30 && !XChartsSettings.editorShowAllListData)
{
int num = listSize > 10 ? 10 : listSize;
for (int i = 0; i < num; i++)
{
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
}
if (num >= 10)
{
EditorGUI.LabelField(drawRect, "...");
AddSingleLineHeight();
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, listSize - 1, pos.width);
}
}
else
{
for (int i = 0; i < m_Datas.arraySize; i++)
{
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
}
}
AddHeight(EditorGUIUtility.standardVerticalSpacing);
EditorGUI.indentLevel--;
}
}
@@ -491,7 +310,7 @@ namespace XCharts
{
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + index));
}
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
AddHeight(EditorGUI.GetPropertyHeight(element));
}
else
{
@@ -527,8 +346,7 @@ namespace XCharts
drawRect.width = dataWid + 40 + dimension * namegap;
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
}
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
AddSingleLineHeight();
drawRect.x = lastX;
drawRect.width = lastWid;
EditorGUIUtility.fieldWidth = lastFieldWid;
@@ -547,149 +365,23 @@ namespace XCharts
var m_EnableSymbol = serieData.FindPropertyRelative("m_EnableSymbol");
var m_Symbol = serieData.FindPropertyRelative("m_Symbol");
EditorGUI.PropertyField(drawRect, m_Icon);
drawRect.y += EditorGUI.GetPropertyHeight(m_Icon);
AddHeight(EditorGUI.GetPropertyHeight(m_Icon));
EditorGUI.PropertyField(drawRect, m_Symbol);
ChartEditorHelper.MakeBool(drawRect, m_EnableSymbol, 1, "(enable)");
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
AddHeight(EditorGUI.GetPropertyHeight(m_Symbol));
EditorGUI.PropertyField(drawRect, m_Label);
ChartEditorHelper.MakeBool(drawRect, m_EnableLabel, 1, "(enable)");
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
AddHeight(EditorGUI.GetPropertyHeight(m_Label));
EditorGUI.PropertyField(drawRect, m_ItemStyle);
ChartEditorHelper.MakeBool(drawRect, m_EnableItemStyle, 1, "(enable)");
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
AddHeight(EditorGUI.GetPropertyHeight(m_ItemStyle));
EditorGUI.PropertyField(drawRect, m_Emphasis);
ChartEditorHelper.MakeBool(drawRect, m_EnableEmphasis, 1, "(enable)");
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
AddHeight(EditorGUI.GetPropertyHeight(m_Emphasis));
EditorGUI.indentLevel -= 2;
}
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
float height = 0;
int index = InitToggle(prop);
if (!m_SerieModuleToggle.ContainsKey(prop.propertyPath) || !m_SerieModuleToggle[prop.propertyPath])
{
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
else
{
SerializedProperty type = prop.FindPropertyRelative("m_Type");
var serieType = (SerieType)type.enumValueIndex;
switch (serieType)
{
case SerieType.Line:
height += 20 * EditorGUIUtility.singleLineHeight + 19 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Symbol"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineArrow"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_AreaStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Bar:
height += 22 * EditorGUIUtility.singleLineHeight + 21 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Pie:
height += 12 * EditorGUIUtility.singleLineHeight + 11 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Ring:
height += 10 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_TitleStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Radar:
height += 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Symbol"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_AreaStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Scatter:
case SerieType.EffectScatter:
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Symbol"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Heatmap:
height += 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Gauge:
height += 13 * EditorGUIUtility.singleLineHeight + 12 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_TitleStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_GaugeAxis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_GaugePointer"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Liquid:
height += 11 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
}
if (m_DataFoldout[index])
{
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
height += 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
int num = m_Data.arraySize;
if (num > 30)
{
num = 11;
height += (num + 1) * EditorGUIUtility.singleLineHeight + (num) * EditorGUIUtility.standardVerticalSpacing;
}
else
{
height += (num) * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
}
height += EditorGUIUtility.standardVerticalSpacing;
if (prop.FindPropertyRelative("m_ShowDataIcon").boolValue)
{
for (int i = 0; i < num; i++)
{
var item = m_Data.GetArrayElementAtIndex(i);
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_IconStyle"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_Symbol"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_Emphasis"));
}
}
}
if (m_ShowJsonDataArea)
{
height += EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing;
}
return height;
}
}
private int InitToggle(SerializedProperty prop)
{
int index = 0;

View File

@@ -5,7 +5,6 @@
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
@@ -23,7 +22,7 @@ namespace XCharts
++EditorGUI.indentLevel;
PropertyField(prop, "m_MaxWidth");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_LimitSuffix");
PropertyField(prop, "m_Suffix");
--EditorGUI.indentLevel;
}
}

View File

@@ -165,13 +165,13 @@ namespace XCharts
else if (IsAssetsExist(XChartsMgr.GetThemeAssetPath(m_ChartName)))
{
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
+ XChartsMgr.GetThemeAssetPath(m_ChartName)), 5);
+ XChartsMgr.GetThemeAssetPath(m_ChartName)));
}
else
{
XChartsMgr.ExportTheme(target.theme, m_ChartName);
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
+ XChartsMgr.GetThemeAssetPath(m_ChartName)), 5);
+ XChartsMgr.GetThemeAssetPath(m_ChartName)));
}
}
}

View File

@@ -14,7 +14,8 @@ public class ChartEditorHelper
#else
public const float INDENT_WIDTH = 15;
public const float BOOL_WIDTH = 15;
public const float ARROW_WIDTH = 13;
public const float ARROW_WIDTH = 17.2f;
public const float BLOCK_WIDTH = 0;
public const float GAP_WIDTH = 0;
#endif
@@ -26,8 +27,8 @@ public class ChartEditorHelper
font = headerStyle.font,
fontStyle = headerStyle.fontStyle,
};
public static readonly GUIContent iconAdd = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add");
public static readonly GUIContent iconRemove = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove");
public static readonly GUIContent iconAdd = new GUIContent("+", "Add");
public static readonly GUIContent iconRemove = new GUIContent("-", "Remove");
public static readonly GUIContent iconUp = new GUIContent("↑", "Up");
public static readonly GUIContent iconDown = new GUIContent("↓", "Down");
public static readonly GUIStyle invisibleButton = "InvisibleButton";
@@ -41,13 +42,17 @@ public class ChartEditorHelper
drawRect = offset.Remove(drawRect);
}
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp, string name)
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp,
string name)
{
while (arrayProp.arraySize < 2) arrayProp.arraySize++;
MakeTwoField(ref drawRect, rectWidth, arrayProp.GetArrayElementAtIndex(0), arrayProp.GetArrayElementAtIndex(1), name);
var prop1 = arrayProp.GetArrayElementAtIndex(0);
var prop2 = arrayProp.GetArrayElementAtIndex(1);
MakeTwoField(ref drawRect, rectWidth, prop1, prop2, name);
}
public static void MakeDivideList(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp, string name, int showNum)
public static void MakeDivideList(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp,
string name, int showNum)
{
while (arrayProp.arraySize < showNum) arrayProp.arraySize++;
EditorGUI.LabelField(drawRect, name);
@@ -70,7 +75,8 @@ public class ChartEditorHelper
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty prop1, SerializedProperty prop2, string name)
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
SerializedProperty prop2, string name)
{
EditorGUI.LabelField(drawRect, name);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
@@ -134,21 +140,23 @@ public class ChartEditorHelper
{
float defaultWidth = drawRect.width;
float defaultX = drawRect.x;
var style = bold ? Styles.foldoutStyle : EditorStyles.foldout;
drawRect.width = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH;
moduleToggle = EditorGUI.Foldout(drawRect, moduleToggle, content, bold ? Styles.foldoutStyle : EditorStyles.foldout);
moduleToggle = EditorGUI.Foldout(drawRect, moduleToggle, content, style);
MakeBool(drawRect, prop);
drawRect.width = defaultWidth;
drawRect.x = defaultX;
return moduleToggle;
}
public static bool MakeFoldout(ref Rect drawRect, Dictionary<string, float> heights, Dictionary<string, bool> moduleToggle,
string key, string content, SerializedProperty prop, bool bold = false)
public static bool MakeFoldout(ref Rect drawRect, Dictionary<string, float> heights,
Dictionary<string, bool> moduleToggle, string key, string content, SerializedProperty prop, bool bold = false)
{
float defaultWidth = drawRect.width;
float defaultX = drawRect.x;
drawRect.width = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH;
moduleToggle[key] = EditorGUI.Foldout(drawRect, moduleToggle[key], content, bold ? Styles.foldoutStyle : EditorStyles.foldout);
var style = bold ? Styles.foldoutStyle : EditorStyles.foldout;
drawRect.width = EditorGUIUtility.labelWidth;
moduleToggle[key] = EditorGUI.Foldout(drawRect, moduleToggle[key], content, style);
if (prop != null)
{
if (prop.propertyType == SerializedPropertyType.Boolean)
@@ -200,10 +208,11 @@ public class ChartEditorHelper
drawRect.x = defaultX;
}
public static bool MakeFoldout(ref Rect drawRect, ref float height, ref Dictionary<string, bool> moduleToggle, SerializedProperty prop,
string moduleName, string showPropName, bool bold = false)
public static bool MakeFoldout(ref Rect drawRect, ref float height, ref Dictionary<string, bool> moduleToggle,
SerializedProperty prop, string moduleName, string showPropName, bool bold = false)
{
var flag = MakeFoldout(ref drawRect, ref moduleToggle, prop, moduleName, prop.FindPropertyRelative(showPropName), bold);
var relativeProp = prop.FindPropertyRelative(showPropName);
var flag = MakeFoldout(ref drawRect, ref moduleToggle, prop, moduleName, relativeProp, bold);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
return flag;
@@ -255,13 +264,15 @@ public class ChartEditorHelper
return toggle;
}
public static bool MakeListWithFoldout(ref Rect drawRect, SerializedProperty listProp, bool foldout, bool showOrder = false, bool showSize = true)
public static bool MakeListWithFoldout(ref Rect drawRect, SerializedProperty listProp, bool foldout,
bool showOrder = false, bool showSize = true)
{
var height = 0f;
return MakeListWithFoldout(ref drawRect, ref height, listProp, foldout, showOrder, showSize);
}
public static bool MakeListWithFoldout(ref Rect drawRect, ref float height, SerializedProperty listProp, bool foldout, bool showOrder = false, bool showSize = true)
public static bool MakeListWithFoldout(ref Rect drawRect, ref float height, SerializedProperty listProp,
bool foldout, bool showOrder = false, bool showSize = true)
{
var rawWidth = drawRect.width;
drawRect.width = EditorGUIUtility.labelWidth + 10;
@@ -276,13 +287,15 @@ public class ChartEditorHelper
return flag;
}
public static void MakeList(ref Rect drawRect, SerializedProperty listProp, bool showOrder = false, bool showSize = true)
public static void MakeList(ref Rect drawRect, SerializedProperty listProp, bool showOrder = false,
bool showSize = true)
{
var height = 0f;
MakeList(ref drawRect, ref height, listProp, showOrder, showSize);
}
public static void MakeList(ref Rect drawRect, ref float height, SerializedProperty listProp, bool showOrder = false, bool showSize = true)
public static void MakeList(ref Rect drawRect, ref float height, SerializedProperty listProp,
bool showOrder = false, bool showSize = true)
{
EditorGUI.indentLevel++;
var listSize = listProp.arraySize;
@@ -293,12 +306,14 @@ public class ChartEditorHelper
if (showOrder)
{
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth - 1, drawRect.height);
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth + 2, drawRect.height);
var iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += BLOCK_WIDTH;
}
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, Styles.iconAdd, Styles.invisibleButton))
{
if (listProp.displayName.Equals("Series"))
@@ -311,6 +326,7 @@ public class ChartEditorHelper
listProp.arraySize++;
}
}
GUI.contentColor = oldColor;
listSize = listProp.arraySize;
listSize = EditorGUI.IntField(elementRect, "Size", listSize);
}
@@ -357,11 +373,10 @@ public class ChartEditorHelper
SerializedProperty element = listProp.GetArrayElementAtIndex(i);
if (showOrder)
{
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var isSerie = "Serie".Equals(element.type);
var elementRect = isSerie
? new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH, drawRect.height)
? new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height)
: new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height);
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
var iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
@@ -369,6 +384,8 @@ public class ChartEditorHelper
{
iconRect.x += BLOCK_WIDTH;
}
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, Styles.iconUp, Styles.invisibleButton))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
@@ -396,6 +413,7 @@ public class ChartEditorHelper
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
}
GUI.contentColor = oldColor;
}
else
{
@@ -408,23 +426,62 @@ public class ChartEditorHelper
EditorGUI.indentLevel--;
}
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key, SerializedProperty prop)
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop)
{
if (prop == null)
{
return false;
}
if (prop == null) return false;
EditorGUI.PropertyField(drawRect, prop, true);
var hig = EditorGUI.GetPropertyHeight(prop);
// var hig = prop.hasVisibleChildren
// ? EditorGUI.GetPropertyHeight(prop)
// : EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.y += hig;
heights[key] += hig;
return true;
}
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key, SerializedProperty parentProp, string relativeName)
public static bool PropertyFieldWithMinValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop, float minValue)
{
if (prop == null) return false;
EditorGUI.PropertyField(drawRect, prop, true);
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue < minValue)
prop.floatValue = minValue;
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue < minValue)
prop.intValue = (int)minValue;
var hig = EditorGUI.GetPropertyHeight(prop);
drawRect.y += hig;
heights[key] += hig;
return true;
}
public static bool PropertyFieldWithMaxValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop, float maxValue)
{
if (prop == null) return false;
EditorGUI.PropertyField(drawRect, prop, true);
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue > maxValue)
prop.floatValue = maxValue;
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue > maxValue)
prop.intValue = (int)maxValue;
var hig = EditorGUI.GetPropertyHeight(prop);
drawRect.y += hig;
heights[key] += hig;
return true;
}
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName)
{
return PropertyField(ref drawRect, heights, key, parentProp.FindPropertyRelative(relativeName));
}
public static bool PropertyFieldWithMinValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName, float minValue)
{
var relativeProp = parentProp.FindPropertyRelative(relativeName);
return PropertyFieldWithMinValue(ref drawRect, heights, key, relativeProp, minValue);
}
public static bool PropertyFieldWithMaxValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName, float maxValue)
{
var relativeProp = parentProp.FindPropertyRelative(relativeName);
return PropertyFieldWithMaxValue(ref drawRect, heights, key, relativeProp, maxValue);
}
}

View File

@@ -37,7 +37,7 @@ namespace XCharts
GUILayout.Label("The current version: " + mgr.nowVersion);
if (mgr.needUpdate && !mgr.isCheck)
{
GUILayout.Label("The latest version: " + mgr.newVersion);
GUILayout.Label("The remote version: " + mgr.newVersion);
GUILayout.Label("");
if (mgr.isCheck) GUILayout.Label("check ...");
else if (mgr.isNetworkError) GUILayout.Label("check failed: " + mgr.networkError);
@@ -72,9 +72,9 @@ namespace XCharts
}
else
{
if (mgr.isCheck) GUILayout.Label("The latest version: checking ...");
if (mgr.isCheck) GUILayout.Label("The remote version: checking ...");
else if (mgr.isNetworkError) GUILayout.Label("check failed: " + mgr.networkError);
else GUILayout.Label("The latest version: " + mgr.newVersion);
else GUILayout.Label("The remote version: " + mgr.newVersion);
GUILayout.Label("");
if (!mgr.isNetworkError && !mgr.needUpdate && !mgr.isCheck)

View File

@@ -1,8 +1,7 @@
{
"name": "XCharts.Editor",
"references": [
"XCharts.Runtime",
"Unity.TextMeshPro"
"XCharts.Runtime"
],
"includePlatforms": [
"Editor"

View File

@@ -10,16 +10,35 @@
一款基于UGUI的数据可视化图表插件。
<br>
</p>
![license](https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts)
[![npm Package](https://img.shields.io/npm/v/unity-ugui-xcharts.svg)](https://www.npmjs.org/package/unity-ugui-xcharts)
[![github release](https://img.shields.io/github/v/release/monitor1394/unity-ugui-XCharts?include_prereleases&label=github)](https://github.com/monitor1394/unity-ugui-XCharts/releases)
![code size](https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts)
[![github download](https://img.shields.io/github/downloads/monitor1394/unity-ugui-XCharts/total?label=github%20downloads)](https://github.com/monitor1394/unity-ugui-XCharts/releases)
[![npm downloads](https://img.shields.io/npm/dt/unity-ugui-xcharts?label=npm%20downloads%20)](https://www.npmjs.org/package/unity-ugui-xcharts)
[![npm downloads](https://img.shields.io/npm/dm/unity-ugui-xcharts?label=%20)](https://www.npmjs.org/package/unity-ugui-xcharts)
![unity version](https://img.shields.io/badge/Unity-5.6%20%7C%202017%20%7C%202018%20%7C%202019%20%7C%202020%20%7C%202021-green)
![textmeshpro](https://img.shields.io/badge/TextMeshPro-YES-green)
<p align="center">
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
</a>
<a href="">
<img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/v/unity-ugui-xcharts.svg?label=npm">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/dt/unity-ugui-xcharts?label=npm%20downloads%20">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/dm/unity-ugui-xcharts?label=%20">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
<img src="https://img.shields.io/github/v/release/monitor1394/unity-ugui-XCharts?include_prereleases&label=github">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
<img src="https://img.shields.io/github/downloads/monitor1394/unity-ugui-XCharts/total?label=github%20downloads">
</a>
<a href="">
<img src="https://img.shields.io/badge/Unity-5.6%20%7C%202017%20%7C%202018%20%7C%202019%20%7C%202020%20%7C%202021-green">
</a>
<a href="">
<img src="https://img.shields.io/badge/TextMeshPro-YES-green">
</a>
</p>
A powerful, easy-to-use, configurable charting and data visualization library for Unity. Supporting line, bar, pie, radar, scatter, heatmap, gauge, ring, polar, liquid and other common chart.
@@ -63,6 +82,11 @@ A powerful, easy-to-use, configurable charting and data visualization library fo
![radarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-radar.png)
![scatterchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-scatter.png)
![heatmapchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-heatmap.png)
![gaugechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-gauge.png)
![ringchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-ring.png)
![polarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-polar.png)
![liquidchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-liquid.png)
![combinations](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-combinations.png)
## Cheat Sheet

View File

@@ -38,6 +38,7 @@ MonoBehaviour:
m_SerieScatterSymbolSize: 20
m_SerieScatterSymbolSelectedSize: 30
m_EditorBlockEnable: 1
m_EditorShowAllListData: 0
m_MaxPainter: 10
m_LineSmoothStyle: 3
m_LineSmoothness: 2

View File

@@ -26,6 +26,17 @@ namespace XCharts
m_Radars.Clear();
}
/// <summary>
/// 移除指定Radar的所有Indicator。
/// </summary>
/// <param name="radarIndex"></param>
public void RemoveIndicator(int radarIndex)
{
var radar = GetRadar(radarIndex);
if (radar == null) return;
radar.indicatorList.Clear();
}
/// <summary>
/// 添加雷达坐标系组件。
/// </summary>
@@ -61,6 +72,14 @@ namespace XCharts
return radar;
}
public bool AddIndicator(int radarIndex, Radar.Indicator indicator)
{
var radar = GetRadar(radarIndex);
if (radar == null) return false;
radar.AddIndicator(indicator);
return true;
}
/// <summary>
/// 添加指示器。
/// </summary>

View File

@@ -340,6 +340,12 @@ namespace XCharts
return new Vector3(x, y);
}
public void AddIndicator(Radar.Indicator indicator)
{
indicatorList.Add(indicator);
SetAllDirty();
}
public Radar.Indicator AddIndicator(string name, float min, float max)
{
var indicator = new Radar.Indicator();

View File

@@ -60,6 +60,7 @@ namespace XCharts
[SerializeField] private string m_NumericFormatter = "";
[SerializeField] private float m_PaddingLeftRight = 5f;
[SerializeField] private float m_PaddingTopBottom = 5f;
[SerializeField] private bool m_IgnoreDataShow = false;
[SerializeField] private string m_IgnoreDataDefaultContent = "-";
[SerializeField] private bool m_AlwayShow = false;
[SerializeField] private Vector2 m_Offset = new Vector2(18f, -25f);
@@ -185,6 +186,11 @@ namespace XCharts
/// </summary>
public float paddingTopBottom { get { return m_PaddingTopBottom; } set { m_PaddingTopBottom = value; } }
/// <summary>
/// Whether to show ignored data on tooltip.
/// 是否显示忽略数据在tooltip上。
/// </summary>
public bool ignoreDataShow { get { return m_IgnoreDataShow; } set { m_IgnoreDataShow = value; } }
/// <summary>
/// The default display character information for ignored data.
/// 被忽略数据的默认显示字符信息。
/// </summary>

View File

@@ -28,9 +28,9 @@ namespace XCharts
grid.bottom = 60;
m_XAxes[0].type = Axis.AxisType.Category;
m_XAxes[0].boundaryGap = false;
m_XAxes[0].boundaryGap = true;
m_YAxes[0].type = Axis.AxisType.Category;
m_YAxes[0].boundaryGap = false;
m_YAxes[0].boundaryGap = true;
m_XAxes[0].splitNumber = 10;
m_YAxes[0].splitNumber = 10;
RemoveData();

View File

@@ -249,16 +249,19 @@ namespace XCharts
m_Theme.ClearDirty();
}
CheckComponentDirty(tooltip);
foreach (var title in m_Titles) CheckComponentDirty(title);
foreach (var legend in m_Legends) CheckComponentDirty(legend);
foreach (var dataZoom in m_DataZooms) CheckComponentDirty(dataZoom);
foreach (var visualMap in m_VisualMaps) CheckComponentDirty(visualMap);
foreach (var grid in m_Grids) CheckComponentDirty(grid);
foreach (var axis in m_XAxes) CheckComponentDirty(axis);
foreach (var axis in m_YAxes) CheckComponentDirty(axis);
foreach (var polar in m_Polars) CheckComponentDirty(polar);
foreach (var axis in m_AngleAxes) CheckComponentDirty(axis);
foreach (var axis in m_RadiusAxes) CheckComponentDirty(axis);
foreach (var component in m_Titles) CheckComponentDirty(component);
foreach (var component in m_Legends) CheckComponentDirty(component);
foreach (var component in m_Tooltips) CheckComponentDirty(component);
foreach (var component in m_DataZooms) CheckComponentDirty(component);
foreach (var component in m_VisualMaps) CheckComponentDirty(component);
foreach (var component in m_Grids) CheckComponentDirty(component);
foreach (var component in m_XAxes) CheckComponentDirty(component);
foreach (var component in m_YAxes) CheckComponentDirty(component);
foreach (var component in m_Vessels) CheckComponentDirty(component);
foreach (var component in m_Polars) CheckComponentDirty(component);
foreach (var component in m_AngleAxes) CheckComponentDirty(component);
foreach (var component in m_RadiusAxes) CheckComponentDirty(component);
foreach (var component in m_Radars) CheckComponentDirty(component);
foreach (var drawSerie in m_DrawSeries) drawSerie.CheckComponent();
}
@@ -278,9 +281,19 @@ namespace XCharts
{
base.SetAllComponentDirty();
m_Theme.SetAllDirty();
foreach (var title in m_Titles) title.SetAllDirty();
foreach (var legend in m_Legends) legend.SetAllDirty();
tooltip.SetAllDirty();
foreach (var component in m_Titles) component.SetAllDirty();
foreach (var component in m_Legends) component.SetAllDirty();
foreach (var component in m_Tooltips) component.SetAllDirty();
foreach (var component in m_Grids) component.SetAllDirty();
foreach (var component in m_XAxes) component.SetAllDirty();
foreach (var component in m_YAxes) component.SetAllDirty();
foreach (var component in m_DataZooms) component.SetAllDirty();
foreach (var component in m_VisualMaps) component.SetAllDirty();
foreach (var component in m_Vessels) component.SetAllDirty();
foreach (var component in m_Polars) component.SetAllDirty();
foreach (var component in m_RadiusAxes) component.SetAllDirty();
foreach (var component in m_AngleAxes) component.SetAllDirty();
foreach (var component in m_Radars) component.SetAllDirty();
m_ReinitLabel = true;
m_ReinitTitle = true;
}
@@ -337,18 +350,16 @@ namespace XCharts
}
private void InitTitle(Title title)
{
title.OnChanged();
var anchorMin = title.location.runtimeAnchorMin;
var anchorMax = title.location.runtimeAnchorMax;
var pivot = title.location.runtimePivot;
var titleObject = ChartHelper.AddObject(s_TitleObjectName + title.index, transform, anchorMin, anchorMax,
pivot, m_ChartSizeDelta);
title.gameObject = titleObject;
title.painter = null;
title.refreshComponent = delegate ()
{
if (titleObject == null) return;
title.OnChanged();
var anchorMin = title.location.runtimeAnchorMin;
var anchorMax = title.location.runtimeAnchorMax;
var pivot = title.location.runtimePivot;
var titleObject = ChartHelper.AddObject(s_TitleObjectName + title.index, transform, anchorMin, anchorMax,
pivot, m_ChartSizeDelta);
title.gameObject = titleObject;
anchorMin = title.location.runtimeAnchorMin;
anchorMax = title.location.runtimeAnchorMax;
pivot = title.location.runtimePivot;
@@ -392,15 +403,13 @@ namespace XCharts
private void InitLegend(Legend legend)
{
legend.OnChanged();
var legendObject = ChartHelper.AddObject(s_LegendObjectName + legend.index, transform, m_ChartMinAnchor,
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
legend.gameObject = legendObject;
legend.painter = null; // legend component does not need to paint
legend.refreshComponent = delegate ()
{
if (legendObject == null) return;
legend.OnChanged();
var legendObject = ChartHelper.AddObject(s_LegendObjectName + legend.index, transform, m_ChartMinAnchor,
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
legend.gameObject = legendObject;
legendObject.hideFlags = chartHideFlags;
SeriesHelper.UpdateSerieNameList(m_Series, ref m_LegendRealShowName);
List<string> datas;
@@ -583,12 +592,11 @@ namespace XCharts
private void InitTooltip()
{
tooltip.gameObject = ChartHelper.AddObject("tooltip", transform, m_ChartMinAnchor,
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
tooltip.painter = m_PainterTop;
tooltip.refreshComponent = delegate ()
{
if (tooltip.gameObject == null) return;
tooltip.gameObject = ChartHelper.AddObject("tooltip", transform, m_ChartMinAnchor,
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
var tooltipObject = tooltip.gameObject;
tooltipObject.transform.localPosition = Vector3.zero;
tooltipObject.hideFlags = chartHideFlags;
@@ -678,7 +686,7 @@ namespace XCharts
{
m_Painter.Refresh();
foreach (var painter in m_PainterList) painter.Refresh();
m_PainterTop.Refresh();
if (m_PainterTop != null) m_PainterTop.Refresh();
m_RefreshChart = false;
}
}
@@ -688,7 +696,7 @@ namespace XCharts
if (m_Painter == null) return;
m_Painter.CheckRefresh();
foreach (var painter in m_PainterList) painter.CheckRefresh();
m_PainterTop.CheckRefresh();
if (m_PainterTop != null) m_PainterTop.CheckRefresh();
}
protected void CheckRefreshLabel()
@@ -739,10 +747,7 @@ namespace XCharts
m_ChartSizeDelta = m_GraphSizeDelta;
m_ChartRect = m_GraphRect;
m_Background.SetAllDirty();
foreach (var title in m_Titles) title.SetAllDirty();
foreach (var legend in m_Legends) legend.SetAllDirty();
tooltip.SetAllDirty();
SetAllComponentDirty();
m_Series.SetLabelDirty();
m_ReinitLabel = true;
RefreshChart();

View File

@@ -34,6 +34,7 @@ namespace XCharts
protected Vector2 m_GraphMaxAnchor;
protected Vector2 m_GraphPivot;
protected Vector2 m_GraphSizeDelta;
protected Vector2 m_GraphAnchoredPosition;
protected Rect m_GraphRect = new Rect(0, 0, 0, 0);
protected bool m_RefreshChart = false;
protected bool m_ForceOpenRaycastTarget;
@@ -197,13 +198,12 @@ namespace XCharts
private void InitBackground()
{
var backgroundObj = ChartHelper.AddObject(s_BackgroundObjectName, transform, m_GraphMinAnchor,
m_GraphMaxAnchor, m_GraphPivot, m_GraphSizeDelta);
m_Background.gameObject = backgroundObj;
m_Background.painter = m_Painter;
m_Background.refreshComponent = delegate ()
{
if (backgroundObj == null) return;
var backgroundObj = ChartHelper.AddObject(s_BackgroundObjectName, transform, m_GraphMinAnchor,
m_GraphMaxAnchor, m_GraphPivot, m_GraphSizeDelta);
m_Background.gameObject = backgroundObj;
backgroundObj.hideFlags = chartHideFlags;
var backgroundImage = ChartHelper.GetOrAddComponent<Image>(backgroundObj);
ChartHelper.UpdateRectTransform(backgroundObj, m_GraphMinAnchor,
@@ -235,8 +235,11 @@ namespace XCharts
Awake();
}
if (m_GraphWidth != currWidth || m_GraphHeight != currHeight ||
m_GraphMinAnchor != rectTransform.anchorMin || m_GraphMaxAnchor != rectTransform.anchorMax)
if (m_GraphWidth != currWidth
|| m_GraphHeight != currHeight
|| m_GraphMinAnchor != rectTransform.anchorMin
|| m_GraphMaxAnchor != rectTransform.anchorMax
|| m_GraphAnchoredPosition != rectTransform.anchoredPosition)
{
UpdateSize();
}
@@ -255,6 +258,7 @@ namespace XCharts
m_GraphMaxAnchor = rectTransform.anchorMax;
m_GraphMinAnchor = rectTransform.anchorMin;
m_GraphSizeDelta = rectTransform.sizeDelta;
m_GraphAnchoredPosition = rectTransform.anchoredPosition;
rectTransform.pivot = LayerHelper.ResetChartPositionAndPivot(m_GraphMinAnchor, m_GraphMaxAnchor,
m_GraphWidth, m_GraphHeight, ref m_GraphX, ref m_GraphY);

View File

@@ -26,7 +26,6 @@ namespace XCharts
private float m_DataZoomLastStartIndex;
private float m_DataZoomLastEndIndex;
private bool m_CheckDataZoomLabel;
private Dictionary<int, List<Serie>> m_StackSeries = new Dictionary<int, List<Serie>>();
protected override void InitComponent()
{
@@ -61,15 +60,6 @@ namespace XCharts
Awake();
}
#endif
protected override void SetAllComponentDirty()
{
base.SetAllComponentDirty();
foreach (var dataZoom in m_DataZooms) dataZoom.SetAllDirty();
foreach (var visualMap in m_VisualMaps) visualMap.SetAllDirty();
foreach (var grid in m_Grids) grid.SetAllDirty();
foreach (var axis in m_XAxes) axis.SetAllDirty();
foreach (var axis in m_YAxes) axis.SetAllDirty();
}
private void RefreshSeriePainterByGridIndex(int gridIndex)
{
@@ -499,14 +489,13 @@ namespace XCharts
private void InitYAxis(int yAxisIndex, YAxis yAxis)
{
string objName = ChartCached.GetYAxisName(yAxisIndex);
var axisObj = ChartHelper.AddObject(objName, transform, graphAnchorMin,
graphAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
yAxis.gameObject = axisObj;
yAxis.painter = m_Painter;
yAxis.refreshComponent = delegate ()
{
if (axisObj == null) return;
string objName = ChartCached.GetYAxisName(yAxisIndex);
var axisObj = ChartHelper.AddObject(objName, transform, graphAnchorMin,
graphAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
yAxis.gameObject = axisObj;
yAxis.axisLabelTextList.Clear();
axisObj.SetActive(yAxis.show && yAxis.axisLabel.show);
axisObj.hideFlags = chartHideFlags;
@@ -610,14 +599,13 @@ namespace XCharts
private void InitXAxis(int xAxisIndex, XAxis xAxis)
{
string objName = ChartCached.GetXAxisName(xAxisIndex);
var axisObj = ChartHelper.AddObject(objName, transform, graphAnchorMin,
graphAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
xAxis.gameObject = axisObj;
xAxis.painter = m_Painter;
xAxis.refreshComponent = delegate ()
{
if (axisObj == null) return;
string objName = ChartCached.GetXAxisName(xAxisIndex);
var axisObj = ChartHelper.AddObject(objName, transform, graphAnchorMin,
graphAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
xAxis.gameObject = axisObj;
xAxis.axisLabelTextList.Clear();
axisObj.SetActive(xAxis.show && xAxis.axisLabel.show);
axisObj.hideFlags = chartHideFlags;
@@ -716,13 +704,12 @@ namespace XCharts
{
var dataZoom = m_DataZooms[i];
dataZoom.index = i;
var dataZoomObject = ChartHelper.AddObject(s_DefaultDataZoom + i, transform, graphAnchorMin,
graphAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
dataZoom.gameObject = dataZoomObject;
dataZoom.painter = m_PainterTop;
dataZoom.refreshComponent = delegate ()
{
if (dataZoomObject == null) return;
var dataZoomObject = ChartHelper.AddObject(s_DefaultDataZoom + i, transform, graphAnchorMin,
graphAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
dataZoom.gameObject = dataZoomObject;
dataZoomObject.hideFlags = chartHideFlags;
ChartHelper.HideAllObject(dataZoomObject);
var startLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "start", dataZoomObject.transform,
@@ -1021,7 +1008,8 @@ namespace XCharts
pX += startX - yAxis.axisTick.GetLength(m_Theme.axis.tickLength);
}
UGL.DrawLine(vh, new Vector3(startX, pY), new Vector3(pX, pY),
yAxis.axisTick.GetWidth(m_Theme.axis.tickWidth), m_Theme.axis.tickColor);
yAxis.axisTick.GetWidth(m_Theme.axis.tickWidth),
yAxis.axisTick.GetColor(m_Theme.axis.tickColor));
}
totalWidth += scaleWidth;
}
@@ -1038,7 +1026,8 @@ namespace XCharts
var startPos = new Vector3(lineX, grid.runtimeY + grid.runtimeHeight);
var arrowPos = new Vector3(lineX, grid.runtimeY);
UGL.DrawArrow(vh, startPos, arrowPos, axisArrow.width, axisArrow.height,
axisArrow.offset, axisArrow.dent, axisArrow.GetColor(m_Theme.axis.lineColor));
axisArrow.offset, axisArrow.dent,
axisArrow.GetColor(yAxis.axisLine.GetColor(m_Theme.axis.lineColor)));
}
else
{
@@ -1046,7 +1035,8 @@ namespace XCharts
var startPos = new Vector3(lineX, grid.runtimeX);
var arrowPos = new Vector3(lineX, grid.runtimeY + grid.runtimeHeight + lineWidth);
UGL.DrawArrow(vh, startPos, arrowPos, axisArrow.width, axisArrow.height,
axisArrow.offset, axisArrow.dent, axisArrow.GetColor(m_Theme.axis.lineColor));
axisArrow.offset, axisArrow.dent,
axisArrow.GetColor(yAxis.axisLine.GetColor(m_Theme.axis.lineColor)));
}
}
}
@@ -1127,7 +1117,8 @@ namespace XCharts
pY += startY - xAxis.axisTick.GetLength(m_Theme.axis.tickLength);
}
UGL.DrawLine(vh, new Vector3(pX, startY), new Vector3(pX, pY),
xAxis.axisTick.GetWidth(m_Theme.axis.tickWidth), m_Theme.axis.tickColor);
xAxis.axisTick.GetWidth(m_Theme.axis.tickWidth),
xAxis.axisTick.GetColor(m_Theme.axis.tickColor));
}
totalWidth += scaleWidth;
}
@@ -1144,14 +1135,16 @@ namespace XCharts
var startPos = new Vector3(grid.runtimeX + grid.runtimeWidth, lineY);
var arrowPos = new Vector3(grid.runtimeX, lineY);
UGL.DrawArrow(vh, startPos, arrowPos, axisArrow.width, axisArrow.height,
axisArrow.offset, axisArrow.dent, axisArrow.GetColor(m_Theme.axis.lineColor));
axisArrow.offset, axisArrow.dent,
axisArrow.GetColor(xAxis.axisLine.GetColor(m_Theme.axis.lineColor)));
}
else
{
var startPos = new Vector3(grid.runtimeX, lineY);
var arrowPos = new Vector3(grid.runtimeX + grid.runtimeWidth + xAxis.axisLine.GetWidth(m_Theme.axis.lineWidth), lineY);
UGL.DrawArrow(vh, startPos, arrowPos, axisArrow.width, axisArrow.height,
axisArrow.offset, axisArrow.dent, axisArrow.GetColor(m_Theme.axis.lineColor));
axisArrow.offset, axisArrow.dent,
axisArrow.GetColor(xAxis.axisLine.GetColor(m_Theme.axis.lineColor)));
}
}
}
@@ -1375,7 +1368,8 @@ namespace XCharts
private void CheckRaycastTarget()
{
var ray = dataZoom.enable || (visualMap.enable && visualMap.show && visualMap.calculable);
var ray = (dataZoom != null && dataZoom.enable)
|| (visualMap != null && visualMap.enable && visualMap.show && visualMap.calculable);
if (raycastTarget != ray)
{
raycastTarget = ray;
@@ -1384,7 +1378,7 @@ namespace XCharts
private void CheckDataZoom()
{
if (!dataZoom.enable) return;
if (dataZoom == null || !dataZoom.enable) return;
CheckDataZoomScale();
CheckDataZoomLabel();
}
@@ -2043,7 +2037,7 @@ namespace XCharts
if (!axis.axisLine.onZero) return 0;
foreach (var xAxis in m_XAxes)
{
if (xAxis.IsValue() && xAxis.gridIndex == axis.gridIndex) return xAxis.runtimeZeroYOffset;
if (xAxis.IsValue() && xAxis.gridIndex == axis.gridIndex) return xAxis.runtimeZeroXOffset;
}
return 0;
}

View File

@@ -18,7 +18,7 @@ namespace XCharts
protected void CheckVisualMap()
{
if (!visualMap.enable || !visualMap.show) return;
if (visualMap == null || !visualMap.enable || !visualMap.show) return;
Vector2 local;
if (canvas == null) return;
@@ -120,6 +120,8 @@ namespace XCharts
if (serie.animation.HasFadeOut()) return;
var yAxis = m_YAxes[serie.yAxisIndex];
var xAxis = m_XAxes[serie.xAxisIndex];
xAxis.boundaryGap = true;
yAxis.boundaryGap = true;
var grid = GetSerieGridOrDefault(serie);
var xCount = xAxis.data.Count;
var yCount = yAxis.data.Count;
@@ -153,9 +155,11 @@ namespace XCharts
serie.dataPoints.Add(Vector3.zero);
continue;
}
var value = serieData.GetCurrData(dimension, dataChangeDuration, yAxis.inverse, yAxis.runtimeMinValue, yAxis.runtimeMaxValue);
var value = serieData.GetCurrData(dimension, dataChangeDuration, yAxis.inverse,
yAxis.runtimeMinValue, yAxis.runtimeMaxValue);
if (serieData.IsDataChanged()) dataChanging = true;
var pos = new Vector3(zeroX + (i + 0.5f) * xWidth, zeroY + (j + 0.5f) * yWidth);
var pos = new Vector3(zeroX + (i + (xAxis.boundaryGap ? 0.5f : 0)) * xWidth,
zeroY + (j + (yAxis.boundaryGap ? 0.5f : 0)) * yWidth);
serie.dataPoints.Add(pos);
serieData.canShowLabel = false;
if (value == 0) continue;
@@ -171,7 +175,9 @@ namespace XCharts
}
if (animationIndex >= 0 && i > animationIndex) continue;
serieData.canShowLabel = true;
var emphasis = (tooltip.show && i == (int)tooltip.runtimeXValues[0] && j == (int)tooltip.runtimeYValues[0])
var emphasis = (tooltip.show
&& i == (int)tooltip.runtimeXValues[0]
&& j == (int)tooltip.runtimeYValues[0])
|| visualMap.runtimeSelectedIndex > 0;
var rectWid = xWidth - 2 * borderWidth;
var rectHig = yWidth - 2 * borderWidth;
@@ -180,10 +186,12 @@ namespace XCharts
{
UGL.DrawBorder(vh, pos, rectWid, rectHig, borderWidth, borderColor);
}
if (visualMap.hoverLink && emphasis && serie.emphasis.show && serie.emphasis.itemStyle.borderWidth > 0)
if (visualMap.hoverLink && emphasis && serie.emphasis.show
&& serie.emphasis.itemStyle.borderWidth > 0)
{
var emphasisBorderWidth = serie.emphasis.itemStyle.borderWidth;
var emphasisBorderColor = serie.emphasis.itemStyle.opacity > 0 ? serie.emphasis.itemStyle.borderColor : ChartConst.clearColor32;
var emphasisBorderColor = serie.emphasis.itemStyle.opacity > 0
? serie.emphasis.itemStyle.borderColor : ChartConst.clearColor32;
UGL.DrawBorder(vh, pos, rectWid, rectHig, emphasisBorderWidth, emphasisBorderColor);
}
}

View File

@@ -18,7 +18,6 @@ namespace XCharts
public BaseChart chart;
private const string INDICATOR_TEXT = "indicator";
private bool m_IsEnterLegendButtom;
private bool m_RadarsDirty;
Dictionary<string, int> serieNameSet = new Dictionary<string, int>();
public DrawSerieRadar(BaseChart chart)
@@ -28,26 +27,11 @@ namespace XCharts
public void InitComponent()
{
InitIndicator();
InitRadars();
}
public void CheckComponent()
{
var anyDirty = IsAnyRadarDirty();
if (m_RadarsDirty || anyDirty)
{
InitIndicator();
chart.RefreshBasePainter();
chart.tooltip.UpdateToTop();
if (anyDirty)
{
foreach (var radar in chart.radars)
{
radar.ClearDirty();
}
}
m_RadarsDirty = false;
}
}
public void Update()
@@ -244,22 +228,31 @@ namespace XCharts
{
}
private void InitIndicator()
private void InitRadars()
{
ChartHelper.HideAllObject(chart.transform, INDICATOR_TEXT);
for (int n = 0; n < chart.radars.Count; n++)
{
Radar radar = chart.radars[n];
radar.index = n;
InitRadar(radar);
}
}
private void InitRadar(Radar radar)
{
float txtWid = 100;
float txtHig = 20;
radar.painter = chart.GetPainter(radar.index);
radar.refreshComponent = delegate ()
{
ChartHelper.HideAllObject(chart.transform, INDICATOR_TEXT + "_" + radar.index);
radar.UpdateRadarCenter(chart.chartPosition, chart.chartWidth, chart.chartHeight);
int indicatorNum = radar.indicatorList.Count;
float txtWid = 100;
float txtHig = 20;
for (int i = 0; i < indicatorNum; i++)
for (int i = 0; i < radar.indicatorList.Count; i++)
{
var indicator = radar.indicatorList[i];
var pos = radar.GetIndicatorPosition(i);
var textStyle = indicator.textStyle;
var objName = INDICATOR_TEXT + "_" + n + "_" + i;
var objName = INDICATOR_TEXT + "_" + radar.index + "_" + i;
var txt = ChartHelper.AddTextObject(objName, chart.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(txtWid, txtHig),
textStyle, chart.theme.radar);
@@ -270,7 +263,9 @@ namespace XCharts
var offset = new Vector3(textStyle.offset.x, textStyle.offset.y);
AxisHelper.AdjustCircleLabelPos(txt, pos, radar.runtimeCenterPos, txtHig, offset);
}
}
chart.RefreshBasePainter();
};
radar.refreshComponent?.Invoke();
}
private void DrawMutipleRadar(VertexHelper vh, Serie serie, int i)

View File

@@ -177,7 +177,10 @@ namespace XCharts
if (axis.IsCategory())
{
int tick = Mathf.RoundToInt(axis.data.Count * 1f / splitNum);
return Mathf.CeilToInt(axis.data.Count * 1.0f / tick) + 1;
if (axis.boundaryGap)
return Mathf.CeilToInt(axis.data.Count * 1.0f / tick) + 1;
else
return Mathf.CeilToInt(axis.data.Count * 1.0f / tick);
}
else
{

View File

@@ -228,7 +228,6 @@ namespace XCharts
labelRadius = serie.runtimeOutsideRadius + serieLabel.lineLength1;
labelCenter = new Vector2(serie.runtimeCenterPos.x + labelRadius * Mathf.Sin(currRad),
serie.runtimeCenterPos.y + labelRadius * Mathf.Cos(currRad));
float labelWidth = serieData.labelObject.label.GetPreferredWidth();
serieData.labelPosition = labelCenter;
}
break;

View File

@@ -106,7 +106,7 @@ namespace XCharts
public static void InitRadarTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, Radar radar,
ChartTheme theme)
{
if(radar == null) return;
if (radar == null) return;
if (!serie.show) return;
if (tooltip.runtimeGridIndex >= 0) return;
if (serie.radarIndex != radar.index) return;
@@ -206,7 +206,7 @@ namespace XCharts
.Append(ChartCached.FloatToStr(yValue, numericFormatter)).Append("]");
}
}
else
else if (!isIngore || (isIngore && tooltip.ignoreDataShow))
{
var valueTxt = isIngore ? tooltip.ignoreDataDefaultContent :
ChartCached.FloatToStr(yValue, numericFormatter);

View File

@@ -100,7 +100,6 @@ namespace XCharts
public static void DrawLineStyle(VertexHelper vh, LineStyle.Type lineType, float lineWidth,
Vector3 startPos, Vector3 endPos, Color32 color)
{
var type = lineType;
switch (lineType)
{
case LineStyle.Type.Dashed:

View File

@@ -1,7 +1,6 @@
{
"name": "XCharts.Runtime",
"references": [
"Unity.TextMeshPro"
],
"optionalUnityReferences": [],
"includePlatforms": [],

View File

@@ -35,8 +35,8 @@ namespace XCharts
[ExecuteInEditMode]
public class XChartsMgr : MonoBehaviour
{
internal static string _version = "2.0.0-preview.2";
internal static int _versionDate = 20210121;
internal static string _version = "2.0.1";
internal static int _versionDate = 20210226;
public static string version { get { return _version; } }
public static int versionDate { get { return _versionDate; } }
public static string fullVersion { get { return version + "-" + versionDate; } }
@@ -104,7 +104,7 @@ namespace XCharts
{
get
{
return !isNetworkError && !m_NowVersion.Equals(m_NewVersion);
return !isNetworkError && newDate > versionDate;
}
}

View File

@@ -12,7 +12,6 @@ namespace XCharts
public class XChartsPackageResourceImporter
{
bool m_EssentialResourcesImported;
bool m_ExamplesAndExtrasResourcesImported;
public XChartsPackageResourceImporter() { }
@@ -23,7 +22,6 @@ namespace XCharts
public void OnGUI()
{
m_EssentialResourcesImported = File.Exists("Assets/XCharts/Resources/XChartsSettings.asset");
m_ExamplesAndExtrasResourcesImported = Directory.Exists("Assets/XCharts/Examples & Extras");
GUILayout.BeginVertical();
{

View File

@@ -14,7 +14,10 @@ using TMPro;
namespace XCharts
{
[Serializable]
#if UNITY_2018_3
[ExcludeFromPresetAttribute]
#endif
public class XChartsSettings : ScriptableObject
{

View File

@@ -1,9 +1,9 @@
{
"name": "com.monitor1394.xcharts",
"displayName": "XCharts",
"version": "2.0.0-preview.2",
"date": "20210121",
"checkdate": "20210121",
"version": "2.0.1",
"date": "20210226",
"checkdate": "20210226",
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
"unity": "2018.3",
"description": "A charting and data visualization library for Unity.",

View File

@@ -1,7 +1,7 @@
{
"version": "2.0.0-preview.2",
"date": "20210121",
"checkdate": "20210121",
"version": "2.0.1",
"date": "20210226",
"checkdate": "20210226",
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 1014 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 307 KiB

View File

@@ -17,7 +17,7 @@ If your project use `Unity 2018.3` or above, your can import `XCharts` by `Packa
1. Open the `mamnifest.json` file in `Packages` directory, and add:
``` json
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#upm",
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#2.0-upm",
```
2. Switch to `Unity`, It may take 3 to 5 minutes to download and compile, and once successful you can start using `XCharts`.
3. If you want to delete `XCharts`, undo step 1.

View File

@@ -18,7 +18,7 @@
1. 打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
``` json
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#upm",
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#2.0-upm",
```
2. 回到`Unity`可能会花3到5分钟进行下载和编译成功后就可以开始使用`XCharts`了。

View File

@@ -11,18 +11,35 @@
<br>
<a href="Assets/XCharts/README.md">English Doc</a>
</p>
[![license](https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts)](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE)
[![github release](https://img.shields.io/github/v/release/monitor1394/unity-ugui-XCharts?include_prereleases)](https://github.com/monitor1394/unity-ugui-XCharts/releases)
![repo size](https://img.shields.io/github/repo-size/monitor1394/unity-ugui-xcharts)
![code size](https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts)
[![github download](https://img.shields.io/github/downloads/monitor1394/unity-ugui-XCharts/total?label=github%20downloads)](https://github.com/monitor1394/unity-ugui-XCharts/releases)
[![npm downloads](https://img.shields.io/npm/dt/unity-ugui-xcharts?label=npm%20downloads%20)](https://www.npmjs.org/package/unity-ugui-xcharts)
[![npm downloads](https://img.shields.io/npm/dm/unity-ugui-xcharts?label=%20)](https://www.npmjs.org/package/unity-ugui-xcharts)
![unity version](https://img.shields.io/badge/Unity-5.6%20%7C%202017%20%7C%202018%20%7C%202019%20%7C%202020%20%7C%202021-green)
![textmeshpro](https://img.shields.io/badge/TextMeshPro-YES-green)
<p align="center">
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
<img src="https://img.shields.io/github/v/release/monitor1394/unity-ugui-XCharts?include_prereleases">
</a>
<a href="">
<img src="https://img.shields.io/github/repo-size/monitor1394/unity-ugui-xcharts">
</a>
<a href="">
<img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
<img src="https://img.shields.io/github/downloads/monitor1394/unity-ugui-XCharts/total?label=github%20downloads">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/dt/unity-ugui-xcharts?label=npm%20downloads%20">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/dm/unity-ugui-xcharts?label=%20">
</a>
<a href="">
<img src="https://img.shields.io/badge/Unity-5.6%20%7C%202017%20%7C%202018%20%7C%202019%20%7C%202020%20%7C%202021-green">
</a>
<a href="">
<img src="https://img.shields.io/badge/TextMeshPro-YES-green">
</a>
</p>
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持折线图、柱状图、饼图、雷达图、散点图、热力图、仪表盘、环形图、极坐标、水位图等常见图表。
@@ -66,6 +83,11 @@
![radarchart](Doc/screenshot/xcharts-radar.png)
![scatterchart](Doc/screenshot/xcharts-scatter.png)
![heatmapchart](Doc/screenshot/xcharts-heatmap.png)
![gaugechart](Doc/screenshot/xcharts-gauge.png)
![ringchart](Doc/screenshot/xcharts-ring.png)
![polarchart](Doc/screenshot/xcharts-polar.png)
![liquidchart](Doc/screenshot/xcharts-liquid.png)
![combinations](Doc/screenshot/xcharts-combinations.png)
## 术语
@@ -142,7 +164,7 @@ XCharts的图表由组件和数据组成。不同的组件和数据可以组合
* 通过下载源码或`unitypackage`包导入到你的项目中。如果你是`2018.3`及以上版本,可通过`Package Manager`的`Git`来导入包:
1. 打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
``` json
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#upm",
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#2.0-upm",
```
2. 回到`Unity`可能会花3到5分钟进行下载和编译成功后就可以开始使用`XCharts`了。
3. 如果要删除`XCharts`删除掉1步骤所加的内容即可。