Compare commits

...

129 Commits

Author SHA1 Message Date
monitor1394
77f17c7dec 发布v1.6.3版本 2021-01-02 14:08:43 +08:00
monitor1394
e8737ec50e 修复Animation不启用时更新数据会导致图表一直刷新的问题 2020-12-18 19:06:34 +08:00
monitor1394
045e1576b6 XCharts 2.0 is comming soon! 2020-12-12 13:14:29 +08:00
monitor1394
b1c9f36a30 去掉调试日志 2020-12-01 12:18:52 +08:00
monitor1394
1b4e3a449d 修复Unity2020上新创建的图表无法正常绘制的问题 2020-12-01 09:29:11 +08:00
monitor1394
9ebbdaba28 发布v1.6.2版本 2020-11-22 20:37:50 +08:00
monitor1394
779ab98762 发布v1.6.2版本 2020-11-22 20:29:32 +08:00
monitor1394
105d0a85f9 修复LineChart在数据过于密集时折线绘制异常的问题 #99 2020-11-22 15:10:56 +08:00
monitor1394
a4281288ee 修复LineChart的刻度位置在alignWithLabeltrue时可能异常的问题 2020-11-21 08:42:03 +08:00
monitor1394
30f40b601f 修复Unity5兼容报错的问题 2020-11-21 08:41:52 +08:00
monitor1394
a3a9850e13 完善RadarChartIndicator\n换行的支持 2020-11-13 08:48:59 +08:00
monitor1394
0027968e99 update doc 2020-11-12 09:38:26 +08:00
monitor1394
ea8d560f3f 修复LineChart当类型为Smooth时数据过密情况下报错的问题 #101 2020-11-12 09:23:10 +08:00
monitor1394
95cf5ed303 完善HeatmapChartVisualMapPiecewise的支持 2020-10-22 09:39:47 +08:00
monitor1394
7e7d7270ab 修复对数轴logBase设置为0时会卡死的问题 2020-09-24 09:36:09 +08:00
monitor1394
a69667337d 修复PieChart边框大小不一致的问题 2020-09-22 07:29:48 +08:00
monitor1394
a4f1726ab1 meta文件 2020-09-21 20:56:44 +08:00
monitor1394
3e1b3637c9 meta文件 2020-09-21 20:56:36 +08:00
monitor1394
8627494972 整理代码,去掉warning 2020-09-19 18:11:16 +08:00
monitor1394
be71983047 发布v1.6.1版本 2020-09-19 18:05:28 +08:00
monitor1394
9274844548 更新教程 2020-09-19 17:56:56 +08:00
monitor1394
075b0939e9 优化demo效果 2020-09-19 17:25:14 +08:00
monitor1394
1cf0ecf9d6 优化symbol颜色 2020-09-19 17:25:03 +08:00
monitor1394
b07798f5a2 增加Remove All Chart Object移除图表下的所有子节点 2020-09-18 22:24:51 +08:00
monitor1394
ecb09e4ca4 修复SerieLabel在点击图例隐藏Serie后还显示的问题#94 2020-09-18 22:00:03 +08:00
monitor1394
f266655d24 更新文档 2020-09-18 09:35:58 +08:00
monitor1394
a43cf64fb3 优化坐标轴刻度和文本显示#93 2020-09-18 09:29:40 +08:00
monitor1394
be61cb908f meta文件 2020-09-16 19:52:50 +08:00
monitor1394
afc84a0dc0 修复默认分割线不显示的问题 2020-09-13 20:32:41 +08:00
monitor1394
b2f5f69619 优化坐标轴刻度和数据对齐 2020-09-13 20:17:11 +08:00
monitor1394
cd519f021f 优化Legend的颜色可自动匹配ItemStyle的自定义颜色#89 2020-09-08 09:28:19 +08:00
monitor1394
f18dd10f0d Merge pull request #88 from Ernest-su/patch-1
Update ItemStyle.cs
2020-09-08 07:30:28 +08:00
Ernest-su
92e4d9de1b Update ItemStyle.cs
fix backgroundWidth doc
2020-09-07 17:57:21 +08:00
monitor1394
e64284f5ab 优化LineChart在不使用XAxis1时也能显示XAxis1 2020-09-05 17:16:26 +08:00
monitor1394
683f4e1c97 增加LineStyletoColortoColor2设置LineChart的水平渐变,取消通过ItemStyle设置LineChart的水平渐变。 2020-08-29 23:35:40 +08:00
monitor1394
b9566cb180 增加onPointerClickPieonPointerClickBar回调 2020-08-29 22:44:32 +08:00
monitor1394
e82ee56b7f 发布v1.6.0版本 2020-08-24 22:49:47 +08:00
monitor1394
2c1c50c72b 更新问答29 2020-08-24 09:23:28 +08:00
monitor1394
f290ca2ba6 升级颜色配置到新版本 2020-08-24 09:19:11 +08:00
monitor1394
c9d11b3ab8 优化UpgradeChartColor 2020-08-24 09:18:56 +08:00
monitor1394
411695d0dd 优化UpgradeChartColor 2020-08-24 09:10:22 +08:00
monitor1394
ea62d03142 更新文档 2020-08-23 15:41:11 +08:00
monitor1394
c2aa222bbd 更新文档 2020-08-23 15:34:00 +08:00
monitor1394
872020e729 增加升级颜色配置脚本UpgradeChartColor 2020-08-23 15:31:22 +08:00
monitor1394
951c3fe16c 重构代码,将与绘制相关的Color改为Color32,减少隐式转换 2020-08-23 14:31:26 +08:00
monitor1394
85e8b17171 修复动画问题 2020-08-19 09:11:23 +08:00
monitor1394
b2cba25a1e 性能优化 2020-08-18 09:29:23 +08:00
monitor1394
2cc01d4101 优化PieChart绘制表现效果#85 2020-08-15 08:52:25 +08:00
monitor1394
dbbe6de544 修复serieData的Label设置numericFormatter无效的问题 2020-08-13 12:29:24 +08:00
monitor1394
18be460bee 优化BarChart的数据变更动画#83 2020-08-13 09:05:21 +08:00
monitor1394
c1c7312f2c 增加LiquidChart数据变更动画#83 2020-08-11 09:25:28 +08:00
monitor1394
342337c13e Merge pull request #86 from Bian-Sh/master
ToolTips formatter 数值的格式化支持 0.##
2020-08-11 08:57:27 +08:00
monitor1394
0849b359ce 优化PieChart文本堆叠和引线效果#85 2020-08-11 08:47:20 +08:00
雨落随风
2eeec329b2 Update Tooltip.cs
更新对 Tooltips.formatter 的描述
2020-08-09 18:17:52 +08:00
雨落随风
ef10fd987c Tooltips 支持 ToString 中的格式 “0.##”
本次更新用于改善ToString("f2") 出现 100.00%的情况,“#”代表后面不是0就被保留,反之去掉,也就不会出现100.00%的情况
2020-08-09 18:10:33 +08:00
monitor1394
b52105e798 优化LineChart密集数据的绘制表现 2020-08-08 17:14:33 +08:00
monitor1394
fe15760aab 优化LineChart数据密集时的绘制效果 2020-07-31 23:27:20 +08:00
monitor1394
3c3730db44 优化RadarChart#77 2020-07-31 22:36:34 +08:00
monitor1394
fa118d93f8 增加LineChart可通过VisualMapItemStyle配置渐变#78 2020-07-30 09:31:44 +08:00
monitor1394
04507ee863 修复LiquidChart渐出动画问题 2020-07-27 08:59:42 +08:00
monitor1394
2c25af3694 修复折线图在开启动画时可能不绘制线条的问题 2020-07-26 08:56:45 +08:00
monitor1394
87d7668768 修复LineChart渐出动画绘制异常的问题#79 2020-07-25 19:20:14 +08:00
monitor1394
d17a306f7c 优化LiquidChart满时的绘制表现 2020-07-25 18:33:09 +08:00
monitor1394
6a88d899b7 修复LiquidChart100%时渐变色会失效的问题 2020-07-25 14:38:15 +08:00
monitor1394
2a42bcfbef 增加RadarChartTooltipformatter支持#77 2020-07-25 14:09:57 +08:00
monitor1394
af8765734c 增加RingChart环形渐变支持 2020-07-23 12:53:10 +08:00
monitor1394
3a3c79c3cc 增加RingChart环形渐变支持#75 2020-07-23 12:52:06 +08:00
monitor1394
2cafbc7706 增加AxisLabelSerieLabelformatter可单独配置数值格式化#68 2020-07-21 09:13:51 +08:00
monitor1394
3860d1c862 增加动画完成回调接口 2020-07-17 12:19:21 +08:00
monitor1394
5818c3404f 优化Chart放在ScrollView下时不影响ScrollView的滚动和拖动 2020-07-17 09:26:01 +08:00
monitor1394
87511da0c4 完善文档 2020-07-17 08:53:06 +08:00
monitor1394
ebceea3491 完善文档 2020-07-17 08:52:32 +08:00
monitor1394
fe1c11fc5d Fixed a problem with Tooltip that would also show up if it was blocked on top. 修复Tooltip在上层有遮挡还会显示的问题#74 2020-07-16 09:16:36 +08:00
monitor1394
64178ef88d 完善文档 2020-07-15 09:11:35 +08:00
monitor1394
7c95d2d8b8 整理文档 2020-07-11 07:52:08 +08:00
monitor1394
7144f1a2af 更新文档 2020-07-10 12:33:10 +08:00
monitor1394
70a27f2aca test markdown link 2020-07-10 12:29:49 +08:00
monitor1394
7a90b6c943 整理文档 2020-07-10 09:36:56 +08:00
monitor1394
b59c0c790c 整理文档 2020-07-10 09:20:46 +08:00
monitor1394
6da8784102 整理文档 2020-07-10 09:13:26 +08:00
monitor1394
c2c6b87b2c 优化Scatter类型Serie支持Log轴#68 2020-07-08 09:32:49 +08:00
monitor1394
158e56abdf 优化Scatter类型的Serie支持Log 2020-07-08 09:31:11 +08:00
monitor1394
67fc201e83 优化Scatter类型的Serie支持Log轴#68 2020-07-08 09:22:47 +08:00
monitor1394
d66f22ddc8 优化Scatter类型的Serie支持Log 2020-07-08 09:15:28 +08:00
monitor1394
aed0485ba7 修复SerieLabel位置错乱的问题 2020-07-07 07:29:45 +08:00
monitor1394
bd65007851 增加Tooltipoffset参数配置偏移 2020-07-07 07:16:01 +08:00
monitor1394
aa2f90d048 整理重构代码 2020-07-07 06:53:02 +08:00
monitor1394
d343ff9d07 更新文档 2020-07-06 09:09:24 +08:00
monitor1394
fe8fa90625 增加LiquidChart水位图 2020-07-06 08:41:28 +08:00
monitor1394
cc23df6821 优化PolarChartTooltip 2020-07-02 09:44:25 +08:00
monitor1394
d6859f5543 增加PolarChartclockwise是否顺时针支持 2020-07-02 07:31:32 +08:00
monitor1394
b6139514f5 增加PolarChart极坐标图表 2020-07-01 09:38:00 +08:00
monitor1394
9e48c23225 发布v1.5.2版本 2020-06-25 21:18:20 +08:00
monitor1394
5cf93b6111 add asmref 2020-06-25 21:14:25 +08:00
monitor1394
a3aa610d57 修复BarChart在数值为0时还会绘制一小部分柱条的问题 2020-06-25 21:07:17 +08:00
monitor1394
ce69581a3a 优化折线图绘制效果 2020-06-24 12:50:36 +08:00
monitor1394
523067ad58 优化LineChart的堆叠区域半透明绘制效果 2020-06-24 09:23:35 +08:00
monitor1394
e67bab471c Merge branch 'master' of https://github.com/monitor1394/unity-ugui-XCharts 2020-06-24 09:09:14 +08:00
monitor1394
10fe66fcb8 修复PieChart在设置clockwise后绘制异常的问题#65 2020-06-24 09:09:08 +08:00
monitor1394
1639dcd4ee 修复PieChart在设置clockwise后绘制异常的问题 2020-06-24 09:06:39 +08:00
monitor1394
b8bb3abac7 完善Demo 2020-06-23 12:34:55 +08:00
monitor1394
75a58c6975 优化LineChart在峰谷差异过大时的绘制效果#64 2020-06-23 12:21:27 +08:00
monitor1394
eb9da8210e 修复SerieLabel在重新添加数据时可能不显示的问题 2020-06-18 08:57:11 +08:00
monitor1394
04c69ea9e0 增加SerieData可单独设置SerieSymbol#66 2020-06-17 12:46:04 +08:00
monitor1394
02a5b45e10 修复Check For UpdateUnity 2018部分版本报错的问题#63 2020-06-17 07:00:07 +08:00
monitor1394
5835a372f5 增加SerieavoidLabelOverlap参数避免饼图标签堆叠的情况#56 2020-06-16 09:33:34 +08:00
monitor1394
590a13688d 修复SerieLabel可能显示错乱的问题 2020-06-15 08:56:30 +08:00
monitor1394
45dede8aee 优化Tooltip 2020-06-14 18:16:23 +08:00
monitor1394
e77c9fd327 优化Tooltip 2020-06-14 17:04:50 +08:00
monitor1394
d694c5d9f1 整理代码更新文档 2020-06-12 09:22:51 +08:00
monitor1394
30b6b061e6 优化Tooltip 2020-06-11 12:48:00 +08:00
monitor1394
a65ad893eb 修复Check warning不生效的问题 2020-06-11 09:24:33 +08:00
monitor1394
77fd92d2b0 修复饼图和环形图占比很小时不显示的问题 2020-06-11 08:39:15 +08:00
monitor1394
8c759fd94d 增加TooltiptitleFormatter支持配置占位符{i}表示忽略不显示标题 2020-06-11 07:44:11 +08:00
monitor1394
536cccbfaf 修复Editor下Serie的Data在多维数据下编辑异常的问题#62 2020-06-11 07:32:01 +08:00
monitor1394
64568ce2cc 关闭部分组件的raycastTarget 2020-06-11 06:59:16 +08:00
monitor1394
22ca68e04a 修复SerieData回收时部分配置没有重置的问题 2020-06-10 13:10:24 +08:00
monitor1394
63fd4c81b4 优化Legend的布局 2020-06-09 09:24:08 +08:00
monitor1394
c77d13f5db 增加AnimationcustomFadeInDelay等自定义数据项延时和时长回调函数 2020-06-09 06:57:37 +08:00
monitor1394
63fb591b46 增加QA:为什么serie里设置的参数运行后又被重置了 2020-06-08 07:15:28 +08:00
monitor1394
f93355e6c4 修复图例判断超范围异常的问题 2020-06-07 18:22:57 +08:00
monitor1394
53e988e8d2 优化PieChart在数据全为0时的显示为等份的效果 2020-06-07 07:16:24 +08:00
monitor1394
a2e1cd9840 更新文档 2020-06-05 09:27:51 +08:00
monitor1394
9b0165b291 重构代码,增加BaseGraph基类 2020-06-05 08:52:36 +08:00
monitor1394
91a7c88ea1 增加SerieLabelautoOffset参数设置是否自动判断上下偏移 2020-06-04 12:33:25 +08:00
monitor1394
384c6a842e 增加TooltipalwayShow参数设置触发后一直显示 2020-06-04 07:46:07 +08:00
monitor1394
6590b70db6 优化Tooltipformatter支持{.1}类型的通配符 2020-06-04 07:22:58 +08:00
monitor1394
930fb59755 优化Legend数量过多时自动换行显示 2020-06-04 07:06:41 +08:00
monitor1394
8851e54266 修复Single类型的RadarChart设置ceilRate不生效的问题 2020-06-03 12:27:34 +08:00
205 changed files with 424232 additions and 68930 deletions

1
.gitignore vendored
View File

