Compare commits

..

72 Commits

Author SHA1 Message Date
monitor1394
1d2f83169d 修复Pie只有一个数据时设置border后显示异常的问题 (#237) 2022-12-28 18:17:00 +08:00
monitor1394
a7c4e24555 [bug][datazoom] fix datazoom range error (#221) 2022-08-30 08:10:18 +08:00
monitor1394
6fad4fcccc update to Unity2019.4.39f1 2022-08-16 06:54:04 +08:00
monitor1394
95e40c6f1a v2.8.2 2022-08-15 22:12:44 +08:00
monitor1394
8e30a370b5 support tooltip formatter for HeatmapChart 2022-08-15 22:11:36 +08:00
monitor1394
d94e304058 v2.8.2 2022-07-13 21:45:54 +08:00
monitor1394
34dc49004e fix serielabel refresh exception (#215) 2022-07-13 21:45:09 +08:00
monitor1394
61c6d68c4c set tooltip on heighest layer 2022-06-30 13:38:46 +08:00
monitor1394
50a666fecc v2.8.1 2022-05-06 08:20:32 +08:00
monitor1394
626a187758 v2.8.1 2022-05-06 08:16:48 +08:00
monitor1394
dee06f8d6f add delegate callback function for legend 2022-05-03 22:30:51 +08:00
monitor1394
e6eea34a45 fix ring tooltip bug #192 2022-04-21 22:07:30 +08:00
monitor1394
76b8146e53 fix datazoom exception 2022-04-21 22:07:07 +08:00
monitor1394
240eda0be2 v2.8.0 2022-04-10 22:34:04 +08:00
monitor1394
6fa093bc80 add debug info 2022-04-10 22:27:27 +08:00
monitor1394
5884fd99dd Fixed VisualMap not working in some cases 2022-04-09 13:13:02 +08:00
monitor1394
f177799202 Merge pull request #190 from DK-Kermit/patch-1
Update XChartsMgr.cs
2022-04-08 14:23:34 +08:00
Kermit
2d3f5dd51d Update XChartsMgr.cs
修复因XChartsMgr不存在,而创建新对象时导致的死循环问题。
由于Awake会在组件被创建时同步执行一次,而在执行Awake时m_XCharts并没有被赋值,所以导致死循环。
让对象处于关闭状态,添加组件时就不会同步执行Awake方法,而是延迟到下一次开启对象时执行。
在下一次开启对象时,m_XCharts已经被赋值,所以不会导致死循环问题。
死循环发生在Awake时调用XThemeMgr.ReloadThemeList,而ReloadThemeList方法中有调用了实例。
2022-04-08 14:12:15 +08:00
monitor1394
b9ca646e0c Merge pull request #188 from Sterling-zzp/2.0
修复Radar初始化时画线取色错误
2022-04-08 10:48:38 +08:00
Sterling
c157c07b0d 修复Radar初始化时画线取色错误 2022-04-08 09:37:44 +08:00
monitor1394
82d0788905 Fixed axis precision issue #184 2022-03-24 08:32:27 +08:00
monitor1394
a7ac0277a7 2.7.0 2022-03-20 19:18:28 +08:00
monitor1394
3f36c27384 update doc link 2022-03-18 13:12:01 +08:00
monitor1394
e4da5e30dc update doc link 2022-03-18 13:08:36 +08:00
monitor1394
bfa68fd037 refactor code to support 3d pie 2022-03-16 07:43:46 +08:00
monitor1394
c002ac071b Fixed chart name repeat check error #183 2022-02-21 21:30:33 +08:00
monitor1394
5c2ea52118 Fixed MissingReferenceException #183 2022-02-17 08:39:55 +08:00
monitor1394
0e25a23ed2 Fixed axis split line bug #181 2022-02-17 08:29:57 +08:00
monitor1394
41a9606bee Fixed {d} formatter error when value is 0 2022-02-09 22:02:16 +08:00
monitor1394
6f6248be77 fixed y axis label onZero does not work 2022-02-08 20:50:47 +08:00
monitor1394
2b5275b15d improve zebra bar chart 2022-01-06 21:47:21 +08:00
monitor1394
ca26fd7c21 Improved zebra bar chart 2022-01-06 21:25:18 +08:00
monitor1394
a2e790561e v2.6.0 2021-12-30 08:19:48 +08:00
monitor1394
f0e94d35b6 fixed emphasis label 2021-12-21 07:01:54 +08:00
monitor1394
76f640f64d Fixed markline label refresh when serie hide #178 2021-12-17 21:27:14 +08:00
monitor1394
9d8dc80494 Improved radarchart 2021-12-10 13:22:00 +08:00
monitor1394
bc1d2ac095 Fixed y axis does not refresh when serie hidden 2021-12-08 20:53:12 +08:00
monitor1394
913c8e1fb2 optimize emptyRect symbol 2021-12-04 14:12:34 +08:00
monitor1394
634bb45dc4 optimize emptyRect symbol 2021-12-04 14:10:28 +08:00
monitor1394
e4827ac262 Added new symbol type: EmptyRect, EmptyTriangle, EmptyDiamond 2021-12-04 08:46:32 +08:00
monitor1394
9ad8a86ffc set symbol empty area color by itemStyle's backgroundColor 2021-12-04 08:26:56 +08:00
monitor1394
23a8ce52d1 Fixed formatter {c} not work #175 2021-12-03 13:08:20 +08:00
monitor1394
38584f618b Fixed axis boundaryGap display error #174 2021-12-03 08:38:00 +08:00
monitor1394
84c47e0d84 inspector show seriedata.selected 2021-12-01 21:35:08 +08:00
monitor1394
7ff1405de5 Fixed serie ignore display error #173 2021-11-30 21:40:18 +08:00
monitor1394
acae09bf28 v2.5.0 2021-11-27 22:12:08 +08:00
monitor1394
b304bd2033 add tooltip delegate function: positionFunction 2021-11-27 22:06:15 +08:00
monitor1394
72c29235d8 Add Time axis warning 2021-11-03 06:48:45 +08:00
monitor1394
5f18f060e3 Optimized SerieData to support tree data 2021-11-02 21:23:01 +08:00
monitor1394
a281028a22 Removed settings for TextMeshPro when package first imported 2021-10-29 07:26:33 +08:00
monitor1394
fe702f3447 Added support for {e} in Tooltip #170 2021-10-29 07:05:30 +08:00
monitor1394
6888ba96e3 增加Treemap扩展支持 2021-10-24 19:23:17 +08:00
monitor1394
b261ef0573 improve radar chart 2021-09-12 15:01:40 +08:00
monitor1394
64d0b047b3 fix pie chart fade out animation #168 2021-09-07 21:44:05 +08:00
monitor1394
5c395ade25 Fixed bug where GaugeChart does not refresh label when changing splitNumber #167 2021-09-06 21:33:44 +08:00
monitor1394
5149376806 v2.4.0 2021-08-31 22:29:49 +08:00
monitor1394
d8f739cbdf v2.4.0 2021-08-31 21:13:59 +08:00
monitor1394
71fb45af9f 优化RingChart的渐变效果 2021-08-31 21:05:02 +08:00
monitor1394
ca63d041b9 修复DataZoom拖动时SerieLabel不刷新的问题 (#165) 2021-08-31 13:41:46 +08:00
monitor1394
8fccfdb5fc Fixed the problem of displaying exceptions after adding data again when DataZoom is enable (#163) 2021-08-26 20:46:50 +08:00
monitor1394
f08ae794ae 修复Theme主题切换无法保持到场景上的问题 (#166) 2021-08-26 20:42:11 +08:00
monitor1394
8efa8145b1 匀速动画优化 2021-08-25 13:41:41 +08:00
monitor1394
e247ad9e71 增加AnimationalongWithLinePath参数设置折线轨迹匀速动画 2021-08-24 07:21:00 +08:00
monitor1394
645506a6fd Added serie's ignoreLineBreak parameter (#164) 2021-08-22 09:26:14 +08:00
monitor1394
c5ef7e765b Fixed axis label may not be updated when datazoom is turn on (#164) 2021-08-22 07:55:16 +08:00
monitor1394
3949018555 Improved Axis's AxisLabel text rotate setting to avoid inconsistency offset in DataZoom (#163) 2021-08-15 22:36:14 +08:00
monitor1394
34b0a97198 Added Legend's textAutoColor to set the text color match with Serie color (#163) 2021-08-15 22:36:06 +08:00
monitor1394
de3e482687 优化BarChart设置Corner时正负柱条圆角对称 2021-08-12 22:16:36 +08:00
monitor1394
8dbbbd7405 优化Serie的数据全为0时Y轴不显示的问题 2021-08-03 08:23:02 +08:00
monitor1394
3316fce8a5 修复Serie开启ignore时被忽略的数据还会参与计算的问题 (#161) 2021-07-29 08:27:23 +08:00
monitor1394
f85f96a560 完善BarChartZebra斑马柱图渐变支持 2021-07-29 08:05:54 +08:00
monitor1394
8f6f5790b6 修复TextMeshPro Enable时找不到XCharts路径的问题 (#160) 2021-07-26 21:28:13 +08:00
994 changed files with 1747309 additions and 30917 deletions

20
.gitignore vendored
View File

@@ -1,6 +1,26 @@
/.vs
/.vscode
.vs
/XCharts-ios
/Library
/Temp
/Logs
/obj
/UnityPackageManager
/Packages
/ProjectSettings/XRSettings.asset
/Assets/Res
/Assets/Res.meta
/Assets/Package
/Assets/Package.meta
/Assets/TextMesh Pro
/Assets/TextMesh Pro.meta
/Doc/*.meta
/Assets/XChartsDemo/demo_test.unity
/Assets/XChartsDemo/demo_test.unity.meta
/Assets/XChartsDemo/empty.unity
/Assets/XChartsDemo/empty.unity.meta
*.sln
*.csproj

10
Assets/XCharts.meta Normal file
View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3e77b3cfd5a4d2646964841d2b14dcb2
folderAsset: yes
timeCreated: 1536101212
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +1,14 @@
# 更新日志
[master](#master)
[branch-2.0](#branch-2.0)
[v2.8.2](#v2.8.2)
[v2.8.1](#v2.8.1)
[v2.8.0](#v2.8.0)
[v2.7.0](#v2.7.0)
[v2.6.0](#v2.6.0)
[v2.5.0](#v2.5.0)
[v2.4.0](#v2.4.0)
[v2.3.0](#v2.3.0)
[v2.2.3](#v2.2.3)
[v2.2.2](#v2.2.2)
@@ -37,9 +44,78 @@
[v0.5.0](#v0.5.0)
[v0.1.0](#v0.1.0)
## master
## branch-2.0
* (2021.08.15) Fixed the problem of displaying exceptions after adding data again when `DataZoom` is enable (#163)
## v2.8.2
* (2022.08.15) Release `v2.8.2` version
* (2022.08.15) Added support for the `HeatmapChart` formatter for custom Tooltip
* (2022.07.13) Fixed `SerieLabel` refresh exception #215
* (2022.06.30) Optimize `Radar` so that the `Tooltip` layer is above `Indicator`
## v2.8.1
* (2022.05.03) Added `onLegendClick`, `onLegendEnter` and `onLegendExit` delegate callbacks for `Legend`
* (2022.04.21) Fixed bug #192 with `RingChart` `Tooltip` exception
* (2022.04.21) Fixed error when setting `minShowNum` in `DataZoom`
## v2.8.0
* (2022.04.10) Added the debug information panel
* (2022.04.09) Fixed `VisualMap` not working in some cases
* (2022.04.08) Optimized `XCharts` initialization #190
* (2022.04.08) Fixed color error #187 in `Radar`
* (2022.03.24) Fixed `Axis` precision issue #184
## v2.7.0
* (2022.03.20) Release `v2.7.0` version
* (2022.02.21) Fixed chart name repeat check error #183
* (2022.02.17) Fixed bug where axis split line might be displayed outside the coordinate system #181
* (2022.02.08) Fixed {d} formatter error when value is 0
* (2022.02.08) Fixed `YAxis` `AxisLabel`'s `onZero` does not work
* (2022.01.06) Improved `Zebra` bar chart
## v2.6.0
* (2021.12.30) Release `v2.6.0` version
* (2021.12.21) Fixed `Emphasis` dont work
* (2021.12.17) Fixed `MarkLine` does not auto refresh label active when serie hide #178
* (2021.12.10) Improved `Radar`'s `AxisLine` and `SplitLine` to be controlled separately
* (2021.12.08) Fixed y axis does not refresh when serie hidden
* (2021.12.04) Added `Symbol` new types: `EmptyRect`, `EmptyTriangle`, `EmptyDiamond`
* (2021.12.04) Added setting symbol empty area color by itemStyle's backgroundColor
* (2021.12.03) Fixed formatter `{c}` not work #175
* (2021.12.03) Fixed axis `boundaryGap` display error in some cases #174
* (2021.11.30) Fixed serie `ignore` display error in some cases #173
## v2.5.0
* (2021.11.27) Release `v2.5.0` version
* (2021.11.27) Added `Tooltip` delegate function `positionFunction`
* (2021.10.29) Removed settings for `TextMeshPro` when package first imported
* (2021.10.29) Added support for `{e}` in `Tooltip` #170
* (2021.09.08) Improved `RadarChart`
* (2021.09.07) Fixed bug where `label` does not disappear at the end of `PieChart` fade animation #168
* (2021.09.06) Fixed bug where `GaugeChart` changing `splitNumber` with code does not refresh `label` #167
## v2.4.0
### Main points
* LineChart support the line of ignore data is disconnected or connected
* LineChart support animation at a constant speed
* Other optimizations and bug fixes
### Details
* (2021.08.31) Release `v2.4.0` version
* (2021.08.31) Optimized the gradient effect of `RingChart`
* (2021.08.31) Fixed bug where `SerieLabel` does not refresh when `DataZoom` is dragged (#165)
* (2021.08.25) Fixed an issue where the theme switch could not be save to the scene (#166)
* (2021.08.24) Added `Animation`'s `alongWithLinePath`
* (2021.08.22) Added `Serie`'s `ignoreLineBreak` (#164)
* (2021.08.22) Fixed `Axis` label may not be updated when `DataZoom` is turn on (#164)
* (2021.08.15) Improved `Axis`'s `AxisLabel` text rotate setting to avoid inconsistency offset in `DataZoom` (#163)
* (2021.08.14) Added `Legend`'s `textAutoColor` to set the text color match with `Serie` color (#163)
* (2021.08.12) Optimize `BarChart` setting `Corner` when the positive and negative columns are fillet symmetric
@@ -215,7 +291,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
## 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.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/2.0/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md) to upgrade)
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
* (2020.08.11) Added `LiquidChart` data change animation#83
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85
@@ -263,7 +339,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
* (2020.05.30) 优化`PieChart`支持设置`ignoreValue`不显示指定数据
* (2020.05.30) 修复`RadarChart``Circle`时不绘制`SplitArea`的问题
* (2020.05.30) 优化`RadarChart`在设置`max``0`时可自动刷新最大值
* (2020.05.29) 修复`PieChart`设置`gap`时只有一个数据时绘制异常的问题
* (2020.05.29) 修复`PieChart`设置`space`时只有一个数据时绘制异常的问题
* (2020.05.27) 修复调用`UpdateDataName()`接口时不会自动刷新的问题
* (2020.05.27) 优化`柱状图`的渐变色效果
* (2020.05.24) 修复`Axis`同时设置`boundaryGap``alignWithLabel``Tick`绘制异常的问题

View File

@@ -1,7 +1,14 @@
# 更新日志
[master](#master)
[branch-2.0](#branch-2.0)
[v2.8.2](#v2.8.2)
[v2.8.1](#v2.8.1)
[v2.8.0](#v2.8.0)
[v2.7.0](#v2.7.0)
[v2.6.0](#v2.6.0)
[v2.5.0](#v2.5.0)
[v2.4.0](#v2.4.0)
[v2.3.0](#v2.3.0)
[v2.2.3](#v2.2.3)
[v2.2.2](#v2.2.2)
@@ -37,9 +44,83 @@
[v0.5.0](#v0.5.0)
[v0.1.0](#v0.1.0)
## master
## branch-2.0
* (2021.08.15) 修复`DataZoom`开启时重新添加数据后图表数据显示异常的问题 (#163)
* (2022.12.28) 修复`Pie`只有一个数据时设置`border`显示异常的问题 (#237)
* (2022.08.30) 修复`DataZoom`在某些情况下计算范围不准确的问题 (#221)
## v2.8.2
* (2022.08.15) 发布`v2.8.2`版本
* (2022.08.15) 增加`HeatmapChart`对自定义`Tooltip``formatter`的支持
* (2022.07.13) 修复`SerieLabel`刷新异常的问题 #215
* (2022.06.30) 优化`Radar``Tooltip`的层在`Indicator`之上
## v2.8.1
* (2022.05.06) 发布`v2.8.1`版本
* (2022.05.03) 增加`Legend``onLegendClick`,`onLegendEnter``onLegendExit`委托回调
* (2022.04.21) 修复`RingChart``Tooltip`异常的问题 #192
* (2022.04.21) 修复`DataZoom`设置`minShowNum`时可能会报错的问题
## v2.8.0
* (2022.04.10) 发布`v2.8.0`版本
* (2022.04.10) 增加`Debug`调试信息面板
* (2022.04.09) 修复`VisualMap`某些情况下不生效的问题
* (2022.04.08) 优化`XCharts`初始化 #190
* (2022.04.08) 修复`Radar`的颜色异常问题 #187
* (2022.03.24) 修复`Axis`的精度问题 #184
## v2.7.0
* (2022.03.20) 发布`v2.7.0`版本
* (2022.02.21) 修复`Chart``chartName`重复检测问题 #183
* (2022.02.17) 修复`Axis``SplitLine`可能会显示在坐标系外的问题 #181
* (2022.02.08) 修复数据全0时`{d}`显示不正确的问题
* (2022.02.08) 修复`YAxis``AxisLabel``onZero`参数不生效的问题
* (2022.01.06) 优化`Zebra`斑马柱图
## v2.6.0
* (2021.12.30) 发布`v2.6.0`版本
* (2021.12.21) 修复`Emphasis`不生效的问题
* (2021.12.17) 修复`MarkLine`在运行时`Label`不自动刷新显示隐藏的问题 #178
* (2021.12.10) 完善`Radar``AxisLine``SplitLine`可单独控制
* (2021.12.08) 修复`Serie`隐藏后`Y`轴最大值不刷新的问题
* (2021.12.04) 增加`Symbol`新类型:`EmptyRect`,`EmptyTriangle`,`EmptyDiamond`
* (2021.12.04) 增加`Symbol``Empty`区域颜色可通过`ItemStyle``backgroundColor`设置的支持
* (2021.12.03) 修复`Formatter``{c}`通配符不生效的问题 #175
* (2021.12.03) 修复`Axis``boundaryGap`某些情况下显示的问题 #174
* (2021.11.30) 修复`Serie``ignore`某些情况下绘制异常的问题 #173
## v2.5.0
* (2021.11.27) 发布`v2.5.0`版本
* (2021.11.27) 增加`Tooltip``positionFunction`的坐标设置委托函数
* (2021.10.29) 移除`XCharts`首次导入时`TextMeshPro`的相关设置
* (2021.10.29) 增加`Tooltip`对通配符`{e}`的支持 #170
* (2021.09.08) 完善`RadarChart`
* (2021.09.07) 修复`PieChart`渐出动画结束时`label`没有消失的问题 #168
* (2021.09.06) 修复`GaugeChart`用代码改变`splitNumber`不会刷新`label`的问题 #167
## v2.4.0
### 版本要点
* 折线图支持忽略数据的连线是断开还是连接
* 折线图支持轨迹匀速动画
* 其他优化和问题修复
### 日志详情
* (2021.08.31) 发布`v2.4.0`版本
* (2021.08.31) 优化`RingChart`的渐变效果
* (2021.08.31) 修复`DataZoom`拖动时`SerieLabel`不刷新的问题 (#165)
* (2021.08.25) 修复`Theme`主题切换无法保持到场景上的问题 (#166)
* (2021.08.24) 增加`Animation``alongWithLinePath`参数设置折线轨迹匀速动画
* (2021.08.22) 增加`Serie``ignoreLineBreak`参数设置忽略数据连线是否断开 (#164)
* (2021.08.22) 修复`Axis``DataZoom`开启时`Label`可能不更新的问题 (#164)
* (2021.08.15) 优化`Axis``AxisLabel`文本旋转设置避免在DataZoom开启时偏移不一致 (#163)
* (2021.08.14) 增加`Legend``textAutoColor`设置文本颜色和`Serie`一致 (#163)
* (2021.08.12) 优化`BarChart`设置`Corner`时正负柱条圆角对称
@@ -217,7 +298,7 @@
## 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.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
* (2020.08.15) 优化`PieChart`绘制表现效果#85
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
@@ -267,7 +348,7 @@
* (2020.05.30) 优化`PieChart`支持设置`ignoreValue`不显示指定数据
* (2020.05.30) 修复`RadarChart``Circle`时不绘制`SplitArea`的问题
* (2020.05.30) 优化`RadarChart`在设置`max``0`时可自动刷新最大值
* (2020.05.29) 修复`PieChart`设置`gap`时只有一个数据时绘制异常的问题
* (2020.05.29) 修复`PieChart`设置`space`时只有一个数据时绘制异常的问题
* (2020.05.27) 修复调用`UpdateDataName()`接口时不会自动刷新的问题
* (2020.05.27) 优化`柱状图`的渐变色效果
* (2020.05.24) 修复`Axis`同时设置`boundaryGap``alignWithLabel``Tick`绘制异常的问题

View File

@@ -176,6 +176,9 @@
* `ceilRate`最大最小值向上取整的倍率。默认为0时自动计算。
* `splitNumber`:分割段数。默认为 `5`
* `isAxisTooltip`是否Tooltip显示轴线上的所有数据。只对Mutiple类型的Radar有效。
* `outRangeColor`:数值超出范围时显示的颜色。
* `connectCenter`:数值是否连线到中心点。
* `lineGradient`:数值线段是否渐变。
* `splitLine`:分割线条 [AxisSplitLine](#AxisSplitLine)。
* `splitArea`:分割区域 [AxisSplitArea](#AxisSplitArea)。
* `indicator`:是否显示指示器。
@@ -187,6 +190,7 @@
* `name`:指示器名称。
* `max`:指示器的最大值,默认为 0 无限制。
* `min`:指示器的最小值,默认为 0 无限制。
* `range`:指示器的正常值范围,当数值超出这个范围时显示`Radar``outRangeColor`颜色。
* `textStyle`:文本样式 [TextStyle](#TextStyle)。
## `TextLimit`
@@ -638,7 +642,7 @@
* `None`:不展示成南丁格尔玫瑰图。
* `Radius`:扇区圆心角展现数据的百分比,半径展现数据的大小。
* `Area`:所有扇区圆心角相同,仅通过半径展现数据大小。
* `gap`:扇区间隙。
* `space`:扇区间隙。
* `center`:中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`:半径。`radius[0]`为内径,`radius[1]`为外径。当内径大于0时即为圆环图。
* `minAngle`最小的扇区角度0-360。用于防止某个值过小导致扇区太小影响交互。
@@ -811,6 +815,7 @@ K线图系列。
* `fadeOutDuration`:设定的渐出动画时长,单位毫秒。如果要设置单个数据项的渐出时长,可以用代码定制:`customFadeOutDuration`
* `dataChangeEnable`:是否开启数据变更动画。
* `dataChangeDuration`:数据变更动画时长,单位毫秒。
* `alongWithLinePath`:是否沿着线的轨迹进行匀速动画。
## `AreaStyle`

View File

@@ -152,10 +152,10 @@
## 为什么升级到1_6_0版本后很多自定义颜色丢失了_应该如何升级
1.6.0版本为了减少隐式转换,将所有的绘制相关的`Color`都改为了`Color32`,所以会导致一些自定义的颜色的丢失。影响到的主要组件有:`ItemStyle``LineStyle``AreaStyle``Vessel``VisualMap``AxisSplitArea``AxisSplitLine``GaugeAxis``SerieLabel`等。可以用脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)进行升级。
1.6.0版本为了减少隐式转换,将所有的绘制相关的`Color`都改为了`Color32`,所以会导致一些自定义的颜色的丢失。影响到的主要组件有:`ItemStyle``LineStyle``AreaStyle``Vessel``VisualMap``AxisSplitArea``AxisSplitLine``GaugeAxis``SerieLabel`等。可以用脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)进行升级。
升级步骤如下:
1. 备份好你的项目。
2. 先不升级`XCharts`,只下载或拷贝脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)放到旧项目的`Editor`由于旧版本可能不存在某些新版本才有的图表或者属性配置可能会编译错误需要处理按34步骤处理一下。
2. 先不升级`XCharts`,只下载或拷贝脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)放到旧项目的`Editor`由于旧版本可能不存在某些新版本才有的图表或者属性配置可能会编译错误需要处理按34步骤处理一下。
3. 若是由`itemStyle.toColor2`引起的编译报错,可将导出地方的`itemStyle.toColor2`改为`Color.clear`;导入的地方注释掉即可。
4. 若是由`LiquidChart`引起的编译报错,将所有涉及`LiquidChart`的地方都注释掉即可。
5. 编译通过后,通过`菜单栏->XCharts->ExportColorConfig`导出旧版本的颜色配置文件(配置文件默认保存到`Assets`下的`color.config`)。

View File

@@ -176,7 +176,10 @@ Radar coordinate conponnet for radar charts.
* `center`: the center of radar chart. The `center[0]` is the x-coordinate, and the `center[1]` is the y-coordinate. When value between 0 and 1 represents a percentage relative to the chart.[default:[0.5f,0.4f]].
* `ceilRate`: The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.[default:0].
* `splitNumber`: Segments of indicator axis.[default:5].
* `splitNumber`: Tooltip displays all the data on the axis.[default:false].
* `isAxisTooltip`: Tooltip displays all the data on the axis.[default:false].
* `outRangeColor`: The color displayed when data out of range.[default:red]
* `connectCenter`: Whether serie data connect to radar center with line.[default:false]
* `lineGradient`: Whether need gradient for data line..[default:true]
* `splitLine`: The split line style of radar [AxisSplitLine](#AxisSplitLine).
* `splitArea`: The split area style of radar [AxisSplitArea](#AxisSplitArea).
* `indicator`: Whether to show indicator.
@@ -190,6 +193,7 @@ Indicator of radar chart, which is used to assign multiple variables(dimensions)
* `name`: The name of indicator.
* `max`: The maximum value of indicator, with default value of 0, but we recommend to set it manually.
* `min`: The minimum value of indicator, with default value of 0.
* `min`: Normal range. When the value is outside this range, the display color is automatically changed.
* `textStyle`: The text style of indicator [TextStyle](#TextStyle).
## `TextLimit`
@@ -212,7 +216,7 @@ The component of settings related to text.
* `font`: the font of text. When `null`, the theme's font is used by default. [default: `null`].
* `fontSize`: the size of text. [default: `18`].
* `fontStyle`: the font style of text. [default: `FontStyle.Normal`].
* `lineSpacing`: the gap of text line. [default: `1f`].
* `lineSpacing`: the space of text line. [default: `1f`].
* `autoWrap`: Whether to wrap lines.
* `autoAlign`: Whether to let the system automatically set alignment. If true, the system automatically selects alignment, and if false, use alignment.
@@ -233,7 +237,7 @@ Tooltip component.
* `{b}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`, or a `category` value (such as the X-axis of a line chart).
* `{c}` is the value of a Y-dimension (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`.
* `{d}` is the percentage value of Y-dimensions (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`, with no `%` sign.
* `{b}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`.
* `{e}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`.
* `{.1}` represents a dot from serie corresponding color that specifies `index` as `1`.
* `1` in `{a1}`, `{b1}`, `{c1}` represents a `serie` that specifies an `index` of `1`.
* `{c1:2}` represents the third data from `serie`'s current indication data item indexed to `1` (a data item has multiple data, `index` 2 represents the third data).
@@ -531,7 +535,7 @@ Line chart serie.
* `None`: 不展示成南丁格尔玫瑰图。
* `Radius`: 扇区圆心角展现数据的百分比,半径展现数据的大小。
* `Area`: 所有扇区圆心角相同,仅通过半径展现数据大小。
* `gap`: 扇区间隙。
* `space`: 扇区间隙。
* `center`: 中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`: 半径。`radius[0]`为内径,`radius[1]`为外径。当内径大于0时即为圆环图。
* `minAngle`: The minimum angle of sector(0-360). It prevents some sector from being too small when value is small.

View File

@@ -148,10 +148,10 @@ A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to
## Why_are_many_custom_colors_lost_after_upgrading_to_1_6_0_How_should_I_upgrade
A: In version `1.6.0`, in order to reduce implicit conversion, all drawing related `Color` was changed to `Color32`, so some custom colors were lost. The main components affected are: `ItemStyle`, `LineStyle`, `AreaStyle`, `Vessel`, `VisualMap`, `AxisSplitArea`, `AxisSplitLine`, `GaugeAxis`,`SerieLabel`, etc. Can use the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) to upgrade.
A: In version `1.6.0`, in order to reduce implicit conversion, all drawing related `Color` was changed to `Color32`, so some custom colors were lost. The main components affected are: `ItemStyle`, `LineStyle`, `AreaStyle`, `Vessel`, `VisualMap`, `AxisSplitArea`, `AxisSplitLine`, `GaugeAxis`,`SerieLabel`, etc. Can use the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) to upgrade.
The upgrade steps are as follows:
1. Back up the project.
2. Download or copy the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) in the old project `Editor`, Change the `color` field inside to `color.clear` (because some fields may not exist in the old version).
2. Download or copy the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) in the old project `Editor`, Change the `color` field inside to `color.clear` (because some fields may not exist in the old version).
3. After compilation, the old version of color configuration file is exported through `menu bar -> XCharts-> ExportColorConfig` (the configuration file is saved by default to `color.config` under `Assets`).
4. Upgrade `XCharts` to the latest version.
5. The custom color can be restored by importing `color.config` through `menu bar -> XCharts-> ImportColorConfig` (if `color.config` is not under `Assets` of the upgraded project, copy it to this directory).

View File

@@ -0,0 +1,35 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI BarChart.
/// </summary>
[CustomEditor(typeof(BarChart), false)]
public class BarChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (BarChart)target;
}
protected override void OnEndInspectorGUI()
{
base.OnEndInspectorGUI();
if (m_Chart == null && target == null)
{
return;
}
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 99bd61acea264400fb4747b17a2731e4
guid: 5acea6fd06c0e9c498c434f941e4cba9
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,341 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using System.Text;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI BaseChart.
/// </summary>
[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 = -1.5f;
#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;
protected SerializedProperty m_MultiComponentMode;
protected SerializedProperty m_EnableTextMeshPro;
protected SerializedProperty m_ChartWidth;
protected SerializedProperty m_ChartHeight;
protected SerializedProperty m_Settings;
protected SerializedProperty m_Theme;
protected SerializedProperty m_Background;
protected SerializedProperty m_Titles;
protected SerializedProperty m_Legends;
protected SerializedProperty m_Tooltips;
protected SerializedProperty m_Vessels;
protected SerializedProperty m_Radars;
protected SerializedProperty m_Series;
protected SerializedProperty m_Large;
protected SerializedProperty m_ChartName;
protected SerializedProperty m_DebugMode;
protected float m_DefaultLabelWidth;
protected float m_DefaultFieldWidth;
private int m_SeriesSize;
private Vector2 scrollPos;
private bool m_CheckWarning = false;
private StringBuilder sb = new StringBuilder();
private bool m_BaseFoldout;
private bool m_CustomFoldout;
protected bool m_ShowAllComponent;
protected Dictionary<string, bool> m_Flodouts = new Dictionary<string, bool>();
protected virtual void OnEnable()
{
if (target == null) return;
m_Chart = (BaseChart)target;
m_Script = serializedObject.FindProperty("m_Script");
m_MultiComponentMode = serializedObject.FindProperty("m_MultiComponentMode");
m_EnableTextMeshPro = serializedObject.FindProperty("m_EnableTextMeshPro");
m_ChartName = serializedObject.FindProperty("m_ChartName");
m_ChartWidth = serializedObject.FindProperty("m_ChartWidth");
m_ChartHeight = serializedObject.FindProperty("m_ChartHeight");
m_Theme = serializedObject.FindProperty("m_Theme");
m_Settings = serializedObject.FindProperty("m_Settings");
m_Background = serializedObject.FindProperty("m_Background");
m_Titles = serializedObject.FindProperty("m_Titles");
m_Legends = serializedObject.FindProperty("m_Legends");
m_Tooltips = serializedObject.FindProperty("m_Tooltips");
m_Vessels = serializedObject.FindProperty("m_Vessels");
m_Series = serializedObject.FindProperty("m_Series");
m_Radars = serializedObject.FindProperty("m_Radars");
m_Large = serializedObject.FindProperty("m_Large");
m_DebugMode = serializedObject.FindProperty("m_DebugMode");
}
public override void OnInspectorGUI()
{
if (m_Chart == null && target == null)
{
base.OnInspectorGUI();
return;
}
serializedObject.Update();
m_DefaultLabelWidth = EditorGUIUtility.labelWidth;
m_DefaultFieldWidth = EditorGUIUtility.fieldWidth;
OnStartInspectorGUI();
OnMiddleInspectorGUI();
OnEndInspectorGUI();
OnDebugInspectorGUI();
EditorGUILayout.Space();
serializedObject.ApplyModifiedProperties();
}
protected virtual void OnStartInspectorGUI()
{
BlockStart();
EditorGUILayout.BeginHorizontal();
var version = string.Format("v{0}_{1}", XChartsMgr.version, XChartsMgr.versionDate);
if (m_EnableTextMeshPro.boolValue)
{
version += " TMP";
}
EditorGUILayout.LabelField(version);
if (GUILayout.Button("Github"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
}
EditorGUILayout.EndHorizontal();
BlockEnd();
BlockStart();
m_BaseFoldout = EditorGUILayout.Foldout(m_BaseFoldout, "Base", true);
if (m_BaseFoldout)
{
EditorGUILayout.PropertyField(m_Script);
EditorGUILayout.PropertyField(m_ChartName);
var fileds = m_Chart.GetCustomChartInspectorShowFileds();
if (fileds != null && fileds.Length > 0)
{
foreach (var filed in fileds)
{
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
}
}
if (XChartsMgr.Instance.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox("chart name is repeated:" + m_ChartName.stringValue, MessageType.Error);
EditorGUILayout.EndHorizontal();
}
}
BlockEnd();
BlockField(m_Theme);
BlockField(m_Settings);
BlockField(m_Background);
m_ShowAllComponent = m_MultiComponentMode.boolValue;
BlockListField(m_ShowAllComponent, m_Titles);
BlockListField(m_ShowAllComponent, m_Legends);
BlockListField(m_ShowAllComponent, m_Tooltips);
BlockListField(m_ShowAllComponent, SerieType.Liquid, m_Vessels);
BlockListField(m_ShowAllComponent, SerieType.Radar, m_Radars);
}
protected virtual void OnMiddleInspectorGUI()
{
BlockField(m_Series);
}
protected virtual void OnEndInspectorGUI()
{
}
protected virtual void OnDebugInspectorGUI()
{
BlockStart();
EditorGUILayout.PropertyField(m_DebugMode);
EditorGUILayout.PropertyField(m_MultiComponentMode);
EditorGUILayout.Space();
EditorGUILayout.Space();
MoreDebugInspector();
CheckWarning();
BlockEnd();
}
protected virtual void MoreDebugInspector()
{
}
protected void BlockStart()
{
if (XChartsSettings.editorBlockEnable) EditorGUILayout.BeginVertical(EditorStyles.helpBox);
}
protected void BlockEnd()
{
if (XChartsSettings.editorBlockEnable) EditorGUILayout.EndVertical();
}
protected void BlockField(params SerializedProperty[] props)
{
if (props.Length == 0) return;
BlockStart();
foreach (var prop in props)
EditorGUILayout.PropertyField(prop, true);
BlockEnd();
}
protected void BlockListField(bool all, params SerializedProperty[] props)
{
if (props.Length == 0) return;
BlockStart();
foreach (var prop in props)
{
if (all)
{
var flag = m_Flodouts.ContainsKey(prop.displayName) && m_Flodouts[prop.displayName];
m_Flodouts[prop.displayName] = EditorGUILayout.Foldout(flag, prop.displayName, true);
if (m_Flodouts[prop.displayName])
{
EditorGUI.indentLevel++;
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
currRect.y -= EditorGUIUtility.singleLineHeight;
var rect1 = new Rect(currRect.width + k_IconXOffset,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd, ChartEditorHelper.Styles.invisibleButton))
{
prop.InsertArrayElementAtIndex(prop.arraySize > 0 ? prop.arraySize - 1 : 0);
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
serializedObject.ApplyModifiedProperties();
chart.RemoveChartObject();
chart.RefreshAllComponent();
}
for (int i = 0; i < prop.arraySize; i++)
{
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
currRect.y -= EditorGUI.GetPropertyHeight(prop.GetArrayElementAtIndex(i));
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 (prop.arraySize == 1)
{
if (EditorUtility.DisplayDialog("Delete component", "Confirm to delete last component?", "Sure", "Cancel"))
{
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
prop.DeleteArrayElementAtIndex(i);
serializedObject.ApplyModifiedProperties();
chart.RemoveChartObject();
chart.RefreshAllComponent();
}
}
else if (i < prop.arraySize && i >= 0)
{
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
prop.DeleteArrayElementAtIndex(i);
serializedObject.ApplyModifiedProperties();
chart.RemoveChartObject();
chart.RefreshAllComponent();
}
}
var rect2 = new Rect(currRect.width + k_IconXOffset - k_IconWidth - k_IconGap,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect2, ChartEditorHelper.Styles.iconDown, ChartEditorHelper.Styles.invisibleButton))
{
if (i < prop.arraySize - 1) prop.MoveArrayElement(i, i + 1);
}
var rect3 = new Rect(currRect.width + k_IconXOffset - 2 * (k_IconWidth + k_IconGap),
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect3, ChartEditorHelper.Styles.iconUp, ChartEditorHelper.Styles.invisibleButton))
{
if (i > 0) prop.MoveArrayElement(i, i - 1);
}
GUI.contentColor = oldColor;
}
EditorGUI.indentLevel--;
}
}
else if (prop.arraySize > 0) EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(0), true);
}
BlockEnd();
}
protected void BlockListField(bool all, SerieType serieType, params SerializedProperty[] props)
{
if (!m_Chart.ContainsSerie(serieType)) return;
BlockListField(all, props);
}
private void CheckWarning()
{
if (GUILayout.Button("Remove All Chart Object"))
{
m_Chart.RemoveChartObject();
}
// if (GUILayout.Button("Check XCharts Update"))
// {
// CheckVersionEditor.ShowWindow();
// }
if (m_CheckWarning)
{
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Check Warning"))
{
m_CheckWarning = true;
m_Chart.CheckWarning();
}
if (GUILayout.Button("Hide Warning"))
{
m_CheckWarning = false;
}
EditorGUILayout.EndHorizontal();
sb.Length = 0;
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
if (!string.IsNullOrEmpty(m_Chart.warningInfo))
{
sb.AppendLine();
sb.Append(m_Chart.warningInfo);
}
else
{
sb.AppendLine();
sb.Append("Perfect! No warning!");
}
EditorGUILayout.HelpBox(sb.ToString(), MessageType.Warning);
}
else
{
if (GUILayout.Button("Check warning"))
{
m_CheckWarning = true;
m_Chart.CheckWarning();
}
}
EditorGUILayout.Space();
}
}
}

View File

@@ -0,0 +1,25 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI CandlestickChart.
/// </summary>
[CustomEditor(typeof(CandlestickChart), false)]
public class CandlestickChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (CandlestickChart)target;
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dcdc7a72224af419d96584fa40f822c9
guid: 1bc2ab7ace40d480e839052673b65a5d
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,63 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI CoordinateChart.
/// </summary>
[CustomEditor(typeof(CoordinateChart), false)]
public class CoordinateChartEditor : BaseChartEditor
{
protected SerializedProperty m_Grids;
protected SerializedProperty m_MultipleXAxis;
protected SerializedProperty m_XAxes;
protected SerializedProperty m_MultipleYAxis;
protected SerializedProperty m_YAxes;
protected SerializedProperty m_DataZooms;
protected SerializedProperty m_VisualMaps;
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (CoordinateChart)target;
m_Grids = serializedObject.FindProperty("m_Grids");
m_XAxes = serializedObject.FindProperty("m_XAxes");
m_YAxes = serializedObject.FindProperty("m_YAxes");
m_DataZooms = serializedObject.FindProperty("m_DataZooms");
m_VisualMaps = serializedObject.FindProperty("m_VisualMaps");
}
protected override void OnStartInspectorGUI()
{
base.OnStartInspectorGUI();
BlockListField(m_ShowAllComponent, m_DataZooms);
BlockListField(m_ShowAllComponent, m_VisualMaps);
BlockListField(m_ShowAllComponent, m_Grids);
BlockListField(m_ShowAllComponent, m_XAxes);
BlockListField(m_ShowAllComponent, m_YAxes);
}
protected override void MoreDebugInspector()
{
base.MoreDebugInspector();
CovertXYAxis();
}
private void CovertXYAxis()
{
if (GUILayout.Button("Covert XY Axis"))
{
(m_Chart as CoordinateChart).CovertXYAxis(0);
}
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f433acf13ec404a6d91eb78352d18d4d
guid: 1dd7acd8b13f3f14e9891af4e8dd0b0b
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,25 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI GaugeChart.
/// </summary>
[CustomEditor(typeof(GaugeChart), false)]
public class GaugeChartEditor : BaseChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (GaugeChart)target;
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 29a267a45c6e64454a982032947046c6
guid: bd96c5068df484d1c95748a85d8380a8
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,25 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI HeatmapChart.
/// </summary>
[CustomEditor(typeof(HeatmapChart), false)]
public class HeatmapChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (HeatmapChart)target;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1144057dfc00f4572913a63ba5291dd7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI LineChart.
/// </summary>
[CustomEditor(typeof(LineChart), false)]
public class LineChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (LineChart)target;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6bd1a238bc5b407408b8f902aa3db9fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI LiquidChart.
/// </summary>
[CustomEditor(typeof(LiquidChart), false)]
public class LiquidChartEditor : BaseChartEditor
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 307a1578a6be1403c98fdc27d99d1808
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI PieChart.
/// </summary>
[CustomEditor(typeof(PieChart), false)]
public class PieChartEditor : BaseChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (PieChart)target;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28de30021bed0f945af09633584fcb44
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI PolarChart.
/// </summary>
[CustomEditor(typeof(PolarChart), false)]
public class PolarChartEditor : BaseChartEditor
{
protected SerializedProperty m_Polars;
protected SerializedProperty m_RadiusAxes;
protected SerializedProperty m_AngleAxes;
protected override void OnEnable()
{
base.OnEnable();
if(target == null) return;
m_Chart = (PolarChart)target;
m_Polars = serializedObject.FindProperty("m_Polars");
m_RadiusAxes = serializedObject.FindProperty("m_RadiusAxes");
m_AngleAxes = serializedObject.FindProperty("m_AngleAxes");
}
protected override void OnStartInspectorGUI()
{
base.OnStartInspectorGUI();
var showAll = m_MultiComponentMode.boolValue;
BlockListField(showAll, m_Polars);
BlockListField(showAll, m_RadiusAxes);
BlockListField(showAll, m_AngleAxes);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 157ef5f1d75e04aa1814e0b188591912
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8e7c19967ca244147b0fcbb129201b46
guid: 0ad1e8940e4805b49a18ea7a2cbd4bce
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -1,21 +1,26 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(AnimationStyle), true)]
[CustomPropertyDrawer(typeof(SerieAnimation), true)]
public class AnimationDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Animation"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
if (MakeFoldout(prop, "m_Enable"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_FadeInDuration");
PropertyField(prop, "m_FadeInDelay");
PropertyField(prop, "m_FadeOutDuration");

View File

@@ -1,9 +1,14 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(AreaStyle), true)]
public class AreaStyleDrawer : BasePropertyDrawer
@@ -12,7 +17,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Origin");
@@ -21,6 +26,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_HighlightColor");
PropertyField(prop, "m_HighlightToColor");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_TooltipHighlight");
--EditorGUI.indentLevel;
}
}

View File

@@ -0,0 +1,194 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Axis), true)]
public class AxisDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Axis"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
SerializedProperty m_LogBase = prop.FindPropertyRelative("m_LogBase");
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
var chart = prop.serializedObject.targetObject as BaseChart;
var isPolar = chart is PolarChart;
EditorGUI.indentLevel++;
PropertyField(prop, isPolar ? "m_PolarIndex" : "m_GridIndex");
PropertyField(prop, "m_Type");
if (type == Axis.AxisType.Time)
{
var chartTypeName = prop.serializedObject.targetObject.GetType().Name;
if (!chartTypeName.Equals("GanttChart"))
EditorGUILayout.HelpBox("The Time axis is currently only supported in GanttChart.", MessageType.Warning);
}
PropertyField(prop, "m_Position");
PropertyField(prop, "m_Offset");
if (type == Axis.AxisType.Log)
{
PropertyField(prop, "m_LogBaseE");
EditorGUI.BeginChangeCheck();
PropertyField(prop, "m_LogBase");
if (m_LogBase.floatValue <= 0 || m_LogBase.floatValue == 1)
{
m_LogBase.floatValue = 10;
}
EditorGUI.EndChangeCheck();
}
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
{
PropertyField(prop, "m_MinMaxType");
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
switch (minMaxType)
{
case Axis.AxisMinMaxType.Default:
break;
case Axis.AxisMinMaxType.MinMax:
break;
case Axis.AxisMinMaxType.Custom:
EditorGUI.indentLevel++;
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
EditorGUI.indentLevel--;
break;
}
PropertyField(prop, "m_CeilRate");
if (type == Axis.AxisType.Value)
{
PropertyField(prop, "m_Inverse");
}
}
PropertyField(prop, "m_SplitNumber");
if (type == Axis.AxisType.Category)
{
PropertyField(prop, "m_InsertDataToHead");
PropertyField(prop, "m_MaxCache");
PropertyField(prop, "m_BoundaryGap");
}
else
{
PropertyField(prop, "m_Interval");
}
DrawExtendeds(prop);
PropertyField(prop, "m_AxisLine");
PropertyField(prop, "m_AxisName");
PropertyField(prop, "m_AxisTick");
PropertyField(prop, "m_AxisLabel");
PropertyField(prop, "m_SplitLine");
PropertyField(prop, "m_SplitArea");
PropertyField(prop, "m_IconStyle");
PropertyListField(prop, "m_Icons", true);
if (type == Axis.AxisType.Category)
{
PropertyListField(prop, "m_Data", true);
}
EditorGUI.indentLevel--;
}
}
}
[CustomPropertyDrawer(typeof(XAxis), true)]
public class XAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "XAxis"; } }
}
[CustomPropertyDrawer(typeof(YAxis), true)]
public class YAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "YAxis"; } }
}
[CustomPropertyDrawer(typeof(AngleAxis), true)]
public class AngleAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "AngleAxis"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_StartAngle");
PropertyField(prop, "m_Clockwise");
}
}
[CustomPropertyDrawer(typeof(RadiusAxis), true)]
public class RadiusAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "RadiusAxis"; } }
}
[CustomPropertyDrawer(typeof(AxisLabel), true)]
public class AxisLabelDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AxisLabel"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_Margin");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_ShowStartLabel");
PropertyField(prop, "m_ShowEndLabel");
PropertyField(prop, "m_TextLimit");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisName), true)]
public class AxisNameDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AxisName"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_Location");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisSplitArea), true)]
public class AxisSplitAreaDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "SplitArea"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Color");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d0544f1db7f17644bb3cbe7c85da84d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Background), true)]
public class BackgroundDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Background"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_ImageColor");
PropertyField(prop, "m_HideThemeBackgroundColor");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 24e3f8609cdf9494cb350a110566176f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +1,17 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
namespace XCharts
{
public delegate void DelegateMenuAction(Vector2 postion);
[CustomPropertyDrawer(typeof(Settings), true)]
public class BasePropertyDrawer : PropertyDrawer
{
protected int m_Index;
@@ -93,7 +99,7 @@ namespace XCharts.Editor
var toggleKeyName = m_KeyName + relativePropName;
m_DataToggles[toggleKeyName] = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
prop.FindPropertyRelative(relativePropName),
m_DataToggles.ContainsKey(toggleKeyName) && m_DataToggles[toggleKeyName], showOrder, true);
m_DataToggles.ContainsKey(toggleKeyName) && m_DataToggles[toggleKeyName], showOrder);
m_Heights[m_KeyName] = height;
}
@@ -162,21 +168,6 @@ namespace XCharts.Editor
m_DisplayName, relativeProp);
}
}
protected bool MakeComponentFoldout(SerializedProperty prop, string relativePropName, bool relativePropEnable,
params HeaderMenuInfo[] menus)
{
if (string.IsNullOrEmpty(relativePropName))
{
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, null, relativePropEnable, menus);
}
else
{
var relativeProp = prop.FindPropertyRelative(relativePropName);
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, relativeProp, relativePropEnable, menus);
}
}
protected virtual void DrawExtendeds(SerializedProperty prop)
{

View File

@@ -1,13 +1,18 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(ComponentTheme), true)]
public class ComponentThemeDrawer : BasePropertyDrawer
@@ -16,7 +21,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
if (MakeFoldout(prop, ""))
{
++EditorGUI.indentLevel;
#if dUI_TextMeshPro
@@ -26,6 +31,7 @@ namespace XCharts.Editor
#endif
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_TextColor");
//PropertyField(prop, "m_TextBackgroundColor");
DrawExtendeds(prop);
--EditorGUI.indentLevel;
}
@@ -75,6 +81,27 @@ namespace XCharts.Editor
}
}
}
[CustomPropertyDrawer(typeof(GaugeAxisTheme), true)]
public class GaugeAxisThemeDrawer : AxisThemeDrawer
{
public override string ClassName { get { return "Gauge Axis"; } }
public override List<string> IngorePropertys
{
get
{
return new List<string> {
"m_TextBackgroundColor" ,
"m_LineLength",
};
}
}
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_BarBackgroundColor");
PropertyField(prop, "m_StageColor");
}
}
[CustomPropertyDrawer(typeof(DataZoomTheme), true)]
public class DataZoomThemeDrawer : ComponentThemeDrawer
@@ -141,13 +168,14 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
if (MakeFoldout(prop, ""))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineSymbolSize");
PropertyField(prop, "m_LineSymbolSelectedSize");
PropertyField(prop, "m_ScatterSymbolSize");
PropertyField(prop, "m_SelectedRate");
PropertyField(prop, "m_ScatterSymbolSelectedSize");
PropertyField(prop, "m_PieTooltipExtraRadius");
PropertyField(prop, "m_PieSelectedOffset");
PropertyField(prop, "m_CandlestickColor");

View File

@@ -0,0 +1,72 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(DataZoom), true)]
public class DataZoomDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "DataZoom"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Enable"))
{
var m_SupportInside = prop.FindPropertyRelative("m_SupportInside");
var m_SupportSlider = prop.FindPropertyRelative("m_SupportSlider");
var m_Start = prop.FindPropertyRelative("m_Start");
var m_End = prop.FindPropertyRelative("m_End");
var m_MinShowNum = prop.FindPropertyRelative("m_MinShowNum");
++EditorGUI.indentLevel;
PropertyField(prop, "m_Orient");
PropertyField(prop, "m_SupportInside");
if (m_SupportInside.boolValue)
{
PropertyField(prop, "m_SupportInsideScroll");
PropertyField(prop, "m_SupportInsideDrag");
}
PropertyField(prop, m_SupportSlider);
PropertyField(prop, "m_ZoomLock");
PropertyField(prop, "m_ScrollSensitivity");
PropertyField(prop, "m_RangeMode");
PropertyField(prop, m_Start);
PropertyField(prop, m_End);
PropertyField(prop, m_MinShowNum);
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
if (m_End.floatValue > 100) m_End.floatValue = 100;
if (m_MinShowNum.intValue < 0) m_MinShowNum.intValue = 0;
if (m_SupportSlider.boolValue)
{
PropertyField(prop, "m_ShowDataShadow");
PropertyField(prop, "m_ShowDetail");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_FillerColor");
PropertyField(prop, "m_Left");
PropertyField(prop, "m_Right");
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_AreaStyle");
PropertyListField(prop, "m_XAxisIndexs", true);
PropertyListField(prop, "m_YAxisIndexs", true);
PropertyField(prop, "m_TextStyle");
}
else
{
PropertyListField(prop, "m_XAxisIndexs", true);
PropertyListField(prop, "m_YAxisIndexs", true);
}
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cba26e421f79077499f05aaf10d06b4f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,10 +1,15 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(Emphasis), true)]
public class EmphasisDrawer : BasePropertyDrawer
@@ -13,11 +18,10 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Label");
PropertyField(prop, "m_LabelLine");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
}

View File

@@ -0,0 +1,70 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(GaugeAxis), true)]
public class GaugeAxisDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Gauge Axis"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_AxisLine");
PropertyField(prop, "m_SplitLine");
PropertyField(prop, "m_AxisTick");
PropertyField(prop, "m_AxisLabel");
PropertyField(prop, "m_AxisLabelText");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(StageColor), true)]
public class GaugeAxisLineStageColorDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty m_Percent = prop.FindPropertyRelative("m_Percent");
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
ChartEditorHelper.MakeTwoField(ref drawRect, drawRect.width, m_Percent, m_Color, "Stage");
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
}
}
[CustomPropertyDrawer(typeof(GaugePointer), true)]
public class GaugePointerDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Gauge Pointer"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Length");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dec6cfc5ef85147738a81d8de84b079a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Grid), true)]
public class GridDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Grid"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Left");
PropertyField(prop, "m_Right");
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_BackgroundColor");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4142159d55a64e1d88d81ac84b714d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,9 +1,15 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(IconStyle), true)]
public class IconStyleDrawer : BasePropertyDrawer
@@ -12,7 +18,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Layer");

View File

@@ -1,9 +1,14 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(ItemStyle), true)]
public class ItemStyleDrawer : BasePropertyDrawer
@@ -12,7 +17,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", false))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Color");
@@ -23,13 +28,13 @@ namespace XCharts.Editor
PropertyField(prop, "m_BackgroundWidth");
PropertyField(prop, "m_CenterColor");
PropertyField(prop, "m_CenterGap");
PropertyField(prop, "m_BorderType");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_BorderColor0");
PropertyField(prop, "m_BorderToColor");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_ItemMarker");
PropertyField(prop, "m_ItemFormatter");
PropertyField(prop, "m_TooltipFormatter");
PropertyField(prop, "m_NumericFormatter");
PropertyListField(prop, "m_CornerRadius", true);
--EditorGUI.indentLevel;

View File

@@ -0,0 +1,40 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Legend), true)]
public class LegendDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Legend"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_IconType");
PropertyField(prop, "m_ItemWidth");
PropertyField(prop, "m_ItemHeight");
PropertyField(prop, "m_ItemGap");
PropertyField(prop, "m_ItemAutoColor");
PropertyField(prop, "m_TextAutoColor");
PropertyField(prop, "m_SelectedMode");
PropertyField(prop, "m_Orient");
PropertyField(prop, "m_Location");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_TextStyle");
PropertyListField(prop, "m_Icons");
PropertyListField(prop, "m_Data");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b96d10541649a23468168ba0bf1c0bc5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,18 +1,24 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(ArrowStyle), true)]
[CustomPropertyDrawer(typeof(Arrow), true)]
public class ArrowDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Arrow"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
if (MakeFoldout(prop, ""))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Width");
@@ -32,7 +38,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Position");

View File

@@ -1,9 +1,14 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(BaseLine), true)]
public class BaseLineDrawer : BasePropertyDrawer
@@ -12,7 +17,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
DrawExtendeds(prop);
@@ -43,8 +48,6 @@ namespace XCharts.Editor
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_AutoColor");
}
}
[CustomPropertyDrawer(typeof(AxisTick), true)]
@@ -58,9 +61,36 @@ namespace XCharts.Editor
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_ShowStartTick");
PropertyField(prop, "m_ShowEndTick");
}
}
[CustomPropertyDrawer(typeof(GaugeAxisSplitLine), true)]
public class GaugeAxisSplitDrawer : BaseLineDrawer
{
public override string ClassName { get { return "Split Line"; } }
}
[CustomPropertyDrawer(typeof(GaugeAxisTick), true)]
public class GaugeAxisTickDrawer : BaseLineDrawer
{
public override string ClassName { get { return "Axis Tick"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_SplitNumber");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_AutoColor");
}
}
[CustomPropertyDrawer(typeof(GaugeAxisLine), true)]
public class GaugeAxisLineDrawer : BaseLineDrawer
{
public override string ClassName { get { return "Axis Line"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_BarColor");
PropertyField(prop, "m_BarBackgroundColor");
PropertyField(prop, "m_StageColor");
}
}
}

View File

@@ -1,9 +1,14 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(LineStyle), true)]
public class LineStyleDrawer : BasePropertyDrawer
@@ -12,7 +17,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");

View File

@@ -1,9 +1,14 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(Location), true)]
public class LocationDrawer : BasePropertyDrawer
@@ -12,7 +17,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Align", true))
if (MakeFoldout(prop, "m_Align"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Top");

View File

@@ -1,20 +1,29 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[ComponentEditor(typeof(MarkLine))]
public class MarkLineEditor : MainComponentEditor<MarkLine>
[CustomPropertyDrawer(typeof(MarkLine), true)]
public class MarkLineDrawer : BasePropertyDrawer
{
public override void OnInspectorGUI()
public override string ClassName { get { return "MarkLine"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
++EditorGUI.indentLevel;
PropertyField("m_SerieIndex");
PropertyField("m_Animation");
PropertyListField("m_Data", true);
--EditorGUI.indentLevel;
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Animation");
PropertyListField(prop, "m_Data", true);
--EditorGUI.indentLevel;
}
}
}
@@ -25,7 +34,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
if (MakeFoldout(prop, ""))
{
++EditorGUI.indentLevel;
var type = (MarkLineType)(prop.FindPropertyRelative("m_Type")).enumValueIndex;

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e9c530aeba79d40a8918424df421d081
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Polar), true)]
public class PolarDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Polar"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyTwoFiled(prop, "m_Center");
PropertyField(prop, "m_Radius");
PropertyField(prop, "m_BackgroundColor");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 48ff9465776e54e749f9ff8c424bafe2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,62 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Radar), true)]
public class RadarDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Radar"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Shape");
PropertyField(prop, "m_PositionType");
PropertyTwoFiled(prop, "m_Center");
PropertyField(prop, "m_Radius");
PropertyField(prop, "m_SplitNumber");
PropertyField(prop, "m_CeilRate");
PropertyField(prop, "m_IsAxisTooltip");
PropertyField(prop, "m_OutRangeColor");
PropertyField(prop, "m_ConnectCenter");
PropertyField(prop, "m_LineGradient");
PropertyField(prop, "m_AxisLine");
PropertyField(prop, "m_SplitLine");
PropertyField(prop, "m_SplitArea");
PropertyField(prop, "m_IndicatorList");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(Radar.Indicator), true)]
public class RadarIndicatorDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Indicator"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, ""))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyTwoFiled(prop, "m_Range");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 09bf71ecf64f321468ac28af28bec878
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,459 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Serie), true)]
public class SerieDrawer : BasePropertyDrawer
{
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)
{
pos.width -= 9;
base.OnGUI(pos, prop, label);
var chart = prop.serializedObject.targetObject as BaseChart;
var type = prop.FindPropertyRelative("m_Type");
var serieType = (SerieType)type.enumValueIndex;
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;
type.enumValueIndex = EditorGUI.Popup(drawRect, (int)serieType, GetChartSerieTypeNames(chart));
}
else
{
m_IsPolar = chart is PolarChart;
++EditorGUI.indentLevel;
type.enumValueIndex = EditorGUI.Popup(m_DrawRect, "Type", (int)serieType, GetChartSerieTypeNames(chart));
var hig = EditorGUI.GetPropertyHeight(prop);
m_DrawRect.y += hig;
m_Heights[m_KeyName] += hig;
PropertyField(prop, "m_InsertDataToHead");
PropertyField(prop, "m_Name");
switch (serieType)
{
case SerieType.Line:
PropertyField(prop, "m_Stack");
if (m_IsPolar)
{
PropertyField(prop, "m_PolarIndex");
}
else
{
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
}
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_IgnoreLineBreak");
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_AreaStyle");
PropertyField(prop, "m_MarkLine");
break;
case SerieType.Bar:
PropertyField(prop, "m_Stack");
if (m_IsPolar)
{
PropertyField(prop, "m_PolarIndex");
}
else
{
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
}
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_MarkLine");
break;
case SerieType.Pie:
PropertyField(prop, "m_RoseType");
PropertyField(prop, "m_Space");
PropertyTwoFiled(prop, "m_Center");
PropertyTwoFiled(prop, "m_Radius");
PropertyField(prop, "m_MinAngle");
PropertyField(prop, "m_RoundCap");
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_AvoidLabelOverlap");
break;
case SerieType.Ring:
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");
break;
case SerieType.Radar:
PropertyField(prop, "m_RadarType");
PropertyField(prop, "m_RadarIndex");
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_AreaStyle");
break;
case SerieType.Scatter:
case SerieType.EffectScatter:
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Symbol");
break;
case SerieType.Heatmap:
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
break;
case SerieType.Gauge:
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");
break;
case SerieType.Liquid:
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");
break;
case SerieType.Candlestick:
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
PropertyFieldLimitMin(prop, "m_MinShow", 0);
PropertyFieldLimitMin(prop, "m_MaxShow", 0);
PropertyFieldLimitMin(prop, "m_MaxCache", 0);
PropertyField(prop, "m_BarWidth");
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_Large");
PropertyField(prop, "m_LargeThreshold");
break;
case SerieType.Custom:
var fileds = chart.GetCustomSerieInspectorShowFileds();
if (fileds != null && fileds.Length > 0)
{
foreach (var filed in fileds)
{
PropertyField(prop, filed);
}
}
var customs = chart.GetCustomSerieInspectorCustomFileds();
if (customs != null && customs.Length > 0)
{
foreach (var custom in customs)
{
var customProp = prop.FindPropertyRelative(custom[0]);
var anatherName = custom[1] + " (" + customProp.displayName + ")";
EditorGUI.PropertyField(m_DrawRect, customProp, new GUIContent(anatherName));
m_DrawRect.y += EditorGUI.GetPropertyHeight(prop);
m_Heights[m_KeyName] += hig;
}
}
break;
}
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_IconStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
PropertyField(prop, "m_Animation");
DrawData(pos, prop, serieType, ref m_DrawRect);
--EditorGUI.indentLevel;
}
}
private string[] GetChartSerieTypeNames(BaseChart chart)
{
var list = System.Enum.GetNames(typeof(SerieType));
for (int i = 0; i < list.Length; i++)
{
if (list[i].Equals("Custom"))
{
var customName = chart.GetCustomSerieTypeName();
if (!string.IsNullOrEmpty(customName))
{
list[i] = customName;
}
}
}
return list;
}
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", true);
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;
#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;
}
var jsonRect = new Rect(pos.width - 70, drawRect.y - pos.height - 2, 90, pos.height);
if (GUI.Button(jsonRect, new GUIContent("data from json")))
{
PraseJsonDataEditor.chart = prop.serializedObject.targetObject as BaseChart;
PraseJsonDataEditor.serieIndex = index;
PraseJsonDataEditor.ShowWindow();
}
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--;
}
}
private void DrawDataElement(ref Rect drawRect, int dimension, SerializedProperty m_Datas, bool showName,
bool showDetail, bool showSelected, int index, float currentWidth)
{
var lastX = drawRect.x;
var lastWid = drawRect.width;
var lastFieldWid = EditorGUIUtility.fieldWidth;
var lastLabelWid = EditorGUIUtility.labelWidth;
var serieData = m_Datas.GetArrayElementAtIndex(index);
var sereName = serieData.FindPropertyRelative("m_Name");
var selected = serieData.FindPropertyRelative("m_Selected");
var data = serieData.FindPropertyRelative("m_Data");
var fieldCount = dimension + (showName ? 1 : 0);
if (fieldCount <= 1)
{
while (2 > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
if (showSelected)
{
drawRect.width = drawRect.width - 18;
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + index));
drawRect.x = currentWidth - 40;
EditorGUI.PropertyField(drawRect, selected, GUIContent.none);
drawRect.x = lastX;
drawRect.width = lastWid;
}
else
{
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + index));
}
AddHeight(EditorGUI.GetPropertyHeight(element));
}
else
{
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
#else
var gap = 0;
var namegap = 0;
#endif
EditorGUI.LabelField(drawRect, "Element " + index);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
var dataWid = dataWidTotal / fieldCount;
var xWid = dataWid - 2;
for (int i = 0; i < dimension; i++)
{
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + 40;
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
if (showName)
{
drawRect.x = startX + (fieldCount - 1) * xWid;
drawRect.width = dataWid + 40 + dimension * namegap;
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
}
AddSingleLineHeight();
drawRect.x = lastX;
drawRect.width = lastWid;
EditorGUIUtility.fieldWidth = lastFieldWid;
EditorGUIUtility.labelWidth = lastLabelWid;
}
if (showDetail)
{
EditorGUI.indentLevel += 2;
var m_Ignore = serieData.FindPropertyRelative("m_Ignore");
var m_Selected = serieData.FindPropertyRelative("m_Selected");
var m_Id = serieData.FindPropertyRelative("m_Id");
var m_EnableIcon = serieData.FindPropertyRelative("m_EnableIconStyle");
var m_Icon = serieData.FindPropertyRelative("m_IconStyle");
var m_EnableLabel = serieData.FindPropertyRelative("m_EnableLabel");
var m_Label = serieData.FindPropertyRelative("m_Label");
var m_EnableItemStyle = serieData.FindPropertyRelative("m_EnableItemStyle");
var m_ItemStyle = serieData.FindPropertyRelative("m_ItemStyle");
var m_EnableEmphasis = serieData.FindPropertyRelative("m_EnableEmphasis");
var m_Emphasis = serieData.FindPropertyRelative("m_Emphasis");
var m_EnableSymbol = serieData.FindPropertyRelative("m_EnableSymbol");
var m_Symbol = serieData.FindPropertyRelative("m_Symbol");
EditorGUI.PropertyField(drawRect, m_Ignore);
AddHeight(EditorGUI.GetPropertyHeight(m_Ignore));
EditorGUI.PropertyField(drawRect, m_Selected);
AddHeight(EditorGUI.GetPropertyHeight(m_Selected));
EditorGUI.PropertyField(drawRect, m_Id);
AddHeight(EditorGUI.GetPropertyHeight(m_Id));
EditorGUI.PropertyField(drawRect, m_Icon);
ChartEditorHelper.MakeBool(drawRect, m_EnableIcon, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_Icon));
EditorGUI.PropertyField(drawRect, m_Symbol);
ChartEditorHelper.MakeBool(drawRect, m_EnableSymbol, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_Symbol));
EditorGUI.PropertyField(drawRect, m_Label);
ChartEditorHelper.MakeBool(drawRect, m_EnableLabel, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_Label));
EditorGUI.PropertyField(drawRect, m_ItemStyle);
ChartEditorHelper.MakeBool(drawRect, m_EnableItemStyle, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_ItemStyle));
EditorGUI.PropertyField(drawRect, m_Emphasis);
ChartEditorHelper.MakeBool(drawRect, m_EnableEmphasis, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_Emphasis));
EditorGUI.indentLevel -= 2;
}
}
private int InitToggle(SerializedProperty prop)
{
int index = 0;
var sindex = prop.propertyPath.LastIndexOf('[');
var eindex = prop.propertyPath.LastIndexOf(']');
if (sindex >= 0 && eindex >= 0)
{
var str = prop.propertyPath.Substring(sindex + 1, eindex - sindex - 1);
int.TryParse(str, out index);
}
while (index >= m_DataFoldout.Count)
{
m_DataFoldout.Add(false);
}
return index;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c30d9496b99e39944a6987e390bed91f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(SerieLabel), true)]
public class SerieLabelDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Label"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Position");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_AutoOffset");
PropertyField(prop, "m_Margin");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_BackgroundWidth");
PropertyField(prop, "m_BackgroundHeight");
PropertyField(prop, "m_PaddingLeftRight");
PropertyField(prop, "m_PaddingTopBottom");
PropertyField(prop, "m_Border");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_Line");
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineGap");
PropertyField(prop, "m_LineLength1");
PropertyField(prop, "m_LineLength2");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d30d82b48b553451fad726478777a02e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,24 +1,29 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(SymbolStyle), true)]
public class SymbolStyleDrawer : BasePropertyDrawer
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
public class SerieSymbolDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Symbol"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
var type = (SerieSymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
PropertyField(prop, "m_Type");
if (type == SymbolType.Custom)
if (type == SerieSymbolType.Custom)
{
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
@@ -28,18 +33,18 @@ namespace XCharts.Editor
}
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_SizeType");
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
switch ((SerieSymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
{
case SymbolSizeType.Custom:
case SerieSymbolSizeType.Custom:
PropertyField(prop, "m_Size");
PropertyField(prop, "m_SelectedSize");
break;
case SymbolSizeType.FromData:
case SerieSymbolSizeType.FromData:
PropertyField(prop, "m_DataIndex");
PropertyField(prop, "m_DataScale");
PropertyField(prop, "m_SelectedDataScale");
break;
case SymbolSizeType.Function:
case SerieSymbolSizeType.Callback:
break;
}
PropertyField(prop, "m_StartIndex");

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e0c4d3c3303994821bde654cf67d414d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Series), true)]
public class SeriesDrawer : PropertyDrawer
{
private bool m_SeriesModuleToggle = false;
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty m_Series = prop.FindPropertyRelative("m_Series");
m_SeriesModuleToggle = ChartEditorHelper.MakeListWithFoldout(ref drawRect,
m_Series, m_SeriesModuleToggle, true, true);
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
float height = 0;
if (m_SeriesModuleToggle)
{
SerializedProperty m_Data = prop.FindPropertyRelative("m_Series");
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
for (int i = 0; i < m_Data.arraySize; i++)
{
height += EditorGUI.GetPropertyHeight(m_Data.GetArrayElementAtIndex(i)) + EditorGUIUtility.standardVerticalSpacing;
}
}
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
return height;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c2458b1901047547b1a59d097786816
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,9 +1,14 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(Settings), true)]
public class SettingsDrawer : BasePropertyDrawer
@@ -12,12 +17,15 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", false, new HeaderMenuInfo("Reset", () =>
{
var chart = prop.serializedObject.targetObject as BaseChart;
chart.settings.Reset();
})))
if (MakeFoldout(prop, ""))
{
var btnWidth = 50;
var btnRect = new Rect(pos.x + pos.width - btnWidth, pos.y, btnWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(btnRect, new GUIContent("Reset", "Reset to default settings")))
{
var chart = prop.serializedObject.targetObject as BaseChart;
chart.settings.Reset();
}
++EditorGUI.indentLevel;
PropertyField(prop, "m_ReversePainter");
PropertyField(prop, "m_MaxPainter");

View File

@@ -1,9 +1,14 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(TextLimit), true)]
public class TextLimitDrawer : BasePropertyDrawer
@@ -12,7 +17,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
if (MakeFoldout(prop, "m_Enable"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_MaxWidth");

View File

@@ -1,12 +1,17 @@

/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
using XCharts.Runtime;
namespace XCharts.Editor
namespace XCharts
{
[CustomPropertyDrawer(typeof(TextStyle), true)]
public class TextStyleDrawer : BasePropertyDrawer
@@ -15,7 +20,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
if (MakeFoldout(prop, ""))
{
++EditorGUI.indentLevel;
#if dUI_TextMeshPro
@@ -25,9 +30,7 @@ namespace XCharts.Editor
#endif
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_ExtraWidth");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_AutoBackgroundColor");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_LineSpacing");

View File

@@ -0,0 +1,172 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.IO;
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
namespace XCharts
{
[CustomPropertyDrawer(typeof(ChartTheme), true)]
public class ThemeDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Theme"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
var defaultWidth = pos.width;
var defaultX = pos.x;
var btnWidth = 50;
if (MakeFoldout(prop, ""))
{
var btnRect = new Rect(m_DrawRect);
btnRect.x = defaultX + defaultWidth - 2 * btnWidth - 2;
btnRect.y = m_DrawRect.y - EditorGUIUtility.singleLineHeight - 3;
btnRect.width = btnWidth;
var chart = prop.serializedObject.targetObject as BaseChart;
if (GUI.Button(btnRect, new GUIContent("Reset", "Reset to theme default color")))
{
chart.theme.ResetTheme();
chart.RefreshAllComponent();
}
btnRect.x = defaultX + defaultWidth - btnWidth;
btnRect.width = btnWidth;
if (GUI.Button(btnRect, new GUIContent("Export", "Export theme to asset for a new theme")))
{
ExportThemeWindow.target = chart;
EditorWindow.GetWindow(typeof(ExportThemeWindow));
}
++EditorGUI.indentLevel;
var chartNameList = XThemeMgr.GetAllThemeNames();
var lastIndex = chartNameList.IndexOf(chart.theme.themeName);
var y = pos.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
var selectedIndex = EditorGUI.Popup(new Rect(pos.x, y, pos.width, EditorGUIUtility.singleLineHeight),
"Theme", lastIndex, chartNameList.ToArray());
AddSingleLineHeight();
if (lastIndex != selectedIndex)
{
XThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
}
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFont");
if(chart.theme.tmpFont == null && !string.IsNullOrEmpty(chart.theme.tmpFontName))
{
var msg = string.Format("Can't find theme font asset:{0} in project.", chart.theme.tmpFontName);
EditorGUILayout.HelpBox(msg, MessageType.Error);
}
#else
PropertyField(prop, "m_Font");
if (chart.theme.font == null && !string.IsNullOrEmpty(chart.theme.fontName))
{
var msg = string.Format("Can't find theme font asset:{0} in project.", chart.theme.fontName);
EditorGUILayout.HelpBox(msg, MessageType.Error);
}
#endif
PropertyField(prop, "m_ContrastColor");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_ColorPalette");
PropertyField(prop, "m_Common");
PropertyField(prop, "m_Title");
PropertyField(prop, "m_SubTitle");
PropertyField(prop, "m_Legend");
PropertyField(prop, "m_Axis");
PropertyField(prop, "m_RadiusAxis");
PropertyField(prop, "m_AngleAxis");
PropertyField(prop, "m_Polar");
PropertyField(prop, "m_Gauge");
PropertyField(prop, "m_Radar");
PropertyField(prop, "m_Tooltip");
PropertyField(prop, "m_DataZoom");
PropertyField(prop, "m_VisualMap");
PropertyField(prop, "m_Serie");
--EditorGUI.indentLevel;
}
}
private void AddPropertyField(Rect pos, SerializedProperty prop, ref float y)
{
float height = EditorGUI.GetPropertyHeight(prop, new GUIContent(prop.displayName), true);
EditorGUI.PropertyField(new Rect(pos.x, y, pos.width, height), prop, true);
y += height + EditorGUIUtility.standardVerticalSpacing;
m_Heights[m_KeyName] += height + EditorGUIUtility.standardVerticalSpacing;
}
}
public class ExportThemeWindow : EditorWindow
{
public static BaseChart target;
private static ExportThemeWindow window;
private string m_ChartName;
static void Init()
{
window = (ExportThemeWindow)EditorWindow.GetWindow(typeof(ExportThemeWindow), false, "Export Theme", true);
window.minSize = new Vector2(600, 50);
window.maxSize = new Vector2(600, 50);
window.Show();
}
void OnInspectorUpdate()
{
Repaint();
}
private void OnGUI()
{
if (target == null)
{
Close();
return;
}
GUILayout.Space(10);
GUILayout.Label("Input a new name for theme:");
m_ChartName = GUILayout.TextField(m_ChartName);
GUILayout.Space(10);
GUILayout.Label("Export path:");
if (string.IsNullOrEmpty(m_ChartName))
{
GUILayout.Label("Need input a new name.");
}
else
{
GUILayout.Label(XThemeMgr.GetThemeAssetPath(m_ChartName));
}
GUILayout.Space(20);
if (GUILayout.Button("Export"))
{
if (string.IsNullOrEmpty(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:Need input a new name!"));
}
else if (XThemeMgr.ContainsTheme(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:The name you entered is already in use!"));
}
else if (IsAssetsExist(XThemeMgr.GetThemeAssetPath(m_ChartName)))
{
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
+ XThemeMgr.GetThemeAssetPath(m_ChartName)));
}
else
{
XThemeMgr.ExportTheme(target.theme, m_ChartName);
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
+ XThemeMgr.GetThemeAssetPath(m_ChartName)));
}
}
}
private bool IsAssetsExist(string path)
{
return File.Exists(Application.dataPath + "/../" + path);
}
}
}

View File

@@ -0,0 +1,33 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Title), true)]
public class TitleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Title"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Text");
PropertyField(prop, "m_SubText");
PropertyField(prop, "m_ItemGap");
PropertyField(prop, "m_Location");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_SubTextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 22ae7ec778f27c1409cb9151ce7b9aba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +1,15 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
namespace XCharts.Editor
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(TitleStyle), true)]
public class TitleStyleDrawer : BasePropertyDrawer
@@ -11,10 +18,9 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_OffsetCenter");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}

Some files were not shown because too many files have changed in this diff Show More