@@ -12,6 +12,7 @@
/Assets/Res.meta
/Assets/Package
/Assets/Package.meta
/Doc/*.meta
/Assets/XChartsDemo/demo_test.unity
/Assets/XChartsDemo/demo_test.unity.meta

View File

@@ -0,0 +1,295 @@
# 更新日志
* (2021.01.02) Release `v1.6.3` version
* (2020.12.18) fixed an issue where updating data when `Animation` was not enabled caused the chart to keep refreshing
* (2020.12.01) fixed an issue where a newly created chart on `Unity2020` could not be drawn properly
* (2020.11.22) Release `v1.6.2` version
* (2020.11.22) Fixed an issue where `LineChart` draws an exception when the data is too dense #99
* (2020.11.21) Fixed an issue where the scale position of `LineChart` could be abnormal if `alignWithLabel` was `true`
* (2020.11.21) Fixed `Unity5` compatibility error reporting problem
* (2020.11.13) Improved `RadarChart` `Indicator` support for `\n` line feed
* (2020.11.12) Fixed `LineChart` reporting errors when the type was `Smooth` when the data was too secure #100
* (2020.10.22) Improve the support of `VisualMap` for `Piecewise` in `HeatmapChart`
* (2020.09.22) Fixed `PieChart` inconsistent border size
* (2020.09.18) Added `Remove All Chart Object` to Remove All child nodes under the Chart (automatically reinitialized)
* (2020.09.18) Fixed `SerieLabel` also displayed after hided `Serie` by clicked the legend #94
* (2020.09.18) Optimize coordinate axis calibration and text display #93
* (2020.09.17) fixed `Package` import missing `meta` file causing failure #92
* (2020.09.08) Optimize the color of `Legend` to automatically match the custom color of `ItemStyle`
* (2020.09.05) Optimize `LineChart` to display `XAxis1` without using `XAxis1`.
* (2020.08.29) Added `toColor` and `toColor2` of `LineStyle` to set the horizontal gradient of `LineChart`. Cancel `ItemStyle` to set the horizontal gradient of `LineChart`.
* (2020.08.29) Added the `onPointerClickPie` of `PieChart`, a callback function of click pie area.
* (2020.08.29) Added the `onPointerClickBar` of `BarChart`, a callback function of click bar.
* (2020.08.24) Release `v1.6.0` version
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md) to upgrade)
* (2020.08.15) Optimize `PieChart` drawing performance effect #85
* (2020.08.11) Added `LiquidChart` data change animation#83
* (2020.08.11) Optimize `PieChart` text stack and lead line effects#85
* (2020.08.08) Optimize `LineChart` the rendering performance of dense data
* (2020.07.30) Added `LineChart` to configure gradient through `VisualMap` or `ItemStyle`#78
* (2020.07.25) Fixed a problem with `LineChart` emerging abnormal in animation drawing#79
* (2020.07.25) Fixed a problem with gradual discoloration on `LiquidChart` at `100%`#80
* (2020.07.25) Added `RadarChart` support for `formatter` of `Tooltip`#77
* (2020.07.23) Added `RingChart` ring gradient support#75
* (2020.07.21) Added `formatter` of `AxisLabel` and `SerieLabel` to configure numeric formatting separately.
* (2020.07.17) Added animation completion callback interface for `SerieAnimation`.
* (2020.07.17) Optimize `Chart` under `ScrollView` without affecting the scrolling and dragging of `ScrollView`.
* (2020.07.16) Fixed a problem with `Tooltip` that would also show up if it was blocked on top. #74
* (2020.07.08) 优化`Scatter`类型`Serie`支持`Log`#70
* (2020.07.07) 修复`SerieLabel`位置错乱的问题
* (2020.07.07) 增加`Tooltip``offset`参数配置偏移
* (2020.07.06) 增加`LiquidChart`水位图
* (2020.07.01) 增加`PolarChart`极坐标图表
* (2020.06.25) 发布`v1.5.2`版本
* (2020.06.25) 修复`BarChart`在数值为`0`时还会绘制一小部分柱条的问题
* (2020.06.24) 修复`PieChart`在设置`clockwise`后绘制异常的问题#65
* (2020.06.23) 优化`LineChart`在峰谷差异过大时的绘制效果#64
* (2020.06.18) 修复`SerieLabel`在重新添加数据时可能不显示的问题
* (2020.06.17) 增加`SerieData`可单独设置`SerieSymbol`#66
* (2020.06.17) 修复`Check For Update``Unity 2018`部分版本报错的问题#63
* (2020.06.16) 增加`Serie``avoidLabelOverlap`参数避免饼图标签堆叠的情况#56
* (2020.06.15) 修复`SerieLabel`单独控制显示时可能错乱的问题
* (2020.06.11) 修复`Check warning`不生效的问题
* (2020.06.11) 修复`PieChart``RingChart`在数据占比很小时不显示的问题
* (2020.06.11) 增加`Tooltip``titleFormatter`支持配置占位符`{i}`表示忽略不显示标题
* (2020.06.07) 增加`Animation``customFadeInDelay`等自定义数据项延时和时长回调函数#58
* (2020.06.07) 优化`PieChart`在数据全为`0`时的显示为等份的效果#59
* (2020.06.04) 增加`SerieLabel``autoOffset`参数设置是否自动判断上下偏移
* (2020.06.04) 增加`Tooltip``alwayShow`参数设置触发后一直显示
* (2020.06.04) 优化`Tooltip``formatter`支持`{.1}`通配符
* (2020.06.04) 优化`Legend`数量过多时自动换行显示#53
* (2020.06.03) 发布`v1.5.1`版本
* (2020.06.02) 增加`Radar``ceilRate`,设置最大最小值的取整倍率
* (2020.06.02) 优化`Tooltip``formatter`,支持`{c1:1-1:f1}`格式配置
* (2020.05.31) 优化`Background`组件的生效条件,需要有单独的父节点(升级前需要自己处理旧的背景节点)
* (2020.05.30) 优化`PieChart`支持设置`ignoreValue`不显示指定数据
* (2020.05.30) 修复`RadarChart``Circle`时不绘制`SplitArea`的问题
* (2020.05.30) 优化`RadarChart`在设置`max``0`时可自动刷新最大值
* (2020.05.29) 修复`PieChart`设置`space`时只有一个数据时绘制异常的问题
* (2020.05.27) 修复调用`UpdateDataName()`接口时不会自动刷新的问题
* (2020.05.27) 优化`柱状图`的渐变色效果
* (2020.05.24) 修复`Axis`同时设置`boundaryGap``alignWithLabel``Tick`绘制异常的问题
* (2020.05.24) 优化版本更新检测
* (2020.05.22) 发布`v1.5.0`版本
* (2020.05.21) 增加`圆角柱图`支持渐变
* (2020.05.21) 增加`Background`背景组件
* (2020.05.19) 隐藏`Hierarchy`试图下自动生成的子节点
* (2020.05.18) 增加`chartName`属性可指定图表的别称,可通过`XChartMgr.Instance.GetChart(chartName)`获取图表
* (2020.05.16) 增加部分鼠标事件回调
* (2020.05.15) 优化自带例子,`Demo`改名为`Example`
* (2020.05.13) 增加`Serie``large``largeThreshold`参数配置折线图和柱状图的性能模式
* (2020.05.13) 完善Demo增加性能演示Demo
* (2020.05.13) 优化性能,优化大数据绘制,重构代码
* (2020.05.04) 增加`numericFormatter`参数可配置数值格式化显示,去掉`forceENotation`参数
* (2020.04.28) 增加`自由锚点`支持,任意对齐方式
* (2020.04.23) 优化`ScatterChart``Tooltip`显示效果
* (2020.04.23) 增加`Tooltip``formatter``{.}``{c:0}``{c1:1}`的支持
* (2020.04.19) 优化`LineChart`折线图的区域填充渐变效果
* (2020.04.19) 增加`AxisLabel``onZero`参数可将`Label`显示在`0`刻度上
* (2020.04.19) 增加`Serie``AxisLabel``showAsPositiveNumber`参数将负数数值显示为正数
* (2020.04.18) 增加`Covert XY Axis`互换XY轴配置
* (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转
* (2020.04.16) 修复`Check warning``Unity2019.3`上的显示问题
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
* (2020.04.11) 发布`v1.4.0`版本
* (2020.04.11) 增加`Check warning`检测功能
* (2020.04.09) 修复`Legend`初始化异常的问题
* (2020.04.08) 增加`PieChart`通过`ItemStyle`设置边框的支持
* (2020.03.29) 增加`Axis``ceilRate`设置最大最小值的取整倍率
* (2020.03.29) 增加`BarChart`可通过`itemStyle``cornerRadius`设置`圆角柱图`
* (2020.03.29) 增加`itemStyle``cornerRadius`支持圆角矩形
* (2020.03.24) 优化`Editor`参数编辑,兼容`Unity2019.3`及以上版本
* (2020.03.24) 增加`Serie``inspector`上可进行调整顺序、添加和删除操作
* (2020.03.23) 修复`Title``textStyle``subTextStyle`无效的问题
* (2020.03.22) 增加`BarChart`通过`barType`参数设置`胶囊柱状图`
* (2020.03.21) 增加`BarChart``HeatmapChart`可通过`ignore`参数设置忽略数据的支持
* (2020.03.21) 增加`ItemStyle``tooltipFormatter`参数可单独配置`Serie``Tooltip`显示
* (2020.03.20) 修复`X Axis 1``Y Axis 1`配置变更时不会自动刷新的问题
* (2020.03.20) 增加`AxisTick``width`参数可单独设置坐标轴刻度的宽度
* (2020.03.20) 增加`Serie``radarType`参数设置`多圈``单圈`雷达图
* (2020.03.17) 增加`BarChart`可用`ItemStyle``backgroundColor`设置数据项背景颜色
* (2020.03.17) 增加`SerieData``ItemStyle``Emphasis`可单独配置数据项样式的支持
* (2020.03.15) 重构`EmptyCricle`类型的`Symbol`边宽取自`ItemStyle``borderWidth`参数
* (2020.03.15) 重构`SerieSymbol`,去掉`color``opacity`参数,取自`ItemStyle`
* (2020.03.14) 发布`v1.3.1`版本
* (2020.03.14) 修复`LineChart`开启`ingore`时部分数据可能绘制异常的问题
* (2020.03.13) 修复`LineChart``label`偏移显示异常的问题
* (2020.03.11) 发布`v1.3.0`版本
* (2020.03.11) 优化`LineChart``label`偏移显示
* (2020.03.11) 优化清空并重新添加数据后的自动刷新问题
* (2020.03.10) 增加`LineChart`的普通折线图可通过`ignore`参数设置忽略数据的支持
* (2020.03.09) 增加`BarChart`可通过`ItemStyle`配置边框的支持
* (2020.03.08) 增加`RingChart`环形图
* (2020.03.05) 调整`Serie``arcShaped`参数重命名为`roundCap`
* (2020.03.05) 增加运行时和非运行时参数变更自动刷新图表
* (2020.02.26) 重构`Legend`图例,改变样式,增加自定义图标等设置
* (2020.02.23) 增加`BaseChart.AnimationFadeOut()`渐出动画,重构动画系统
* (2020.02.13) 增加`BaseChart.RefreshTooltip()`接口立即重新初始化`Tooltip`组件
* (2020.02.13) 增加`Tooltip``textStyle`参数配置内容文本样式,去掉`fontSize``fontStyle`参数
* (2020.02.13) 增加`TextStyle``lineSpacing`参数配置行间距
* (2020.02.11) 增加`Radar``splitLine`参数配置分割线,去掉`lineStyle`参数
* (2020.02.11) 增加`Tooltip``backgroundImage`参数配置背景图
* (2020.02.11) 增加`Tooltip``paddingLeftRight``paddingTopBottom`参数配置文字和边框的间距
* (2020.02.11) 增加`Tooltip``lineStyle`参数配置指示线样式
* (2020.02.11) 增加`Axis``splitLine`参数控制分割线,去掉`showSplitLine``splitLineType`参数(更新时需要重新设置分割线相关设置)
* (2020.02.10) 增加`Serie``clip`参数控制是否超出坐标系外裁剪(只适用于折线图、柱状图、散点图)
* (2020.02.08) 增加`SerieSymbol``gap`参数控制图形标记的外留白距离
* (2020.01.26) 增加`TextLimit`组件可以设置`AxisLabel`的文本自适应
* (2020.01.20) 优化`Tooltip`设置`itemFormatter`时显示系列颜色
* (2020.01.20) 增加`Radar`雷达图在`inspector`配置`areaStyle`的支持
* (2020.01.15) 发布`v1.2.0`版本
* (2020.01.15) 增加`AxisLabel`格式化为整数的支持(`{value:f0}`
* (2020.01.15) 增加折线图对数轴`Log`的支持
* (2020.01.09) 修复当设置`DataZoom``minShowNum`时可能异常的问题
* (2020.01.08) 修复当设置`AxisLine``onZero`时刻度显示异常的问题
* (2020.01.08) 增加`Mask`遮罩遮挡支持
* (2019.12.21) 增加`Tooltip`的单个数据项和标题的字符串模版格式器
* (2019.12.21) 增加`DataZoom`的最小显示数据个数`minShowNum`
* (2019.12.20) 增加`Demo40_Radar.cs`雷达图代码操作`Demo`
* (2019.12.20) 添加`RadarChart`相关API接口
* (2019.12.17) 发布`v1.1.0`版本
* (2019.12.16) 修复`Overlay`模式下不显示`Tooltip`的问题
* (2019.12.15) 增加`Title``TextStyle`支持
* (2019.12.11) 修复`Legend`都隐藏时`Value轴`还显示数值的问题
* (2019.12.11) 修复`Series->Data->Size`重置为0后设置无效的问题
* (2019.12.06) 修复数据过小时`AxisLabel`直接科学计数法显示的问题
* (2019.12.04) 优化和完善数据更新`UpdateData`接口
* (2019.12.03) 增加圆环饼图的圆角支持,参数:`serie.arcShaped`
* (2019.12.03) 增加数据更新动画,参数:`serie.animation.dataChangeEnable`
* (2019.11.30) 增加`GaugeChart`仪表盘
* (2019.11.22) 修复`BarChart`清空数据重新赋值后`SerieLabel`显示异常的问题
* (2019.11.16) 修复`SerieLabel`设置`color`等参数不生效的问题
* (2019.11.12) 发布`v1.0.5`版本
* (2019.11.12) 修复`2018.3`以下版本打开项目报错的问题
* (2019.11.12) 增加`IconStyle`子组件,优化`SerieData`的图标配置
* (2019.11.11) 修复`Serie`的图标显示在上层遮挡`Label`的问题
* (2019.11.11) 修复饼图当数据过小时视觉引导线会穿透的的问题
* (2019.11.09) 修复饼图添加数据时`Label`异常的问题
* (2019.11.09) 优化结构,分离为`XCharts``XChartsDemo`两部分
* (2019.11.05) 发布`v1.0.4`版本
* (2019.11.05) 增加`Radar`雷达组件文本样式参数配置支持
* (2019.11.04) 修复`Unity2018.3`以下版本代码不兼容的问题
* (2019.11.04) 优化`SerieLabel`过多时引起的性能问题
* (2019.11.03) 发布`v1.0.3`版本
* (2019.11.03) 增加`Editor`快捷添加图表:`Hierarchy`试图下右键`XCharts->LineChart`
* (2019.11.02) 优化非配置参数变量命名和访问权限,简化`API`
* (2019.10.31) 发布`v1.0.2`版本
* (2019.10.31) 修复`prefab`预设制作报错的问题
* (2019.10.31) 增加访问主题组件API`BaseChart.themeInfo`
* (2019.10.26) 发布`v1.0.1`版本
* (2019.10.26) 修复版本检查功能在非运行时异常的问题
* (2019.10.26) 增加科学计数法显示数值的支持(查阅`forceENotation`参数)
* (2019.10.26) 增加`Axis`类目轴数据为空时的默认显示支持
* (2019.10.26) 增加`Axis`数值轴的最大最小值可设置为小数的支持,优化极小数图表的表现效果
* (2019.10.25) 发布`v1.0.0`版本
* (2019.10.23) 增加版本检测功能:`Component -> XCharts -> Check For Update`
* (2019.10.22) 增加`Package Manager`安装的支持
* (2019.10.20) 增加`Demo`首页`BarChart`的代码动态控制效果
* (2019.10.18) 增加`Serie``barType`参数,可配置`斑马柱状图`
* (2019.10.18) 增加`Serie``barPercentStack`参数,可配置`百分比堆叠柱状图`
* (2019.10.16) 增加`Demo`首页`LineChart`的代码动态控制效果
* (2019.10.15) 移除`Pie`组件,相关参数放到`Settings`中配置
* (2019.10.15) 增加`Demo`首页,展示代码动态控制效果
* (2019.10.14) 增加`RadarChart``ScatterChart``HeatmapChart`的起始动画效果
* (2019.10.14) 增加`SerieData``radius`自定义数据项的半径
* (2019.10.14) 增加`HeatmapChart`热力图
* (2019.10.14) 增加`VisualMap`视觉映射组件
* (2019.10.14) 增加`ItemStyle`数据项样式组件
* (2019.10.14) 增加`Emphasis`高亮样式组件
* (2019.10.10) 增加`Settings`全局参数配置组件,开放更多参数可配置
* (2019.10.09) 增加`AreaStyle`的高亮相关参数配置鼠标悬浮时高亮之前区域
* (2019.10.09) 优化`DataZoom`组件,增加双指缩放
* (2019.10.05) 增加`SerieLabel``LineType`给饼图配置不同类型的视觉引导线
* (2019.10.02) 增加`ScatterChart`同时对`Scatter``Line`的支持,实现折线图和散点图的组合图
* (2019.10.01) 重构代码,废弃`Series.series`接口,用`Series.list`代替
* (2019.10.01) 增加`customDrawCallback`自定义绘制回调
* (2019.10.01) 增加`SmoothDash`平滑虚线的支持
* (2019.09.30) 增加`Serie`采样类型`sampleType`的相关配置
* (2019.09.29) 增加`SerieSymbol`关于显示间隔的相关配置
* (2019.09.29) 重构代码:
* `BaseChart``sampleDist`删除,`Serie`增加`lineSampleDist`
* `BaseChart``minShowDataNumber`删除,`Serie`增加`minShow`
* `BaseChart``maxShowDataNumber`删除,`Serie`增加`maxShow`
* `BaseChart``maxCacheDataNumber`删除,`Serie`增加`maxCache`
* `BaseChart``AddSerie()`接口参数调整
* `BaseChart``UpdateData()`接口参数调整
* `Axis`增加`maxCache`
* (2019.09.28) 增加`LineChart``BarChart`同时对`Line``Bar`类型`Serie`的支持,实现折线图和柱状图的组合图
* (2019.09.27) 增加`Axis``splitNumber`设置为`0`时表示绘制所有类目数据
* (2019.09.27) 增加`SampleDist`采样距离的配置,对过密的曲线开启采样,优化绘制效率
* (2019.09.27) 增加`XCharts问答``XChartsAPI接口``XCharts配置项手册`等文档
* (2019.09.26) 增加`AnimationReset()`重置初始化动画接口
* (2019.09.26) 优化`LineChart`的密集数据的曲线效果
* (2019.09.25) 优化`SerieData`的自定义图标不与`SerieLabel`关联,可单独控制是否显示
* (2019.09.24) 增加`SerieData`的自定义图标相关配置支持
* (2019.09.23) 增加`Formatter`配置`Axis``AxisLabel`的格式化输出
* (2019.09.23) 增加`Tooltip``FontSize``FontStyle`配置字体大小和样式
* (2019.09.23) 增加`Formatter`配置`SerieLabel``Legend``Tooltip`的格式化输出
* (2019.09.19) 增加`LineArrow`配置带箭头曲线
* (2019.09.19) 增加`Tooltip``FixedWidth``FixedHeight``MinWidth``MinHeight`设置支持
* (2019.09.18) 增加单条堆叠柱状图
* (2019.09.18) 增加虚线`Dash`、点线`Dot`、点划线`DashDot`、双点划线`DashDotDot`等类型的折线图支持
* (2019.09.17) 增加`AnimationEnabel()`启用或取消起始动画接口
* (2019.09.17) 增加`Axis``Interval`强制设置坐标轴分割间隔
* (2019.09.16) 去掉`Serie`中的旧版本数据兼容,不再支持`xData``yData`
* (2019.09.06) 增加`Animation`在重新初始化数据时自启动功能
* (2019.09.06) 增加`SerieLabel``Border`边框相关配置支持
* (2019.09.05) 增加`PieChart``Animation`初始化动画配置支持
* (2019.09.03) 增加`BarChart``Animation`初始化动画配置支持
* (2019.09.02) 增加`LineChart``Animation`初始化动画配置支持
* (2019.08.22) 增加`AxisName``Offset`偏移配置支持
* (2019.08.22) 增加`AxisLine``Width`配置支持
* (2019.08.20) 增加`SerieLabel`的背景宽高、文字边距、文字旋转的配置
* (2019.08.20) 增加`BarChart``Label`配置支持
* (2019.08.15) 增加`LineChart``Label`配置
* (2019.08.15) 重构`BarChart`,移除`Bar`组件,相关参数统一放到`Serie`中配置
* (2019.08.15) 重构`LineChart`,移除`Line`组件,相关参数统一放到`Serie`中配置
* (2019.08.15) 发布`v0.8.3`版本
* (2019.08.14) 修复`PieChart``Label`无法自动更新的问题
* (2019.08.13) 修复`UpdateData`接口无法更新数据的问题
* (2019.08.07) 增加`SerieSymbol``Color``Opacity`配置
* (2019.08.07) 发布`v0.8.2`版本
* (2019.08.07) 修复区域平滑折线图显示异常的问题
* (2019.08.06) 修复`serie`系列数超过调色盘颜色数时获取的颜色异常的问题
* (2019.08.06) 修复当`Axis``minMaxType``Custom``max`设置为`100`不生效的问题
* (2019.08.04) 发布`v0.8.1`版本
* (2019.08.04) 修复从Inspector中修改数据不生效的问题
* (2019.08.04) 发布`v0.8.0`版本
* (2019.08.04) 优化`RadarChart`雷达图,增加多雷达图支持
* (2019.08.01) 增加代码API注释文档整理代码
* (2019.07.29) 增加`Radius``Area`两种南丁格尔玫瑰图展示类型
* (2019.07.29) 增加`SerieLabel`配置饼图标签,支持`Center``Inside``Outside`等显示位置
* (2019.07.28) 增加`PieChart`多饼图支持
* (2019.07.23) 优化`Theme`主题的自定义,切换主题时自定义配置不受影响
* (2019.07.22) 增加`EffectScatter`类型的散点图
* (2019.07.21) 增加`ScatterChart`散点图
* (2019.07.21) 增加`SerieData`支持多维数据配置
* (2019.07.20) 增加`Symbol`配置`Serie`标志图形的显示
* (2019.07.19) 增加用代码添加动态正弦曲线的示例`Demo11_AddSinCurve`
* (2019.07.19) 优化`Legend`的显示和控制
* (2019.07.18) 优化抗锯齿,曲线更平滑
* (2019.07.18) 增加`Tooltip`指示器类型,优化显示控制
* (2019.07.15) 增加`Size`设置图表尺寸
* (2019.07.14) 增加`二维数据`支持XY轴都可以设置为数值轴
* (2019.07.13) 增加`双坐标轴`支持,代码改动较大
* (2019.07.10) 发布`v0.5.0`版本
* (2019.07.09) 增加`AxisLine`配置坐标轴轴线和箭头
* (2019.07.03) 增加`AxisLabel`配置坐标轴`刻度标签`
* (2019.07.02) 增加`selected`等相关参数配置`PieChart`的选中效果
* (2019.06.30) 增加`SplitArea`配置坐标轴`分割区域`
* (2019.06.29) 增加`AxisName`配置坐标轴`名称`
* (2019.06.20) 增加`AreaAlpha`控制`RadarChart``Area`透明度
* (2019.06.13) 增加`DataZoom`实现`区域缩放`
* (2019.06.01) 增加`stepType`实现`LineChart``阶梯线图`
* (2019.05.29) 增加`InSameBar`实现`BarChart``非堆叠同柱`
* (2019.05.29) 增加`crossLabel`控制`Tooltip``十字准星指示器`
* (2019.05.24) 增加`堆叠区域图`
* (2019.05.16) 增加`AxisMinMaxType`控制坐标轴最大最小刻度
* (2019.05.15) 完善数据接口
* (2019.05.14) 增加X轴`AxisType.Value`模式支持
* (2019.05.13) 增加负数数值轴支持
* (2019.05.11) 增加自定义`Editor`编辑
* (2019.03.21) 增加`Tooltip`
* (2018.11.01) 增加`Default``Light``Dark`三种默认主题
* (2018.09.05) 发布`v0.1.0`版本

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c6e25b74d4d65457f971a07609658393
guid: 042c85734494346adab5b3233234d261
TextScriptImporter:
externalObjects: {}
userData:

View File

@@ -1,6 +1,65 @@
# 更新日志
* (2021.01.02) 发布`v1.6.3`版本
* (2020.12.18) 修复`Animation`不启用时更新数据会导致图表一直刷新的问题
* (2020.12.01) 修复`Unity2020`上新创建的图表无法正常绘制的问题
* (2020.11.22) 发布`v1.6.2`版本
* (2020.11.22) 修复`LineChart`在数据过于密集时折线绘制异常的问题 #99
* (2020.11.21) 修复`LineChart`的刻度位置在`alignWithLabel``true`时可能异常的问题
* (2020.11.21) 修复`Unity5`兼容报错的问题
* (2020.11.13) 完善`RadarChart``Indicator``\n`换行的支持
* (2020.11.12) 修复`LineChart`当类型为`Smooth`时数据过密情况下报错的问题 #100
* (2020.10.22) 完善`HeatmapChart``VisualMap``Piecewise`的支持
* (2020.09.22) 修复`PieChart`边框大小不一致的问题
* (2020.09.19) 发布`v1.6.1`版本
* (2020.09.19) 增加`Remove All Chart Object`移除图表下的所有子节点(会自动重新初始化)
* (2020.09.18) 修复`SerieLabel`在点击图例隐藏`Serie`后还显示的问题#94
* (2020.09.18) 优化`Axis`的类目轴刻度和文本显示#93
* (2020.09.17) 修复`Package`导入时缺失`meta`文件导致失败的问题#92
* (2020.09.08) 优化`Legend`的颜色可自动匹配`ItemStyle`的自定义颜色#89
* (2020.09.05) 优化`LineChart`在不使用`XAxis1`时也能显示`XAxis1`
* (2020.08.29) 增加`LineStyle``toColor``toColor2`设置`LineChart`的水平渐变,取消通过`ItemStyle`设置`LineChart`的水平渐变
* (2020.08.29) 增加`PieChart``onPointerClickPie`点击扇形图扇区回调
* (2020.08.29) 增加`BarChart``onPointerClickBar`点击柱形图柱条回调
* (2020.08.24) 发布`v1.6.0`版本
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
* (2020.08.15) 优化`PieChart`绘制表现效果#85
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
* (2020.08.08) 优化`LineChart`密集数据的绘制表现效果
* (2020.07.30) 增加`LineChart`可通过`VisualMap``ItemStyle`配置渐变#78
* (2020.07.25) 修复`LineChart`渐出动画绘制异常的问题#79
* (2020.07.25) 修复`LiquidChart``100%`时渐变色会失效的问题#80
* (2020.07.25) 增加`RadarChart``Tooltip``formatter`支持#77
* (2020.07.23) 增加`RingChart`环形渐变支持#75
* (2020.07.21) 增加`AxisLabel``SerieLabel``formatter`可单独配置数值格式化#68
* (2020.07.17) 增加`SerieAnimation`动画完成回调接口
* (2020.07.17) 优化`Chart`放在`ScrollView`下时不影响`ScrollView`的滚动和拖动
* (2020.07.16) 修复`Tooltip`在上层有遮挡还会显示的问题#74
* (2020.07.08) 优化`Scatter`类型`Serie`支持`Log`#70
* (2020.07.07) 修复`SerieLabel`位置错乱的问题
* (2020.07.07) 增加`Tooltip``offset`参数配置偏移
* (2020.07.06) 增加`LiquidChart`水位图
* (2020.07.01) 增加`PolarChart`极坐标图表
* (2020.06.25) 发布`v1.5.2`版本
* (2020.06.25) 修复`BarChart`在数值为`0`时还会绘制一小部分柱条的问题
* (2020.06.24) 修复`PieChart`在设置`clockwise`后绘制异常的问题#65
* (2020.06.23) 优化`LineChart`在峰谷差异过大时的绘制效果#64
* (2020.06.18) 修复`SerieLabel`在重新添加数据时可能不显示的问题
* (2020.06.17) 增加`SerieData`可单独设置`SerieSymbol`#66
* (2020.06.17) 修复`Check For Update``Unity 2018`部分版本报错的问题#63
* (2020.06.16) 增加`Serie``avoidLabelOverlap`参数避免饼图标签堆叠的情况#56
* (2020.06.15) 修复`SerieLabel`单独控制显示时可能错乱的问题
* (2020.06.11) 修复`Check warning`不生效的问题
* (2020.06.11) 修复`PieChart``RingChart`在数据占比很小时不显示的问题
* (2020.06.11) 增加`Tooltip``titleFormatter`支持配置占位符`{i}`表示忽略不显示标题
* (2020.06.07) 增加`Animation``customFadeInDelay`等自定义数据项延时和时长回调函数#58
* (2020.06.07) 优化`PieChart`在数据全为`0`时的显示为等份的效果#59
* (2020.06.04) 增加`SerieLabel``autoOffset`参数设置是否自动判断上下偏移
* (2020.06.04) 增加`Tooltip``alwayShow`参数设置触发后一直显示
* (2020.06.04) 优化`Tooltip``formatter`支持`{.1}`通配符
* (2020.06.04) 优化`Legend`数量过多时自动换行显示#53
* (2020.06.03) 发布`v1.5.1`版本
* (2020.06.02) 增加`Radar``ceilRate`,设置最大最小值的取整倍率
* (2020.06.02) 优化`Tooltip``formatter`,支持`{c1:1-1:f1}`格式配置
@@ -196,7 +255,7 @@
* (2019.08.06) 修复`serie`系列数超过调色盘颜色数时获取的颜色异常的问题
* (2019.08.06) 修复当`Axis``minMaxType``Custom``max`设置为`100`不生效的问题
* (2019.08.04) 发布`v0.8.1`版本
* (2019.08.04) 修复Inspector中修改数据不生效的问题
* (2019.08.04) 修复`Inspector`中修改数据不生效的问题
* (2019.08.04) 发布`v0.8.0`版本
* (2019.08.04) 优化`RadarChart`雷达图,增加多雷达图支持
* (2019.08.01) 增加代码API注释文档整理代码

View File

@@ -103,10 +103,14 @@
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
* `BarChart.onPointerClickBar`:点击柱条回调。参数:`eventData`, `dataIndex`
## `PieChart`
* 继承自 `BaseChart`
* `PieChart.onPointerClickPie`:点击柱条回调。参数:`eventData`, `serieIndex`, `dataIndex`
## `RadarChart`
* 继承自 `BaseChart`

View File

@@ -11,6 +11,7 @@
* [DataZoom 区域缩放](#DataZoom)
* [Grid 网格](#Grid)
* [Legend 图例](#Legend)
* [Polar 极坐标](#Polar)
* [Radar 雷达](#Radar)
* [Series 系列](#Series)
* [Serie-Line 折线图](#Serie-Line)
@@ -21,9 +22,11 @@
* [Serie-Heatmap 热力图](#Serie-Heatmap)
* [Serie-Gauge 仪表盘](#Serie-Gauge)
* [Serie-Ring 环形图](#Serie-Ring)
* [Serie-Liquid 水位图](#Serie-Liquid)
* [Settings 设置](#Settings)
* [Theme 主题](#Theme)
* [Tooltip 提示框](#Tooltip)
* [Vessel 容器](#Vessel)
* [Title 标题](#Title)
* [VisualMap 视觉映射](#VisualMap)
@@ -138,6 +141,17 @@
* `GetData(int index)`:获得指定索引的图例。
* `GetIndex(string legendName)`:获得指定图例的索引。
## `Polar`
极坐标系组件。极坐标系,可以用于散点图和折线图。每个极坐标系拥有一个角度轴和一个半径轴。
相关参数:
* `show`:是否显示直角坐标系网格。
* `center`极坐标的中心点。数组的第一项是横坐标第二项是纵坐标。当值为0-1之间时表示百分比设置成百分比时第一项是相对于容器宽度第二项是相对于容器高度。
* `radius`:极坐标的半径。
* `backgroundColor`:极坐标的背景色,默认透明。
## `Radar`
* `shape`:雷达图绘制类型。
@@ -150,6 +164,7 @@
* `center`雷达图的中心点。数组的第一项是横坐标第二项是纵坐标。当值为0-1之间时表示百分比设置成百分比时第一项是相对于容器宽度第二项是相对于容器高度。
* `ceilRate`最大最小值向上取整的倍率。默认为0时自动计算。
* `splitNumber`:分割段数。默认为 `5`
* `isAxisTooltip`是否Tooltip显示轴线上的所有数据。只对Mutiple类型的Radar有效。
* `splitLine`:分割线条 [AxisSplitLine](#AxisSplitLine)。
* `splitArea`:分割区域 [AxisSplitArea](#AxisSplitArea)。
* `indicator`:是否显示指示器。
@@ -195,17 +210,18 @@
* `Corss`:十字准星指示器。坐标轴显示`Label`和交叉线。
* `formatter`:提示框内容字符串模版格式器。支持用 `\n` 换行。当`formatter`不为空时,优先使用`formatter`,否则使用`itemFormatter`
* 模板变量有`{.}``{a}``{b}``{c}``{d}`
* `{.}`表示带动态颜色的圆点。
* `{a}`系列名`serie``name`
* `{b}`为数据项`serieData``name`,或者类目值(如折线图的`X`轴)。
* `{c}`为数值。
* `{d}`为百分比值,注意不带`%`号。
* `{a1}``{b1}``{c1}`表示指定`index``1``serie``{a}`默认`index``0``serie`
* `{c1:2}`表示索引为`1``serie`的数据项的第`3`个数据(`index``2`
* `{c1:2-2}`表示索引为`1``serie`的第`3`个数据项的`3`个数据。
* `{.}`为当前所指示或`index``0``serie`的对应颜色的圆点。
* `{a}`当前所指示或`index``0``serie`系列名`name`
* `{b}`当前所指示或`index``0``serie`数据项`serieData``name`,或者类目值(如折线图的`X`轴)。
* `{c}`当前所指示或`index``0``serie``y`维(`dimesion``1`)的数值。
* `{d}`当前所指示或`index``0``serie``y`维(`dimesion``1`百分比值,注意不带`%`号。
* `{.1}`表示指定`index``1``serie`对应颜色的圆点
* `{a1}``{b1}``{c1}`中的`1`表示指定`index``1``serie`
* `{c1:2}`表示索引为`1``serie`当前指示数据项的`3`个数据一个数据项有多个数据index为`2`表示`3`个数据
* `{c1:2-2}`表示索引为`1``serie`的第`3`个数据项的第`3`个数据(也就是要指定第几个数据项时必须要指定第几个数据)。
* `{d1:2:f2}`表示单独指定了数值的格式化字符串为`f2`(不指定时用`numericFormatter`)。
* 示例:`"{a}:{c}"``"{a1}:{c1:f1}"``"{a1}:{c1:1f1}"`
* `titleFormatter`:提示框标题内容的字符串模版格式器。支持用 `\n` 换行。仅当`itemFormatter`生效时才有效。
* `titleFormatter`:提示框标题内容的字符串模版格式器。支持用 `\n` 换行。仅当`itemFormatter`生效时才有效。可以单独设置占位符`{i}`表示忽略不显示标题内容。
* `itemFormatter`:提示框单个`serie`或数据项内容的字符串模版格式器。支持用 `\n` 换行。当`formatter`不为空时,优先使用`formatter`,否则使用`itemFormatter`
* `numericFormatter`:标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式:`A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `fixedWidth`:固定宽度。当同时设置 `fixedWidth``minWidth` 时,`fixedWidth``minWidth` 优先级高。
@@ -216,9 +232,29 @@
* `paddingTopBottom`:文字和边框的上下边距。
* `backgroundImage`:提示框的背景图。
* `ignoreDataDefaultContent`:被忽略数据的默认显示字符信息。
* `alwayShow`:是否触发后一直显示。
* `offset``(since v1.5.3)`提示框相对于鼠标位置的偏移。
* `lineStyle`:指示器线条样式 [LineStyle](#LineStyle)。
* `textStyle`:显示内容文本样式 [TextStyle](#TextStyle)。
## `Vessel`
容器组件。一般用于LiquidChart。
相关参数:
* `show`:是否显示容器组件。
* `shape`:容器形状。
* `shapeWidth`:容器的厚度。
* `gap`:间隙。容器和液体的间隙。
* `center`中心点。数组的第一项是横坐标第二项是纵坐标。当值为0-1之间时表示百分比设置成百分比时表示图表宽高最小值的百分比。
* `radius`:半径。
* `smoothness`:开启或关闭缩放区域功能。
* `backgroundColor`:背景色,默认透明。
* `color`:容器颜色。当`autoColor``false`时生效。
* `autoColor`:是否自动颜色。默认`true`。为`true`时颜色会和`serie`一致。
## `DataZoom`
区域缩放组件。用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。
@@ -264,8 +300,9 @@
* ~~`selectedMode`:分段型的选择模式,支持以下模式:~~
* ~~`Multiple`:多选。~~
* ~~`Single`:单选。~~
* `min`:允许的最小值。'min' 必须用户指定。[visualMap.min, visualMap.max] 形成了视觉映射的『定义域』
* `max`:允许的最值。'max' 必须用户指定。[visualMap.min, visualMax.max] 形成了视觉映射的『定义域』。
* `autoMinMax`:自动设置`min``max`的值
* `min`:允许的最值。`autoMinMax``false`时必须指定。`[min, max]` 形成了视觉映射的『定义域』。
* `max`:允许的最大值。`autoMinMax``false`时必须指定。`[min, max]` 形成了视觉映射的『定义域』。
* `range`指定手柄对应数值的位置。range 应在 min max 范围内。
* ~~`text`:两端的文本,如 ['High', 'Low']。~~
* ~~`textGap`两端文字主体之间的距离单位为px。~~
@@ -572,6 +609,7 @@
* `roundCap`:是否启用圆弧效果。
* `ignore`:是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制,对应的`Label``Legend`也不会显示。
* `ignoreValue`忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `avoidLabelOverlap`:在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
@@ -671,6 +709,25 @@
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。环形图的数据只有二维,`data[0]`表示当前值,`data[1]`表示最大值。
## `Serie-Liquid`
水位图系列。
* `show`:系列是否显示在图表上。
* `type``Liquid`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `vesselIndex`:水位图所使用的`vessel`组件的`index`
* `min`:最小值。
* `max`:最大值。
* `waveLength`:水波长。
* `waveHeight`:水波高。
* `waveSpeed`:水波移动速度。正数时左移,负数时右移。
* `waveOffset`:水波偏移。
* `itemStyle`:环形图的圆环样式,包括设置背景颜色和边框等 [ItemStyle](#ItemStyle)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。水位图的数据一般只有一个,表示当前水位值,用`max`设置最大水位值。
## `Settings`
全局参数设置组件。一般情况下可使用默认值,当有需要时可进行调整。
@@ -684,9 +741,10 @@
* `enable`:是否开启动画系统。
* ~~`threshold`:是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。~~
* `fadeInDelay`:设定的渐入动画延时,单位毫秒。
* `fadeInDuration`:设定的渐入动画时长,单位毫秒。
* `fadeOutDuration`:设定的渐出动画时,单位毫秒。
* `fadeInDelay`:设定的渐入动画延时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制:`customFadeInDelay`
* `fadeInDuration`:设定的渐入动画时长,单位毫秒。如果要设置单个数据项的渐入时长,可以用代码定制:`customFadeInDuration`
* `fadeOutDelay`:设定的渐出动画时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制:`customFadeOutDelay`
* `fadeOutDuration`:设定的渐出动画时长,单位毫秒。如果要设置单个数据项的渐出时长,可以用代码定制:`customFadeOutDuration`
* `dataChangeEnable`:是否开启数据变更动画。
* `dataChangeDuration`:数据变更动画时长,单位毫秒。
@@ -774,6 +832,8 @@
* `show`:是否启用。
* `color`:颜色。
* `toColor`渐变颜色1。
* `toColor2`渐变颜色2。只在折线图中有效。
* `backgroundColor`:背景颜色。
* `backgroundWidth`:背景的宽。
* `centerColor`:中心区域的颜色。如环形图的中心区域。
@@ -808,6 +868,8 @@
* `DashDot`:点划线。
* `DashDotDot`:双点划线。
* `color`:线条颜色。默认和 `serie` 一致。
* `toColor`:线的渐变颜色(需要水平方向渐变时)。
* `toColor2`线的渐变颜色2需要水平方向三个渐变色的渐变时
* `width`:线条宽。
* `opacity`:线条的透明度。支持从 `0``1` 的数字,为 `0` 时不绘制该图形。
@@ -833,12 +895,16 @@
* `name`:数据项名称。
* `selected`:该数据项是否被选中。
* `radius`:自定义半径。可用在饼图中自定义某个数据项的半径。
* `showIcon`:是否显示图标
* `iconImage`:图标的图片
* `iconColor`:图标颜色
* `iconWidth`:图标宽
* `iconHeight`:图标高
* `iconOffset`:图标偏移
* `iconStyle`:数据项图标样式
* `enableLabel`:是否启用单个数据项的标签设置
* `label`:单个数据项的标签设置
* `enableItemStyle`:是否启用单个数据项的样式
* `itemStyle`:单个数据项的样式设置
* `enableEmphasis`:是否启用单个数据项的高亮样式
* `emphasis`:单个数据项的高亮样式设置。
* `enableSymbol`:是否启用单个数据项的标记设置。
* `symbol`:单个数据项的标记设置。
* `data`:可指定任意维数的数值列表。对于折线图和柱状图,`data`其实是`size``2`的数组,`data[0]`是x的编号`data[1]``y`的数值,默认显示`data[1]`。其他图表看需求而定是长度大于`2`的数组。可通过`Serie``showDataDimension`指定数据长度。
## `SerieLabel`
@@ -852,6 +918,7 @@
* `formatter`:标签内容字符串模版格式器。支持用 `\n` 换行。模板变量有:`{a}`:系列名;`{b}`:数据名;`{c}`:数据值;`{d}`:百分比。示例:`{b}:{c}`
* `numericFormatter`:标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式:`A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `offset`:距离图形元素的偏移。
* `autoOffset`是否开启自动偏移。当开启时Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。
* `color`:自定义文字颜色,默认和系列的颜色一致。
* `backgroundColor`:标签的背景色,默认无颜色。
* `backgroundWidth`:标签的背景宽度。一般不用指定,不指定时则自动是文字的宽度。
@@ -876,6 +943,7 @@
## `SerieSymbol`
* `show`:是否显示标记。
* `type`:标记类型。支持以下六种类型:
* `EmptyCircle`:空心圆。
* `Circle`:实心圆。

View File

@@ -6,29 +6,33 @@
[QA 1如何调整坐标轴与背景的边距](#如何调整坐标轴与背景的边距)
[QA 2如何让初始动画重新播放](#如何让初始动画重新播放)
[QA 3如何自定义折线图、饼图等数据项的颜色](#如何自定义折线图饼图等数据项的颜色)
[QA 4如何格式化文字如我想给坐标轴标签加上单位](#如何格式化文字如我想给坐标轴标签加上单位)
[QA 3如何自定义折线图、饼图等数据项的颜色](#如何自定义折线图_饼图等数据项的颜色)
[QA 4如何格式化文字如我想给坐标轴标签加上单位](#如何格式化文字_如我想给坐标轴标签加上单位)
[QA 5如何让柱形图的柱子堆叠显示](#如何让柱形图的柱子堆叠显示)
[QA 6如何让柱形图的柱子同柱但不重叠](#如何让柱形图的柱子同柱但不重叠)
[QA 7如何调整柱形图的柱子宽度和间距](#如何调整柱形图的柱子宽度和间距)
[QA 8如何调整柱形图单个柱子的颜色](#如何调整柱形图单个柱子的颜色)
[QA 9如何调整图表的对齐方式](#如何调整图表的对齐方式)
[QA 10可以显示超过1000以上的大数据吗](#可以显示超过1000以上的大数据吗)
[QA 11折线图可以画虚线、点线、点划线吗](#折线图可以画虚线点线点划线吗)
[QA 12如何限定Y轴Value轴的值范围](#如何限定Y轴Value轴的值范围)
[QA 11折线图可以画虚线、点线、点划线吗](#折线图可以画虚线_点线_点划线吗)
[QA 12如何限定Y轴Value轴的值范围](#如何限定Y轴的值范围)
[QA 13如何自定义数值轴刻度大小](#如何自定义数值轴刻度大小)
[QA 14如何在数据项顶上显示文本](#如何在数据项顶上显示文本)
[QA 15如何给数据项自定义图标](#如何给数据项自定义图标)
[QA 16锯齿太严重如何让图表更顺滑](#锯齿太严重如何让图表更顺滑)
[QA 17为什么鼠标移上图表Tooltip不显示](#为什么鼠标移上图表`Tooltip`不显示)
[QA 18如何取消Tooltip的竖线](#如何取消`Tooltip`的竖线)
[QA 19如何让Y轴数值轴显示多位小数](#如何让Y轴数值轴显示多位小数)
[QA 20如何用代码动态更新数据?](#如何用代码动态更新数据)
[QA 21如何显示图例?](#如何显示图例)
[QA 22如何做成预设?](#如何做成预设)
[QA 23如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
[QA 24如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
[QA 25如何使用背景组件?有什么条件限制?](#如何使用背景组件?有什么条件限制)
[QA 16锯齿太严重如何让图表更顺滑](#锯齿太严重_如何让图表更顺滑)
[QA 17为什么鼠标移上图表 Tooltip 不显示?](#为什么鼠标移上图表Tooltip不显示)
[QA 18如何取消 Tooltip 的竖线?](#如何取消Tooltip的竖线)
[QA 19如何自定义 Tooltip 的显示内容?](#如何自定义Tooltip的显示内容)
[QA 20如何让Y轴数值轴显示多位小数](#如何让Y轴显示多位小数)
[QA 21如何用代码动态更新数据?](#如何用代码动态更新数据)
[QA 22如何显示图例?为什么有时候图例无法显示?](#如何显示图例_为什么有时候图例无法显示)
[QA 23如何做成预设?](#如何做成预设)
[QA 24如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
[QA 25如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
[QA 26如何使用背景组件有什么条件限制](#如何使用背景组件_有什么条件限制)
[QA 27Mesh can not have more than 65000 vertices?](#Mesh_cannot_have_more_than_65000_vertices)
[QA 28为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
[QA 29为什么升级到1.6.0版本后很多自定义颜色丢失了?应该如何升级?](#为什么升级到1_6_0版本后很多自定义颜色丢失了_应该如何升级)
## 如何调整坐标轴与背景的边距
@@ -38,11 +42,11 @@
答:调用`AnimationReset()`接口。
## 如何自定义折线图饼图等数据项的颜色
## 如何自定义折线图_饼图等数据项的颜色
答:通过`Theme``colorPalette`调整,或者部分`Serie`下的`LineStyle``ItemStyle`
## 如何格式化文字如我想给坐标轴标签加上单位
## 如何格式化文字_如我想给坐标轴标签加上单位
答:通过`formatter``numericFormatter`参数,在`Legend``Axis``AxisLabel``Tooltop``Serie``Label`都提供该参数的配置。
@@ -70,11 +74,11 @@
答:可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie``symbol``label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large``largeThreshold`参数来开启性能模式。
## 折线图可以画虚线点线点划线吗
## 折线图可以画虚线_点线_点划线吗
答:可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
## 如何限定Y轴Value轴的值范围
## 如何限定Y轴的值范围
答:设置`Axis`下的`minMaxType``Custom`,自定义`min``max`
@@ -90,29 +94,33 @@
答:通过设置`Serie``data`下的数据项可单独设置`icon`相关参数。
## 锯齿太严重如何让图表更顺滑
## 锯齿太严重_如何让图表更顺滑
答:开启抗锯齿设置(在`Unity`里设置。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。锯齿只能减少难以避免,像素越高锯齿越不明显。
## 为什么鼠标移上图表`Tooltip`不显示
## 为什么鼠标移上图表Tooltip不显示
答:确认`Tooltip`是否开启。确认父节点是否关闭了鼠标事件。
## 如何取消`Tooltip`的竖线
## 如何取消Tooltip的竖线
答:设置`Tooltip``type``None`
答:设置`Tooltip``type``None`或者调整`lineStyle`的参数。
## 如何让Y轴数值轴显示多位小数
## 如何自定义Tooltip的显示内容
答:设置`Axis``AxisLabel`中的`formatter``{value:f1}``{value:f2}`。1.5.0及以上版本通过`numericFormatter`设置
答:自定义总的内容可以通过`Tooltip``formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter``titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie``itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](XCharts配置项手册.md)
## 如何让Y轴显示多位小数
答:设置`Axis`下的`AxisLabel`中的`formatter``{value:f1}``{value:f2}``1.5.0`及以上版本通过`numericFormatter`设置。
## 如何用代码动态更新数据
答:请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能相关API请查看文档[XChartsAPI接口](XChartsAPI.md) 。
## 如何显示图例
## 如何显示图例_为什么有时候图例无法显示
答:首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例即可
答:首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示
## 如何做成预设
@@ -126,10 +134,34 @@
答:参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis``serie`都设置相同的`maxCache``maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
## 如何使用背景组件有什么条件限制
## 如何使用背景组件_有什么条件限制
答:设置`background`组件的`show``true`,但不一定就能激活背景组件。由于框架的局限性,背景组件有两个前提条件:一是图表的父节点不能用布局控制,因为背景组件和图表的节点关系是并行的,用了布局控制背景组件的位置就无法控制。二是图表的父节点只能有图表自己一个子节点,这是方便管理背景组件节点的需要,要不然并行关系的原因,容易错乱对不上。另外,调整图表的层级关系时最好先隐藏背景组件,这是会自动删除关联的背景组件节点。
## 区域折线图在用半透明颜色时有时候会一条叠加的线
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
## Mesh_cannot_have_more_than_65000_vertices
答:这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[QA 10可以显示超过1000以上的大数据吗](#可以显示超过1000以上的大数据吗)
## 为什么serie里设置的参数运行后又被重置了
答:检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
## 为什么升级到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. 备份好你的项目。
2. 先不升级`XCharts`,只下载或拷贝脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)放到旧项目的`Editor`由于旧版本可能不存在某些新版本才有的图表或者属性配置可能会编译错误需要处理按34步骤处理一下。
3. 若是由`itemStyle.toColor2`引起的编译报错,可将导出地方的`itemStyle.toColor2`改为`Color.clear`;导入的地方注释掉即可。
4. 若是由`LiquidChart`引起的编译报错,将所有涉及`LiquidChart`的地方都注释掉即可。
5. 编译通过后,通过`菜单栏->XCharts->ExportColorConfig`导出旧版本的颜色配置文件(配置文件默认保存到`Assets`下的`color.config`)。
6. 升级`XCharts`到最新版本。
7. 通过`菜单栏->XCharts->ImportColorConfig``color.config`导入即可恢复自定义的颜色(如果`color.config`不在升级后的项目的`Assets`下的话需要拷贝到此目录下)。
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XChartsAPI接口](XChartsAPI.md)
[XCharts配置项手册](XCharts配置项手册.md)

View File

@@ -0,0 +1,146 @@
# XCharts API
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts问答](XCharts问答.md)
## `BaseChart`
* `BaseChart.themeInfo`:主题组件`ThemeInfo`
* `BaseChart.title`:标题组件`Title`
* `BaseChart.legend`:图例组件`Legend`
* `BaseChart.tooltip`:提示框组件`Tooltip`
* `BaseChart.series`:系列列表`Series`
* `BaseChart.chartName`:图表的别称。
* `BaseChart.chartWidth`:图表的宽。
* `BaseChart.chartHeight`:图表的高。
* `BaseChart.forceOpenRaycastTarget`:强制开启鼠标事件检测。一般不用手动设置,内部会自动判断是否需要检测。
* `BaseChart.onCustomDraw`:自定义绘制回调。
* `BaseChart.onPointerClick`:鼠标点击回调。
* `BaseChart.onPointerDown`:鼠标按下回调。
* `BaseChart.onPointerUp`:鼠标弹起回调。
* `BaseChart.onPointerEnter`:鼠标进入图表回调。
* `BaseChart.onPointerExit`:鼠标退出图表回调。
* `BaseChart.onBeginDrag`:鼠标开始拖拽回调。
* `BaseChart.onDrag`:鼠标拖拽回调。
* `BaseChart.onEndDrag`:鼠标结束拖拽回调。
* `BaseChart.onScroll`:鼠标滚动回调。
* `BaseChart.SetSize(float width, float height)` 设置图表的宽高在非stretch pivot下才有效其他情况需要自己调整RectTransform
* `BaseChart.ClearData()`:清除所有数据,系列列表会保留,只是移除列表中系列的数据。
* `BaseChart.RemoveData()`:清除所有系列和图例数据,系列列表也会被清除。
* `BaseChart.RemoveData(string serieName)`:清除指定系列名称的数据。
* `BaseChart.AddSerie(SerieType type, string serieName = null, bool show = true)`:添加一个系列到系列列表中。
* `BaseChart.AddData(string serieName, float data, string dataName = null)`:添加一个数据到指定的系列中。
* `BaseChart.AddData(int serieIndex, float data, string dataName = null)`:添加一个数据到指定的系列中。
* `BaseChart.AddData(string serieName, List<float> multidimensionalData, string dataName = null)`:添加多维数据`x,y,z...`到指定的系列中。
* `BaseChart.AddData(int serieIndex, List<float> multidimensionalData, string dataName = null)`:添加多维数据`x,y,z...`到指定的系列中。
* `BaseChart.AddData(string serieName, float xValue, float yValue, string dataName)`:添加`x,y`数据到指定系列中。
* `BaseChart.AddData(int serieIndex, float xValue, float yValue, string dataName = null)`:添加`x,y`数据到指定系列中。
* `BaseChart.UpdateData(string serieName,int dataIndex, float value)`:更新指定系列中的指定索引数据。
* `BaseChart.UpdateData(int serieIndex,int dataIndex, float value)`:更新指定系列中的指定索引数据。
* `BaseChart.UpdateData(string serieName, int dataIndex, List<float> multidimensionalData)`:更新指定系列指定索引的数据项的多维数据。
* `BaseChart.UpdateData(int serieIndex, int dataIndex, List<float> multidimensionalData)`:更新指定系列指定索引的数据项的多维数据。
* `BaseChart.UpdateData(string serieName, int dataIndex, int dimension, float value)`更新指定系列指定索引指定维数的数据。维数从0开始。
* `BaseChart.UpdateData(int serieIndex, int dataIndex, int dimension, float value)`更新指定系列指定索引指定维数的数据。维数从0开始。
* `BaseChart.UpdateDataName(string serieName,int dataIndex, string dataName)`:更新指定系列中的指定索引数据名称。
* `BaseChart.UpdateDataName(int serieIndex, int dataIndex, string dataName)`:更新指定系列中的指定索引数据名称。
* `BaseChart.SetActive(string serieName, bool active)`:设置指定系列是否显示。
* `BaseChart.SetActive(int serieIndex, bool active)`:设置指定系列是否显示。
* `BaseChart.IsActive(string serieName)`:获取指定系列是否显示。
* `BaseChart.IsActive(int serieIndex)`:获取指定系列是否显示。
* `BaseChart.IsActiveByLegend(string legendName)`:获得指定图例名字的系列是否显示。
* `BaseChart.RefreshChart()`:在下一帧刷新图表。
* `BaseChart.RefreshLabel()`:在下一帧刷新文本标签。
* `BaseChart.RefreshTooltip()`:立即刷新`Tooltip`组件。
* `BaseChart.UpdateTheme(Theme theme)`:切换图表主题。
* `BaseChart.AnimationEnable(bool flag)`:启用或关闭动画。
* `BaseChart.AnimationFadeIn()`:渐入动画。
* `BaseChart.AnimationFadeOut()`:渐出动画。
* `BaseChart.AnimationPause()`:暂停动画。
* `BaseChart.AnimationResume()`:继续动画。
* `BaseChart.AnimationReset()`:重置动画。
* `BaseChart.ClickLegendButton(int legendIndex, string legendName, bool show)`:点击图例按钮。
* `BaseChart.IsInChart(Vector2 local)`:坐标是否在图表范围内。
* `BaseChart.IsInChart(float x, float y)`:坐标是否在图表范围内。
* `BaseChart.EnableBackground(bool flag)`:开启背景组件。背景组件在`chart`受上层布局控制时无法开启。
## `CoordinateChart`
* `CoordinateChart.grid`:网格组件 `Grid`
* `CoordinateChart.xAxises`:左右两个 `X` 轴组件 `XAxis`
* `CoordinateChart.yAxises`:左右两个 `Y` 轴组件 `YAxis`
* `CoordianteChart.xAxis0`X轴
* `CoordianteChart.xAxis1`X轴
* `CoordianteChart.xAxis0`Y轴
* `CoordianteChart.yAxis1`Y轴
* `CoordinateChart.dataZoom`:区域缩放组件 `DataZoom`
* `CoordinateChart.coordinateX`:坐标系的左下角坐标 `X`
* `CoordinateChart.coordinateY`:坐标系的左下角坐标 `Y`
* `CoordinateChart.coordinateWidth`:坐标系的宽。
* `CoordinateChart.coordinateHeight`:坐标系的高。
* `CoordinateChart.ClearAxisData()`清除所有x轴和y轴的类目数据。
* `CoordinateChart.AddXAxisData(string category, int xAxisIndex = 0)`:添加一个类目数据到指定的 `X` 轴。
* `CoordinateChart.AddYAxisData(string category, int yAxisIndex = 0)`:添加一个类目数据到指定的 `Y` 轴。
* `CoordinateChart.IsValue()`:是否是纯数值坐标。
* `CoordinateChart.RefreshDataZoom()`在下一帧刷新DataZoom组件。
* `CoordinateChart.RefreshAxisMinMaxValue()`:立即刷新数值坐标轴的最大最小值(更新坐标轴标签并触发重绘)。
* `CoordinateChart.IsInCooridate(Vector2 local)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(Vector3 local)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(float x, float y)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(Vector2 local)`:坐标是否在坐标轴内。
* `CoordinateChart.ClampInCoordinate(Vector3 pos)`:将坐标限制在坐标系内。
* `CoordinateChart.CovertXYAxis(int index)`转换X轴和Y轴的配置。
* `CoordinateChart.UpdateCoordinate()`:更新坐标系原点和宽高。一般内部会自动更新,也可强制更新。
* `CoordinateChart.SetMaxCache(int maxCache)`:设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。
## `LineChart`
* 继承 `BaseChart`
* 继承自 `CoordinateChart`
## `BarChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
* `BarChart.onPointerClickBar`:点击柱条回调。参数:`eventData`, `dataIndex`
## `PieChart`
* 继承自 `BaseChart`
* `PieChart.onPointerClickPie`:点击柱条回调。参数:`eventData`, `serieIndex`, `dataIndex`
## `RadarChart`
* 继承自 `BaseChart`
* `RadarChart.radars`:雷达坐标系组件列表 `Radar`
* `RadarChart.RemoveRadar()`:移除所有雷达坐标系组件。
* `RadarChart.AddRadar(Radar radar)`:添加雷达坐标系组件。
* `RadarChart.AddRadar(Radar.Shape shape, Vector2 center, float radius, int splitNumber = 5,float lineWidth = 0.6f, bool showIndicator = true, bool showSplitArea = true)`:添加雷达坐标系组件。
* `RadarChart.AddIndicator(int radarIndex, string name, float min, float max)`:添加指示器。
* `RadarChart.UpdateIndicator(int radarIndex, int indicatorIndex, string name, float min, float max)`:更新指示器。
* `RadarChart.GetRadar(int radarIndex)`:获得指定索引的雷达坐标系组件。
* `RadarChart.GetIndicator(int radarIndex, int indicatorIndex)`:获得指定雷达坐标系组件指定索引的指示器。
## `ScatterChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
## `HeatmapChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
## `RingChart`
* 继承自 `BaseChart`
* `RingChart.UpdateMax(int serieIndex, int dataIndex, float value)`:更新指定系列执行数据项的最大值。
* `RingChart.UpdateMax(int serieIndex, float value)`:更新指定系列的所有数据项的最大值。
* `RingChart.UpdateMax(float value)`:更新第一个系列第一个数据项的最大值。
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts问答](XCharts问答.md)

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f74b65f3be5d64689a5db6bdbc91df3e
guid: 529e55126e1d04a629b14d857f76fffd
TextScriptImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,867 @@
# XCharts Configuration
[XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts API](xcharts-api-EN.md)
[XCharts Q&A](xcharts-questions-and-answers-EN.md)
The translation work is still in progress.
Main component:
* [Axis](#XAxis)
* [Background](#Background)
* [DataZoom](#DataZoom)
* [Grid](#Grid)
* [Legend](#Legend)
* [Polar](#Polar)
* [Radar](#Radar)
* [Series](#Series)
* [Serie-Line](#Serie-Line)
* [Serie-Bar](#Serie-Bar)
* [Serie-Pie](#Serie-Pie)
* [Serie-Radar](#Serie-Radar)
* [Serie-Scatter](#Serie-Scatter)
* [Serie-Heatmap](#Serie-Heatmap)
* [Serie-Gauge](#Serie-Gauge)
* [Serie-Ring](#Serie-Ring)
* [Serie-Liquid](#Serie-Liquid)
* [Settings](#Settings)
* [Theme](#Theme)
* [Title](#Title)
* [Tooltip](#Tooltip)
* [Vessel](#Vessel)
* [VisualMap](#VisualMap)
Sub component:
* [AreaStyle](#AreaStyle)
* [AxisLabel](#AxisLabel)
* [AxisLine](#AxisLine)
* [AxisName](#AxisName)
* [AxisSplitLine](#AxisSplitLine)
* [AxisSplitArea](#AxisSplitArea)
* [AxisTick](#AxisTick)
* [Emphasis](#Emphasis)
* [ItemStyle](#ItemStyle)
* [LineArrow](#LineArrow)
* [LineStyle](#LineStyle)
* [Location](#Location)
* [SerieAnimation](#SerieAnimation)
* [SerieData](#SerieData)
* [SerieLabel](#SerieLabel)
* [SerieSymbol](#SerieSymbol)
* [TextLimit](#TextLimit)
* [TextStyle](#TextStyle)
## `Theme`
Theme components. Topics are used to configure other parameters such as the global color scheme for the chart.
Parameters:
* `theme`: Built-in theme types. There are `Default`, `Light`, `Dark` three optional built-in theme.
* `font`: A common font for all text.
* `backgroundColor`: Chart background color.
* `titleTextColor`: The text color of the main title.
* `titleSubTextColor`: The text color of the sub title.
* `legendTextColor`: Legend text color when actived.
* `legendUnableColor`: Legend text color when unactived.
* `axisTextColor`: The text color of axis label.
* `axisLineColor`: The color of axis line.
* `axisSplitLineColor`: The color of the dividing line of the coordinate axis is the same as the default color of the axis.
* `tooltipBackgroundColor`: The background color of the tooltip.
* `tooltipFlagAreaColor`: The color of the shadow indicator for the tooltip.
* `tooltipTextColor`: The text color of Tooltip.
* `tooltipLabelColor`: The cross indicator in the tooltip coordinates the background color of the label.
* `tooltipLineColor`: The color of the indicator line in the tooltip.
* `dataZoomTextColor`: The text color of dataZoom.
* `dataZoomLineColor`: The line color of dataZoom.
* `dataZoomSelectedColor`: The selected area color of dataZoom.
* `colorPalette`: Palette color list. The color list of palette. If no color is set in series, the colors would be adopted sequentially and circularly from this list as the colors of series.
API:
* `GetColor(int index)`: Gets the color of the specified index from the palette.
* `GetColorStr(int index)`: Gets the hexadecimal color string of the specified index from the palette.
* `GetColor(string hexColorStr)`: Convert the html string to color.
## `Title`
Title component, including main title and subtitle.
Parameters:
* `show`: Whether to show title component.Set this to false to prevent the title component from showing.
* `text`: The content of main title, supporting `\n` for newlines.
* `textStyle`: The text style of main title [TextStyle](#TextStyle).
* `subText`: The content of sub title, supporting `\n` for newlines.
* `subTextStyle`: The text style of sub title [TextStyle](#TextStyle).
* `itemGap`: The gap between the main title and sub title.
* `location`: The location of title component [Location](#Location).
## `TitleStyle`
Sub component for serie title.
* `show`: Whether to show serie title.
* `textStyle`: The text style of title [TextStyle](#TextStyle).
## `Legend`
Legend component.The legend component shows different sets of symbol, colors, and names. You can control which series are not displayed by clicking on the legend.
Parameters:
* `show`: Whether show legend component.
* `selectedMode`: Selected mode of legend, which controls whether series can be toggled displaying by clicking legends:
* `Multiple`: multi-select.
* `Single`: single select.
* `None`: cant select.
* `orient`: horizontal or vertical layout:
* `Horizonal`: horizontal layout.
* `Vertical`: vertical layout.
* `location`: the localtion of legend in chart [Location](#Location).
* `itemWidth`: the width of legend icon.
* `itemHeight`: the height of legend icon.
* `itemGap`: The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout.
* `itemAutoColor`: Whether the legend symbol matches the color automatically.
* `formatter`: Legend content string template formatter. Support for wrapping lines with `\n`. Template:`{name}`.
* `data`: Data array of legend. An array item is usually a name representing string. (If it is a pie chart, it could also be the name of a single data in the pie chart) of a series. If data is not specified, it will be auto collected from series.
* `icons`: The list of cunstomize icons.
* `textStyle`: The text style of legend content [TextStyle](#TextStyle).
API:
* `ClearData()`: Clear legend data.
* `ContainsData(string name)`: Whether include in legend data by the specified name.
* `RemoveData(string name)`: Remove legend from data.
* `AddData(string name)`: Add legend.
* `GetData(int index)`: Get legend.
* `GetIndex(string legendName)`: Get the index of legend.
## `Polar`
Polar coordinate can be used in scatter and line chart. Every polar coordinate has an angleAxis and a radiusAxis.
Parameters:
* `show`: Whether to show the polor component.
* `center`: The center of ploar. 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.
* `radius`: the radius of polar.
* `backgroundColor`: Background color of polar, which is transparent by default.
## `Radar`
Radar coordinate conponnet for radar charts.
* `shape`: Radar render type, in which `Polygon` and `Circle` are supported.
* `Polygon`: Polygon.
* `Circle`: Circle.
* `positionType`: The position type of radar indicator label display.
* `Vertice`: Display at the vertex.
* `Between`: Display at the middle of line.
* `radius`: The radius of radar.[default:0.3f].
* `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].
* `splitLine`: The split line style of radar [AxisSplitLine](#AxisSplitLine).
* `splitArea`: The split area style of radar [AxisSplitArea](#AxisSplitArea).
* `indicator`: Whether to show indicator.
* `indicatorGap`: The gap of indicator and radar.
* `indicatorList`: The indicator list [Radar.Indicator](#Radar.Indicator).
## `Radar.Indicator`
Indicator of radar chart, which is used to assign multiple variables(dimensions) in radar chart.
* `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.
* `textStyle`: The text style of indicator [TextStyle](#TextStyle).
## `TextLimit`
Text character limitation and adaptation component. When the length of the text exceeds the set length, it is cropped and suffixes are appended to the end. Only valid in the category axis.
* `enable`: Whether to enable text limit. [default: `true`].
* `maxWidth`: Set the maximum width. A default of 0 indicates automatic fetch; otherwise, custom. Clipping occurs when the width of the text is greater than this value. [default: `0f`].
* `gap`: White pixel distance at both ends. [default: `10f`].
* `suffix`: Suffixes when the length exceeds. [default: `"..."`].
## `TextStyle`
The component of settings related to text.
* `rotate`: rotate of text. [default: `0f`].
* `offset`: offset of text position. [default: `Vector2.zero`].
* `color`: color of text. [default: `Color.clear`].
* `backgroundColor`: color of text background. [default: `Color.clear`].
* `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 space of text line. [default: `1f`].
## `Tooltip`
Tooltip component.
* `show`: Whether to show the tooltip component.
* `type`: Indicator type. Indicator types are:
* `Line`: line indicator.
* `Shadow`: shadow crosshair indicator.
* `None`: no indicator displayed.
* `Corss`: crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.
* `formatter`: A string template formatter for the total content of the prompt box. Support for wrapping lines with `\n`. When formatter is not null, use formatter first, otherwise use itemFormatter.
* Template variables are `{.}`, `{a}`, `{b}`, `{c}`, `{d}`.
* `{.}` is the dot of the corresponding color of `serie` that is currently indicated or whose `index` is `0`.`
* `{a}` is the `name` of the `serie` that is currently indicated or whose `index` is `0`.
* `{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.
* `{.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).
* `{c1:2-2}` represents the third data item from `serie`'s third data item indexed to `1` (i.e., which data item must be specified to specify).
* `{d1:2: F2}` indicates that a formatted string with a value specified separately is `F2` (`numericFormatter` is used when not specified).
* Example: `"{a}, {c}"`, `"{a1}, {c1: f1}"`, `"{a1}, {c1:0: f1}"`, `"{a1} : {c1:1-1: f1}"`
* `titleFormatter`: The string template formatter for the tooltip title content. Support for wrapping lines with `\n`. This is only valid if the `itemFormatter` is in effect. The placeholder `{I}` can be set separately to indicate that the title is ignored and not displayed.
* `itemFormatter`: a string template formatter for a single Serie or data item content. Support for wrapping lines with `\n`. When `formatter` is not null, use `formatter` first, otherwise use `itemFormatter`.
* `numericFormatter`: Standard numeric format string. Used to format numeric values to display as strings. Using 'Axx' form: 'A' is the single character of the format specifier, supporting 'C' currency, 'D' decimal, 'E' exponent, 'F' number of vertices, 'G' regular, 'N' digits, 'P' percentage, 'R' round tripping, 'X' hex etc. 'XX' is the precision specification, from '0' - '99'. see: <https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings>
* `fixedWidth`: Fixed width. Higher priority than `minWidth`.
* `fixedHeight`: Fixed height. Higher priority than `minHeight`.
* `minWidth`: Minimum width. If `fixedWidth` has a value, get `fixedWidth` first.
* `minHeight`: Minimum height. If `fixedHeight` has a value, get `fixedHeight` first.
* `paddingLeftRight`: the text padding of left and right. [defaut: `5f`].
* `paddingTopBottom`: the text padding of top and bottom. [defaut: `5f`].
* `backgroundImage`: The image of icon.
* `ignoreDataDefaultContent`: The default display character information for ignored data.
* `alwayShow`: Whether to trigger after always display.
* `offset`: `(since v1.5.3)`The position offset of tooltip relative to the mouse position.
* `lineStyle`: the line style of indicator line [LineStyle](#LineStyle).
* `textStyle`: the text style of content [TextStyle](#TextStyle).
## `Vessel`
Vessel component for liquid chart. There can be multiple vessels in a Chart, which can be matched by vesselIndex in Serie.
* `show`: Whether to show the vessel. [defaut: `true`]
* `shape`: The shape of vessel. [default: `Shape.Circle`]
* `shapeWidth`: Thickness of vessel. [defaut: `5f`]
* `gap`: The gap between the vessel and the liquid. [defaut: `10f`]
* `center`: The center of vessel. 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.45f]`]
* `radius`: The radius of vessel. When value between 0 and 1 represents a percentage relative to the chart. [default: `0.35f`]
* `smoothness`: The smoothness of wave. [default: `1f`]
* `backgroundColor`: Background color of polar, which is transparent by default. [default: `Color.clear`]
* `color`: Vessel color. The default is consistent with Serie. [default: `Color32(70, 70, 240, 255)`]
* `autoColor`: Whether automatic color. If true, the color matches serie. [default: `true`]
## `DataZoom`
DataZoom component is used for zooming a specific area, which enables user to investigate data in detail, or get an overview of the data, or get rid of outlier points.
Currently only the control 'X' axis is supported.
* `enable`: Whether to show dataZoom.
* `supportInside`: Whether built-in support is supported. Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging, mouse wheel, finger swiping (on the touch screen).
* `supportSlider`: Whether a slider is supported. There are separate sliders on which the user zooms or roams.
* ~~`filterMode`: The mode of data filter, not support yet.~~
* ~~`Filter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered if one of the relevant dimensions is out of the window.~~
* ~~`WeakFilter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered only if all of the relevant dimensions are out of the same side of the window.~~
* ~~`Empty`: data that outside the window will be set to NaN, which will not lead to changes of windows of other axes.~~
* ~~`None`: Do not filter data.~~
* ~~`xAxisIndex`: Specify which xAxis is controlled by the dataZoom.~~
* ~~`yAxisIndex`: Specify which yAxis is controlled by the dataZoom.~~
* `showDataShadow`: Whether to show data shadow, to indicate the data tendency in brief. [default: `true`]
* `showDetail`: Whether to show detail, that is, show the detailed data information when dragging. [default: `false`]
* `zoomLock`: Specify whether to lock the size of window (selected area). [default: `false`]
* ~~`realtime`: Whether to show data shadow in dataZoom-silder component, to indicate the data tendency in brief. [default: `true`]~~
* ~~`backgroundColor`: The background color of the component.~~
* `bottom`: Distance between dataZoom component and the bottom side of the container. bottom value is a instant pixel value like 10. [default: `10f`]
* `height`: The height of dataZoom component. height value is a instant pixel value like 10. [default: `50f`]
* `rangeMode`: Use absolute value or percent value in `DataZoom.start` and `DataZoom.end`. [default: `RangeMode.Percent`].
* `Percent`: percent.
* `start`: The start percentage of the window out of the data extent, in the range of `0 ~ 100`. [default: `30f`]
* `end`: The end percentage of the window out of the data extent, in the range of 0 ~ 100. [default: `70f`]
* `scrollSensitivity`: The sensitivity of dataZoom scroll. The larger the number, the more sensitive it is. [default: `10f`]
* `fontSize`: font size of datazoom label.
* `fontStyle`: font style of datazoom label.
* `minShowNum`: Minimum number of display data. Minimum number of data displayed when DataZoom is enlarged to maximum. [default: `1`]
## `VisualMap`
VisualMap component. mapping data to visual elements such as colors.
* `enable`: Whether enable visualMap component. [default: false]
* `show`: Whether to display components. If set to false, it will not show up, but the data mapping function still exists. [default: true]
* `type`: the type of visualmap component.
* `Continuous`: Continuous.
* ~~`Piecewise`: Piecewise.~~
* ~~`selectedMode`: the selected mode for Piecewise visualMap.~~
* ~~`Multiple`: Multiple.~~
* ~~`Single`: Single.~~
* `autoMinMax`: Automatically set min, Max value.
* `min`: The minimum allowed. `min` must be user specified. `[min, max]` forms the domain of the visualMap.
* `max`: The maximum allowed. `max` must be user specified. `[min, max]` forms the domain of the visualMap.
* `range`: Specifies the position of the numeric value corresponding to the handle. Range should be within the range of [min,max].
* ~~`text`: Text on both ends. such as ['High', 'Low'].~~
* ~~`textGap`: The distance between the two text bodies.~~
* `splitNumber`: For continuous data, it is automatically evenly divided into several segments and automatically matches the size of inRange color list when the default is 0.
* `calculable`: Whether the handle used for dragging is displayed (the handle can be dragged to adjust the selected range).
* ~~`realtime`: Whether to update in real time while dragging.~~
* `itemWidth`: The width of the figure, that is, the width of the color bar.
* `itemHeight`: The height of the figure, that is, the height of the color bar.
* `borderWidth`: 边框线宽单位px。
* `dimension`: Specifies which `dimension` of the `Data` to map to the visual element. `Data` is series.data. Starting at 1, the default is 0 to take the last dimension in data.
* `hoverLink`: When the hoverLink function is turned on, when the mouse hovers over the visualMap component, the corresponding value of the mouse position is highlighted in the corresponding graphic element in the diagram. Conversely, when the mouse hovers over a graphic element in a diagram, the corresponding value of the visualMap component is triangulated in the corresponding position.
* `orient`: Is the layout horizontal or vertical.
* `location`: The location of component.
* `inRange`: Defines the visual color in the selected range.
* ~~`outOfRange`: Defines a visual color outside of the selected range.~~
## `Grid`
Grid component. Drawing grid in rectangular coordinate. In a single grid, at most two X and Y axes each is allowed. Line chart, bar chart, and scatter chart can be drawn in grid. There is only one single grid component at most in a single echarts instance.
* `show`: Whether to show the grid in rectangular coordinate.
* `left`: Distance between grid component and the left side of the container.
* `right`: Distance between grid component and the right side of the container.
* `top`: Distance between grid component and the top side of the container.
* `bottom`: Distance between grid component and the bottom side of the container.
* `backgroundColor`: Background color of grid, which is transparent by default.
## `GaugeAxis`
GaugeAxis sub component. Settings related to gauge axis line.
* `axisLine`: axis line style.
* `splitLine`: slit line style.
* `axisTick`: axis tick style.
* `axisLabel`: axis label style.
* `axisLabelText`: Coordinate axis scale label custom content. When the content is empty, `axisLabel` automatically displays the content according to the scale; otherwise, the content is taken from the list definition.
## `GaugePointer`
GaugePointer sub component. Settings related to gauge pointer.
* `show`: Whether to display a pointer.
* `width`: Pointer width.
* `length`: Pointer length. It can be an absolute value, or it can be a percentage relative to the radius (0-1).
## `XAxis`
The x axis in cartesian(rectangular) coordinate. a grid component can place at most 2 x axis, one on the bottom and another on the top.
* `show`: Whether to show axis. By default `xAxises[0]` is `true` and `xAxises[1]` is `false`.
* `type`: the type of axis. The default is `Category`.
* `Value`: Numerical axis for continuous data.
* `Category`: Category axis, applicable to discrete category data, category data must be set through `data` for this type.
* `Log`: Log axis, it applies to logarithmic data.
* `logBaseE`: On the log axis, if base e is the natural number, and is true, logBase fails.
* `logBase`: Base of logarithm, which is valid only for numeric axes with type: `Log`.
* `minMaxType`: the type of axis minmax.The default is `Default`.
* `Default`: 0 - max.
* `MinMax`: min - max.
* `Custom`: Custom min - max.
* `min`: The minimun value of axis. Valid when `minMaxType` is `Custom`.
* `max`: The maximum value of axis. Valid when `minMaxType` is `Custom`.
* `ceilRate`: The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
* `splitNumber`: Number of segments that the axis is split into. The default is `5`, When `splitNumber` is set to `0`, it draws all the category data.
* `interval`: Compulsively set segmentation interval for axis.This is unavailable for category axis. The `splitNumber` is invalid when set.
* `boundaryGap`: The boundary gap on both sides of a coordinate axis.
* `maxCache`: The max number of axis data cache. The first data will be remove when the size of axis data is larger then `maxCache`.
* `inverse`: Whether the axis are reversed or not. Invalid in `Category` axis.
* `data`: Category data, valid in the `Category` axis.
* `axisLine`: the style of axis line [AxisLine](#AxisLine).
* `axisName`: the style of axis name [AxisName](#AxisName).
* `axisTick`: the style of axis tick [AxisTick](#AxisTick).
* `axisLabel`: the style of axis label [AxisLabel](#AxisLabel).
* `splitLine`: the style of axis split line [AxisSplitLine](#SplitLine).
* `splitArea`: the style of axis split area [AxisSplitArea](#AxisSplitArea).
## `Background`
Background component.Due to the limitations of the framework, there are two limitations to the use of background component:
1: The parent node of chart cannot have a layout control class component.
2: The parent node of Chart can only have one child node of the current chart.
* `show`: Whether to enable the background component. However, the ability to activate the background component is subject to other conditions.
* `image`: the image of background.
* `imageType`: the fill type of background image.
* `imageColor`: the color of background image, The default is `white`.
* `hideThemeBackgroundColor`: Whether to hide the background color set in the `theme` when the background component is on.
## `YAxis`
The y axis in cartesian(rectangular) coordinate. a grid component can place at most 2 y axis, one on the left and another on the right.
The parameters are the same as XAxis.
## `Series`
Serie list. Each serie determines its own chart type by `type`.
Check each serie for parameters.
## `Serie-Line`
Line chart serie.
* `show`: Whether to show serie in chart.
* `type`: `Line`.
* `name`: Series name used for displaying in tooltip and filtering with legend.
* `stack`: If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
* `axisIndex`: Index of axis to combine with, which is useful for multiple x axes in one chart.
* `minShow`: The min number of data to show in chart.
* `maxShow`: The max number of data to show in chart.
* `maxCache`: The max number of serie data cache. The first data will be remove when the size of serie data is larger then maxCache.
* `sampleDist`: The minimum horizontal pixel distance of sampling, which defaults to `0` without sampling. When the horizontal pixel distance between two data points is less than this value, start sampling to ensure that the horizontal pixel distance between two points is not less than this value.
* `sampleType`: Sample type. This is valid when `sampleDist` is greater than `0`. The following five sampling types are supported:
* `Peak`: Take a peak. When the average value of the filter point is greater than or equal to `sampleAverage`, take the maximum value; If you do it the other way around, you get the minimum.
* `Average`: Take the average of the filter points.
* `Max`: Take the maximum value of the filter point.
* `Min`: Take the minimum value of the filter point.
* `Sum`: Take the sum of the filter points.
* `sampleAverage`: Set the sampling average. When `sampleType` is `Peak`, is the maximum or minimum value used to compare the average value of the filtered data. The default of `0` is to calculate the average of all data in real time.
* `clip`: 是否裁剪超出坐标系部分的图形。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`: 忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `showAsPositiveNumber`: 将负数数值显示为正数。一般和`AxisLabel``showAsPositiveNumber`配合使用。仅在折线图和柱状图中有效。
* `large`: 是否开启大数据量优化,在数据图形特别多而出现卡顿时候可以开启。开启后配合 largeThreshold 在数据量大于指定阈值的时候对绘制进行优化。缺点: 优化后不能自定义设置单个数据项的样式不能显示Label折线图不绘制Symbol。
* `largeThreshold`: 开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。
* `areaStyle`: 区域填充样式 [AreaStyle](#AreaStyle)。
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `lineType`: 折线图样式类型。支持以下十种类型:
* `Normal`: 普通折线图。
* `Smooth`: 平滑曲线。
* `SmoothDash`: 平滑虚线。
* `StepStart`: 阶梯线图: 当前点。
* `StepMiddle`: 阶梯线图: 当前点和下一个点的中间。
* `StepEnd`: 阶梯线图: 下一个拐点。
* `Dash`: 虚线。
* `Dot`: 点线。
* `DashDot`: 点划线。
* `DashDotDot`: 双点划线。
* `lineStyle`: 线条样式 [LineStyle](#LineStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `lineArrow`: 折线图的箭头 [LineArrow](#LineArrow)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Bar`
折线图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Bar`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `stack`: 数据堆叠。同个类目轴上系列配置相同的 `stack` 值后,后一个系列的值会在前一个系列的值上相加。
* `axisIndex`: 使用的坐标轴轴的 `index`,在单个图表实例中存在多个坐标轴轴的时候有用。
* `minShow`: 系列显示数据的最小索引。
* `maxShow`: 系列显示数据的最大索引。
* `maxCache`: 系列中可缓存的最大数据量。默认为`0`没有限制大于0时超过指定值会移除旧数据再插入新数据。
* `barType`: 柱状图类型。以下几种类型:
* `Normal`: 普通柱状图。
* `Zebra`: 斑马柱状图。
* `Capsule`: 胶囊柱状图。
* `barPercentStack`: 是否百分比堆叠柱状图,相同 `stack``serie` 只要有一个 `barPercentStack``true`,则就显示成百分比堆叠柱状图。
* `barWidth`: 柱条的宽度,不设时自适应。支持设置成相对于类目宽度的百分比。
* `barGap`: 不同系列的柱间距离。为百分比(如 `'0.3f'`,表示柱子宽度的 `30%`)。如果想要两个系列的柱子重叠,可以设置 `barGap``'-1f'`。这在用柱子做背景的时候有用。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barCategoryGap`: 同一系列的柱间距离默认为类目间距的20%,可设固定值。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barZebraWidth`: 斑马线的粗细。`barType``Zebra` 时有效。
* `barZebraGap`: 斑马线的间距。`barType``Zebra` 时有效。
* `clip`: 是否裁剪超出坐标系部分的图形。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`: 忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `showAsPositiveNumber`: 将负数数值显示为正数。一般和`AxisLabel``showAsPositiveNumber`配合使用。仅在折线图和柱状图中有效。
* `large`: 是否开启大数据量优化,在数据图形特别多而出现卡顿时候可以开启。开启后配合 largeThreshold 在数据量大于指定阈值的时候对绘制进行优化。缺点: 优化后不能自定义设置单个数据项的样式不能显示Label折线图不绘制Symbol。
* `largeThreshold`: 开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `itemStyle`: 柱条样式 [ItemStyle](#ItemStyle)。
* `areaStyle`: 区域填充样式 [AreaStyle](#AreaStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Pie`
饼图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Pie`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `pieRoseType`: 南丁格尔玫瑰图类型,支持以下类型:
* `None`: 不展示成南丁格尔玫瑰图。
* `Radius`: 扇区圆心角展现数据的百分比,半径展现数据的大小。
* `Area`: 所有扇区圆心角相同,仅通过半径展现数据大小。
* `space`: 扇区间隙。
* `center`: 中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`: 半径。`radius[0]`为内径,`radius[1]`为外径。当内径大于0时即为圆环图。
* `roundCap`: 是否启用圆弧效果。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制,对应的`Label``Legend`也不会显示。
* `ignoreValue`: 忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `avoidLabelOverlap`: 在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Radar`
雷达图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Radar`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `radarType`: 雷达图类型`RadarType`,支持以下类型:
* `Multiple`: 多圈雷达图。此时可一个雷达里绘制多个圈,一个`serieData`就可组成一个圈(多维数据)。
* `Single`: 单圈雷达图。此时一个雷达只能绘制一个圈,多个`serieData`组成一个圈,数据取自`data[1]`
* `radarIndex`: 雷达图所使用的 `radar` 组件的 `index`
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `lineStyle`: 线条样式 [LineStyle](#LineStyle)。
* `itemStyle`: 标记样式 [ItemStyle](#ItemStyle)。
* `areaStyle`: 区域填充样式 [AreaStyle](#AreaStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Scatter`
散点图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Scatter`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `clip`: 是否裁剪超出坐标系部分的图形。
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Heatmap`
热力图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Scatter`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`: 忽略数据的默认值。默认值默认为`0`,当 `ignore``true` 才有效。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Gauge`
仪表盘系列。
* `show`: 系列是否显示在图表上。
* `type`: `Gauge`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `gaugeType`: 仪表盘类型,支持以下类型:
* `Pointer`: 指针类型。
* `ProgressBar`: 进度条类型。
* `center`: 中心点坐标。当值为0-1的浮点数时表示百分比。
* `radius`: 仪表盘半径。
* `min`: 最小的数据值。映射到`startAngle`
* `max`: 最大的数据值。映射到`endAngle`
* `startAngle`: 仪表盘起始角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `endAngle`: 仪表盘结束角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `splitNumber`: 仪表盘刻度分割段数。
* `roundCap`: 是否启用圆弧效果。
* `titleStyle`: 仪表盘标题 [TitleStyle](#TitleStyle)。
* `gaugeAxis`: 仪表盘坐标轴 [GaugeAxis](#GaugeAxis)。
* `gaugePointer`: 仪表盘指针 [GaugePointer](#GaugePointer)。
* `itemStyle`: 仪表盘指针样式 [ItemStyle](#ItemStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。仪表盘的数据一般只有一个,值通过`label`样式显示,`name`通过`titleStyle`样式显示。
## `Serie-Ring`
环形图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Ring`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `center`: 中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`: 仪表盘半径。
* `startAngle`: 仪表盘起始角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `ringGap`: 环形图的环间隙。
* `roundCap`: 是否启用圆弧效果。
* `clockwise`: 是否顺时针,默认为`true`
* `titleStyle`: 环形图中心标题 [TitleStyle](#TitleStyle)。
* `itemStyle`: 环形图的圆环样式,包括设置背景颜色和边框等 [ItemStyle](#ItemStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。环形图的数据只有二维,`data[0]`表示当前值,`data[1]`表示最大值。
## `Serie-Liquid`
水位图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Liquid`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `vesselIndex`: 水位图所使用的`vessel`组件的`index`
* `min`: 最小值。
* `max`: 最大值。
* `waveLength`: 水波长。
* `waveHeight`: 水波高。
* `waveSpeed`: 水波移动速度。正数时左移,负数时右移。
* `waveOffset`: 水波偏移。
* `itemStyle`: 环形图的圆环样式,包括设置背景颜色和边框等 [ItemStyle](#ItemStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。水位图的数据一般只有一个,表示当前水位值,用`max`设置最大水位值。
## `Settings`
全局参数设置组件。一般情况下可使用默认值,当有需要时可进行调整。
* `lineSmoothStyle`: 曲线平滑系数。通过调整平滑系数可以改变曲线的曲率,得到外观稍微有变化的不同曲线。
* `lineSmoothness`: 曲线平滑度。值越小曲线越平滑,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
* `lineSegmentDistance`: 线段的分割距离。普通折线图的线是由很多线段组成,段数由该数值决定。值越小段数越多,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
* `cicleSmoothness`: 圆形(包括扇形、环形等)的平滑度。数越小圆越平滑,但顶点数也会随之增加。
## `SerieAnimation`
* `enable`: 是否开启动画系统。
* ~~`threshold`: 是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。~~
* `fadeInDelay`: 设定的渐入动画延时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制: `customFadeInDelay`
* `fadeInDuration`: 设定的渐入动画时长,单位毫秒。如果要设置单个数据项的渐入时长,可以用代码定制: `customFadeInDuration`
* `fadeOutDelay`: 设定的渐出动画延时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制: `customFadeOutDelay`
* `fadeOutDuration`: 设定的渐出动画时长,单位毫秒。如果要设置单个数据项的渐出时长,可以用代码定制: `customFadeOutDuration`
* `dataChangeEnable`: 是否开启数据变更动画。
* `dataChangeDuration`: 数据变更动画时长,单位毫秒。
## `AreaStyle`
* `show`: 是否显示区域填充。
* `origin`: 区域填充的起始位置 `AreaOrigin`。有以下三种填充方式:
* `Auto`: 填充坐标轴轴线到数据间的区域。
* `Start`: 填充坐标轴底部到数据间的区域。
* `End`: 填充坐标轴顶部到数据间的区域。
* `color`: 区域填充的颜色,默认取 `serie` 对应的颜色。如果 `toColor` 不是默认值,则表示渐变色的起点颜色。
* `toColor`: 区域填充的渐变色的终点颜色。
* `highlightColor`: 高亮时区域填充的颜色,默认取 `serie` 对应的颜色。如果 `highlightToColor` 不是默认值,则表示渐变色的起点颜色。
* `highlightToColor`: 高亮时区域填充的渐变色的终点颜色。
* `opacity`: 图形透明度。支持从 `0``1` 的数字,为 `0` 时不绘制该图形。
* `tooltipHighlight`: 鼠标悬浮时是否高亮之前的区域。
## `AxisLabel`
* `show`: 是否显示刻度标签。
* `interval`: 坐标轴刻度标签的显示间隔,在类目轴中有效。`0`表示显示所有标签,`1`表示隔一个隔显示一个标签,以此类推。
* `inside`: 刻度标签是否朝内,默认朝外。
* `rotate`: 刻度标签旋转的角度,在类目轴的类目标签显示不下的时候可以通过旋转防止标签之间重叠。
* `margin`: 刻度标签与轴线之间的距离。
* `color`: 刻度标签文字的颜色,默认取主题`Theme``axisTextColor`
* `fontSize`: 文字的字体大小。
* `fontStyle`: 文字字体的风格。
* `formatter`: 图例内容字符串模版格式器。支持用 `\n` 换行。模板变量为图例名称 `{value}`,数值格式化通过`numericFormatter`
* `numericFormatter`: 标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式: `A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `showAsPositiveNumber`: 将负数数值显示为正数。一般和`Serie``showAsPositiveNumber`配合使用。
* `onZero`: 刻度标签显示在`0`刻度上。
* `textLimit`: 文本自适应 [TextLimit](#TextLimit)。只在类目轴中有效。
## `AxisLine`
* `show`: 是否显示坐标轴轴线。
* `onZero`: `X` 轴或者 `Y` 轴的轴线是否在另一个轴的 `0` 刻度上,只有在另一个轴为数值轴且包含 `0` 刻度时有效。
* `width`: 坐标轴线线宽。
* `symbol`: 是否显示箭头。
* `symbolWidth`: 箭头宽。
* `symbolHeight`: 箭头高。
* `symbolOffset`: 箭头偏移。
* `symbolDent`: 箭头的凹陷程度。
## `AxisName`
* `show`: 是否显示坐标名称。
* `name`: 坐标轴名称。
* `location`: 坐标轴名称的位置。支持以下类型:
* `Start`: 坐标轴起始处。
* `Middle`: 坐标轴中间。
* `End`: 坐标轴末端。
* `offset`: 坐标轴名称与轴线之间的偏移。
* `rotate`: 坐标轴名字旋转,角度值。
* `color`: 坐标轴名称的文字颜色。
* `fontSize`: 坐标轴名称的文字大小。
* `fontStyle`: 坐标轴名称的文字风格。
## `AxisSplitLine`
* `show`: 是否显示坐标分割线。
* `interval`: 分割线的显示间隔。`0` 表示显示所有分割线,`1` 表示隔一个隔显示一个分割线,以此类推。
* `lineStyle`: 线条样式 [LineStyle](#LineStyle)。
## `AxisSplitArea`
* `show`: 是否显示坐标分割区域。
* `color`: 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
## `AxisTick`
* `show`: 是否显示坐标轴刻度。
* `alignWithLabel`: 类目轴中在 `boundaryGap``true` 的时候有效,可以保证刻度线和标签对齐。
* `inside`: 坐标轴刻度是否朝内,默认朝外。
* `length`: 坐标轴刻度的长度。
* `width`: 坐标轴刻度的宽度。默认为0时宽度和坐标轴一致。
## `Emphasis`
* `show`: 是否启用高亮样式。
* `label`: 图形文本标签样式 [SerieLabel](#SerieLabel)。
* `itemStyle`: 图形样式 [ItemStyle](#ItemStyle)。
## `ItemStyle`
* `show`: 是否启用。
* `color`: 颜色。
* `toColor`gradient color1.
* `toColor2`gradient color2.
* `backgroundColor`: 背景颜色。
* `backgroundWidth`: 背景的宽。
* `centerColor`: 中心区域的颜色。如环形图的中心区域。
* `centerGap`: 中心区域的间隙。如环形图的中心区域于最内环的间隙。
* `borderType`: 边框的类型。
* `borderColor`: 边框的颜色。
* `borderWidth`: 边框宽。
* `opacity`: 透明度。
* `tooltipFormatter`: 提示框单项的字符串模版格式器。具体配置参考`Tooltip``formatter`
* `numericFormatter`: 标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式: `A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`。此字段优先于`SerieLabel``Tooltip``numericFormatter`
* `cornerRadius`: 圆角半径。用数组分别指定4个圆角半径顺时针左上右上右下左下。支持用0-1的浮点数设置百分比。
## `LineArrow`
* `show`: 是否显示箭头。
* `position`: 箭头显示位置。支持以下两种位置:
* `End`: 末端显示。最后一个数据上显示箭头。
* `Start`: 起始端显示。第一个数据上显示箭头。
* `width`: 箭头宽。
* `height`: 箭头长。
* `offset`: 箭头偏移。默认箭头的中心点和数据坐标点一致,可通过 `offset` 调整偏移。
* `dent`: 箭头的凹度。
## `LineStyle`
* `show`: 是否显示线条。当作为子组件,它的父组件有参数控制是否显示时,改参数无效。
* `type`: 线条类型。支持以下五种类型:
* `None`: 不显示分割线。
* `Solid`: 实线。
* `Dashed`: 虚线。
* `Dotted`: 点线。
* `DashDot`: 点划线。
* `DashDotDot`: 双点划线。
* `color`: 线条颜色。默认和 `serie` 一致。
* `toColor`:线的渐变颜色(需要水平方向渐变时)。
* `toColor2`线的渐变颜色2需要水平方向三个渐变色的渐变时
* `width`: 线条宽。
* `opacity`: 线条的透明度。支持从 `0``1` 的数字,为 `0` 时不绘制该图形。
## `Location`
* `align`: 对齐方式。有以下对齐方式。
* `TopLeft`: 左上角对齐。
* `TopRight`: 右上角对齐。
* `TopCenter`: 置顶居中对齐。
* `BottomLeft`: 左下对齐。
* `BottomRight`: 右下对齐。
* `BottomCenter`: 底部居中对齐。
* `Center`: 居中对齐。
* `CenterLeft`: 中部靠左对齐。
* `CenterRight`: 中部靠右对齐。
* `left`: 离容器左侧的距离。
* `right`: 离容器右侧的距离。
* `top`: 离容器上侧的距离。
* `bottom`: 离容器下侧的距离。
## `SerieData`
* `name`: 数据项名称。
* `selected`: 该数据项是否被选中。
* `radius`: 自定义半径。可用在饼图中自定义某个数据项的半径。
* `iconStyle`: 数据项图标样式。
* `enableLabel`: 是否启用单个数据项的标签设置。
* `label`: 单个数据项的标签设置。
* `enableItemStyle`: 是否启用单个数据项的样式。
* `itemStyle`: 单个数据项的样式设置。
* `enableEmphasis`: 是否启用单个数据项的高亮样式。
* `emphasis`: 单个数据项的高亮样式设置。
* `enableSymbol`: 是否启用单个数据项的标记设置。
* `symbol`: 单个数据项的标记设置。
* `data`: 可指定任意维数的数值列表。对于折线图和柱状图,`data`其实是`size``2`的数组,`data[0]`是x的编号`data[1]``y`的数值,默认显示`data[1]`。其他图表看需求而定是长度大于`2`的数组。可通过`Serie``showDataDimension`指定数据长度。
## `SerieLabel`
* `show`: 是否显示文本标签。
* `position`: 标签的位置。折线图时强制默认为 `Center`,支持以下 `5` 种位置:
* `Outside`: 饼图扇区外侧,通过视觉引导线连到相应的扇区。只在饼图种可用。
* `Inside`: 饼图扇区内部。只在饼图可用。
* `Center`: 在中心位置(折线图,柱状图,饼图)。
* `Top`: 顶部(柱状图)。
* `Bottom`: 底部(柱状图)。
* `formatter`: 标签内容字符串模版格式器。支持用 `\n` 换行。模板变量有: `{a}`: 系列名;`{b}`: 数据名;`{c}`: 数据值;`{d}`: 百分比。示例: `{b}:{c}`
* `numericFormatter`: 标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式: `A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `offset`: 距离图形元素的偏移。
* `autoOffset`: 是否开启自动偏移。当开启时Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。
* `color`: 自定义文字颜色,默认和系列的颜色一致。
* `backgroundColor`: 标签的背景色,默认无颜色。
* `backgroundWidth`: 标签的背景宽度。一般不用指定,不指定时则自动是文字的宽度。
* `backgroundHeight`: 标签的背景高度。一般不用指定,不指定时则自动是文字的高度。
* `rotate`: 标签的旋转。
* `paddingLeftRight`: 标签文字和边框的左右边距。
* `paddingTopBottom`: 标签文字和边框的上下边距。
* `fontSize`: 标签文字的字体大小。
* `fontStyle`: 标签文字的字体风格。
* `line`: 是否显示视觉引导线。在 `label` 位置 设置为 `'Outside'` 的时候会显示视觉引导线。
* `lineType`: 视觉引导线类型。支持以下几种类型:
* `BrokenLine`: 折线。
* `Curves`: 曲线。
* `HorizontalLine`: 水平线。
* `lineColor`: 视觉引导线自定义颜色。
* `lineWidth`: 视觉引导线的宽度。
* `lineLength1`: 视觉引导线第一段的长度。
* `lineLength2`: 视觉引导线第二段的长度。
* `border`: 是否显示边框。
* `borderWidth`: 边框宽度。
* `borderColor`: 边框颜色。
## `SerieSymbol`
* `show`: 是否显示标记。
* `type`: 标记类型。支持以下六种类型:
* `EmptyCircle`: 空心圆。
* `Circle`: 实心圆。
* `Rect`: 正方形。可通过设置`itemStyle``cornerRadius`变成圆角矩形。
* `Triangle`: 三角形。
* `Diamond`: 菱形。
* `None`: 不显示标记。
* `gap`: 图形标记的外留白距离。
* `sizeType`: 标记图形的大小获取方式。支持以下三种类型:
* `Custom`: 自定义大小。
* `FromData`: 通过 `dataIndex` 从数据中获取,再乘以一个比例系数 `dataScale`
* `Callback`: 通过回调函数 `sizeCallback` 获取。
* `size`: 标记的大小。
* `selectedSize`: 被选中的标记的大小。
* `dataIndex`: 当 `sizeType` 指定为 `FromData` 时,指定的数据源索引。
* `dataScale`: 当 `sizeType` 指定为 `FromData` 时,指定的倍数系数。
* `selectedDataScale`: 当 `sizeType` 指定为 `FromData` 时,指定的高亮倍数系数。
* `sizeCallback`: 当 `sizeType` 指定为 `Callback` 时,指定的回调函数。
* `selectedSizeCallback`: 当 `sizeType` 指定为 `Callback` 时,指定的高亮回调函数。
* `color`: 标记图形的颜色,默认和系列一致。
* `opacity`: 图形标记的透明度。
* `startIndex`: 开始显示图形标记的索引。
* `interval`: 显示图形标记的间隔。`0`表示显示所有标签,`1`表示隔一个隔显示一个标签,以此类推。
* `forceShowLast`: 是否强制显示最后一个图形标记。默认为 `false`
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XChartsAPI接口](XChartsAPI.md)
[XCharts问答](XCharts问答.md)

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9a4780a4fbaf446cc9d948b6b2c803d6
guid: 3fa7a80a30cd846139159beaadba05f2
TextScriptImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,161 @@
# XCharts Q&A
[XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts API](xcharts-api-EN.md)
[XCharts Configuration](xcharts-configuration-EN.md)
[QA 1: How to adjust the margin between the axis and the background?](#How-to-adjust-the-margin-between-the-axis-and-the=-background)
[QA 2: How to play agian the fadeIn animation?](#How-to-play-agian-the-fadeIn-animation)
[QA 3: How to customize the color of data item in line chart and pie chart?](#How-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
[QA 4: How to formatter the text of axis label, such as add a units text?](#How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
[QA 5: How to stack the bar of bar chart](#How-to-stack-the-bar-of-bar-chart)
[QA 6: How to make the bar serie in the same bar but not stack?](#How-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
[QA 7: How to adjust the bar width and gap of barchart?](#How-to-adjust-the-bar-width-and-gap-of-barchart)
[QA 8: How to adjust the color of bar?](#How-to-adjust-the-color-of-bar)
[QA 9: Can I adjust the anchor of chart?](#Can-I-adjust-the-anchor-of-chart)
[QA 10: Can display more than 1000 data?](#Can-display-more-than-1000-data)
[QA 11: Can line chart drawing be dash, dot and dash-dot?](#Can-line-chart-drawing-be-dash-dot-and-dash-dot)
[QA 12: How to limit the value range of the Y-axis?](#How-to-limit-the-value-range-of-the-Y-axis)
[QA 13: How to customize the tick value range of value axis?](#How-to-customize-the-tick-value-range-of-value-axis)
[QA 14: How to display text at the top of data items?](#How-to-display-text-at-the-top-of-data-items)
[QA 15: How do I customize icons for data items?](#How-do-I-customize-icons-for-data-items)
[QA 16: How to anti-aliasing and make the chart smoother?](#How-to-anti-aliasing-and-make-the-chart-smoother)
[QA 17: Why does mouse over chart Tooltip not show?](#Why-does-mouse-over-chart-Tooltip-not-show)
[QA 18: How not to display the bar line of Tooltip?](#How-not-to-display-the-bar-line-of-Tooltip)
[QA 19: How do I customize the display of Tooltip?](#How-do-I-customize-the-display-of-Tooltip)
[QA 20: How do I get the Y-axis to display multiple decimal places?](#How-do-I-get-the-Y-axis-to-display-multiple-decimal-places)
[QA 21: How do I dynamically update data with code?](#How-do-I-dynamically-update-data-with-code)
[QA 22: How to display legend? Why are legends sometimes not displayed?](#How-to-display-legend?Why-are-legends-sometimes-not-displayed)
[QA 23: How to make chart as prefab?](#How-to-make-chart-as-prefab)
[QA 24: How do I draw custom graphic in chart,such as line or dot?](#How-do-I-draw-custom-content-in-chart-such-as-line-or-dot)
[QA 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram)
[QA 26: How do I use the background component? What are the conditions?](#How-do-I-use-the-background-component-What-are-the-conditions)
[QA 27: Mesh can not have more than 65000 vertices?](#Mesh-cannot-have-more-than-65000-vertices)
[QA 28: Why are the parameters set in Serie reset after they run?](#Why-are-the-parameters-set-in-Serie-reset-after-they-run)
[QA 29: Why are many custom colors lost after upgrading to 1.6.0? How should I upgrade?](#Why_are_many_custom_colors_lost_after_upgrading_to_1_6_0_How_should_I_upgrade)
## How-to-adjust-the-margin-between-the-axis-and-the=-background
A: `Grid` conponentwhich can adjust the left, right, up, down margins of chart.
## How-to-play-agian-the-fadeIn-animation
A: call the `chart.AnimationReset()` API.
## How-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
A: `Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
## How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
A: Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
## How-to-stack-the-bar-of-bar-chart
A: Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
## How-to-make-the-bar-serie-in-the-same-bar-but-not-stack
A: Set the `barGap` of `Serie` to `-1``stack` to null.
## How-to-adjust-the-bar-width-and-gap-of-barchart
A: Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
## How-to-adjust-the-color-of-bar
A: Adjust the `ItemStyle` of `Data` in `inspector`.
## Can-I-adjust-the-anchor-of-chart
A: Yes, you can set any one of 16 anchors but the value use default.
## Can-display-more-than-1000-data
A: Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
## Can-line-chart-drawing-be-dash-dot-and-dash-dot
A: Yes. Adjust the `lineType` of `Serie`.
## How-to-limit-the-value-range-of-the-Y-axis
A: Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
## How-to-customize-the-tick-value-range-of-value-axis
A: By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
## How-to-display-text-at-the-top-of-data-items
A: Adjust the `Label` of `Serie`.
## How-do-I-customize-icons-for-data-items
A: Set the `Icon` of `Data` in `Serie`.
## How-to-anti-aliasing-and-make-the-chart-smoother
A: Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
## Why-does-mouse-over-chart-Tooltip-not-show
A: Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
## How-not-to-display-the-bar-line-of-Tooltip
A: Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
## How-do-I-customize-the-display-of-Tooltip
A: See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
## How-do-I-get-the-Y-axis-to-display-multiple-decimal-places
A: Set the `numericFormatter` parameter of `AxisLabel`.
## How-do-I-dynamically-update-data-with-code
A: See example: `Example01_UpdateData.cs`
## How-to-display-legend?Why-are-legends-sometimes-not-displayed
A: First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
## How-to-make-chart-as-prefab
A: Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
## How-do-I-draw-custom-content-in-chart-such-as-line-or-dot
A: Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
## How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram
A: See `Example_Dynamic.cs`.
## How-do-I-use-the-background-component-What-are-the-conditions
A: Setting `show` to `true` for the `background` component does not necessarily activate the background component. Due to the limitations of the XCharts's framework, there are two prerequisites for the background component: first, the parent node of the chart cannot be controlled by layout, because the node relationship between the background component and the chart is parallel, and the location of the background component cannot be controlled by layout. Second, the parent node of the chart can only have one child node of the chart itself, which is convenient to manage the background component node needs, otherwise the reason of parallel relationship, easy to confuse. In addition, it is best to hide the `background` component when adjusting the chart hierarchy, which automatically removes the associated background component nodes.
## Mesh-cannot-have-more-than-65000-vertices
A: This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [QA 10: Can display more than 1000 data](#Can-display-more-than-1000-data)
## Why-are-the-parameters-set-in-Serie-reset-after-they-run
A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
## 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.
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).
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).
[XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts API](xcharts-api-EN.md)
[XCharts Configuration](xcharts-configuration-EN.md)

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 81071e0166b9e49958800af4678e69ae
guid: ca54a17a3a60f4b36b0be43df9f1c33d
TextScriptImporter:
externalObjects: {}
userData:

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 5acea6fd06c0e9c498c434f941e4cba9
timeCreated: 1554219116
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -116,6 +116,10 @@ namespace XCharts
private void CheckWarning()
{
if (GUILayout.Button("Remove All Chart Object"))
{
m_Target.RemoveChartObject();
}
if (GUILayout.Button("Check XCharts Update "))
{
CheckVersionEditor.ShowWindow();
@@ -138,7 +142,7 @@ namespace XCharts
if (!string.IsNullOrEmpty(m_Target.warningInfo))
{
sb.AppendLine();
sb.Append(XChartsMgr.Instance.nowVersion);
sb.Append(m_Target.warningInfo);
}
else
{

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: d7f1cff1e5bae244a872040086b1cfa8
timeCreated: 1554217495
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -15,7 +15,7 @@ namespace XCharts
private Vector2 scrollPos;
private static CheckVersionEditor window;
[MenuItem("Component/XCharts/Check For Update")]
[MenuItem("XCharts/Check For Update")]
public static void ShowWindow()
{
window = GetWindow<CheckVersionEditor>();

View File

@@ -43,7 +43,7 @@ namespace XCharts
{
EditorGUILayout.PropertyField(m_DataZoom);
}
if (m_Target is HeatmapChart)
if (m_Target is HeatmapChart || m_Target is LineChart)
{
EditorGUILayout.PropertyField(m_VisualMap);
}

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 1dd7acd8b13f3f14e9891af4e8dd0b0b
timeCreated: 1554475249
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 6bd1a238bc5b407408b8f902aa3db9fd
timeCreated: 1554539035
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,34 @@
/******************************************/
/* */
/* 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
{
protected SerializedProperty m_Vessels;
protected override void OnEnable()
{
base.OnEnable();
m_Target = (LiquidChart)target;
m_Vessels = serializedObject.FindProperty("m_Vessels");
}
protected override void OnStartInspectorGUI()
{
base.OnStartInspectorGUI();
EditorGUILayout.PropertyField(m_Vessels, true);
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e78d1b28fc61d4b1b995a1eca16cf3b6
guid: 307a1578a6be1403c98fdc27d99d1808
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 28de30021bed0f945af09633584fcb44
timeCreated: 1554768152
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,40 @@
/******************************************/
/* */
/* Copyright (c) 2018 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_Polar;
protected SerializedProperty m_RadiusAxis;
protected SerializedProperty m_AngleAxis;
protected override void OnEnable()
{
base.OnEnable();
m_Target = (PolarChart)target;
m_Polar = serializedObject.FindProperty("m_Polar");
m_RadiusAxis = serializedObject.FindProperty("m_RadiusAxis");
m_AngleAxis = serializedObject.FindProperty("m_AngleAxis");
}
protected override void OnStartInspectorGUI()
{
base.OnStartInspectorGUI();
EditorGUILayout.PropertyField(m_Polar, true);
EditorGUILayout.PropertyField(m_RadiusAxis, true);
EditorGUILayout.PropertyField(m_AngleAxis, true);
}
}
}

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,8 +1,6 @@
fileFormatVersion: 2
guid: 0ad1e8940e4805b49a18ea7a2cbd4bce
folderAsset: yes
timeCreated: 1554304641
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,40 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(AngleAxis), true)]
public class AngleAxisDrawer : AxisDrawer
{
protected override void DrawExtended(ref Rect drawRect, SerializedProperty prop)
{
SerializedProperty m_StartAngle = prop.FindPropertyRelative("m_StartAngle");
SerializedProperty m_Clockwise = prop.FindPropertyRelative("m_Clockwise");
EditorGUI.PropertyField(drawRect, m_StartAngle);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Clockwise);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected override string GetDisplayName(string displayName)
{
if (displayName.StartsWith("Element"))
{
displayName = displayName.Replace("Element", "Angle Axis");
}
return displayName;
}
protected override float GetExtendedHeight()
{
return 2 * EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
}
}

View File

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

View File

@@ -28,8 +28,9 @@ namespace XCharts
SerializedProperty m_DataChangeEnable = prop.FindPropertyRelative("m_DataChangeEnable");
SerializedProperty m_DataChangeDuration = prop.FindPropertyRelative("m_DataChangeDuration");
SerializedProperty m_FadeInDelay = prop.FindPropertyRelative("m_FadeInDelay");
SerializedProperty m_Threshold = prop.FindPropertyRelative("m_Threshold");
//SerializedProperty m_Threshold = prop.FindPropertyRelative("m_Threshold");
SerializedProperty m_ActualDuration = prop.FindPropertyRelative("m_ActualDuration");
SerializedProperty m_FadeOutDelay = prop.FindPropertyRelative("m_FadeOutDelay");
// SerializedProperty m_CurrDetailProgress = prop.FindPropertyRelative("m_CurrDetailProgress");
// SerializedProperty m_DestDetailProgress = prop.FindPropertyRelative("m_DestDetailProgress");
@@ -40,15 +41,18 @@ namespace XCharts
++EditorGUI.indentLevel;
//EditorGUI.PropertyField(drawRect, m_Easting);
//drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Threshold);
if (m_Threshold.intValue < 0) m_Threshold.intValue = 0;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// EditorGUI.PropertyField(drawRect, m_Threshold);
// if (m_Threshold.intValue < 0) m_Threshold.intValue = 0;
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_FadeInDelay);
if (m_FadeInDelay.floatValue < 0) m_FadeInDelay.floatValue = 0;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_FadeInDuration);
if (m_FadeInDuration.floatValue < 0) m_FadeInDuration.floatValue = 0;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_FadeOutDelay);
if (m_FadeOutDelay.floatValue < 0) m_FadeOutDelay.floatValue = 0;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_FadeOutDuration);
if (m_FadeOutDuration.floatValue < 0) m_FadeOutDuration.floatValue = 0;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

View File

@@ -66,7 +66,13 @@ namespace XCharts
{
EditorGUI.PropertyField(drawRect, m_LogBaseE);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.BeginChangeCheck();
EditorGUI.PropertyField(drawRect, m_LogBase);
if (m_LogBase.floatValue <= 0 || m_LogBase.floatValue == 1)
{
m_LogBase.floatValue = 10;
}
EditorGUI.EndChangeCheck();
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
if (type == Axis.AxisType.Value)
@@ -96,10 +102,17 @@ namespace XCharts
}
EditorGUI.PropertyField(drawRect, m_SplitNumber);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Interval);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BoundaryGap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (type == Axis.AxisType.Category)
{
EditorGUI.PropertyField(drawRect, m_BoundaryGap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
else
{
EditorGUI.PropertyField(drawRect, m_Interval);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
DrawExtended(ref drawRect, prop);
EditorGUI.PropertyField(drawRect, m_AxisLine);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLine);
@@ -133,6 +146,11 @@ namespace XCharts
}
}
protected virtual void DrawExtended(ref Rect drawRect, SerializedProperty prop)
{
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
int index = InitToggle(prop);
@@ -164,7 +182,7 @@ namespace XCharts
}
else
{
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
height += 0 * EditorGUIUtility.singleLineHeight + 0 * EditorGUIUtility.standardVerticalSpacing;
}
if (m_ShowJsonDataArea)
{
@@ -173,7 +191,7 @@ namespace XCharts
}
else if (type == Axis.AxisType.Value)
{
height += 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
height += 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
if (m_MinMaxType.enumValueIndex == (int)Axis.AxisMinMaxType.Custom)
{
@@ -182,7 +200,7 @@ namespace XCharts
}
else if (type == Axis.AxisType.Log)
{
height += 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
if (m_MinMaxType.enumValueIndex == (int)Axis.AxisMinMaxType.Custom)
{
@@ -195,10 +213,16 @@ namespace XCharts
height += EditorGUI.GetPropertyHeight(m_AxisLabel);
height += EditorGUI.GetPropertyHeight(m_SplitArea);
height += EditorGUI.GetPropertyHeight(m_SplitLine);
height += GetExtendedHeight();
return height;
}
}
protected virtual float GetExtendedHeight()
{
return 0;
}
private int InitToggle(SerializedProperty prop)
{
int index = 0;

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: d0544f1db7f17644bb3cbe7c85da84d5
timeCreated: 1554507809
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 7c7d45bc59dedc140b08f6e9d26ccd9d
timeCreated: 1555890921
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: cba26e421f79077499f05aaf10d06b4f
timeCreated: 1559609801
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -25,6 +25,7 @@ namespace XCharts
SerializedProperty show = prop.FindPropertyRelative("m_Show");
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
SerializedProperty m_ToColor = prop.FindPropertyRelative("m_ToColor");
SerializedProperty m_ToColor2 = prop.FindPropertyRelative("m_ToColor2");
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
SerializedProperty m_BackgroundWidth = prop.FindPropertyRelative("m_BackgroundWidth");
SerializedProperty m_CenterColor = prop.FindPropertyRelative("m_CenterColor");
@@ -45,6 +46,8 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ToColor);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ToColor2);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BackgroundWidth);
@@ -80,7 +83,7 @@ namespace XCharts
float height = 0;
if (ChartEditorHelper.IsToggle(m_ItemStyleToggle, prop))
{
height += 14 * EditorGUIUtility.singleLineHeight + 13 * EditorGUIUtility.standardVerticalSpacing;
height += 15 * EditorGUIUtility.singleLineHeight + 14 * EditorGUIUtility.standardVerticalSpacing;
var m_CornerRadius = prop.FindPropertyRelative("m_CornerRadius");
if (ChartEditorHelper.IsToggle(m_CornerRadiusToggle, m_CornerRadius))
{

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: b96d10541649a23468168ba0bf1c0bc5
timeCreated: 1554395454
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -23,6 +23,8 @@ namespace XCharts
SerializedProperty show = prop.FindPropertyRelative("m_Show");
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
SerializedProperty m_ToColor = prop.FindPropertyRelative("m_ToColor");
SerializedProperty m_ToColor2 = prop.FindPropertyRelative("m_ToColor2");
SerializedProperty m_Width = prop.FindPropertyRelative("m_Width");
SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LineStyleToggle, prop, "Line Style", show, false);
@@ -34,6 +36,10 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Color);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ToColor);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ToColor2);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Width);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Opacity);
@@ -47,7 +53,7 @@ namespace XCharts
float height = 0;
if (ChartEditorHelper.IsToggle(m_LineStyleToggle, prop))
{
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
}
else
{

View File

@@ -25,69 +25,78 @@ namespace XCharts
EditorGUI.PropertyField(drawRect, align, new GUIContent("Location"));
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
++EditorGUI.indentLevel;
switch ((Location.Align)align.enumValueIndex)
{
case Location.Align.TopCenter:
EditorGUI.PropertyField(drawRect, top);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
case Location.Align.TopLeft:
EditorGUI.PropertyField(drawRect, top);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, left);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
case Location.Align.TopRight:
EditorGUI.PropertyField(drawRect, top);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, right);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
case Location.Align.BottomCenter:
EditorGUI.PropertyField(drawRect, bottom);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
case Location.Align.BottomLeft:
EditorGUI.PropertyField(drawRect, bottom);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, left);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
case Location.Align.BottomRight:
EditorGUI.PropertyField(drawRect, bottom);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, right);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
case Location.Align.Center:
break;
case Location.Align.CenterLeft:
EditorGUI.PropertyField(drawRect, left);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
case Location.Align.CenterRight:
EditorGUI.PropertyField(drawRect, right);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
break;
}
EditorGUI.PropertyField(drawRect, top);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, bottom);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, left);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, right);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// switch ((Location.Align)align.enumValueIndex)
// {
// case Location.Align.TopCenter:
// EditorGUI.PropertyField(drawRect, top);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// case Location.Align.TopLeft:
// EditorGUI.PropertyField(drawRect, top);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// EditorGUI.PropertyField(drawRect, left);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// case Location.Align.TopRight:
// EditorGUI.PropertyField(drawRect, top);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// EditorGUI.PropertyField(drawRect, right);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// case Location.Align.BottomCenter:
// EditorGUI.PropertyField(drawRect, bottom);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// case Location.Align.BottomLeft:
// EditorGUI.PropertyField(drawRect, bottom);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// EditorGUI.PropertyField(drawRect, left);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// case Location.Align.BottomRight:
// EditorGUI.PropertyField(drawRect, bottom);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// EditorGUI.PropertyField(drawRect, right);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// case Location.Align.Center:
// break;
// case Location.Align.CenterLeft:
// EditorGUI.PropertyField(drawRect, left);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// case Location.Align.CenterRight:
// EditorGUI.PropertyField(drawRect, right);
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// break;
// }
--EditorGUI.indentLevel;
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
SerializedProperty align = prop.FindPropertyRelative("m_Align");
switch ((Location.Align)align.enumValueIndex)
{
case Location.Align.Center:
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
case Location.Align.TopCenter:
case Location.Align.BottomCenter:
case Location.Align.CenterLeft:
case Location.Align.CenterRight:
return 2 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
default:
return 3 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
}
return 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
// SerializedProperty align = prop.FindPropertyRelative("m_Align");
// switch ((Location.Align)align.enumValueIndex)
// {
// case Location.Align.Center:
// return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
// case Location.Align.TopCenter:
// case Location.Align.BottomCenter:
// case Location.Align.CenterLeft:
// case Location.Align.CenterRight:
// return 2 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
// default:
// return 3 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
// }
}
}
}

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 34092595791508d4b94b074a8788c388
timeCreated: 1554307767
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,49 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Polar), true)]
public class PolarDrawer : PropertyDrawer
{
private bool m_PolarModuleToggle = false;
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty show = prop.FindPropertyRelative("m_Show");
SerializedProperty m_Center = prop.FindPropertyRelative("m_Center");
SerializedProperty m_Radius = prop.FindPropertyRelative("m_Radius");
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_PolarModuleToggle, "Polar", show);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_PolarModuleToggle)
{
EditorGUI.indentLevel++;
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
EditorGUI.PropertyField(drawRect, m_Radius);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.indentLevel--;
}
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
if (m_PolarModuleToggle)
return 4 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
else
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
}
}

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

@@ -25,6 +25,7 @@ namespace XCharts
SerializedProperty m_IndicatorGap;
SerializedProperty m_CeilRate;
SerializedProperty m_IndicatorList;
SerializedProperty m_IsAxisTooltip;
private Dictionary<string, bool> m_RadarModuleToggle = new Dictionary<string, bool>();
private Dictionary<string, bool> m_IndicatorToggle = new Dictionary<string, bool>();
@@ -46,6 +47,7 @@ namespace XCharts
m_IndicatorGap = prop.FindPropertyRelative("m_IndicatorGap");
m_CeilRate = prop.FindPropertyRelative("m_CeilRate");
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
m_IsAxisTooltip = prop.FindPropertyRelative("m_IsAxisTooltip");
}
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
@@ -74,10 +76,7 @@ namespace XCharts
var tempWidth = (pos.width - startX + 35) / 2;
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
var centerYRect = new Rect(centerXRect.x + tempWidth - 20, drawRect.y, tempWidth, drawRect.height);
while (m_Center.arraySize < 2)
{
m_Center.InsertArrayElementAtIndex(m_Center.arraySize);
}
while (m_Center.arraySize < 2) m_Center.arraySize++;
EditorGUI.PropertyField(centerXRect, m_Center.GetArrayElementAtIndex(0), GUIContent.none);
EditorGUI.PropertyField(centerYRect, m_Center.GetArrayElementAtIndex(1), GUIContent.none);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
@@ -88,6 +87,8 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_CeilRate);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_IsAxisTooltip);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SplitLine);
drawRect.y += EditorGUI.GetPropertyHeight(m_SplitLine);
@@ -113,7 +114,7 @@ namespace XCharts
int propNum = 1;
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle, prop))
{
propNum += 8;
propNum += 9;
if (m_IndicatorJsonAreaToggle) propNum += 4;
float height = propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_SplitLine"));

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 09bf71ecf64f321468ac28af28bec878
timeCreated: 1555563898
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 7fb5d2a98871919459956dc252632435
timeCreated: 1556220585
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,24 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEditor;
namespace XCharts
{
[CustomPropertyDrawer(typeof(RadiusAxis), true)]
public class RadiusAxisDrawer : AxisDrawer
{
protected override string GetDisplayName(string displayName)
{
if (displayName.StartsWith("Element"))
{
displayName = displayName.Replace("Element", "Radius Axis");
}
return displayName;
}
}
}

View File

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

View File

@@ -30,6 +30,7 @@ namespace XCharts
SerializedProperty m_AxisIndex = prop.FindPropertyRelative("m_AxisIndex");
SerializedProperty m_RadarType = prop.FindPropertyRelative("m_RadarType");
SerializedProperty m_RadarIndex = prop.FindPropertyRelative("m_RadarIndex");
SerializedProperty m_VesselIndex = prop.FindPropertyRelative("m_VesselIndex");
SerializedProperty m_MinShow = prop.FindPropertyRelative("m_MinShow");
SerializedProperty m_MaxShow = prop.FindPropertyRelative("m_MaxShow");
SerializedProperty m_MaxCache = prop.FindPropertyRelative("m_MaxCache");
@@ -77,6 +78,11 @@ namespace XCharts
SerializedProperty m_ShowAsPositiveNumber = prop.FindPropertyRelative("m_ShowAsPositiveNumber");
SerializedProperty m_Large = prop.FindPropertyRelative("m_Large");
SerializedProperty m_LargeThreshold = prop.FindPropertyRelative("m_LargeThreshold");
SerializedProperty m_AvoidLabelOverlap = prop.FindPropertyRelative("m_AvoidLabelOverlap");
SerializedProperty m_WaveHeight = prop.FindPropertyRelative("m_WaveHeight");
SerializedProperty m_WaveLength = prop.FindPropertyRelative("m_WaveLength");
SerializedProperty m_WaveSpeed = prop.FindPropertyRelative("m_WaveSpeed");
SerializedProperty m_WaveOffset = prop.FindPropertyRelative("m_WaveOffset");
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
int index = InitToggle(prop);
@@ -213,6 +219,8 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_IgnoreValue);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_AvoidLabelOverlap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
@@ -319,6 +327,26 @@ namespace XCharts
EditorGUI.PropertyField(drawRect, m_Emphasis);
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
break;
case SerieType.Liquid:
EditorGUI.PropertyField(drawRect, m_VesselIndex);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Min);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Max);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveLength);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveHeight);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveSpeed);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_WaveOffset);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
break;
}
EditorGUI.PropertyField(drawRect, m_Animation);
drawRect.y += EditorGUI.GetPropertyHeight(m_Animation);
@@ -363,10 +391,8 @@ namespace XCharts
bool showSelected = (serieType == SerieType.Pie);
if (listSize != m_Datas.arraySize)
{
while (listSize > m_Datas.arraySize)
m_Datas.InsertArrayElementAtIndex(m_Datas.arraySize);
while (listSize < m_Datas.arraySize)
m_Datas.DeleteArrayElementAtIndex(m_Datas.arraySize - 1);
while (listSize > m_Datas.arraySize) m_Datas.arraySize++;
while (listSize < m_Datas.arraySize) m_Datas.arraySize--;
}
if (listSize > 30)
{
@@ -414,8 +440,9 @@ namespace XCharts
{
while (2 > data.arraySize)
{
data.InsertArrayElementAtIndex(data.arraySize);
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = 0;
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
if (showSelected)
@@ -449,10 +476,12 @@ namespace XCharts
var xWid = dataWid - 4;
for (int i = 0; i < dimension; i++)
{
while (i > data.arraySize - 1)
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
data.InsertArrayElementAtIndex(data.arraySize);
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = 0;
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;
@@ -482,8 +511,13 @@ namespace XCharts
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_Icon);
drawRect.y += EditorGUI.GetPropertyHeight(m_Icon);
EditorGUI.PropertyField(drawRect, m_Symbol);
ChartEditorHelper.MakeBool(drawRect, m_EnableSymbol, 1, "(enable)");
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
EditorGUI.PropertyField(drawRect, m_Label);
ChartEditorHelper.MakeBool(drawRect, m_EnableLabel, 1, "(enable)");
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
@@ -493,7 +527,6 @@ namespace XCharts
EditorGUI.PropertyField(drawRect, m_Emphasis);
ChartEditorHelper.MakeBool(drawRect, m_EnableEmphasis, 1, "(enable)");
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
EditorGUI.indentLevel -= 2;
}
}
@@ -531,7 +564,7 @@ namespace XCharts
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Pie:
height += 11 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
height += 12 * EditorGUIUtility.singleLineHeight + 11 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
@@ -581,6 +614,12 @@ namespace XCharts
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
case SerieType.Liquid:
height += 11 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
break;
}
if (m_DataFoldout[index])
{
@@ -603,6 +642,7 @@ namespace XCharts
{
var item = m_Data.GetArrayElementAtIndex(i);
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_IconStyle"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_Symbol"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_Label"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_ItemStyle"));
height += EditorGUI.GetPropertyHeight(item.FindPropertyRelative("m_Emphasis"));

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: c30d9496b99e39944a6987e390bed91f
timeCreated: 1555200849
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -44,6 +44,7 @@ namespace XCharts
SerializedProperty m_BorderWidth = prop.FindPropertyRelative("m_BorderWidth");
SerializedProperty m_BorderColor = prop.FindPropertyRelative("m_BorderColor");
SerializedProperty m_NumericFormatter = prop.FindPropertyRelative("m_NumericFormatter");
SerializedProperty m_AutoOffset = prop.FindPropertyRelative("m_AutoOffset");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieLabelToggle, prop, null, show, false);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
@@ -56,6 +57,8 @@ namespace XCharts
EditorGUI.PropertyField(drawRect, m_Offset);
drawRect.y += EditorGUI.GetPropertyHeight(m_Offset);
EditorGUI.PropertyField(drawRect, m_AutoOffset);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Margin);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Formatter);
@@ -107,7 +110,7 @@ namespace XCharts
float height = 0;
if (ChartEditorHelper.IsToggle(m_SerieLabelToggle, prop))
{
height += 23 * EditorGUIUtility.singleLineHeight + 22 * EditorGUIUtility.standardVerticalSpacing;
height += 24 * EditorGUIUtility.singleLineHeight + 23 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Offset"));
}
else

View File

@@ -20,6 +20,7 @@ namespace XCharts
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty m_Show = prop.FindPropertyRelative("m_Show");
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
SerializedProperty m_SizeType = prop.FindPropertyRelative("m_SizeType");
SerializedProperty m_Size = prop.FindPropertyRelative("m_Size");
@@ -32,12 +33,14 @@ namespace XCharts
SerializedProperty m_ForceShowLast = prop.FindPropertyRelative("m_ForceShowLast");
SerializedProperty m_Gap = prop.FindPropertyRelative("m_Gap");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieSymbolToggle, prop, null, m_Type, false);
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieSymbolToggle, prop, null, m_Show, false);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (ChartEditorHelper.IsToggle(m_SerieSymbolToggle, prop))
{
++EditorGUI.indentLevel;
EditorGUI.PropertyField(drawRect, m_Type);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Gap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_SizeType);
@@ -78,16 +81,18 @@ namespace XCharts
{
SerializedProperty m_SizeType = prop.FindPropertyRelative("m_SizeType");
SerieSymbolSizeType sizeType = (SerieSymbolSizeType)m_SizeType.enumValueIndex;
var hig = 9 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
switch (sizeType)
{
case SerieSymbolSizeType.Custom:
return 8 * EditorGUIUtility.singleLineHeight + 8 * EditorGUIUtility.standardVerticalSpacing;
break;
case SerieSymbolSizeType.FromData:
return 9 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
hig += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
break;
case SerieSymbolSizeType.Callback:
return 8 * EditorGUIUtility.singleLineHeight + 8 * EditorGUIUtility.standardVerticalSpacing;
break;
}
return 8 * EditorGUIUtility.singleLineHeight + 8 * EditorGUIUtility.standardVerticalSpacing;
return hig;
}
else
{

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 6c2458b1901047547b1a59d097786816
timeCreated: 1556016849
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -320,7 +320,7 @@ namespace XCharts
{
while (i > m_CustomColorPalette.arraySize - 1)
{
m_CustomColorPalette.InsertArrayElementAtIndex(m_CustomColorPalette.arraySize);
m_CustomColorPalette.arraySize++;
}
var customElement = m_CustomColorPalette.GetArrayElementAtIndex(i);
color = !ChartHelper.IsClearColor(customElement.colorValue) ?

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: bcac1baa719179549b24d7056f7e0cb5
timeCreated: 1554541305
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 22ae7ec778f27c1409cb9151ce7b9aba
timeCreated: 1554304641
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -35,6 +35,7 @@ namespace XCharts
SerializedProperty m_IgnoreDataDefaultContent = prop.FindPropertyRelative("m_IgnoreDataDefaultContent");
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
SerializedProperty m_TextStyle = prop.FindPropertyRelative("m_TextStyle");
SerializedProperty m_Offset = prop.FindPropertyRelative("m_Offset");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
@@ -67,6 +68,8 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_IgnoreDataDefaultContent);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Offset);
drawRect.y += EditorGUI.GetPropertyHeight(m_Offset);
EditorGUI.PropertyField(drawRect, m_LineStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
EditorGUI.PropertyField(drawRect, m_TextStyle);
@@ -79,6 +82,7 @@ namespace XCharts
{
if (m_TooltipModuleToggle)
return 14 * EditorGUIUtility.singleLineHeight + 13 * EditorGUIUtility.standardVerticalSpacing +
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Offset")) +
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle")) +
EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_TextStyle"));
else

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 5600b7009bc024a49800448cece012e2
timeCreated: 1554419729
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,68 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Vessel), true)]
public class VesselDrawer : PropertyDrawer
{
private bool m_VesselModuleToggle = false;
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty show = prop.FindPropertyRelative("m_Show");
SerializedProperty m_Shape = prop.FindPropertyRelative("m_Shape");
SerializedProperty m_Center = prop.FindPropertyRelative("m_Center");
SerializedProperty m_Radius = prop.FindPropertyRelative("m_Radius");
SerializedProperty m_ShapeWidth = prop.FindPropertyRelative("m_ShapeWidth");
SerializedProperty m_Gap = prop.FindPropertyRelative("m_Gap");
SerializedProperty m_Smoothness = prop.FindPropertyRelative("m_Smoothness");
SerializedProperty m_AutoColor = prop.FindPropertyRelative("m_AutoColor");
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
int index = ChartEditorHelper.GetIndexFromPath(prop);
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_VesselModuleToggle, "Vessel " + index, show);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_VesselModuleToggle)
{
EditorGUI.indentLevel++;
EditorGUI.PropertyField(drawRect, m_Shape);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ShapeWidth);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Gap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
EditorGUI.PropertyField(drawRect, m_Radius);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Color);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_AutoColor);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Smoothness);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.indentLevel--;
}
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
if (m_VesselModuleToggle)
return 10 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
else
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
}
}

View File

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

View File

@@ -42,7 +42,9 @@ namespace XCharts
SerializedProperty m_Orient = prop.FindPropertyRelative("m_Orient");
SerializedProperty m_Location = prop.FindPropertyRelative("m_Location");
SerializedProperty m_InRange = prop.FindPropertyRelative("m_InRange");
// SerializedProperty m_OutOfRange = prop.FindPropertyRelative("m_OutOfRange");
SerializedProperty m_AutoMinMax = prop.FindPropertyRelative("m_AutoMinMax");
SerializedProperty m_Direction = prop.FindPropertyRelative("m_Direction");
SerializedProperty m_OutOfRange = prop.FindPropertyRelative("m_OutOfRange");
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_VisualMapModuleToggle, "Visual Map", m_Enable);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
@@ -51,7 +53,10 @@ namespace XCharts
++EditorGUI.indentLevel;
EditorGUI.PropertyField(drawRect, m_Type);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Direction);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_AutoMinMax);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Min);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Max);
@@ -60,8 +65,6 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Dimension);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_HoverLink);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
m_InRangeFoldout = EditorGUI.Foldout(drawRect, m_InRangeFoldout, "InRange");
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
@@ -71,12 +74,12 @@ namespace XCharts
}
// drawRect.width = pos.width;
// m_OutOfRangeFoldout = EditorGUI.Foldout(drawRect, m_OutOfRangeFoldout, "OutOfRange");
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
// if (m_OutOfRangeFoldout)
// {
// ChartEditorHelper.MakeList(ref drawRect, ref m_OutOfRangeSize, m_OutOfRange);
// }
m_OutOfRangeFoldout = EditorGUI.Foldout(drawRect, m_OutOfRangeFoldout, "OutOfRange");
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_OutOfRangeFoldout)
{
ChartEditorHelper.MakeList(ref drawRect, ref m_OutOfRangeSize, m_OutOfRange);
}
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Show);
@@ -88,6 +91,8 @@ namespace XCharts
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Range, "Range");
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Text, "Text");
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Text, "TextGap");
EditorGUI.PropertyField(drawRect, m_HoverLink);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Calculable);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_ItemWidth);
@@ -111,7 +116,7 @@ namespace XCharts
int num = 1;
if (m_VisualMapModuleToggle)
{
num += 8;
num += 10;
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
if (m_InRangeFoldout)
@@ -121,16 +126,16 @@ namespace XCharts
height += size * EditorGUIUtility.singleLineHeight + (size - 1) * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUIUtility.standardVerticalSpacing;
}
// if (m_OutOfRangeFoldout)
// {
// SerializedProperty m_OutOfRange = prop.FindPropertyRelative("m_OutOfRange");
// int size = m_OutOfRange.arraySize + 1;
// height += size * EditorGUIUtility.singleLineHeight + (size - 1) * EditorGUIUtility.standardVerticalSpacing;
// height += EditorGUIUtility.standardVerticalSpacing;
// }
if (m_OutOfRangeFoldout)
{
SerializedProperty m_OutOfRange = prop.FindPropertyRelative("m_OutOfRange");
int size = m_OutOfRange.arraySize + 1;
height += size * EditorGUIUtility.singleLineHeight + (size - 1) * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUIUtility.standardVerticalSpacing;
}
if (prop.FindPropertyRelative("m_Show").boolValue)
{
height += 9 * EditorGUIUtility.singleLineHeight + 8 * EditorGUIUtility.standardVerticalSpacing;
height += 10 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Location"));
}
}

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 8ea6609b1e1634241947b4ef14c38849
timeCreated: 1555512890
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: bdb8a35f2c8c145f2891995e538592ff
guid: 5f8c1764407aa478892ac9355ec71934
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -0,0 +1,377 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
/// <summary>
/// 升级旧版本的颜色配置到1.6.0以上版本,参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)进行升级
/// 导出:菜单栏->XCharts->ExportColorConfig
/// 导入:菜单栏->XCharts->ImportColorConfig
/// </summary>
public static class UpgradeChartColor
{
private const string CONFIG_PATH = "/colors.config"; // /Assets/
[MenuItem("XCharts/ExportColorConfig")]
/// <summary>
/// Export all the color configuration associated with drawing.
/// 导出所有图表的和绘制相关的颜色配置。保存在Assets目录下的colors.config文件里。
/// </summary>
public static void ExportColorConfig()
{
Debug.Log("ExportColorConfig");
var charts = Resources.FindObjectsOfTypeAll(typeof(BaseChart));
var sb = new StringBuilder();
foreach (var chart in charts)
{
if (chart is CoordinateChart) ExportCoordinateChart(sb, chart as CoordinateChart);
else if (chart is LiquidChart) ExportLiquidChart(sb, chart as LiquidChart); //如果这里编译失败说明该版本不存在LiquidChart可以整行注释掉。
else if (chart is RadarChart) ExportRadarChart(sb, chart as RadarChart);
else ExportSeries(sb, chart as BaseChart);
sb.Append("\n");
}
Debug.LogFormat("ExportColorConfig DONE: {0} charts.", charts.Length);
File.WriteAllText(Application.dataPath + CONFIG_PATH, sb.ToString());
}
[MenuItem("XCharts/ImportColorConfig")]
/// <summary>
/// 导入旧版本的颜色配置。
/// </summary>
public static void ImportColorConfig()
{
Debug.Log("ImportColorConfig");
var configPath = Application.dataPath + CONFIG_PATH;
if (!File.Exists(configPath))
{
Debug.LogError("ImportColorConfig ERROR:can't found config:" + configPath);
return;
}
var charts = Resources.FindObjectsOfTypeAll(typeof(BaseChart));
var chartDic = new Dictionary<int, BaseChart>();
foreach (var chart in charts)
{
chartDic[chart.GetInstanceID()] = chart as BaseChart;
}
var allLines = File.ReadAllLines(configPath);
var chartSet = new HashSet<int>();
foreach (var line in allLines)
{
if (string.IsNullOrEmpty(line)) continue;
var temp = line.Split('=');
var instanceId = int.Parse(temp[0]);
if (!chartDic.ContainsKey(instanceId))
{
Debug.LogError("can't find chart:" + instanceId);
continue;
}
if (!chartSet.Contains(instanceId)) chartSet.Add(instanceId);
var chart = chartDic[instanceId];
var colorList = ConvertToColorList(temp[2]);
var temp2 = temp[1].Split('_');
var allType = temp[1];
var strType = temp2[0];
if (allType.Equals("visualMap")) ImportColorList((chart as CoordinateChart).visualMap.inRange, colorList);
else if (allType.Equals("xAxis0_splitArea")) ImportColorList((chart as CoordinateChart).xAxis0.splitArea.color, colorList);
else if (allType.Equals("xAxis1_splitArea")) ImportColorList((chart as CoordinateChart).xAxis1.splitArea.color, colorList);
else if (allType.Equals("yAxis0_splitArea")) ImportColorList((chart as CoordinateChart).yAxis0.splitArea.color, colorList);
else if (allType.Equals("yAxis1_splitArea")) ImportColorList((chart as CoordinateChart).yAxis1.splitArea.color, colorList);
else if (allType.Equals("xAxis0_splitLine")) (chart as CoordinateChart).xAxis0.splitLine.lineStyle.color = colorList[0];
else if (allType.Equals("xAxis1_splitLine")) (chart as CoordinateChart).xAxis1.splitLine.lineStyle.color = colorList[0];
else if (allType.Equals("yAxis0_splitLine")) (chart as CoordinateChart).yAxis0.splitLine.lineStyle.color = colorList[0];
else if (allType.Equals("yAxis1_splitLine")) (chart as CoordinateChart).yAxis1.splitLine.lineStyle.color = colorList[0];
else if (strType.Equals("vessel")) ImportVesselColor(chart, int.Parse(temp2[1]), colorList); //没有LiquidChart的版本该行可以注释掉。
else if (strType.Equals("radarSplitLine")) ImportRadarSplitLineColor(chart, int.Parse(temp2[1]), colorList);
else if (strType.Equals("radarSplitArea")) ImportRadarSplitAreaColor(chart, int.Parse(temp2[1]), colorList);
else if (strType.Equals("serie"))
{
var index = int.Parse(temp2[1]);
var strSubType = temp2[2];
var serie = chart.series.GetSerie(index);
if (strSubType.Equals("lineStyle")) serie.lineStyle.color = colorList[0];
else if (strSubType.Equals("areaStyle")) ImportSerieAreaColor(serie.areaStyle, colorList);
else if (strSubType.Equals("label")) ImportLabelColor(serie.label, colorList);
else if (strSubType.Equals("labelEmphasis")) ImportLabelColor(serie.emphasis.label, colorList);
else if (strSubType.Equals("itemStyle")) ImportItemStyleColor(serie.itemStyle, colorList);
else if (strSubType.Equals("itemStyleEmphasis")) ImportItemStyleColor(serie.emphasis.itemStyle, colorList);
else if (strSubType.Equals("gaugeAxisLine")) ImportGaugeAxisLineColor(serie.gaugeAxis, colorList);
else if (strSubType.Equals("gaugeSplitLine")) serie.gaugeAxis.splitLine.lineStyle.color = colorList[0];
else if (strSubType.Equals("gaugeAxisTick")) serie.gaugeAxis.axisTick.lineStyle.color = colorList[0];
}
else if (strType.Equals("serieData"))
{
var index = int.Parse(temp2[1]);
var dataIndex = int.Parse(temp2[2]);
var strSubType = temp2[3];
var serieData = chart.series.GetSerie(index).GetSerieData(dataIndex);
if (strSubType.Equals("label")) ImportLabelColor(serieData.label, colorList);
else if (strSubType.Equals("labelEmphasis")) ImportLabelColor(serieData.emphasis.label, colorList);
else if (strSubType.Equals("itemStyle")) ImportItemStyleColor(serieData.itemStyle, colorList);
else if (strSubType.Equals("itemStyleEmphasis")) ImportItemStyleColor(serieData.emphasis.itemStyle, colorList);
}
chart.RefreshChart();
}
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.LogFormat("ImportColorConfig DONE: {0} charts.", chartSet.Count);
}
private static void ExportCoordinateChart(StringBuilder sb, CoordinateChart chart)
{
var instanceId = chart.GetInstanceID();
if (chart.visualMap.show)
{
AppendColor(sb, instanceId, "visualMap", chart.visualMap.inRange);
}
if (chart.xAxis0.show)
{
if (chart.xAxis0.splitArea.show)
AppendColor(sb, instanceId, "xAxis0_splitArea", chart.xAxis0.splitArea.color);
if (chart.xAxis0.splitLine.show)
AppendColor(sb, instanceId, "xAxis0_splitLine", chart.xAxis0.splitLine.lineStyle.color);
}
if (chart.xAxis1.show)
{
if (chart.xAxis1.splitArea.show)
AppendColor(sb, instanceId, "xAxis1_splitArea", chart.xAxis1.splitArea.color);
if (chart.xAxis1.splitLine.show)
AppendColor(sb, instanceId, "xAxis1_splitLine", chart.xAxis1.splitLine.lineStyle.color);
}
if (chart.yAxis0.show)
{
if (chart.yAxis0.splitArea.show)
AppendColor(sb, instanceId, "yAxis0_splitArea", chart.yAxis0.splitArea.color);
if (chart.yAxis0.splitLine.show)
AppendColor(sb, instanceId, "yAxis0_splitLine", chart.yAxis0.splitLine.lineStyle.color);
}
if (chart.yAxis1.show)
{
if (chart.yAxis1.splitArea.show)
AppendColor(sb, instanceId, "yAxis1_splitArea", chart.yAxis1.splitArea.color);
if (chart.yAxis1.splitLine.show)
AppendColor(sb, instanceId, "yAxis1_splitLine", chart.yAxis1.splitLine.lineStyle.color);
}
ExportSeries(sb, chart);
}
/// <summary>
/// LiquidChart不在该版本时整个函数可以注释掉
/// </summary>
private static void ExportLiquidChart(StringBuilder sb, LiquidChart chart)
{
var instanceId = chart.GetInstanceID();
var key = "vessel_";
for (int i = 0; i < chart.vessels.Count; i++)
{
var vessel = chart.vessels[i];
AppendColor(sb, instanceId, key + i, vessel.color, vessel.backgroundColor);
}
ExportSeries(sb, chart);
}
private static void ExportRadarChart(StringBuilder sb, RadarChart chart)
{
var instanceId = chart.GetInstanceID();
for (int i = 0; i < chart.radars.Count; i++)
{
var radar = chart.radars[i];
AppendColor(sb, instanceId, "radarSplitLine_" + i, radar.splitLine.lineStyle.color);
AppendColor(sb, instanceId, "radarSplitArea_" + i, radar.splitArea.color);
}
ExportSeries(sb, chart);
}
private static void ExportSeries(StringBuilder sb, BaseChart chart)
{
var instanceId = chart.GetInstanceID();
for (int i = 0; i < chart.series.list.Count; i++)
{
var serie = chart.series.GetSerie(i);
var key = "serie_" + i;
AppendColor(sb, instanceId, key + "_itemStyle", serie.itemStyle.color, serie.itemStyle.toColor, serie.itemStyle.toColor2, serie.itemStyle.backgroundColor, serie.itemStyle.borderColor);
AppendColor(sb, instanceId, key + "_label", serie.label.backgroundColor, serie.label.borderColor);
AppendColor(sb, instanceId, key + "_itemStyleEmphasis", serie.emphasis.itemStyle.color, serie.emphasis.itemStyle.toColor, serie.emphasis.itemStyle.toColor2, serie.emphasis.itemStyle.backgroundColor, serie.emphasis.itemStyle.borderColor);
AppendColor(sb, instanceId, key + "_labelEmphasis", serie.emphasis.label.backgroundColor, serie.emphasis.label.borderColor);
if (serie.type == SerieType.Line)
{
AppendColor(sb, instanceId, key + "_lineStyle", serie.lineStyle.color);
AppendColor(sb, instanceId, key + "_areaStyle", serie.areaStyle.color, serie.areaStyle.toColor, serie.areaStyle.highlightColor, serie.areaStyle.highlightToColor);
}
if (serie.type == SerieType.Gauge)
{
var axisLineColors = new List<Color>();
axisLineColors.Add(serie.gaugeAxis.axisLine.barColor);
axisLineColors.Add(serie.gaugeAxis.axisLine.barBackgroundColor);
for (int n = 0; n < serie.gaugeAxis.axisLine.stageColor.Count; n++)
{
axisLineColors.Add(serie.gaugeAxis.axisLine.stageColor[n].color);
}
AppendColor(sb, instanceId, key + "_gaugeAxisLine", axisLineColors);
AppendColor(sb, instanceId, key + "_gaugeSplitLine", serie.gaugeAxis.splitLine.lineStyle.color);
AppendColor(sb, instanceId, key + "_gaugeAxisTick", serie.gaugeAxis.axisTick.lineStyle.color);
}
for (int j = 0; j < serie.dataCount; j++)
{
key = string.Format("serieData_{0}_{1}", i, j);
var serieData = serie.GetSerieData(j);
if (serieData.enableItemStyle)
AppendColor(sb, instanceId, key + "_itemStyle", serieData.itemStyle.color, serieData.itemStyle.toColor, serieData.itemStyle.toColor2, serieData.itemStyle.backgroundColor, serieData.itemStyle.borderColor);
if (serieData.enableLabel)
AppendColor(sb, instanceId, key + "_label", serieData.label.backgroundColor, serieData.label.borderColor);
if (serieData.enableEmphasis)
AppendColor(sb, instanceId, key + "_itemStyleEmphasis", serieData.emphasis.itemStyle.color, serieData.emphasis.itemStyle.toColor, serieData.emphasis.itemStyle.toColor2, serieData.emphasis.itemStyle.backgroundColor, serieData.emphasis.itemStyle.borderColor);
if (serieData.enableEmphasis)
AppendColor(sb, instanceId, key + "_labelEmphasis", serieData.emphasis.label.backgroundColor, serieData.emphasis.label.borderColor);
}
}
}
private static void ExportGague(GaugeAxis gauge, StringBuilder sb)
{
}
private static void AppendColor(StringBuilder sb, int instanceId, string key, List<Color> list)
{
if (list.Count <= 0) return;
sb.AppendFormat("{0}={1}=", instanceId, key);
for (int i = 0; i < list.Count; i++)
{
sb.AppendFormat("{0}|", GetColorRGBA(list[i]));
}
sb.Append("\n");
}
private static void AppendColor(StringBuilder sb, int instanceId, string key, params Color[] color)
{
sb.AppendFormat("{0}={1}=", instanceId, key);
for (int i = 0; i < color.Length; i++)
{
sb.AppendFormat("{0}|", GetColorRGBA(color[i]));
}
sb.Append("\n");
}
private static void AppendColor(StringBuilder sb, int instanceId, string key, List<Color32> list)
{
if (list.Count <= 0) return;
sb.AppendFormat("{0}={1}=", instanceId, key);
for (int i = 0; i < list.Count; i++)
{
sb.AppendFormat("{0}|", GetColorRGBA(list[i]));
}
sb.Append("\n");
}
private static string GetColorRGBA(Color color)
{
Color32 color32 = color;
return string.Format("{0},{1},{2},{3}", color32.r, color32.g, color32.b, color32.a);
}
private static List<Color32> ConvertToColorList(string strInfo)
{
var temp = strInfo.Split('|');
var list = new List<Color32>();
for (int i = 0; i < temp.Length; i++)
{
if (!string.IsNullOrEmpty(temp[i]))
{
var temp2 = temp[i].Split(',');
var r = byte.Parse(temp2[0]);
var g = byte.Parse(temp2[1]);
var b = byte.Parse(temp2[2]);
var a = byte.Parse(temp2[3]);
list.Add(new Color32(r, g, b, a));
}
}
return list;
}
private static void ImportColorList(List<Color32> target, List<Color32> colorList)
{
target.Clear();
for (int i = 0; i < colorList.Count; i++)
{
target.Add(colorList[i]);
}
}
private static void ImportColorList(List<Color> target, List<Color32> colorList)
{
target.Clear();
for (int i = 0; i < colorList.Count; i++)
{
target.Add(colorList[i]);
}
}
private static void ImportSerieAreaColor(AreaStyle areaStyle, List<Color32> colorList)
{
areaStyle.color = colorList[0];
areaStyle.toColor = colorList[1];
areaStyle.highlightColor = colorList[2];
areaStyle.highlightToColor = colorList[3];
}
private static void ImportLabelColor(SerieLabel label, List<Color32> colorList)
{
label.backgroundColor = colorList[0];
label.borderColor = colorList[1];
}
private static void ImportItemStyleColor(ItemStyle itemStyle, List<Color32> colorList)
{
itemStyle.color = colorList[0];
itemStyle.toColor = colorList[1];
itemStyle.toColor2 = colorList[2];//没有toColor2的版本可以注释掉改行
itemStyle.backgroundColor = colorList[3];
itemStyle.borderColor = colorList[4];
}
private static void ImportGaugeAxisLineColor(GaugeAxis gauge, List<Color32> colorList)
{
gauge.axisLine.barColor = colorList[0];
gauge.axisLine.barBackgroundColor = colorList[1];
for (int i = 2; i < colorList.Count; i++)
{
gauge.axisLine.stageColor[i - 2].color = colorList[i];
}
}
/// <summary>
/// 没有LiquidChart的版本这个函数可以注释掉
/// </summary>
/// <param name="chart"></param>
/// <param name="index"></param>
/// <param name="colorList"></param>
private static void ImportVesselColor(BaseChart chart, int index, List<Color32> colorList)
{
var vessel = (chart as LiquidChart).GetVessel(index);
vessel.color = colorList[0];
vessel.backgroundColor = colorList[1];
}
private static void ImportRadarSplitLineColor(BaseChart chart, int index, List<Color32> colorList)
{
var radar = (chart as RadarChart).GetRadar(index);
radar.splitLine.lineStyle.color = colorList[0];
}
private static void ImportRadarSplitAreaColor(BaseChart chart, int index, List<Color32> colorList)
{
var radar = (chart as RadarChart).GetRadar(index);
ImportColorList(radar.splitArea.color, colorList);
}
}
}

View File

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

View File

@@ -1,8 +1,6 @@
fileFormatVersion: 2
guid: cb0b30c9bc2c84f46a99514a69d7e462
folderAsset: yes
timeCreated: 1555303340
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:

View File

@@ -32,19 +32,13 @@ public class ChartEditorHelper
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp, string name)
{
while (arrayProp.arraySize < 2)
{
arrayProp.InsertArrayElementAtIndex(arrayProp.arraySize);
}
while (arrayProp.arraySize < 2) arrayProp.arraySize++;
MakeTwoField(ref drawRect, rectWidth, arrayProp.GetArrayElementAtIndex(0), arrayProp.GetArrayElementAtIndex(1), name);
}
public static void MakeDivideList(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp, string name, int showNum)
{
while (arrayProp.arraySize < showNum)
{
arrayProp.InsertArrayElementAtIndex(arrayProp.arraySize);
}
while (arrayProp.arraySize < showNum) arrayProp.arraySize++;
EditorGUI.LabelField(drawRect, name);
#if UNITY_2019_3_OR_NEWER
var gap = 2;
@@ -214,7 +208,7 @@ public class ChartEditorHelper
var iconRect = new Rect(drawRect.width - nameWid + temp, drawRect.y, nameWid, drawRect.height);
if (GUI.Button(iconRect, new GUIContent("+", "add")))
{
listProp.InsertArrayElementAtIndex(listProp.arraySize);
listProp.arraySize++;
}
listSize = listProp.arraySize;
listSize = EditorGUI.IntField(elementRect, "Size", listSize);
@@ -228,10 +222,8 @@ public class ChartEditorHelper
if (listSize != listProp.arraySize)
{
while (listSize > listProp.arraySize)
listProp.InsertArrayElementAtIndex(listProp.arraySize);
while (listSize < listProp.arraySize)
listProp.DeleteArrayElementAtIndex(listProp.arraySize - 1);
while (listSize > listProp.arraySize) listProp.arraySize++;
while (listSize < listProp.arraySize) listProp.arraySize--;
}
}
if (listSize > 30)

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: bd22466b776d93c4cb0b252ee510cc7a
timeCreated: 1555303340
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -72,52 +72,74 @@ namespace XCharts
rect.pivot = new Vector2(0.5f, 0.5f);
}
[MenuItem("XCharts/LineChart", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart", priority = 44)]
public static void AddLineChart()
{
AddChart<LineChart>("LineChart");
}
[MenuItem("XCharts/BarChart", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart", priority = 45)]
public static void AddBarChart()
{
AddChart<BarChart>("BarChart");
}
[MenuItem("XCharts/PieChart", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart", priority = 46)]
public static void AddPieChart()
{
AddChart<PieChart>("PieChart");
}
[MenuItem("XCharts/RadarChart", priority = 47)]
[MenuItem("GameObject/XCharts/RadarChart", priority = 47)]
public static void AddRadarChart()
{
AddChart<RadarChart>("RadarChart");
}
[MenuItem("XCharts/ScatterChart", priority = 48)]
[MenuItem("GameObject/XCharts/ScatterChart", priority = 48)]
public static void AddScatterChart()
{
AddChart<ScatterChart>("ScatterChart");
}
[MenuItem("XCharts/HeatmapChart", priority = 49)]
[MenuItem("GameObject/XCharts/HeatmapChart", priority = 49)]
public static void AddHeatmapChart()
{
AddChart<HeatmapChart>("HeatmapChart");
}
[MenuItem("XCharts/GaugeChart", priority = 50)]
[MenuItem("GameObject/XCharts/GaugeChart", priority = 50)]
public static void AddGaugeChart()
{
AddChart<GaugeChart>("GaugeChart");
}
[MenuItem("XCharts/RingChart", priority = 51)]
[MenuItem("GameObject/XCharts/RingChart", priority = 51)]
public static void AddRingChart()
{
AddChart<RingChart>("RingChart");
}
[MenuItem("XCharts/PolarChart", priority = 52)]
[MenuItem("GameObject/XCharts/PolarChart", priority = 52)]
public static void AddPolarChart()
{
AddChart<PolarChart>("PolarChart");
}
[MenuItem("XCharts/LiquidChart", priority = 53)]
[MenuItem("GameObject/XCharts/LiquidChart", priority = 53)]
public static void AddLiquidChart()
{
AddChart<LiquidChart>("LiquidChart");
}
}
}

View File

@@ -31,32 +31,32 @@ namespace XCharts.Examples
chart.onScroll = OnScroll;
}
void OnPointerEnter(BaseChart chart, PointerEventData eventData)
void OnPointerEnter(PointerEventData eventData, BaseGraph chart)
{
//Debug.LogError("enter:" + chart);
}
void OnPointerExit(BaseChart chart, PointerEventData eventData)
void OnPointerExit(PointerEventData eventData, BaseGraph chart)
{
//Debug.LogError("exit:" + chart);
}
void OnPointerDown(BaseChart chart, PointerEventData eventData)
void OnPointerDown(PointerEventData eventData, BaseGraph chart)
{
//Debug.LogError("down:" + chart);
}
void OnPointerUp(BaseChart chart, PointerEventData eventData)
void OnPointerUp(PointerEventData eventData, BaseGraph chart)
{
//Debug.LogError("up:" + chart);
}
void OnPointerClick(BaseChart chart, PointerEventData eventData)
void OnPointerClick(PointerEventData eventData, BaseGraph chart)
{
//Debug.LogError("click:" + chart);
}
void OnScroll(BaseChart chart, PointerEventData eventData)
void OnScroll(PointerEventData eventData, BaseGraph chart)
{
//Debug.LogError("scroll:" + chart);
}

View File

@@ -0,0 +1,43 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example03_ChartAnimation : MonoBehaviour
{
BaseChart chart;
void Awake()
{
chart = gameObject.GetComponent<BaseChart>();
if (chart == null)
{
chart = gameObject.AddComponent<BarChart>();
}
var serie = chart.series.GetSerie(0);
serie.animation.enable = true;
//自定义每个数据项的渐入延时
serie.animation.customFadeInDelay = CustomFadeInDelay;
//自定义每个数据项的渐入时长
serie.animation.customFadeInDuration = CustomFadeInDuration;
}
float CustomFadeInDelay(int dataIndex)
{
return dataIndex * 1000;
}
float CustomFadeInDuration(int dataIndex)
{
return dataIndex * 1000 + 1000;
}
}
}

View File

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

View File

@@ -46,7 +46,7 @@ namespace XCharts.Examples
chart.RemoveData();
var serie = chart.AddSerie(SerieType.Line);
serie.symbol.type = SerieSymbolType.None;
serie.symbol.show = false;
serie.lineType = LineType.Normal;
for (angle = 0; angle < 1080; angle++)
{

View File

@@ -19,6 +19,7 @@ namespace XCharts.Examples
if (chart == null)
{
chart = gameObject.AddComponent<LineChart>();
chart.SetSize(580, 300);//代码动态添加图表需要设置尺寸或直接操作chart.rectTransform
}
chart.title.show = true;
chart.title.text = "Line Simple";

View File

@@ -15,7 +15,6 @@ namespace XCharts.Examples
public class Example31_PieUpdateName : MonoBehaviour
{
PieChart chart;
int count = 0;
void Awake()
{
@@ -35,9 +34,9 @@ namespace XCharts.Examples
{
if (Input.GetKeyDown(KeyCode.Space))
{
if (count % 2 == 0) ResetSameName();
else UpdateDataName();
count++;
ClearAndAddData();
//UpdateDataName();
//UpdateDataName();
}
}
@@ -63,7 +62,19 @@ namespace XCharts.Examples
{
chart.UpdateDataName(serieIndex, i, "piename");
}
chart.themeInfo.SetAllDirty();
}
void ClearAndAddData()
{
var serieIndex = 0;
var serie = chart.series.GetSerie(serieIndex);
if (serie == null) return;
int count = serie.dataCount;
serie.ClearData();
for (int i = 0; i < count; i++)
{
chart.AddData(0, Random.Range(0, 100), "pie" + i);
}
}
}
}

View File

@@ -0,0 +1,58 @@
using System.Runtime.InteropServices;
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example80_Polar : MonoBehaviour
{
private PolarChart chart;
private float updateTime;
void Awake()
{
chart = gameObject.GetComponent<PolarChart>();
if (chart == null)
{
chart = gameObject.AddComponent<PolarChart>();
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
AddData();
}
}
void AddData()
{
chart.RemoveData();
chart.tooltip.type = Tooltip.Type.Corss;
chart.angleAxis.type = Axis.AxisType.Value;
chart.angleAxis.minMaxType = Axis.AxisMinMaxType.Custom;
chart.angleAxis.min = 0;
chart.angleAxis.max = 360;
chart.angleAxis.startAngle = Random.Range(0, 90);
chart.AddSerie(SerieType.Line, "line1");
var rate = Random.Range(1, 4);
for (int i = 0; i <= 360; i++)
{
var t = i / 180f * Mathf.PI;
var r = Mathf.Sin(2 * t) * Mathf.Cos(2 * t) * rate;
chart.AddData(0, Mathf.Abs(r), i);
}
}
}
}

View File

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

View File

@@ -31,7 +31,7 @@ namespace XCharts.Examples
chart = gameObject.GetComponentInChildren<CoordinateChart>();
chart.RemoveData();
var serie = chart.AddSerie(SerieType.Line);
serie.symbol.type = SerieSymbolType.None;
serie.symbol.show = false;
serie.maxCache = maxCacheDataNumber;
chart.xAxises[0].maxCache = maxCacheDataNumber;
timeNow = DateTime.Now;

View File

@@ -1,20 +1,119 @@
# XCharts
A powerful, easy-to-use, configurable charting and data visualization library for Unity. Support line charts, bar charts, pie charts, radar charts, scatter charts, heatmaps, gauge, ring charts and other common charts.
![license](https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts)
[![npm Package](https://img.shields.io/npm/v/unity-ugui-xcharts.svg)](https://www.npmjs.org/package/unity-ugui-xcharts)
[![downloads per month](http://img.shields.io/npm/dm/unity-ugui-xcharts.svg)](https://www.npmjs.org/package/unity-ugui-xcharts)
![qq](https://img.shields.io/badge/QQ群-202030963-green)
---
__XCharts 2.0 is comming soon!__
* Framework reconstruction, layered rendering, support more data
* Support TextMeshPro
* Support multi-chart, multi-component mode
* A friendlier editing interface
* More …
---
A powerful, easy-to-use, configurable charting and data visualization library for Unity. Supporting line, bar, pie, radar, scatter, heatmap, gauge, ring, polar, liquid and other common chart.
[XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
[Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
## Features
* Rich built-in examples and templates, parameter visualization configuration, effect real-time preview, pure code drawing.
* Support line charts, bar charts, pie charts, radar charts, scatter charts, heatmaps, gauge charts, ring charts and other common charts.
* Support line graph, curve graph, area graph, step graph, etc.
* Support parallel bar chart, stack bar chart, stack percentage bar chart, zebra bar chart, etc.
* Support for ring chart, rose chart and other pie chart.
* Support broken line graph - bar graph, scatter graph - broken line graph, etc.
* Support solid line, curve, ladder line, dotted line, dot line, dot line, double point line and other lines.
* Support line, bar, pie, radar, scatter, heatmaps, gauge, ring, polar, liquid and other common chart.
* Support line graph, curve graph, area graph, step graph and other LineChart.
* Support parallel bar, stack bar, stack percentage bar, zebra bar and other BarChart.
* Support ring, rose and other PieChart.
* Support line-bar chart, scatter-line chart and other combination chart.
* Support solid line, curve, ladder line, dotted line, dash line, dot line, double dot line and other lines.
* Support custom theme, built-in theme switching.
* support custom chart content drawing, drawing points, line, curve, triangle, quadrilateral, circle, ring, sector, border, arrow and other drawing API.
* support interactive operations such as data filtering, view zooming and detail display on PC and mobile terminals.
* support 10,000-level big data rendering.
* Support custom chart content drawing, drawing points, line, curve, triangle, quadrilateral, circle, ring, sector, border, arrow and other drawing API.
* Support interactive operations such as data filtering, view zooming and detail display on PC and mobile terminals.
* Support 10,000-level big data rendering.
## Screenshot
<img src="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-line.png" width="550" height="auto"/>
<img src="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-bar.png" width="550" height="auto"/>
<img src="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-pie.png" width="550" height="auto"/>
<img src="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-radar.png" width="550" height="auto"/>
<img src="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-scatter.png" width="550" height="auto"/>
<img src="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-heatmap.png" width="550" height="auto"/>
## Cheat Sheet
<img src="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-cheatsheet.gif" />
`XCharts` consist of components and data. Different components and data can be combined into different types of charts. The component is divided into main component and sub component. The main component contains the sub components.
`XCharts` main components:
* `Theme` theme component, which can configure the default colors, fonts and so on.
* `Title` title component, which contains the main title and subtitle.
* `Legend` legend component, which represent different sets of symbols, colors, and names. You can control which series are not displayed by clicking on the legend.
* `Grid` grid component, drawing grid in rectangular coordinate system. Up to two X axes and two Y axes can be placed within a grid component. You can draw line, bar and scatter chart on the grid.
* `Axis` axis component, the axis of a rectangular coordinate system. Supports the upper and lower X axes and the left and right Y axes.
* `Series` series component, a list of serie. A chart can contain many different series, and each series determines its own chart type by type.
* `Tooltip` tooltip component, feedback more details of the data indicated by the mouse at the time.
* `DataZoom` data zoom component, used for area zooming so you can focus on detailed data information, or overview the data as a whole, or remove the impact of outliers.
* `VisualMap` visual mapping component, you can map data in different colors.
* `Radar` radar component, suitable for radar chart only.
* `Settings` global Settings component, Some global parameters can be adjusted. Use the default values in general and adjust them as needed.
`XCharts` support chart:
* `LineChart`
* `BarChart`
* `PieChart`
* `RadarChart`
* `ScatterChart`
* `HeatmapChart`
* `GuageChart`
* `RingChart`
* `PolarChart`
* `LiquidChart`
The following is the relationship structure of LineChart:
``` js
.
├── LineChart
. ├── ThemeInfo
├── Title
│ └── Location
├── Legend
│ └── Location
├── Tooltip
├── DataZoom
├── VisualMap
├── Grid
├── Axis
│ ├── AxisLine
│ ├── AxisName
│ ├── AxisLabel
│ ├── AxisTick
│ └── AxisSplitArea
├── Series
│ ├── ItemStyle
│ ├── AreaStyle
│ ├── SerieSymbol
│ ├── LineStyle
│ ├── LineArrow
│ ├── SerieLabel
│ ├── Emphasis
│ ├── Animation
│ └── SerieData
└── Settings
```
## Environment
@@ -39,15 +138,27 @@ A powerful, easy-to-use, configurable charting and data visualization library fo
2. In unity menu bar, `Component->XCharts->LineChart`.
3. In `Inspector`,`Add Component->LineChart`.
4. Then a simple line chart is done.
5. In `Inspector` you can adjust the parameters of components, and in `Game` will feedback the adjustment effect in realtime 。the detail of parameters go to see: [XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md).
5. In `Inspector` you can adjust the parameters of components, and in `Game` will feedback the adjustment effect in realtime 。the detail of parameters go to see: [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md).
* See more examples of code dynamic control: [教程5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程5分钟上手XCharts.md) .
* See more examples of code dynamic control: [Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md).
## Documents
* [XCharts主页](https://github.com/monitor1394/unity-ugui-XCharts)
* 常见问题看这里☞ [XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
* 接口文档看这里☞ [XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
* 参数配置看这里☞ [XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md)
* 更新日志看这里☞ [XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
* 新手教程看这里☞ [教程5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程5分钟上手XCharts.md)
* [XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
* [XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
* [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
* [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
* [XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
* [XCharts Tutorial: Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
## Changelog
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
## Licenses
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/LICENSE.md)
## Contact
gmail: monitor1394@gmail.com

View File

@@ -0,0 +1,22 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
using System;
using UnityEngine.EventSystems;
namespace XCharts
{
public partial class BarChart
{
/// <summary>
/// the callback function of click bar.
/// 点击柱形图柱条回调。参数eventData, dataIndex
/// </summary>
public Action<PointerEventData, int> onPointerClickBar { set { m_OnPointerClickBar = value; m_ForceOpenRaycastTarget = true; } }
}
}

View File

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

View File

@@ -9,13 +9,12 @@ using UnityEngine;
using System.Collections.Generic;
using System;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace XCharts
{
/// <summary>
/// The base class of all charts.
/// 所有Chart的基类,不可直接使用
/// 所有Chart的基类。
/// </summary>
public partial class BaseChart
{
@@ -92,76 +91,19 @@ namespace XCharts
/// </summary>
public Vector3 chartPosition { get { return m_ChartPosition; } }
public Rect chartRect { get { return m_ChartRect; } }
/// <summary>
/// The postion of pointer.
/// 鼠标位置
/// </summary>
public Vector2 pointerPos { get; protected set; }
/// <summary>
/// 警告信息。
/// </summary>
public string warningInfo { get; protected set; }
public bool isControlledByLayout { get { return m_IsControlledByLayout; } }
/// <summary>
/// 强制开启鼠标事件检测。
/// </summary>
public bool forceOpenRaycastTarget { get { return m_ForceOpenRaycastTarget; } set { m_ForceOpenRaycastTarget = value; } }
/// <summary>
/// 自定义绘制回调。
/// </summary>
public Action<VertexHelper> onCustomDraw { set { m_OnCustomDrawCallback = value; } }
/// <summary>
/// 鼠标点击回调。
/// </summary>
public Action<BaseChart, PointerEventData> onPointerClick { set { m_OnPointerClick = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标按下回调。
/// </summary>
public Action<BaseChart, PointerEventData> onPointerDown { set { m_OnPointerDown = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标弹起回调。
/// </summary>
public Action<BaseChart, PointerEventData> onPointerUp { set { m_OnPointerUp = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标进入回调。
/// </summary>
public Action<BaseChart, PointerEventData> onPointerEnter { set { m_OnPointerEnter = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标退出回调。
/// </summary>
public Action<BaseChart, PointerEventData> onPointerExit { set { m_OnPointerExit = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标开始拖拽回调。
/// </summary>
public Action<BaseChart, PointerEventData> onBeginDrag { set { m_OnBeginDrag = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标拖拽回调。
/// </summary>
public Action<BaseChart, PointerEventData> onDrag { set { m_OnDrag = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标结束拖拽回调。
/// </summary>
public Action<BaseChart, PointerEventData> onEndDrag { set { m_OnEndDrag = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标滚动回调。
/// </summary>
public Action<BaseChart, PointerEventData> onScroll { set { m_OnScroll = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 设置图表的宽高在非stretch pivot下才有效其他情况需要自己调整RectTransform
/// Redraw chart in next frame.
/// 在下一帧刷新图表。
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
public virtual void SetSize(float width, float height)
public void RefreshChart()
{
if (LayerHelper.IsFixedWidthHeight(rectTransform))
{
rectTransform.sizeDelta = new Vector2(width, height);
}
else
{
Debug.LogError("Can't set size on stretch pivot,you need to modify rectTransform by yourself.");
}
m_RefreshChart = true;
}
/// <summary>
@@ -236,7 +178,10 @@ namespace XCharts
if (serieData != null)
{
var serie = m_Series.GetSerie(serieName);
AddSerieLabel(serie, serieData);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshChart();
}
return serieData;
@@ -256,7 +201,10 @@ namespace XCharts
if (serieData != null)
{
var serie = m_Series.GetSerie(serieIndex);
AddSerieLabel(serie, serieData);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshChart();
}
return serieData;
@@ -276,7 +224,10 @@ namespace XCharts
if (serieData != null)
{
var serie = m_Series.GetSerie(serieName);
AddSerieLabel(serie, serieData);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshChart();
}
return serieData;
@@ -296,7 +247,10 @@ namespace XCharts
if (serieData != null)
{
var serie = m_Series.GetSerie(serieIndex);
AddSerieLabel(serie, serieData);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshChart();
}
return serieData;
@@ -317,7 +271,10 @@ namespace XCharts
if (serieData != null)
{
var serie = m_Series.GetSerie(serieName);
AddSerieLabel(serie, serieData);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshChart();
}
return serieData;
@@ -338,7 +295,10 @@ namespace XCharts
if (serieData != null)
{
var serie = m_Series.GetSerie(serieIndex);
AddSerieLabel(serie, serieData);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshChart();
}
return serieData;
@@ -504,7 +464,7 @@ namespace XCharts
var legendIndex = m_LegendRealShowName.IndexOf(legendName);
if (legendIndex >= 0)
{
var iconColor = LegendHelper.GetIconColor(legend, legendIndex, m_ThemeInfo, active);
var iconColor = LegendHelper.GetIconColor(legend, legendIndex, m_ThemeInfo, m_Series, legendName, active);
var contentColor = LegendHelper.GetContentColor(legend, m_ThemeInfo, active);
m_Legend.UpdateButtonColor(legendName, iconColor);
m_Legend.UpdateContentColor(legendName, contentColor);
@@ -562,17 +522,6 @@ namespace XCharts
return false;
}
/// <summary>
/// Redraw chart in next frame.
/// 在下一帧刷新图表。
/// </summary>
public void RefreshChart()
{
m_RefreshChart = true;
}
/// <summary>
/// 刷新文本标签Label重新初始化当有改动Label参数时手动调用改接口
/// </summary>
@@ -718,16 +667,6 @@ namespace XCharts
}
}
/// <summary>
/// 检测警告信息。
/// </summary>
/// <returns></returns>
public string CheckWarning()
{
warningInfo = CheckHelper.CheckChart(this);
return warningInfo;
}
/// <summary>
/// 是否可以开启背景组件。背景组件在chart受上层布局控制时无法开启。
/// </summary>
@@ -758,11 +697,6 @@ namespace XCharts
return chartPosition + m_Title.location.GetPosition(chartWidth, chartHeight);
}
public Vector3 GetLegendPosition()
{
return chartPosition + m_Legend.location.GetPosition(chartWidth, chartHeight);
}
[Obsolete("Use BaseChart.RefreshLabel() instead.", true)]
public void ReinitChartLabel() { }

View File

@@ -0,0 +1,146 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
using System;
using UnityEngine.EventSystems;
namespace XCharts
{
/// <summary>
/// The base class of all graphs or components.
/// 所有图形的基类。
/// </summary>
public partial class BaseGraph
{
/// <summary>
/// The x of graph.
/// 图形的X
/// </summary>
public float graphX { get { return m_GraphX; } }
/// <summary>
/// The y of graph.
/// 图形的Y
/// </summary>
public float graphY { get { return m_GraphY; } }
/// <summary>
/// The width of graph.
/// 图形的宽
/// </summary>
public float graphWidth { get { return m_GraphWidth; } }
/// <summary>
/// The height of graph.
/// 图形的高
/// </summary>
public float graphHeight { get { return m_GraphHeight; } }
/// <summary>
/// The position of graph.
/// 图形的左下角起始坐标。
/// </summary>
public Vector3 graphPosition { get { return m_GraphPosition; } }
public Rect graphRect { get { return m_GraphRect; } }
/// <summary>
/// The postion of pointer.
/// 鼠标位置。
/// </summary>
public Vector2 pointerPos { get; protected set; }
/// <summary>
/// Whether the mouse pointer is in the chart.
/// 鼠标是否在图表内。
/// </summary>
public bool isPointerInChart { get; protected set; }
/// <summary>
/// 警告信息。
/// </summary>
public string warningInfo { get; protected set; }
public bool isControlledByLayout { get { return m_IsControlledByLayout; } }
/// <summary>
/// 强制开启鼠标事件检测。
/// </summary>
public bool forceOpenRaycastTarget { get { return m_ForceOpenRaycastTarget; } set { m_ForceOpenRaycastTarget = value; } }
/// <summary>
/// 鼠标点击回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onPointerClick { set { m_OnPointerClick = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标按下回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onPointerDown { set { m_OnPointerDown = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标弹起回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onPointerUp { set { m_OnPointerUp = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标进入回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onPointerEnter { set { m_OnPointerEnter = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标退出回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onPointerExit { set { m_OnPointerExit = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标开始拖拽回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onBeginDrag { set { m_OnBeginDrag = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标拖拽回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onDrag { set { m_OnDrag = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标结束拖拽回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onEndDrag { set { m_OnEndDrag = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 鼠标滚动回调。
/// </summary>
public Action<PointerEventData, BaseGraph> onScroll { set { m_OnScroll = value; m_ForceOpenRaycastTarget = true; } }
/// <summary>
/// 设置图形的宽高在非stretch pivot下才有效其他情况需要自己调整RectTransform
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
public virtual void SetSize(float width, float height)
{
if (LayerHelper.IsFixedWidthHeight(rectTransform))
{
rectTransform.sizeDelta = new Vector2(width, height);
}
else
{
Debug.LogError("Can't set size on stretch pivot,you need to modify rectTransform by yourself.");
}
}
/// <summary>
/// Redraw graph in next frame.
/// 在下一帧刷新图形。
/// </summary>
public void RefreshGraph()
{
m_RefreshChart = true;
}
/// <summary>
/// 检测警告信息。
/// </summary>
/// <returns></returns>
public string CheckWarning()
{
warningInfo = CheckHelper.CheckChart(this);
return warningInfo;
}
/// <summary>
/// 移除所有图表子节点,会自动重现初始化。
/// </summary>
public void RemoveChartObject()
{
ChartHelper.DestroyAllChildren(transform);
}
}
}

View File

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

View File

@@ -0,0 +1,61 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
public partial class LiquidChart
{
/// <summary>
/// 容器组件列表。
/// </summary>
public List<Vessel> vessels { get { return m_Vessels; } }
/// <summary>
/// 移除所有容器组件。
/// </summary>
public void RemoveVessel()
{
m_Vessels.Clear();
}
/// <summary>
/// 添加容器组件。
/// </summary>
public void AddVessel(Vessel vessel)
{
m_Vessels.Add(vessel);
}
/// <summary>
/// 添加容器组件。
/// </summary>
public Vessel AddVessel(Vessel.Shape shape, Vector2 center, float radius)
{
var vessel = new Vessel();
vessel.shape = shape;
vessel.radius = radius;
vessel.center[0] = center.x;
vessel.center[1] = center.y;
AddVessel(vessel);
return vessel;
}
/// <summary>
/// 获得指定索引的容器组件。
/// </summary>
/// <param name="radarIndex"></param>
/// <returns></returns>
public Vessel GetVessel(int vesselIndex)
{
if (vesselIndex < 0 || vesselIndex > m_Vessels.Count - 1) return null;
return m_Vessels[vesselIndex];
}
}
}

View File

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

View File

@@ -0,0 +1,22 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
using System;
using UnityEngine.EventSystems;
namespace XCharts
{
public partial class PieChart
{
/// <summary>
/// the callback function of click pie area.
/// 点击饼图区域回调。参数PointerEventDataSerieIndexSerieDataIndex
/// </summary>
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } }
}
}

View File

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

View File

@@ -0,0 +1,30 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
public partial class PolarChart
{
/// <summary>
/// 极坐标。
/// </summary>
public Polar polar { get { return m_Polar; } }
/// <summary>
/// Angle axis of Polar Coordinate.
/// 极坐标系的角度轴。
/// </summary>
public AngleAxis angleAxis { get { return m_AngleAxis; } }
/// <summary>
/// Radial axis of polar coordinate.
/// 极坐标系的径向轴。
/// </summary>
public RadiusAxis radiusAxis { get { return m_RadiusAxis; } }
}
}

View File

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

View File

@@ -24,11 +24,7 @@ namespace XCharts
var serie = m_Series.GetSerie(serieIndex);
if (serie != null)
{
var serieData = serie.GetSerieData(dataIndex);
if (serieData != null)
{
return serieData.UpdateData(1, value);
}
return serie.UpdateData(dataIndex, 1, value);
}
return false;
}
@@ -45,9 +41,9 @@ namespace XCharts
if (serie != null)
{
var flag = true;
foreach (var serieData in serie.data)
for (int i = 0; i < serie.dataCount; i++)
{
if (!serieData.UpdateData(1, value)) flag = false;
if (serie.UpdateData(i, 1, value)) flag = false;
}
return flag;
}

View File

@@ -5,7 +5,9 @@
/* */
/******************************************/
using System;
using UnityEngine;
using UnityEngine.EventSystems;
namespace XCharts
{
@@ -13,9 +15,15 @@ namespace XCharts
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
public class BarChart : CoordinateChart
public partial class BarChart : CoordinateChart
{
protected Action<PointerEventData, int> m_OnPointerClickBar;
protected override void Awake()
{
base.Awake();
raycastTarget = false;
}
#if UNITY_EDITOR
protected override void Reset()
{
@@ -27,9 +35,22 @@ namespace XCharts
for (int i = 0; i < 5; i++)
{
AddXAxisData("x" + (i + 1));
AddData(0, Random.Range(10, 90));
AddData(0, UnityEngine.Random.Range(10, 90));
}
}
#endif
public override void OnPointerDown(PointerEventData eventData)
{
base.OnPointerDown(eventData);
if (m_OnPointerClickBar == null) return;
if (pointerPos == Vector2.zero) return;
UpdateTooltipValue(pointerPos);
var dataIndex = m_Tooltip.runtimeDataIndex[0];
if (dataIndex >= 0)
{
m_OnPointerClickBar(eventData, dataIndex);
}
}
}
}

View File

@@ -1,7 +1,5 @@
fileFormatVersion: 2
guid: 535d2697503c2a94a887354e22a5414d
timeCreated: 1536795169
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -78,6 +78,7 @@ namespace XCharts
[SerializeField] protected bool m_LogBaseE = false;
[SerializeField] protected int m_CeilRate = 0;
[SerializeField] protected bool m_Inverse = false;
[SerializeField] private bool m_Clockwise = true;
[SerializeField] protected List<string> m_Data = new List<string>();
[SerializeField] protected AxisLine m_AxisLine = AxisLine.defaultAxisLine;
[SerializeField] protected AxisName m_AxisName = AxisName.defaultAxisName;
@@ -90,7 +91,7 @@ namespace XCharts
[NonSerialized] private bool m_NeedUpdateFilterData;
/// <summary>
/// Set this to false to prevent the axis from showing.
/// Whether to show axis.
/// 是否显示坐标轴。
/// </summary>
public bool show
@@ -117,7 +118,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_MinMaxType, value)) SetAllDirty(); }
}
/// <summary>
/// The minimun value of axis.
/// The minimun value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最小值当minMaxType为Custom时有效。
/// </summary>
public float min
@@ -126,7 +127,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_Min, value)) SetAllDirty(); }
}
/// <summary>
/// The maximum value of axis.
/// The maximum value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最大值当minMaxType为Custom时有效。
/// </summary>
public float max
@@ -144,8 +145,8 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_SplitNumber, value)) SetAllDirty(); }
}
/// <summary>
/// 强制设置坐标轴分割间隔。无法在类目轴中使用。
/// Compulsively set segmentation interval for axis.This is unavailable for category axis.
/// 强制设置坐标轴分割间隔。无法在类目轴中使用。
/// </summary>
public float interval
{
@@ -153,12 +154,12 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_Interval, value)) SetAllDirty(); }
}
/// <summary>
/// The boundary gap on both sides of a coordinate axis.
/// 坐标轴两边是否留白。
/// The boundary gap on both sides of a coordinate axis, which is valid only for category axis with type: 'Category'.
/// 坐标轴两边是否留白。只对类目轴有效。
/// </summary>
public bool boundaryGap
{
get { return m_BoundaryGap; }
get { return IsCategory() ? m_BoundaryGap : false; }
set { if (PropertyUtility.SetStruct(ref m_BoundaryGap, value)) SetAllDirty(); }
}
/// <summary>
@@ -168,9 +169,14 @@ namespace XCharts
public float logBase
{
get { return m_LogBase; }
set { if (PropertyUtility.SetStruct(ref m_LogBase, value)) SetAllDirty(); }
set
{
if (value <= 0 || value == 1) value = 10;
if (PropertyUtility.SetStruct(ref m_LogBase, value)) SetAllDirty();
}
}
/// <summary>
/// On the log axis, if base e is the natural number, and is true, logBase fails.
/// 对数轴是否以自然数 e 为底数,为 true 时 logBase 失效。
/// </summary>
public bool logBaseE
@@ -189,6 +195,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_MaxCache, value < 0 ? 0 : value)) SetAllDirty(); }
}
/// <summary>
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
/// 最大最小值向上取整的倍率。默认为0时自动计算。
/// </summary>
public int ceilRate
@@ -206,6 +213,15 @@ namespace XCharts
set { if (m_Type == AxisType.Value && PropertyUtility.SetStruct(ref m_Inverse, value)) SetAllDirty(); }
}
/// <summary>
/// Whether the positive position of axis is in clockwise. True for clockwise by default.
/// 刻度增长是否按顺时针,默认顺时针。
/// </summary>
public bool clockwise
{
get { return m_Clockwise; }
set { if (PropertyUtility.SetStruct(ref m_Clockwise, value)) SetAllDirty(); }
}
/// <summary>
/// Category data, available in type: 'Category' axis.
/// 类目数据在类目轴type: 'category')中有效。
/// </summary>
@@ -291,6 +307,7 @@ namespace XCharts
splitLine.ClearVerticesDirty();
splitArea.ClearVerticesDirty();
}
public int index { get; internal set; }
/// <summary>
/// the axis label text list.
/// 坐标轴刻度标签的Text列表。
@@ -732,7 +749,7 @@ namespace XCharts
public float GetLogValue(float value)
{
if (value <= 0) return 0;
if (value <= 0 || value == 1) return 0;
return logBaseE ? Mathf.Log(value) : Mathf.Log(value, logBase);
}
@@ -805,4 +822,77 @@ namespace XCharts
}
}
}
/// <summary>
/// Radial axis of polar coordinate.
/// 极坐标系的径向轴。
/// </summary>
[System.Serializable]
public class RadiusAxis : Axis
{
public static RadiusAxis defaultRadiusAxis
{
get
{
var axis = new RadiusAxis
{
m_Show = true,
m_Type = AxisType.Value,
m_Min = 0,
m_Max = 0,
m_SplitNumber = 5,
m_BoundaryGap = false,
m_Data = new List<string>(5),
};
axis.splitLine.show = true;
axis.splitLine.lineStyle.type = LineStyle.Type.Solid;
axis.axisLabel.textLimit.enable = false;
return axis;
}
}
}
/// <summary>
/// Angle axis of Polar Coordinate.
/// 极坐标系的角度轴。
/// </summary>
[System.Serializable]
public class AngleAxis : Axis
{
[SerializeField] private float m_StartAngle = 90;
/// <summary>
/// Starting angle of axis. 90 degrees by default, standing for top position of center. 0 degree stands for right position of center.
/// 起始刻度的角度,默认为 90 度即圆心的正上方。0 度为圆心的正右方。
/// </summary>
public float startAngle
{
get { return m_StartAngle; }
set { if (PropertyUtility.SetStruct(ref m_StartAngle, value)) SetAllDirty(); }
}
public float runtimeStartAngle { get; set; }
public static AngleAxis defaultAngleAxis
{
get
{
var axis = new AngleAxis
{
m_Show = true,
m_Type = AxisType.Value,
m_SplitNumber = 13,
m_BoundaryGap = false,
m_Data = new List<string>(13),
};
axis.splitLine.show = true;
axis.splitLine.lineStyle.type = LineStyle.Type.Solid;
axis.axisLabel.textLimit.enable = false;
axis.minMaxType = AxisMinMaxType.Custom;
axis.min = 0;
axis.max = 360;
return axis;
}
}
}
}

View File

@@ -13,6 +13,11 @@ using UnityEngine.UI;
namespace XCharts
{
/// <summary>
/// Background component.
/// Due to the limitations of the framework, there are two limitations to the use of background component:
/// 1: The parent node of chart cannot have a layout control class component.
/// 2: The parent node of Chart can only have one child node of the current chart.
///
/// 背景组件。
/// 由于框架的局限性,背景组件使用有以下两个限制:
/// 1chart的父节点不能有布局控制类组件。
@@ -25,14 +30,12 @@ namespace XCharts
[SerializeField] private bool m_Show = true;
[SerializeField] private Sprite m_Image;
[SerializeField] private Image.Type m_ImageType;
[SerializeField] private float m_Left;
[SerializeField] private float m_Right;
[SerializeField] private float m_Top;
[SerializeField] private float m_Bottom;
[SerializeField] private Color m_ImageColor = Color.white;
[SerializeField] private bool m_HideThemeBackgroundColor = true;
/// <summary>
/// Whether to enable the background component. However,
/// the ability to activate the background component is subject to other conditions.
/// 是否启用背景组件。但能否激活背景组件还要受其他条件限制。
/// </summary>
public bool show
@@ -41,6 +44,7 @@ namespace XCharts
internal set { if (PropertyUtility.SetStruct(ref m_Show, value)) SetComponentDirty(); }
}
/// <summary>
/// the image of background.
/// 背景图。
/// </summary>
public Sprite image
@@ -50,6 +54,7 @@ namespace XCharts
}
/// <summary>
/// the fill type of background image.
/// 背景图填充类型。
/// </summary>
public Image.Type imageType
@@ -58,42 +63,6 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_ImageType, value)) SetComponentDirty(); }
}
/// <summary>
/// Distance between background component and the left side of the container.
/// background 组件离容器左侧的距离。
/// </summary>
public float left
{
get { return m_Left; }
set { if (PropertyUtility.SetStruct(ref m_Left, value)) SetComponentDirty(); }
}
/// <summary>
/// Distance between background component and the right side of the container.
/// background 组件离容器右侧的距离。
/// </summary>
public float right
{
get { return m_Right; }
set { if (PropertyUtility.SetStruct(ref m_Right, value)) SetComponentDirty(); }
}
/// <summary>
/// Distance between background component and the top side of the container.
/// background 组件离容器上侧的距离。
/// </summary>
public float top
{
get { return m_Top; }
set { if (PropertyUtility.SetStruct(ref m_Top, value)) SetComponentDirty(); }
}
/// <summary>
/// Distance between background component and the bottom side of the container.
/// background 组件离容器下侧的距离。
/// </summary>
public float bottom
{
get { return m_Bottom; }
set { if (PropertyUtility.SetStruct(ref m_Bottom, value)) SetComponentDirty(); }
}
/// <summary>
/// 背景图颜色。
/// </summary>
@@ -104,6 +73,7 @@ namespace XCharts
}
/// <summary>
/// Whether to hide the background color set in the theme when the background component is on.
/// 当background组件开启时是否隐藏主题中设置的背景色。
/// </summary>
public bool hideThemeBackgroundColor
@@ -115,7 +85,7 @@ namespace XCharts
/// <summary>
/// 是否已激活
/// </summary>
public bool runtimeActive{get;internal set;}
public bool runtimeActive { get; internal set; }
public static Background defaultBackground
{
@@ -126,10 +96,6 @@ namespace XCharts
m_Show = false,
m_Image = null,
m_ImageType = Image.Type.Sliced,
m_Left = 0,
m_Right = 0,
m_Top = 0,
m_Bottom = 0,
m_ImageColor = Color.white,
m_HideThemeBackgroundColor = true,
};

View File

@@ -14,6 +14,7 @@ namespace XCharts
/// DataZoom component is used for zooming a specific area,
/// which enables user to investigate data in detail,
/// or get an overview of the data, or get rid of outlier points.
///
/// <para>DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。</para>
/// </summary>
[System.Serializable]
@@ -23,6 +24,7 @@ namespace XCharts
/// Generally dataZoom component zoom or roam coordinate system through data filtering
/// and set the windows of axes internally.
/// Its behaviours vary according to filtering mode settings.
///
/// dataZoom 的运行原理是通过 数据过滤 来达到 数据窗口缩放 的效果。数据过滤模式的设置不同,效果也不同。
/// </summary>
public enum FilterMode
@@ -30,17 +32,20 @@ namespace XCharts
/// <summary>
/// data that outside the window will be filtered, which may lead to some changes of windows of other axes.
/// For each data item, it will be filtered if one of the relevant dimensions is out of the window.
///
/// 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只要有一个维度在数据窗口外,整个数据项就会被过滤掉。
/// </summary>
Filter,
/// <summary>
/// data that outside the window will be filtered, which may lead to some changes of windows of other axes.
/// For each data item, it will be filtered only if all of the relevant dimensions are out of the same side of the window.
///
/// 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只有当全部维度都在数据窗口同侧外部,整个数据项才会被过滤掉。
/// </summary>
WeakFilter,
/// <summary>
/// data that outside the window will be set to NaN, which will not lead to changes of windows of other axes.
///
/// 当前数据窗口外的数据,被 设置为空。即 不会 影响其他轴的数据范围。
/// </summary>
Empty,
@@ -123,6 +128,10 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_YAxisIndex, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether built-in support is supported.
/// Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging,
/// mouse wheel, finger swiping (on the touch screen).
///
/// 是否支持内置。内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。
/// </summary>
public bool supportInside
@@ -131,6 +140,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_SupportInside, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether a slider is supported. There are separate sliders on which the user zooms or roams.
/// 是否支持滑动条。有单独的滑动条,用户在滑动条上进行缩放或漫游。
/// </summary>
public bool supportSlider
@@ -159,6 +169,7 @@ namespace XCharts
/// <summary>
/// Whether to show detail, that is, show the detailed data information when dragging.
/// 是否显示detail即拖拽时候显示详细数值信息。
/// [default: false]
/// </summary>
public bool showDetail
{
@@ -225,7 +236,7 @@ namespace XCharts
}
/// <summary>
/// The start percentage of the window out of the data extent, in the range of 0 ~ 100.
/// default:30
/// [default:30].
/// 数据窗口范围的起始百分比。范围是0 ~ 100。
/// </summary>
public float start
@@ -244,6 +255,7 @@ namespace XCharts
set { m_End = value; if (m_End < 0) m_End = 0; if (m_End > 100) m_End = 100; SetVerticesDirty(); }
}
/// <summary>
/// Minimum number of display data. Minimum number of data displayed when DataZoom is enlarged to maximum.
/// 最小显示数据个数。当DataZoom放大到最大时最小显示的数据个数。
/// </summary>
public int minShowNum

View File

@@ -11,6 +11,8 @@ using UnityEngine;
namespace XCharts
{
/// <summary>
/// Legend component.The legend component shows different sets of tags, colors, and names.
/// You can control which series are not displayed by clicking on the legend.
/// 图例组件。
/// 图例组件展现了不同系列的标记,颜色和名字。可以通过点击图例控制哪些系列不显示。
/// </summary>
@@ -19,7 +21,6 @@ namespace XCharts
{
/// <summary>
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
/// It is enabled by default, and you may set it to be false to disabled it.
/// 图例选择的模式,控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
/// </summary>
public enum SelectedMode
@@ -64,6 +65,7 @@ namespace XCharts
/// <summary>
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
/// 选择模式。控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
/// [default:SelectedMode.Multiple]
/// </summary>
/// <value></value>
public SelectedMode selectedMode
@@ -74,6 +76,7 @@ namespace XCharts
/// <summary>
/// Specify whether the layout of legend component is horizontal or vertical.
/// 布局方式是横还是竖。
/// [default:Orient.Horizonal]
/// </summary>
public Orient orient
{
@@ -83,6 +86,7 @@ namespace XCharts
/// <summary>
/// The location of legend.
/// 图例显示的位置。
/// [default:Location.defaultTop]
/// </summary>
public Location location
{
@@ -92,6 +96,7 @@ namespace XCharts
/// <summary>
/// Image width of legend symbol.
/// 图例标记的图形宽度。
/// [default:24f]
/// </summary>
public float itemWidth
{
@@ -101,6 +106,7 @@ namespace XCharts
/// <summary>
/// Image height of legend symbol.
/// 图例标记的图形高度。
/// [default:12f]
/// </summary>
public float itemHeight
{
@@ -110,6 +116,7 @@ namespace XCharts
/// <summary>
/// The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout.
/// 图例每项之间的间隔。横向布局时为水平间隔,纵向布局时为纵向间隔。
/// [default:10f]
/// </summary>
public float itemGap
{
@@ -119,6 +126,7 @@ namespace XCharts
/// <summary>
/// Whether the legend symbol matches the color automatically.
/// 图例标记的图形是否自动匹配颜色。
/// [default:true]
/// </summary>
public bool itemAutoColor
{
@@ -126,8 +134,10 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_ItemAutoColor, value)) SetComponentDirty(); }
}
/// <summary>
/// Legend content string template formatter. Support for wrapping lines with \n. Template:{name}.
/// 图例内容字符串模版格式器。支持用 \n 换行。
/// 模板变量为图例名称 {name}
/// 模板变量为图例名称 {name}
/// [default:null]
/// </summary>
public string formatter
{
@@ -188,38 +198,22 @@ namespace XCharts
/// </summary>
/// <value></value>
public Dictionary<string, LegendItem> buttonList { get { return m_DataBtnList; } }
public float runtimeWidth
{
get
{
var width = 0f;
foreach (var kv in buttonList)
{
if (orient == Orient.Horizonal)
width += kv.Value.width + m_ItemGap;
else if (kv.Value.width > width)
width = kv.Value.width;
}
return orient == Orient.Horizonal ? width - m_ItemGap : width;
}
}
public float runtimeHeight
{
get
{
var height = 0f;
foreach (var kv in buttonList)
{
if (orient == Orient.Vertical)
height += kv.Value.height + m_ItemGap;
else if (kv.Value.height > height)
height = kv.Value.height;
}
return orient == Orient.Vertical ? height - m_ItemGap : height;
}
}
/// <summary>
/// 运行时图例的总宽度
/// </summary>
public float runtimeWidth { get; internal set; }
/// <summary>
/// 运行时图例的总高度
/// </summary>
public float runtimeHeight { get; internal set; }
/// <summary>
/// 多列时每列的宽度
/// </summary>
public Dictionary<int, float> runtimeEachWidth { get; internal set; }
/// <summary>
/// 单列高度
/// </summary>
public float runtimeEachHeight { get; internal set; }
/// <summary>
/// 一个在顶部居中显示的默认图例。
@@ -237,6 +231,7 @@ namespace XCharts
m_ItemWidth = 24.0f,
m_ItemHeight = 12.0f,
m_ItemGap = 10f,
runtimeEachWidth = new Dictionary<int, float>()
};
legend.location.top = 30;
legend.textStyle.offset = new Vector2(2, 0);
@@ -246,7 +241,8 @@ namespace XCharts
}
/// <summary>
/// 清空
/// Clear legend data.
/// 清空。
/// </summary>
public void ClearData()
{
@@ -255,6 +251,7 @@ namespace XCharts
}
/// <summary>
/// Whether include in legend data by the specified name.
/// 是否包括由指定名字的图例
/// </summary>
/// <param name="name"></param>
@@ -265,7 +262,8 @@ namespace XCharts
}
/// <summary>
/// 移除指定名字的图例
/// Removes the legend with the specified name.
/// 移除指定名字的图例。
/// </summary>
/// <param name="name"></param>
public void RemoveData(string name)
@@ -278,7 +276,8 @@ namespace XCharts
}
/// <summary>
/// 添加图例项
/// Add legend data.
/// 添加图例。
/// </summary>
/// <param name="name"></param>
public void AddData(string name)
@@ -291,7 +290,8 @@ namespace XCharts
}
/// <summary>
/// 获得指定索引的图例
/// Gets the legend for the specified index.
/// 获得指定索引的图例。
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
@@ -305,7 +305,8 @@ namespace XCharts
}
/// <summary>
/// 获得指定图例的索引
/// Gets the index of the specified legend.
/// 获得指定图例的索引。
/// </summary>
/// <param name="legendName"></param>
/// <returns></returns>
@@ -315,7 +316,8 @@ namespace XCharts
}
/// <summary>
/// 移除所有图例按钮
/// Remove all legend buttons.
/// 移除所有图例按钮。
/// </summary>
public void RemoveButton()
{
@@ -323,7 +325,8 @@ namespace XCharts
}
/// <summary>
/// 给图例绑定按钮
/// Bind buttons to legends.
/// 给图例绑定按钮。
/// </summary>
/// <param name="name"></param>
/// <param name="btn"></param>
@@ -336,7 +339,8 @@ namespace XCharts
}
/// <summary>
/// 更新图例按钮颜色
/// Update the legend button color.
/// 更新图例按钮颜色。
/// </summary>
/// <param name="name"></param>
/// <param name="color"></param>
@@ -348,6 +352,12 @@ namespace XCharts
}
}
/// <summary>
/// Update the text color of legend.
/// 更新图例文字颜色。
/// </summary>
/// <param name="name"></param>
/// <param name="color"></param>
public void UpdateContentColor(string name, Color color)
{
if (m_DataBtnList.ContainsKey(name))
@@ -356,6 +366,12 @@ namespace XCharts
}
}
/// <summary>
/// Gets the legend button for the specified index.
/// 获得指定索引的图例按钮。
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public Sprite GetIcon(int index)
{
if (index >= 0 && index < m_Icons.Count)
@@ -369,7 +385,8 @@ namespace XCharts
}
/// <summary>
/// 参数变更时的回调处理
/// Callback handling when parameters change.
/// 参数变更时的回调处理。
/// </summary>
public void OnChanged()
{
@@ -377,7 +394,8 @@ namespace XCharts
}
/// <summary>
/// 从json字符串解析数据json格式如['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
/// Parsing the data from the JSON string.
/// 从json字符串解析数据json格式如['legend1','legend2','legend3','legend4','legend5']
/// </summary>
/// <param name="jsonData"></param>
public override void ParseJsonData(string jsonData)
@@ -387,6 +405,11 @@ namespace XCharts
SetComponentDirty();
}
/// <summary>
/// 获得图例格式化后的显示内容。
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
public string GetFormatterContent(string category)
{
if (string.IsNullOrEmpty(m_Formatter))

View File

@@ -0,0 +1,94 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using System;
using UnityEngine;
namespace XCharts
{
/// <summary>
/// Polar coordinate can be used in scatter and line chart. Every polar coordinate has an angleAxis and a radiusAxis.
/// <para>
/// 极坐标系组件。
/// 极坐标系,可以用于散点图和折线图。每个极坐标系拥有一个角度轴和一个半径轴。
/// </para>
/// </summary>
[Serializable]
public class Polar : MainComponent
{
[SerializeField] private bool m_Show = true;
[SerializeField] private float[] m_Center = new float[2] { 0.5f, 0.5f };
[SerializeField] private float m_Radius = 100;
[SerializeField] private Color m_BackgroundColor;
/// <summary>
/// Whether to show the polor component.
/// 是否显示极坐标。
/// </summary>
public bool show
{
get { return m_Show; }
set { if (PropertyUtility.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
}
/// <summary>
/// [default:[0.5f,0.45f]]The center of ploar. 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.
/// 极坐标的中心点。数组的第一项是横坐标,第二项是纵坐标。
/// 当值为0-1之间时表示百分比设置成百分比时第一项是相对于容器宽度第二项是相对于容器高度。
/// </summary>
public float[] center
{
get { return m_Center; }
set { if (value != null) { m_Center = value; SetAllDirty(); } }
}
/// <summary>
/// [default:0.35f]the radius of polar.
/// 极坐标的半径。
/// </summary>
public float radius
{
get { return m_Radius; }
set { if (PropertyUtility.SetStruct(ref m_Radius, value)) SetAllDirty(); }
}
/// <summary>
/// [default:Color.clear]Background color of polar, which is transparent by default.
/// 极坐标的背景色,默认透明。
/// </summary>
public Color backgroundColor
{
get { return m_BackgroundColor; }
set { if (PropertyUtility.SetColor(ref m_BackgroundColor, value)) SetVerticesDirty(); }
}
/// <summary>
/// the center position of polar in container.
/// 极坐标在容器中的具体中心点。
/// </summary>
public Vector3 runtimeCenterPos { get; internal set; }
/// <summary>
/// the true radius of polar.
/// 极坐标的运行时实际半径。
/// </summary>
public float runtimeRadius { get; internal set; }
public static Polar defaultPolar
{
get
{
var polar = new Polar
{
m_Show = true,
m_Radius = 0.35f,
};
polar.center[0] = 0.5f;
polar.center[1] = 0.45f;
return polar;
}
}
}
}

View File

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

View File

@@ -14,7 +14,7 @@ using UnityEngine.UI;
namespace XCharts
{
/// <summary>
/// Coordinate for radar charts.
/// Radar coordinate conponnet for radar charts.
/// 雷达图坐标系组件,只适用于雷达图。
/// </summary>
[System.Serializable]
@@ -30,15 +30,18 @@ namespace XCharts
Circle
}
/// <summary>
/// The position type of radar.
/// 显示位置。
/// </summary>
public enum PositionType
{
/// <summary>
/// Display at the vertex.
/// 显示在顶点处。
/// </summary>
Vertice,
/// <summary>
/// Display at the middle of line.
/// 显示在两者之间。
/// </summary>
Between,
@@ -56,9 +59,10 @@ namespace XCharts
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
/// <summary>
/// The name of indicator.
/// 指示器名称。
/// </summary>
public string name { get { return m_Name; } set { m_Name = value; } }
public string name { get { return FormatterHelper.TrimAndReplaceLine(m_Name); } set { m_Name = value; } }
/// <summary>
/// The maximum value of indicator, with default value of 0, but we recommend to set it manually.
/// 指示器的最大值,默认为 0 无限制。
@@ -89,7 +93,8 @@ namespace XCharts
[SerializeField] private bool m_Indicator = true;
[SerializeField] private PositionType m_PositionType = PositionType.Vertice;
[SerializeField] private float m_IndicatorGap = 10;
[SerializeField] protected int m_CeilRate = 0;
[SerializeField] private int m_CeilRate = 0;
[SerializeField] private bool m_IsAxisTooltip;
[SerializeField] private List<Indicator> m_IndicatorList = new List<Indicator>();
/// <summary>
/// Radar render type, in which 'Polygon' and 'Circle' are supported.
@@ -157,6 +162,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_Indicator, value)) SetComponentDirty(); }
}
/// <summary>
/// The gap of indicator and radar.
/// 指示器和雷达的间距。
/// </summary>
public float indicatorGap
@@ -165,6 +171,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_IndicatorGap, value)) SetComponentDirty(); }
}
/// <summary>
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
/// 最大最小值向上取整的倍率。默认为0时自动计算。
/// </summary>
public int ceilRate
@@ -173,7 +180,16 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_CeilRate, value < 0 ? 0 : value)) SetAllDirty(); }
}
/// <summary>
/// /// 显示位置类型
/// 是否Tooltip显示轴线上的所有数据
/// </summary>
public bool isAxisTooltip
{
get { return m_IsAxisTooltip; }
set { if (PropertyUtility.SetStruct(ref m_IsAxisTooltip, value)) SetAllDirty(); }
}
/// <summary>
/// The position type of indicator.
/// 显示位置类型。
/// </summary>
public PositionType positionType
{
@@ -186,6 +202,7 @@ namespace XCharts
/// </summary>
public List<Indicator> indicatorList { get { return m_IndicatorList; } }
public int index { get; internal set; }
/// <summary>
/// the center position of radar in container.
/// 雷达图在容器中的具体中心点。

View File

@@ -56,6 +56,10 @@ namespace XCharts
/// 环形图。只支持一个数据的环形图。
/// </summary>
Ring,
/// <summary>
/// 水位图。
/// </summary>
Liquid,
}
/// <summary>
@@ -185,22 +189,28 @@ namespace XCharts
public enum SampleType
{
/// <summary>
/// Take a peak. When the average value of the filter point is greater than or equal to 'sampleAverage',
/// take the maximum value; If you do it the other way around, you get the minimum.
/// 取峰值。
/// </summary>
Peak,
/// <summary>
/// Take the average of the filter points.
/// 取过滤点的平均值。
/// </summary>
Average,
/// <summary>
/// Take the maximum value of the filter point.
/// 取过滤点的最大值。
/// </summary>
Max,
/// <summary>
/// Take the minimum value of the filter point.
/// 取过滤点的最小值。
/// </summary>
Min,
/// <summary>
/// Take the sum of the filter points.
/// 取过滤点的和。
/// </summary>
Sum
@@ -218,6 +228,7 @@ namespace XCharts
[SerializeField] private string m_Stack;
[SerializeField] [Range(0, 1)] private int m_AxisIndex = 0;
[SerializeField] private int m_RadarIndex = 0;
[SerializeField] private int m_VesselIndex = 0;
[SerializeField] protected int m_MinShow;
[SerializeField] protected int m_MaxShow;
[SerializeField] protected int m_MaxCache;
@@ -273,6 +284,11 @@ namespace XCharts
[SerializeField] private bool m_ShowAsPositiveNumber = false;
[SerializeField] private bool m_Large = true;
[SerializeField] private int m_LargeThreshold = 200;
[SerializeField] private bool m_AvoidLabelOverlap = false;
[SerializeField] private float m_WaveHeight = 10f;
[SerializeField] private float m_WaveLength = 20f;
[SerializeField] private float m_WaveSpeed = 5f;
[SerializeField] private float m_WaveOffset = 0f;
[SerializeField] private RadarType m_RadarType = RadarType.Multiple;
[SerializeField] private List<SerieData> m_Data = new List<SerieData>();
@@ -315,6 +331,7 @@ namespace XCharts
set { if (PropertyUtility.SetClass(ref m_Name, value)) { SetVerticesDirty(); SetNameDirty(); } }
}
/// <summary>
/// Legend name. When the serie name is not empty, the legend name is the series name; Otherwise, it is index.
/// 图例名称。当系列名称不为空时图例名称即为系列名称反之则为索引index。
/// </summary>
public string legendName { get { return string.IsNullOrEmpty(name) ? ChartCached.IntToStr(index) : name; } }
@@ -346,6 +363,15 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_RadarIndex, value)) SetVerticesDirty(); }
}
/// <summary>
/// Index of vesel component that liquid chart uses.
/// 水位图所使用的 vessel 组件的 index。
/// </summary>
public int vesselIndex
{
get { return m_VesselIndex; }
set { if (PropertyUtility.SetStruct(ref m_VesselIndex, value)) SetVerticesDirty(); }
}
/// <summary>
/// The min number of data to show in chart.
/// 系列所显示数据的最小索引
/// </summary>
@@ -787,6 +813,47 @@ namespace XCharts
}
}
/// <summary>
/// 在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
/// </summary>
public bool avoidLabelOverlap
{
get { return m_AvoidLabelOverlap; }
set { if (PropertyUtility.SetStruct(ref m_AvoidLabelOverlap, value)) SetVerticesDirty(); }
}
/// <summary>
/// Wave length of the wave, which is relative to the diameter.
/// 波长。为0-1小数时指直线的百分比。
/// </summary>
public float waveLength
{
get { return m_WaveLength; }
set { if (PropertyUtility.SetStruct(ref m_WaveLength, value)) SetVerticesDirty(); }
}
/// <summary>
/// 波高。
/// </summary>
public float waveHeight
{
get { return m_WaveHeight; }
set { if (PropertyUtility.SetStruct(ref m_WaveHeight, value)) SetVerticesDirty(); }
}
/// <summary>
/// 波偏移。
/// </summary>
public float waveOffset
{
get { return m_WaveOffset; }
set { if (PropertyUtility.SetStruct(ref m_WaveOffset, value)) SetVerticesDirty(); }
}
/// <summary>
/// 波速。正数时左移,负数时右移。
/// </summary>
public float waveSpeed
{
get { return m_WaveSpeed; }
set { if (PropertyUtility.SetStruct(ref m_WaveSpeed, value)) SetVerticesDirty(); }
}
/// <summary>
/// 系列中的数据内容数组。SerieData可以设置1到n维数据。
/// </summary>
public List<SerieData> data { get { return m_Data; } }
@@ -882,7 +949,8 @@ namespace XCharts
/// 饼图的数据项之和
/// </summary>
public float runtimePieDataTotal { get; internal set; }
internal int runtimeLastCheckDataCount { get; set; }
public float runtimeWaveSpeed { get; internal set; }
internal float runtimeCheckValue { get; set; }
public bool nameDirty { get { return m_NameDirty; } }
private void SetNameDirty()
@@ -1027,6 +1095,7 @@ namespace XCharts
{
if (sdata.show)
total += sdata.GetCurrData(1, animation.GetUpdateAnimationDuration());
//total += sdata.GetData(1);
}
return total;
}
@@ -1326,6 +1395,17 @@ namespace XCharts
}
}
public float GetDataTotal(int dimension)
{
float total = 0;
foreach (var sdata in data)
{
if (sdata.show)
total += sdata.GetData(dimension);
}
return total;
}
/// <summary>
/// 获得系列的数据列表
/// </summary>
@@ -1424,7 +1504,9 @@ namespace XCharts
{
if (index >= 0 && index < m_Data.Count)
{
var flag = m_Data[index].UpdateData(dimension, value);
var animationOpen = animation.enable;
var animationDuration = animation.GetUpdateAnimationDuration();
var flag = m_Data[index].UpdateData(dimension, value, animationOpen, animationDuration);
if (flag) SetVerticesDirty();
return flag;
}
@@ -1444,8 +1526,10 @@ namespace XCharts
if (index >= 0 && index < m_Data.Count && values != null)
{
var serieData = m_Data[index];
var animationOpen = animation.enable;
var animationDuration = animation.GetUpdateAnimationDuration();
for (int i = 0; i < values.Count; i++)
serieData.UpdateData(i, values[i]);
serieData.UpdateData(i, values[i], animationOpen, animationDuration);
SetVerticesDirty();
return true;
}
@@ -1474,22 +1558,21 @@ namespace XCharts
public void ClearHighlight()
{
highlighted = false;
foreach (var sd in m_Data)
foreach (var serieData in m_Data)
{
sd.highlighted = false;
serieData.highlighted = false;
}
}
/// <summary>
/// 设置指定索引的数据为高亮状态
/// </summary>
/// <param name="index"></param>
public void SetHighlight(int index)
public void SetHighlight(int index, bool flag)
{
if (index <= 0) return;
for (int i = 0; i < m_Data.Count; i++)
var serieData = GetSerieData(index);
if (serieData != null)
{
m_Data[i].highlighted = index == i;
serieData.highlighted = flag;
}
}
@@ -1499,13 +1582,6 @@ namespace XCharts
else return m_BarWidth * categoryWidth;
}
internal float GetBarGap(float categoryWidth)
{
if (m_BarGap == -1) return 0;
else if (m_BarGap <= 1) return GetBarWidth(categoryWidth) * m_BarGap;
else return m_BarGap;
}
/// <summary>
/// 设置所有数据的图标是否显示
/// </summary>
@@ -1560,15 +1636,6 @@ namespace XCharts
}
}
internal bool IsNeedShowDataIcon()
{
foreach (var data in m_Data)
{
if (data.iconStyle.show) return true;
}
return false;
}
public bool IsIgnoreIndex(int index, int dimension)
{
if (m_Ignore)

View File

@@ -259,19 +259,21 @@ namespace XCharts
if (type == SerieType.Scatter)
{
serie.symbol.show = true;
serie.symbol.type = SerieSymbolType.Circle;
serie.symbol.size = 20f;
serie.symbol.selectedSize = 30f;
}
else if (type == SerieType.Line)
{
serie.symbol.show = true;
serie.symbol.type = SerieSymbolType.EmptyCircle;
serie.symbol.size = 2.5f;
serie.symbol.selectedSize = 5f;
}
else
{
serie.symbol.type = SerieSymbolType.None;
serie.symbol.show = false;
}
serie.animation.Restart();
m_Series.Add(serie);

View File

@@ -298,11 +298,11 @@ namespace XCharts
{
if (m_Font == null && m_CustomFont == null)
{
sb.AppendFormat("warning:theme->font is null");
sb.AppendFormat("warning:theme->font is null\n");
}
if (m_ColorPalette.Length == 0 && m_CustomColorPalette.Count == 0)
{
sb.AppendFormat("warning:theme->colorPalette is empty");
sb.AppendFormat("warning:theme->colorPalette is empty\n");
}
for (int i = 0; i < m_ColorPalette.Length; i++)
{

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