mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 11:40:13 +00:00
Compare commits
72 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d2f83169d | ||
|
|
a7c4e24555 | ||
|
|
6fad4fcccc | ||
|
|
95e40c6f1a | ||
|
|
8e30a370b5 | ||
|
|
d94e304058 | ||
|
|
34dc49004e | ||
|
|
61c6d68c4c | ||
|
|
50a666fecc | ||
|
|
626a187758 | ||
|
|
dee06f8d6f | ||
|
|
e6eea34a45 | ||
|
|
76b8146e53 | ||
|
|
240eda0be2 | ||
|
|
6fa093bc80 | ||
|
|
5884fd99dd | ||
|
|
f177799202 | ||
|
|
2d3f5dd51d | ||
|
|
b9ca646e0c | ||
|
|
c157c07b0d | ||
|
|
82d0788905 | ||
|
|
a7ac0277a7 | ||
|
|
3f36c27384 | ||
|
|
e4da5e30dc | ||
|
|
bfa68fd037 | ||
|
|
c002ac071b | ||
|
|
5c2ea52118 | ||
|
|
0e25a23ed2 | ||
|
|
41a9606bee | ||
|
|
6f6248be77 | ||
|
|
2b5275b15d | ||
|
|
ca26fd7c21 | ||
|
|
a2e790561e | ||
|
|
f0e94d35b6 | ||
|
|
76f640f64d | ||
|
|
9d8dc80494 | ||
|
|
bc1d2ac095 | ||
|
|
913c8e1fb2 | ||
|
|
634bb45dc4 | ||
|
|
e4827ac262 | ||
|
|
9ad8a86ffc | ||
|
|
23a8ce52d1 | ||
|
|
38584f618b | ||
|
|
84c47e0d84 | ||
|
|
7ff1405de5 | ||
|
|
acae09bf28 | ||
|
|
b304bd2033 | ||
|
|
72c29235d8 | ||
|
|
5f18f060e3 | ||
|
|
a281028a22 | ||
|
|
fe702f3447 | ||
|
|
6888ba96e3 | ||
|
|
b261ef0573 | ||
|
|
64d0b047b3 | ||
|
|
5c395ade25 | ||
|
|
5149376806 | ||
|
|
d8f739cbdf | ||
|
|
71fb45af9f | ||
|
|
ca63d041b9 | ||
|
|
8fccfdb5fc | ||
|
|
f08ae794ae | ||
|
|
8efa8145b1 | ||
|
|
e247ad9e71 | ||
|
|
645506a6fd | ||
|
|
c5ef7e765b | ||
|
|
3949018555 | ||
|
|
34b0a97198 | ||
|
|
de3e482687 | ||
|
|
8dbbbd7405 | ||
|
|
3316fce8a5 | ||
|
|
f85f96a560 | ||
|
|
8f6f5790b6 |
@@ -1,7 +1,14 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
[master](#master)
|
[branch-2.0](#branch-2.0)
|
||||||
|
[v2.8.2](#v2.8.2)
|
||||||
|
[v2.8.1](#v2.8.1)
|
||||||
|
[v2.8.0](#v2.8.0)
|
||||||
|
[v2.7.0](#v2.7.0)
|
||||||
|
[v2.6.0](#v2.6.0)
|
||||||
|
[v2.5.0](#v2.5.0)
|
||||||
|
[v2.4.0](#v2.4.0)
|
||||||
[v2.3.0](#v2.3.0)
|
[v2.3.0](#v2.3.0)
|
||||||
[v2.2.3](#v2.2.3)
|
[v2.2.3](#v2.2.3)
|
||||||
[v2.2.2](#v2.2.2)
|
[v2.2.2](#v2.2.2)
|
||||||
@@ -37,7 +44,85 @@
|
|||||||
[v0.5.0](#v0.5.0)
|
[v0.5.0](#v0.5.0)
|
||||||
[v0.1.0](#v0.1.0)
|
[v0.1.0](#v0.1.0)
|
||||||
|
|
||||||
## master
|
## branch-2.0
|
||||||
|
|
||||||
|
## v2.8.2
|
||||||
|
|
||||||
|
* (2022.08.15) Release `v2.8.2` version
|
||||||
|
* (2022.08.15) Added support for the `HeatmapChart` formatter for custom Tooltip
|
||||||
|
* (2022.07.13) Fixed `SerieLabel` refresh exception #215
|
||||||
|
* (2022.06.30) Optimize `Radar` so that the `Tooltip` layer is above `Indicator`
|
||||||
|
|
||||||
|
## v2.8.1
|
||||||
|
|
||||||
|
* (2022.05.03) Added `onLegendClick`, `onLegendEnter` and `onLegendExit` delegate callbacks for `Legend`
|
||||||
|
* (2022.04.21) Fixed bug #192 with `RingChart` `Tooltip` exception
|
||||||
|
* (2022.04.21) Fixed error when setting `minShowNum` in `DataZoom`
|
||||||
|
|
||||||
|
## v2.8.0
|
||||||
|
|
||||||
|
* (2022.04.10) Added the debug information panel
|
||||||
|
* (2022.04.09) Fixed `VisualMap` not working in some cases
|
||||||
|
* (2022.04.08) Optimized `XCharts` initialization #190
|
||||||
|
* (2022.04.08) Fixed color error #187 in `Radar`
|
||||||
|
* (2022.03.24) Fixed `Axis` precision issue #184
|
||||||
|
|
||||||
|
## v2.7.0
|
||||||
|
|
||||||
|
* (2022.03.20) Release `v2.7.0` version
|
||||||
|
* (2022.02.21) Fixed chart name repeat check error #183
|
||||||
|
* (2022.02.17) Fixed bug where axis split line might be displayed outside the coordinate system #181
|
||||||
|
* (2022.02.08) Fixed {d} formatter error when value is 0
|
||||||
|
* (2022.02.08) Fixed `YAxis` `AxisLabel`'s `onZero` does not work
|
||||||
|
* (2022.01.06) Improved `Zebra` bar chart
|
||||||
|
|
||||||
|
## v2.6.0
|
||||||
|
|
||||||
|
* (2021.12.30) Release `v2.6.0` version
|
||||||
|
* (2021.12.21) Fixed `Emphasis` dont work
|
||||||
|
* (2021.12.17) Fixed `MarkLine` does not auto refresh label active when serie hide #178
|
||||||
|
* (2021.12.10) Improved `Radar`'s `AxisLine` and `SplitLine` to be controlled separately
|
||||||
|
* (2021.12.08) Fixed y axis does not refresh when serie hidden
|
||||||
|
* (2021.12.04) Added `Symbol` new types: `EmptyRect`, `EmptyTriangle`, `EmptyDiamond`
|
||||||
|
* (2021.12.04) Added setting symbol empty area color by itemStyle's backgroundColor
|
||||||
|
* (2021.12.03) Fixed formatter `{c}` not work #175
|
||||||
|
* (2021.12.03) Fixed axis `boundaryGap` display error in some cases #174
|
||||||
|
* (2021.11.30) Fixed serie `ignore` display error in some cases #173
|
||||||
|
|
||||||
|
## v2.5.0
|
||||||
|
|
||||||
|
* (2021.11.27) Release `v2.5.0` version
|
||||||
|
* (2021.11.27) Added `Tooltip` delegate function `positionFunction`
|
||||||
|
* (2021.10.29) Removed settings for `TextMeshPro` when package first imported
|
||||||
|
* (2021.10.29) Added support for `{e}` in `Tooltip` #170
|
||||||
|
* (2021.09.08) Improved `RadarChart`
|
||||||
|
* (2021.09.07) Fixed bug where `label` does not disappear at the end of `PieChart` fade animation #168
|
||||||
|
* (2021.09.06) Fixed bug where `GaugeChart` changing `splitNumber` with code does not refresh `label` #167
|
||||||
|
|
||||||
|
## v2.4.0
|
||||||
|
|
||||||
|
### Main points
|
||||||
|
|
||||||
|
* LineChart support the line of ignore data is disconnected or connected
|
||||||
|
* LineChart support animation at a constant speed
|
||||||
|
* Other optimizations and bug fixes
|
||||||
|
|
||||||
|
### Details
|
||||||
|
|
||||||
|
* (2021.08.31) Release `v2.4.0` version
|
||||||
|
* (2021.08.31) Optimized the gradient effect of `RingChart`
|
||||||
|
* (2021.08.31) Fixed bug where `SerieLabel` does not refresh when `DataZoom` is dragged (#165)
|
||||||
|
* (2021.08.25) Fixed an issue where the theme switch could not be save to the scene (#166)
|
||||||
|
* (2021.08.24) Added `Animation`'s `alongWithLinePath`
|
||||||
|
* (2021.08.22) Added `Serie`'s `ignoreLineBreak` (#164)
|
||||||
|
* (2021.08.22) Fixed `Axis` label may not be updated when `DataZoom` is turn on (#164)
|
||||||
|
* (2021.08.15) Improved `Axis`'s `AxisLabel` text rotate setting to avoid inconsistency offset in `DataZoom` (#163)
|
||||||
|
* (2021.08.14) Added `Legend`'s `textAutoColor` to set the text color match with `Serie` color (#163)
|
||||||
|
* (2021.08.12) Optimize `BarChart` setting `Corner` when the positive and negative columns are fillet symmetric
|
||||||
|
* (2021.08.03) Fixed y axis not displaying when all data is 0
|
||||||
|
* (2021.07.29) Fixed ignored data will also participate in calculations when `ignore` is enabled (#161)
|
||||||
|
* (2021.07.29) Improved `BarChart`'s `Zebra` gradient support
|
||||||
|
* (2021.07.26) Fixed issue where `XCharts` path could not be found when `TextMeshPro Enable` (#160)
|
||||||
|
|
||||||
## v2.3.0
|
## v2.3.0
|
||||||
|
|
||||||
@@ -206,7 +291,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
|
|||||||
## v1.6.0
|
## v1.6.0
|
||||||
|
|
||||||
* (2020.08.24) Release `v1.6.0` version
|
* (2020.08.24) Release `v1.6.0` version
|
||||||
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md) to upgrade)
|
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md) to upgrade)
|
||||||
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
|
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
|
||||||
* (2020.08.11) Added `LiquidChart` data change animation#83
|
* (2020.08.11) Added `LiquidChart` data change animation#83
|
||||||
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85
|
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
[master](#master)
|
[branch-2.0](#branch-2.0)
|
||||||
|
[v2.8.2](#v2.8.2)
|
||||||
|
[v2.8.1](#v2.8.1)
|
||||||
|
[v2.8.0](#v2.8.0)
|
||||||
|
[v2.7.0](#v2.7.0)
|
||||||
|
[v2.6.0](#v2.6.0)
|
||||||
|
[v2.5.0](#v2.5.0)
|
||||||
|
[v2.4.0](#v2.4.0)
|
||||||
[v2.3.0](#v2.3.0)
|
[v2.3.0](#v2.3.0)
|
||||||
[v2.2.3](#v2.2.3)
|
[v2.2.3](#v2.2.3)
|
||||||
[v2.2.2](#v2.2.2)
|
[v2.2.2](#v2.2.2)
|
||||||
@@ -37,7 +44,90 @@
|
|||||||
[v0.5.0](#v0.5.0)
|
[v0.5.0](#v0.5.0)
|
||||||
[v0.1.0](#v0.1.0)
|
[v0.1.0](#v0.1.0)
|
||||||
|
|
||||||
## master
|
## branch-2.0
|
||||||
|
|
||||||
|
* (2022.12.28) 修复`Pie`只有一个数据时设置`border`后显示异常的问题 (#237)
|
||||||
|
* (2022.08.30) 修复`DataZoom`在某些情况下计算范围不准确的问题 (#221)
|
||||||
|
|
||||||
|
## v2.8.2
|
||||||
|
|
||||||
|
* (2022.08.15) 发布`v2.8.2`版本
|
||||||
|
* (2022.08.15) 增加`HeatmapChart`对自定义`Tooltip`的`formatter`的支持
|
||||||
|
* (2022.07.13) 修复`SerieLabel`刷新异常的问题 #215
|
||||||
|
* (2022.06.30) 优化`Radar`让`Tooltip`的层在`Indicator`之上
|
||||||
|
|
||||||
|
## v2.8.1
|
||||||
|
|
||||||
|
* (2022.05.06) 发布`v2.8.1`版本
|
||||||
|
* (2022.05.03) 增加`Legend`的`onLegendClick`,`onLegendEnter`和`onLegendExit`委托回调
|
||||||
|
* (2022.04.21) 修复`RingChart`的`Tooltip`异常的问题 #192
|
||||||
|
* (2022.04.21) 修复`DataZoom`设置`minShowNum`时可能会报错的问题
|
||||||
|
|
||||||
|
## v2.8.0
|
||||||
|
|
||||||
|
* (2022.04.10) 发布`v2.8.0`版本
|
||||||
|
* (2022.04.10) 增加`Debug`调试信息面板
|
||||||
|
* (2022.04.09) 修复`VisualMap`某些情况下不生效的问题
|
||||||
|
* (2022.04.08) 优化`XCharts`初始化 #190
|
||||||
|
* (2022.04.08) 修复`Radar`的颜色异常问题 #187
|
||||||
|
* (2022.03.24) 修复`Axis`的精度问题 #184
|
||||||
|
|
||||||
|
## v2.7.0
|
||||||
|
|
||||||
|
* (2022.03.20) 发布`v2.7.0`版本
|
||||||
|
* (2022.02.21) 修复`Chart`的`chartName`重复检测问题 #183
|
||||||
|
* (2022.02.17) 修复`Axis`的`SplitLine`可能会显示在坐标系外的问题 #181
|
||||||
|
* (2022.02.08) 修复数据全0时`{d}`显示不正确的问题
|
||||||
|
* (2022.02.08) 修复`YAxis`的`AxisLabel`的`onZero`参数不生效的问题
|
||||||
|
* (2022.01.06) 优化`Zebra`斑马柱图
|
||||||
|
|
||||||
|
## v2.6.0
|
||||||
|
|
||||||
|
* (2021.12.30) 发布`v2.6.0`版本
|
||||||
|
* (2021.12.21) 修复`Emphasis`不生效的问题
|
||||||
|
* (2021.12.17) 修复`MarkLine`在运行时`Label`不自动刷新显示隐藏的问题 #178
|
||||||
|
* (2021.12.10) 完善`Radar`的`AxisLine`和`SplitLine`可单独控制
|
||||||
|
* (2021.12.08) 修复`Serie`隐藏后`Y`轴最大值不刷新的问题
|
||||||
|
* (2021.12.04) 增加`Symbol`新类型:`EmptyRect`,`EmptyTriangle`,`EmptyDiamond`
|
||||||
|
* (2021.12.04) 增加`Symbol`的`Empty`区域颜色可通过`ItemStyle`的`backgroundColor`设置的支持
|
||||||
|
* (2021.12.03) 修复`Formatter`的`{c}`通配符不生效的问题 #175
|
||||||
|
* (2021.12.03) 修复`Axis`的`boundaryGap`某些情况下显示的问题 #174
|
||||||
|
* (2021.11.30) 修复`Serie`的`ignore`某些情况下绘制异常的问题 #173
|
||||||
|
|
||||||
|
## v2.5.0
|
||||||
|
|
||||||
|
* (2021.11.27) 发布`v2.5.0`版本
|
||||||
|
* (2021.11.27) 增加`Tooltip`的`positionFunction`的坐标设置委托函数
|
||||||
|
* (2021.10.29) 移除`XCharts`首次导入时`TextMeshPro`的相关设置
|
||||||
|
* (2021.10.29) 增加`Tooltip`对通配符`{e}`的支持 #170
|
||||||
|
* (2021.09.08) 完善`RadarChart`
|
||||||
|
* (2021.09.07) 修复`PieChart`渐出动画结束时`label`没有消失的问题 #168
|
||||||
|
* (2021.09.06) 修复`GaugeChart`用代码改变`splitNumber`不会刷新`label`的问题 #167
|
||||||
|
|
||||||
|
## v2.4.0
|
||||||
|
|
||||||
|
### 版本要点
|
||||||
|
|
||||||
|
* 折线图支持忽略数据的连线是断开还是连接
|
||||||
|
* 折线图支持轨迹匀速动画
|
||||||
|
* 其他优化和问题修复
|
||||||
|
|
||||||
|
### 日志详情
|
||||||
|
|
||||||
|
* (2021.08.31) 发布`v2.4.0`版本
|
||||||
|
* (2021.08.31) 优化`RingChart`的渐变效果
|
||||||
|
* (2021.08.31) 修复`DataZoom`拖动时`SerieLabel`不刷新的问题 (#165)
|
||||||
|
* (2021.08.25) 修复`Theme`主题切换无法保持到场景上的问题 (#166)
|
||||||
|
* (2021.08.24) 增加`Animation`的`alongWithLinePath`参数设置折线轨迹匀速动画
|
||||||
|
* (2021.08.22) 增加`Serie`的`ignoreLineBreak`参数设置忽略数据连线是否断开 (#164)
|
||||||
|
* (2021.08.22) 修复`Axis`在`DataZoom`开启时`Label`可能不更新的问题 (#164)
|
||||||
|
* (2021.08.15) 优化`Axis`的`AxisLabel`文本旋转设置,避免在DataZoom开启时偏移不一致 (#163)
|
||||||
|
* (2021.08.14) 增加`Legend`的`textAutoColor`设置文本颜色和`Serie`一致 (#163)
|
||||||
|
* (2021.08.12) 优化`BarChart`设置`Corner`时正负柱条圆角对称
|
||||||
|
* (2021.08.03) 优化`Serie`的数据全为0时Y轴不显示的问题
|
||||||
|
* (2021.07.29) 修复`Serie`开启`ignore`时被忽略的数据还会参与计算的问题 (#161)
|
||||||
|
* (2021.07.29) 完善`BarChart`的`Zebra`斑马柱图渐变支持
|
||||||
|
* (2021.07.26) 修复`TextMeshPro Enable`时找不到`XCharts`路径的问题 (#160)
|
||||||
|
|
||||||
## v2.3.0
|
## v2.3.0
|
||||||
|
|
||||||
@@ -208,7 +298,7 @@
|
|||||||
## v1.6.0
|
## v1.6.0
|
||||||
|
|
||||||
* (2020.08.24) 发布`v1.6.0`版本
|
* (2020.08.24) 发布`v1.6.0`版本
|
||||||
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
|
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
|
||||||
* (2020.08.15) 优化`PieChart`绘制表现效果#85
|
* (2020.08.15) 优化`PieChart`绘制表现效果#85
|
||||||
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
|
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
|
||||||
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
|
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
|
||||||
|
|||||||
@@ -176,6 +176,9 @@
|
|||||||
* `ceilRate`:最大最小值向上取整的倍率。默认为0时自动计算。
|
* `ceilRate`:最大最小值向上取整的倍率。默认为0时自动计算。
|
||||||
* `splitNumber`:分割段数。默认为 `5`。
|
* `splitNumber`:分割段数。默认为 `5`。
|
||||||
* `isAxisTooltip`:是否Tooltip显示轴线上的所有数据。只对Mutiple类型的Radar有效。
|
* `isAxisTooltip`:是否Tooltip显示轴线上的所有数据。只对Mutiple类型的Radar有效。
|
||||||
|
* `outRangeColor`:数值超出范围时显示的颜色。
|
||||||
|
* `connectCenter`:数值是否连线到中心点。
|
||||||
|
* `lineGradient`:数值线段是否渐变。
|
||||||
* `splitLine`:分割线条 [AxisSplitLine](#AxisSplitLine)。
|
* `splitLine`:分割线条 [AxisSplitLine](#AxisSplitLine)。
|
||||||
* `splitArea`:分割区域 [AxisSplitArea](#AxisSplitArea)。
|
* `splitArea`:分割区域 [AxisSplitArea](#AxisSplitArea)。
|
||||||
* `indicator`:是否显示指示器。
|
* `indicator`:是否显示指示器。
|
||||||
@@ -187,6 +190,7 @@
|
|||||||
* `name`:指示器名称。
|
* `name`:指示器名称。
|
||||||
* `max`:指示器的最大值,默认为 0 无限制。
|
* `max`:指示器的最大值,默认为 0 无限制。
|
||||||
* `min`:指示器的最小值,默认为 0 无限制。
|
* `min`:指示器的最小值,默认为 0 无限制。
|
||||||
|
* `range`:指示器的正常值范围,当数值超出这个范围时显示`Radar`的`outRangeColor`颜色。
|
||||||
* `textStyle`:文本样式 [TextStyle](#TextStyle)。
|
* `textStyle`:文本样式 [TextStyle](#TextStyle)。
|
||||||
|
|
||||||
## `TextLimit`
|
## `TextLimit`
|
||||||
@@ -229,6 +233,7 @@
|
|||||||
* `{b}`为当前所指示或`index`为`0`的`serie`的数据项`serieData`的`name`,或者类目值(如折线图的`X`轴)。
|
* `{b}`为当前所指示或`index`为`0`的`serie`的数据项`serieData`的`name`,或者类目值(如折线图的`X`轴)。
|
||||||
* `{c}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)的数值。
|
* `{c}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)的数值。
|
||||||
* `{d}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)百分比值,注意不带`%`号。
|
* `{d}`为当前所指示或`index`为`0`的`serie`的`y`维(`dimesion`为`1`)百分比值,注意不带`%`号。
|
||||||
|
* `{e}`为当前所指示或`index`为`0`的`serie`的数据项`serieData`的`name`。
|
||||||
* `{.1}`表示指定`index`为`1`的`serie`对应颜色的圆点。
|
* `{.1}`表示指定`index`为`1`的`serie`对应颜色的圆点。
|
||||||
* `{a1}`、`{b1}`、`{c1}`中的`1`表示指定`index`为`1`的`serie`。
|
* `{a1}`、`{b1}`、`{c1}`中的`1`表示指定`index`为`1`的`serie`。
|
||||||
* `{c1:2}`表示索引为`1`的`serie`的当前指示数据项的第`3`个数据(一个数据项有多个数据,index为`2`表示第`3`个数据)。
|
* `{c1:2}`表示索引为`1`的`serie`的当前指示数据项的第`3`个数据(一个数据项有多个数据,index为`2`表示第`3`个数据)。
|
||||||
@@ -810,6 +815,7 @@ K线图系列。
|
|||||||
* `fadeOutDuration`:设定的渐出动画时长,单位毫秒。如果要设置单个数据项的渐出时长,可以用代码定制:`customFadeOutDuration`。
|
* `fadeOutDuration`:设定的渐出动画时长,单位毫秒。如果要设置单个数据项的渐出时长,可以用代码定制:`customFadeOutDuration`。
|
||||||
* `dataChangeEnable`:是否开启数据变更动画。
|
* `dataChangeEnable`:是否开启数据变更动画。
|
||||||
* `dataChangeDuration`:数据变更动画时长,单位毫秒。
|
* `dataChangeDuration`:数据变更动画时长,单位毫秒。
|
||||||
|
* `alongWithLinePath`:是否沿着线的轨迹进行匀速动画。
|
||||||
|
|
||||||
## `AreaStyle`
|
## `AreaStyle`
|
||||||
|
|
||||||
|
|||||||
@@ -152,10 +152,10 @@
|
|||||||
|
|
||||||
## 为什么升级到1_6_0版本后很多自定义颜色丢失了_应该如何升级
|
## 为什么升级到1_6_0版本后很多自定义颜色丢失了_应该如何升级
|
||||||
|
|
||||||
答:1.6.0版本为了减少隐式转换,将所有的绘制相关的`Color`都改为了`Color32`,所以会导致一些自定义的颜色的丢失。影响到的主要组件有:`ItemStyle`,`LineStyle`,`AreaStyle`,`Vessel`,`VisualMap`,`AxisSplitArea`,`AxisSplitLine`,`GaugeAxis`,`SerieLabel`等。可以用脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)进行升级。
|
答:1.6.0版本为了减少隐式转换,将所有的绘制相关的`Color`都改为了`Color32`,所以会导致一些自定义的颜色的丢失。影响到的主要组件有:`ItemStyle`,`LineStyle`,`AreaStyle`,`Vessel`,`VisualMap`,`AxisSplitArea`,`AxisSplitLine`,`GaugeAxis`,`SerieLabel`等。可以用脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)进行升级。
|
||||||
升级步骤如下:
|
升级步骤如下:
|
||||||
1. 备份好你的项目。
|
1. 备份好你的项目。
|
||||||
2. 先不升级`XCharts`,只下载或拷贝脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)放到旧项目的`Editor`下,由于旧版本可能不存在某些新版本才有的图表或者属性配置,可能会编译错误,需要处理按3,4步骤处理一下。
|
2. 先不升级`XCharts`,只下载或拷贝脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)放到旧项目的`Editor`下,由于旧版本可能不存在某些新版本才有的图表或者属性配置,可能会编译错误,需要处理按3,4步骤处理一下。
|
||||||
3. 若是由`itemStyle.toColor2`引起的编译报错,可将导出地方的`itemStyle.toColor2`改为`Color.clear`;导入的地方注释掉即可。
|
3. 若是由`itemStyle.toColor2`引起的编译报错,可将导出地方的`itemStyle.toColor2`改为`Color.clear`;导入的地方注释掉即可。
|
||||||
4. 若是由`LiquidChart`引起的编译报错,将所有涉及`LiquidChart`的地方都注释掉即可。
|
4. 若是由`LiquidChart`引起的编译报错,将所有涉及`LiquidChart`的地方都注释掉即可。
|
||||||
5. 编译通过后,通过`菜单栏->XCharts->ExportColorConfig`导出旧版本的颜色配置文件(配置文件默认保存到`Assets`下的`color.config`)。
|
5. 编译通过后,通过`菜单栏->XCharts->ExportColorConfig`导出旧版本的颜色配置文件(配置文件默认保存到`Assets`下的`color.config`)。
|
||||||
|
|||||||
@@ -176,7 +176,10 @@ Radar coordinate conponnet for radar charts.
|
|||||||
* `center`: the center of radar chart. The `center[0]` is the x-coordinate, and the `center[1]` is the y-coordinate. When value between 0 and 1 represents a percentage relative to the chart.[default:[0.5f,0.4f]].
|
* `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].
|
* `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`: Segments of indicator axis.[default:5].
|
||||||
* `splitNumber`: Tooltip displays all the data on the axis.[default:false].
|
* `isAxisTooltip`: Tooltip displays all the data on the axis.[default:false].
|
||||||
|
* `outRangeColor`: The color displayed when data out of range.[default:red]
|
||||||
|
* `connectCenter`: Whether serie data connect to radar center with line.[default:false]
|
||||||
|
* `lineGradient`: Whether need gradient for data line..[default:true]
|
||||||
* `splitLine`: The split line style of radar [AxisSplitLine](#AxisSplitLine).
|
* `splitLine`: The split line style of radar [AxisSplitLine](#AxisSplitLine).
|
||||||
* `splitArea`: The split area style of radar [AxisSplitArea](#AxisSplitArea).
|
* `splitArea`: The split area style of radar [AxisSplitArea](#AxisSplitArea).
|
||||||
* `indicator`: Whether to show indicator.
|
* `indicator`: Whether to show indicator.
|
||||||
@@ -190,6 +193,7 @@ Indicator of radar chart, which is used to assign multiple variables(dimensions)
|
|||||||
* `name`: The name of indicator.
|
* `name`: The name of indicator.
|
||||||
* `max`: The maximum value of indicator, with default value of 0, but we recommend to set it manually.
|
* `max`: The maximum value of indicator, with default value of 0, but we recommend to set it manually.
|
||||||
* `min`: The minimum value of indicator, with default value of 0.
|
* `min`: The minimum value of indicator, with default value of 0.
|
||||||
|
* `min`: Normal range. When the value is outside this range, the display color is automatically changed.
|
||||||
* `textStyle`: The text style of indicator [TextStyle](#TextStyle).
|
* `textStyle`: The text style of indicator [TextStyle](#TextStyle).
|
||||||
|
|
||||||
## `TextLimit`
|
## `TextLimit`
|
||||||
@@ -233,6 +237,7 @@ Tooltip component.
|
|||||||
* `{b}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`, or a `category` value (such as the X-axis of a line chart).
|
* `{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`.
|
* `{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.
|
* `{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.
|
||||||
|
* `{e}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`.
|
||||||
* `{.1}` represents a dot from serie corresponding color that specifies `index` as `1`.
|
* `{.1}` 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`.
|
* `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}` 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).
|
||||||
|
|||||||
@@ -148,10 +148,10 @@ A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to
|
|||||||
|
|
||||||
## Why_are_many_custom_colors_lost_after_upgrading_to_1_6_0_How_should_I_upgrade
|
## Why_are_many_custom_colors_lost_after_upgrading_to_1_6_0_How_should_I_upgrade
|
||||||
|
|
||||||
A: In version `1.6.0`, in order to reduce implicit conversion, all drawing related `Color` was changed to `Color32`, so some custom colors were lost. The main components affected are: `ItemStyle`, `LineStyle`, `AreaStyle`, `Vessel`, `VisualMap`, `AxisSplitArea`, `AxisSplitLine`, `GaugeAxis`,`SerieLabel`, etc. Can use the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) to upgrade.
|
A: In version `1.6.0`, in order to reduce implicit conversion, all drawing related `Color` was changed to `Color32`, so some custom colors were lost. The main components affected are: `ItemStyle`, `LineStyle`, `AreaStyle`, `Vessel`, `VisualMap`, `AxisSplitArea`, `AxisSplitLine`, `GaugeAxis`,`SerieLabel`, etc. Can use the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) to upgrade.
|
||||||
The upgrade steps are as follows:
|
The upgrade steps are as follows:
|
||||||
1. Back up the project.
|
1. Back up the project.
|
||||||
2. Download or copy the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) in the old project `Editor`, Change the `color` field inside to `color.clear` (because some fields may not exist in the old version).
|
2. Download or copy the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) in the old project `Editor`, Change the `color` field inside to `color.clear` (because some fields may not exist in the old version).
|
||||||
3. After compilation, the old version of color configuration file is exported through `menu bar -> XCharts-> ExportColorConfig` (the configuration file is saved by default to `color.config` under `Assets`).
|
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.
|
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).
|
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).
|
||||||
|
|||||||
@@ -137,6 +137,12 @@ namespace XCharts
|
|||||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
|
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (XChartsMgr.Instance.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
|
||||||
|
{
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
EditorGUILayout.HelpBox("chart name is repeated:" + m_ChartName.stringValue, MessageType.Error);
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BlockEnd();
|
BlockEnd();
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_DataChangeEnable");
|
PropertyField(prop, "m_DataChangeEnable");
|
||||||
PropertyField(prop, "m_DataChangeDuration");
|
PropertyField(prop, "m_DataChangeDuration");
|
||||||
PropertyField(prop, "m_ActualDuration");
|
PropertyField(prop, "m_ActualDuration");
|
||||||
|
PropertyField(prop, "m_AlongWithLinePath");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ namespace XCharts
|
|||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
PropertyField(prop, isPolar ? "m_PolarIndex" : "m_GridIndex");
|
PropertyField(prop, isPolar ? "m_PolarIndex" : "m_GridIndex");
|
||||||
PropertyField(prop, "m_Type");
|
PropertyField(prop, "m_Type");
|
||||||
|
if (type == Axis.AxisType.Time)
|
||||||
|
{
|
||||||
|
var chartTypeName = prop.serializedObject.targetObject.GetType().Name;
|
||||||
|
if (!chartTypeName.Equals("GanttChart"))
|
||||||
|
EditorGUILayout.HelpBox("The Time axis is currently only supported in GanttChart.", MessageType.Warning);
|
||||||
|
}
|
||||||
PropertyField(prop, "m_Position");
|
PropertyField(prop, "m_Position");
|
||||||
PropertyField(prop, "m_Offset");
|
PropertyField(prop, "m_Offset");
|
||||||
if (type == Axis.AxisType.Log)
|
if (type == Axis.AxisType.Log)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_ItemHeight");
|
PropertyField(prop, "m_ItemHeight");
|
||||||
PropertyField(prop, "m_ItemGap");
|
PropertyField(prop, "m_ItemGap");
|
||||||
PropertyField(prop, "m_ItemAutoColor");
|
PropertyField(prop, "m_ItemAutoColor");
|
||||||
|
PropertyField(prop, "m_TextAutoColor");
|
||||||
PropertyField(prop, "m_SelectedMode");
|
PropertyField(prop, "m_SelectedMode");
|
||||||
PropertyField(prop, "m_Orient");
|
PropertyField(prop, "m_Orient");
|
||||||
PropertyField(prop, "m_Location");
|
PropertyField(prop, "m_Location");
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_SplitNumber");
|
PropertyField(prop, "m_SplitNumber");
|
||||||
PropertyField(prop, "m_CeilRate");
|
PropertyField(prop, "m_CeilRate");
|
||||||
PropertyField(prop, "m_IsAxisTooltip");
|
PropertyField(prop, "m_IsAxisTooltip");
|
||||||
|
PropertyField(prop, "m_OutRangeColor");
|
||||||
|
PropertyField(prop, "m_ConnectCenter");
|
||||||
|
PropertyField(prop, "m_LineGradient");
|
||||||
PropertyField(prop, "m_AxisLine");
|
PropertyField(prop, "m_AxisLine");
|
||||||
PropertyField(prop, "m_SplitLine");
|
PropertyField(prop, "m_SplitLine");
|
||||||
PropertyField(prop, "m_SplitArea");
|
PropertyField(prop, "m_SplitArea");
|
||||||
@@ -50,6 +53,7 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_Name");
|
PropertyField(prop, "m_Name");
|
||||||
PropertyField(prop, "m_Min");
|
PropertyField(prop, "m_Min");
|
||||||
PropertyField(prop, "m_Max");
|
PropertyField(prop, "m_Max");
|
||||||
|
PropertyTwoFiled(prop, "m_Range");
|
||||||
PropertyField(prop, "m_TextStyle");
|
PropertyField(prop, "m_TextStyle");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_Clip");
|
PropertyField(prop, "m_Clip");
|
||||||
PropertyField(prop, "m_Ignore");
|
PropertyField(prop, "m_Ignore");
|
||||||
PropertyField(prop, "m_IgnoreValue");
|
PropertyField(prop, "m_IgnoreValue");
|
||||||
|
PropertyField(prop, "m_IgnoreLineBreak");
|
||||||
PropertyField(prop, "m_ShowAsPositiveNumber");
|
PropertyField(prop, "m_ShowAsPositiveNumber");
|
||||||
PropertyField(prop, "m_Large");
|
PropertyField(prop, "m_Large");
|
||||||
PropertyField(prop, "m_LargeThreshold");
|
PropertyField(prop, "m_LargeThreshold");
|
||||||
@@ -401,6 +402,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
EditorGUI.indentLevel += 2;
|
EditorGUI.indentLevel += 2;
|
||||||
var m_Ignore = serieData.FindPropertyRelative("m_Ignore");
|
var m_Ignore = serieData.FindPropertyRelative("m_Ignore");
|
||||||
|
var m_Selected = serieData.FindPropertyRelative("m_Selected");
|
||||||
|
var m_Id = serieData.FindPropertyRelative("m_Id");
|
||||||
var m_EnableIcon = serieData.FindPropertyRelative("m_EnableIconStyle");
|
var m_EnableIcon = serieData.FindPropertyRelative("m_EnableIconStyle");
|
||||||
var m_Icon = serieData.FindPropertyRelative("m_IconStyle");
|
var m_Icon = serieData.FindPropertyRelative("m_IconStyle");
|
||||||
var m_EnableLabel = serieData.FindPropertyRelative("m_EnableLabel");
|
var m_EnableLabel = serieData.FindPropertyRelative("m_EnableLabel");
|
||||||
@@ -413,6 +416,10 @@ namespace XCharts
|
|||||||
var m_Symbol = serieData.FindPropertyRelative("m_Symbol");
|
var m_Symbol = serieData.FindPropertyRelative("m_Symbol");
|
||||||
EditorGUI.PropertyField(drawRect, m_Ignore);
|
EditorGUI.PropertyField(drawRect, m_Ignore);
|
||||||
AddHeight(EditorGUI.GetPropertyHeight(m_Ignore));
|
AddHeight(EditorGUI.GetPropertyHeight(m_Ignore));
|
||||||
|
EditorGUI.PropertyField(drawRect, m_Selected);
|
||||||
|
AddHeight(EditorGUI.GetPropertyHeight(m_Selected));
|
||||||
|
EditorGUI.PropertyField(drawRect, m_Id);
|
||||||
|
AddHeight(EditorGUI.GetPropertyHeight(m_Id));
|
||||||
EditorGUI.PropertyField(drawRect, m_Icon);
|
EditorGUI.PropertyField(drawRect, m_Icon);
|
||||||
ChartEditorHelper.MakeBool(drawRect, m_EnableIcon, 1, "(enable)");
|
ChartEditorHelper.MakeBool(drawRect, m_EnableIcon, 1, "(enable)");
|
||||||
AddHeight(EditorGUI.GetPropertyHeight(m_Icon));
|
AddHeight(EditorGUI.GetPropertyHeight(m_Icon));
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<br>
|
<br>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
|
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/LICENSE">
|
||||||
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
|
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
|
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
|
||||||
@@ -45,11 +45,11 @@
|
|||||||
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.
|
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 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 Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
|
||||||
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
|
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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)
|
[Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
|
||||||
|
|
||||||
## XCharts 2.0
|
## XCharts 2.0
|
||||||
|
|
||||||
@@ -78,21 +78,21 @@ A powerful, easy-to-use, configurable charting and data visualization library fo
|
|||||||
|
|
||||||
## Screenshot
|
## Screenshot
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
## Cheat Sheet
|
## Cheat Sheet
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
`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` 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.
|
||||||
|
|
||||||
@@ -179,9 +179,9 @@ The following is the relationship structure of LineChart:
|
|||||||
2. In unity menu bar, `Component->XCharts->LineChart`.
|
2. In unity menu bar, `Component->XCharts->LineChart`.
|
||||||
3. In `Inspector`,`Add Component->LineChart`.
|
3. In `Inspector`,`Add Component->LineChart`.
|
||||||
4. Then a simple line chart is done.
|
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 Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.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/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.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).
|
* See more examples of code dynamic control: [Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md).
|
||||||
|
|
||||||
* Enable TextMeshPro:
|
* Enable TextMeshPro:
|
||||||
1. `XCharts -> TextMeshPro Enable` or `Project Setting -> XCharts -> Enable TextMeshPro`
|
1. `XCharts -> TextMeshPro Enable` or `Project Setting -> XCharts -> Enable TextMeshPro`
|
||||||
@@ -191,19 +191,19 @@ The following is the relationship structure of LineChart:
|
|||||||
## Documents
|
## Documents
|
||||||
|
|
||||||
* [XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
|
* [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 Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
|
||||||
* [XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
|
* [XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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)
|
* [XCharts Tutorial: Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
|
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
|
||||||
|
|
||||||
## Licenses
|
## Licenses
|
||||||
|
|
||||||
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/LICENSE.md)
|
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/LICENSE.md)
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,21 @@ namespace XCharts
|
|||||||
/// 点击饼图区域回调。参数:PointerEventData,SerieIndex,SerieDataIndex
|
/// 点击饼图区域回调。参数:PointerEventData,SerieIndex,SerieDataIndex
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickPie; } }
|
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickPie; } }
|
||||||
|
/// <summary>
|
||||||
|
/// the callback function of click legend.
|
||||||
|
/// 点击图例按钮回调。参数:legendIndex, legendName, show
|
||||||
|
/// </summary>
|
||||||
|
public Action<int, string, bool> onLegendClick { set { m_OnLegendClick = value; } }
|
||||||
|
/// <summary>
|
||||||
|
/// the callback function of enter legend.
|
||||||
|
/// 鼠标进入图例回调。参数:legendIndex, legendName
|
||||||
|
/// </summary>
|
||||||
|
public Action<int, string> onLegendEnter { set { m_OnLegendEnter = value; } }
|
||||||
|
/// <summary>
|
||||||
|
/// the callback function of exit legend.
|
||||||
|
/// 鼠标退出图例回调。参数:legendIndex, legendName
|
||||||
|
/// </summary>
|
||||||
|
public Action<int, string> onLegendExit { set { m_OnLegendExit = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Redraw chart in next frame.
|
/// Redraw chart in next frame.
|
||||||
/// 在下一帧刷新图表。
|
/// 在下一帧刷新图表。
|
||||||
@@ -543,7 +557,7 @@ namespace XCharts
|
|||||||
foreach (var legend in m_Legends)
|
foreach (var legend in m_Legends)
|
||||||
{
|
{
|
||||||
var iconColor = LegendHelper.GetIconColor(this, legendIndex, legendName, active);
|
var iconColor = LegendHelper.GetIconColor(this, legendIndex, legendName, active);
|
||||||
var contentColor = LegendHelper.GetContentColor(legend, m_Theme, active);
|
var contentColor = LegendHelper.GetContentColor(legendIndex, legend, m_Theme, active);
|
||||||
legend.UpdateButtonColor(legendName, iconColor);
|
legend.UpdateButtonColor(legendName, iconColor);
|
||||||
legend.UpdateContentColor(legendName, contentColor);
|
legend.UpdateContentColor(legendName, contentColor);
|
||||||
}
|
}
|
||||||
@@ -643,6 +657,9 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
m_Theme.CopyTheme(theme);
|
m_Theme.CopyTheme(theme);
|
||||||
SetAllComponentDirty();
|
SetAllComponentDirty();
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
UnityEditor.EditorUtility.SetDirty(this);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ namespace XCharts
|
|||||||
[SerializeField] protected int m_PolarIndex;
|
[SerializeField] protected int m_PolarIndex;
|
||||||
[SerializeField] protected AxisPosition m_Position;
|
[SerializeField] protected AxisPosition m_Position;
|
||||||
[SerializeField] protected float m_Offset;
|
[SerializeField] protected float m_Offset;
|
||||||
[SerializeField] protected float m_Min;
|
[SerializeField] protected double m_Min;
|
||||||
[SerializeField] protected float m_Max;
|
[SerializeField] protected double m_Max;
|
||||||
[SerializeField] protected int m_SplitNumber = 5;
|
[SerializeField] protected int m_SplitNumber = 5;
|
||||||
[SerializeField] protected float m_Interval = 0;
|
[SerializeField] protected double m_Interval = 0;
|
||||||
[SerializeField] protected bool m_BoundaryGap = true;
|
[SerializeField] protected bool m_BoundaryGap = true;
|
||||||
[SerializeField] protected int m_MaxCache = 0;
|
[SerializeField] protected int m_MaxCache = 0;
|
||||||
[SerializeField] protected float m_LogBase = 10;
|
[SerializeField] protected float m_LogBase = 10;
|
||||||
@@ -180,7 +180,7 @@ namespace XCharts
|
|||||||
/// The minimun value of axis.Valid when `minMaxType` is `Custom`
|
/// The minimun value of axis.Valid when `minMaxType` is `Custom`
|
||||||
/// 设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
|
/// 设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float min
|
public double min
|
||||||
{
|
{
|
||||||
get { return m_Min; }
|
get { return m_Min; }
|
||||||
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetAllDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetAllDirty(); }
|
||||||
@@ -189,7 +189,7 @@ namespace XCharts
|
|||||||
/// The maximum value of axis.Valid when `minMaxType` is `Custom`
|
/// The maximum value of axis.Valid when `minMaxType` is `Custom`
|
||||||
/// 设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
|
/// 设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float max
|
public double max
|
||||||
{
|
{
|
||||||
get { return m_Max; }
|
get { return m_Max; }
|
||||||
set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetAllDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetAllDirty(); }
|
||||||
@@ -207,7 +207,7 @@ namespace XCharts
|
|||||||
/// Compulsively set segmentation interval for axis.This is unavailable for category axis.
|
/// Compulsively set segmentation interval for axis.This is unavailable for category axis.
|
||||||
/// 强制设置坐标轴分割间隔。无法在类目轴中使用。
|
/// 强制设置坐标轴分割间隔。无法在类目轴中使用。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float interval
|
public double interval
|
||||||
{
|
{
|
||||||
get { return m_Interval; }
|
get { return m_Interval; }
|
||||||
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetAllDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetAllDirty(); }
|
||||||
@@ -489,6 +489,12 @@ namespace XCharts
|
|||||||
return axis;
|
return axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetComponentDirty()
|
||||||
|
{
|
||||||
|
m_NeedUpdateFilterData = true;
|
||||||
|
base.SetComponentDirty();
|
||||||
|
}
|
||||||
|
|
||||||
public void Copy(Axis axis)
|
public void Copy(Axis axis)
|
||||||
{
|
{
|
||||||
show = axis.show;
|
show = axis.show;
|
||||||
@@ -706,13 +712,13 @@ namespace XCharts
|
|||||||
int start = 0, end = 0;
|
int start = 0, end = 0;
|
||||||
if (dataZoom.runtimeInvert)
|
if (dataZoom.runtimeInvert)
|
||||||
{
|
{
|
||||||
end = Mathf.CeilToInt(data.Count * dataZoom.end / 100);
|
end = Mathf.RoundToInt(data.Count * dataZoom.end / 100);
|
||||||
start = end - range;
|
start = end - range;
|
||||||
if (start < 0) start = 0;
|
if (start < 0) start = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start = Mathf.FloorToInt(data.Count * dataZoom.start / 100);
|
start = Mathf.RoundToInt(data.Count * dataZoom.start / 100);
|
||||||
end = start + range;
|
end = start + range;
|
||||||
if (end > data.Count) end = data.Count;
|
if (end > data.Count) end = data.Count;
|
||||||
}
|
}
|
||||||
@@ -722,13 +728,15 @@ namespace XCharts
|
|||||||
filterEnd = end;
|
filterEnd = end;
|
||||||
filterMinShow = dataZoom.minShowNum;
|
filterMinShow = dataZoom.minShowNum;
|
||||||
m_NeedUpdateFilterData = false;
|
m_NeedUpdateFilterData = false;
|
||||||
if (data.Count > 0)
|
if (data.Count > 0 && filterMinShow < data.Count)
|
||||||
{
|
{
|
||||||
if (range < dataZoom.minShowNum)
|
if (range < filterMinShow)
|
||||||
{
|
{
|
||||||
if (dataZoom.minShowNum > data.Count) range = data.Count;
|
if (filterMinShow > data.Count) range = data.Count;
|
||||||
else range = dataZoom.minShowNum;
|
else range = filterMinShow;
|
||||||
}
|
}
|
||||||
|
if (range > data.Count - start)
|
||||||
|
start = data.Count - range;
|
||||||
filterData = data.GetRange(start, range);
|
filterData = data.GetRange(start, range);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
154
Assets/XCharts/Runtime/Component/Main/DebugInfo.cs
Normal file
154
Assets/XCharts/Runtime/Component/Main/DebugInfo.cs
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class DebugInfo
|
||||||
|
{
|
||||||
|
private bool m_ShowDebugInfo = false;
|
||||||
|
private TextStyle m_DebugInfoTextStyle = new TextStyle()
|
||||||
|
{
|
||||||
|
fontSize = 18,
|
||||||
|
backgroundColor = new Color32(32, 32, 32, 170),
|
||||||
|
color = Color.white
|
||||||
|
};
|
||||||
|
|
||||||
|
private static StringBuilder s_Sb = new StringBuilder();
|
||||||
|
|
||||||
|
private static readonly float INTERVAL = 0.2f;
|
||||||
|
private static readonly float MAXCACHE = 20;
|
||||||
|
private int m_FrameCount = 0;
|
||||||
|
private float m_LastTime = 0f;
|
||||||
|
private float m_LastCheckShowTime = 0f;
|
||||||
|
private int m_LastRefreshCount = 0;
|
||||||
|
private BaseChart m_Chart;
|
||||||
|
private ChartLabel m_Label;
|
||||||
|
private List<float> m_FpsList = new List<float>();
|
||||||
|
public float fps { get; private set; }
|
||||||
|
public float avgFps { get; private set; }
|
||||||
|
public int refreshCount { get; internal set; }
|
||||||
|
internal int clickChartCount { get; set; }
|
||||||
|
|
||||||
|
public void Init(BaseChart chart)
|
||||||
|
{
|
||||||
|
m_Chart = chart;
|
||||||
|
m_Label = AddDebugInfoObject("debug", chart.transform, m_DebugInfoTextStyle, chart.theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
if (clickChartCount >= 3)
|
||||||
|
{
|
||||||
|
m_ShowDebugInfo = !m_ShowDebugInfo;
|
||||||
|
ChartHelper.SetActive(m_Label.gameObject.transform, m_ShowDebugInfo);
|
||||||
|
clickChartCount = 0;
|
||||||
|
m_LastCheckShowTime = Time.realtimeSinceStartup;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Time.realtimeSinceStartup - m_LastCheckShowTime > 0.5f)
|
||||||
|
{
|
||||||
|
m_LastCheckShowTime = Time.realtimeSinceStartup;
|
||||||
|
clickChartCount = 0;
|
||||||
|
}
|
||||||
|
if (!m_ShowDebugInfo || m_Label == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_FrameCount++;
|
||||||
|
if (Time.realtimeSinceStartup - m_LastTime >= INTERVAL)
|
||||||
|
{
|
||||||
|
fps = m_FrameCount / (Time.realtimeSinceStartup - m_LastTime);
|
||||||
|
m_FrameCount = 0;
|
||||||
|
m_LastTime = Time.realtimeSinceStartup;
|
||||||
|
if (m_LastRefreshCount == refreshCount)
|
||||||
|
{
|
||||||
|
m_LastRefreshCount = 0;
|
||||||
|
refreshCount = 0;
|
||||||
|
}
|
||||||
|
m_LastRefreshCount = refreshCount;
|
||||||
|
if (m_FpsList.Count > MAXCACHE)
|
||||||
|
{
|
||||||
|
m_FpsList.RemoveAt(0);
|
||||||
|
}
|
||||||
|
m_FpsList.Add(fps);
|
||||||
|
avgFps = GetAvg(m_FpsList);
|
||||||
|
if (m_Label != null)
|
||||||
|
{
|
||||||
|
s_Sb.Length = 0;
|
||||||
|
s_Sb.AppendFormat("v{0}\n", XChartsMgr.version);
|
||||||
|
s_Sb.AppendFormat("fps : {0:f0} / {1:f0}\n", fps, avgFps);
|
||||||
|
s_Sb.AppendFormat("draw : {0}\n", refreshCount);
|
||||||
|
|
||||||
|
var dataCount = m_Chart.series.GetAllSerieDataCount();
|
||||||
|
SetValueWithKInfo(s_Sb, "data", dataCount);
|
||||||
|
|
||||||
|
var vertCount = 0;
|
||||||
|
foreach (var serie in m_Chart.series.list)
|
||||||
|
vertCount += serie.runtimeVertCount;
|
||||||
|
|
||||||
|
SetValueWithKInfo(s_Sb, "b-vert", m_Chart.m_BasePainterVertCount);
|
||||||
|
SetValueWithKInfo(s_Sb, "s-vert", vertCount);
|
||||||
|
SetValueWithKInfo(s_Sb, "t-vert", m_Chart.m_TopPainterVertCount, false);
|
||||||
|
|
||||||
|
m_Label.SetText(s_Sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetValueWithKInfo(StringBuilder s_Sb, string key, int value, bool newLine = true)
|
||||||
|
{
|
||||||
|
if (value >= 1000)
|
||||||
|
s_Sb.AppendFormat("{0} : {1:f1}k", key, value * 0.001f);
|
||||||
|
else
|
||||||
|
s_Sb.AppendFormat("{0} : {1}", key, value);
|
||||||
|
if (newLine)
|
||||||
|
s_Sb.Append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float GetAvg(List<float> list)
|
||||||
|
{
|
||||||
|
var total = 0f;
|
||||||
|
foreach (var v in list) total += v;
|
||||||
|
return total / list.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChartLabel AddDebugInfoObject(string name, Transform parent, TextStyle textStyle,
|
||||||
|
ChartTheme theme)
|
||||||
|
{
|
||||||
|
var anchorMax = new Vector2(0, 1);
|
||||||
|
var anchorMin = new Vector2(0, 1);
|
||||||
|
var pivot = new Vector2(0, 1);
|
||||||
|
var sizeDelta = new Vector2(130, 150);
|
||||||
|
|
||||||
|
var labelGameObject = ChartHelper.AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
||||||
|
labelGameObject.transform.SetAsLastSibling();
|
||||||
|
labelGameObject.hideFlags = m_Chart.chartHideFlags;
|
||||||
|
ChartHelper.SetActive(labelGameObject, m_ShowDebugInfo);
|
||||||
|
|
||||||
|
var image = ChartHelper.GetOrAddComponent<Image>(labelGameObject);
|
||||||
|
image.color = textStyle.backgroundColor;
|
||||||
|
|
||||||
|
var label = new ChartLabel();
|
||||||
|
label.gameObject = labelGameObject;
|
||||||
|
label.label = ChartHelper.AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax,
|
||||||
|
pivot, sizeDelta, textStyle, theme.common);
|
||||||
|
label.SetAutoSize(true);
|
||||||
|
label.label.SetActive(true);
|
||||||
|
label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.UpperLeft));
|
||||||
|
label.label.SetLocalPosition(new Vector2(3, -3));
|
||||||
|
label.SetText("30");
|
||||||
|
label.SetLabelColor(textStyle.color);
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Runtime/Component/Main/DebugInfo.cs.meta
Normal file
11
Assets/XCharts/Runtime/Component/Main/DebugInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9ff63fec5c2f94046b4560565057db8c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -78,6 +78,7 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_ItemHeight = 12.0f;
|
[SerializeField] private float m_ItemHeight = 12.0f;
|
||||||
[SerializeField] private float m_ItemGap = 10f;
|
[SerializeField] private float m_ItemGap = 10f;
|
||||||
[SerializeField] private bool m_ItemAutoColor = true;
|
[SerializeField] private bool m_ItemAutoColor = true;
|
||||||
|
[SerializeField] private bool m_TextAutoColor = false;
|
||||||
[SerializeField] private string m_Formatter;
|
[SerializeField] private string m_Formatter;
|
||||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||||
[SerializeField] private List<string> m_Data = new List<string>();
|
[SerializeField] private List<string> m_Data = new List<string>();
|
||||||
@@ -176,6 +177,16 @@ namespace XCharts
|
|||||||
set { if (PropertyUtil.SetStruct(ref m_ItemAutoColor, value)) SetComponentDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_ItemAutoColor, value)) SetComponentDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Whether the legend text matches the color automatically.
|
||||||
|
/// 图例标记的文本是否自动匹配颜色。
|
||||||
|
/// [default:false]
|
||||||
|
/// </summary>
|
||||||
|
public bool textAutoColor
|
||||||
|
{
|
||||||
|
get { return m_TextAutoColor; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_TextAutoColor, value)) SetComponentDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Legend content string template formatter. Support for wrapping lines with \n. Template:{name}.
|
/// Legend content string template formatter. Support for wrapping lines with \n. Template:{name}.
|
||||||
/// 图例内容字符串模版格式器。支持用 \n 换行。
|
/// 图例内容字符串模版格式器。支持用 \n 换行。
|
||||||
/// 模板变量为图例名称 {name}。
|
/// 模板变量为图例名称 {name}。
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ namespace XCharts
|
|||||||
[SerializeField] private string m_Name;
|
[SerializeField] private string m_Name;
|
||||||
[SerializeField] private double m_Max;
|
[SerializeField] private double m_Max;
|
||||||
[SerializeField] private double m_Min;
|
[SerializeField] private double m_Min;
|
||||||
|
[SerializeField] private double[] m_Range = new double[2] { 0, 0 };
|
||||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -83,6 +84,24 @@ namespace XCharts
|
|||||||
/// 指示器的文本组件。
|
/// 指示器的文本组件。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Text text { get; set; }
|
public Text text { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Normal range. When the value is outside this range, the display color is automatically changed.
|
||||||
|
/// 正常值范围。当数值不在这个范围时,会自动变更显示颜色。
|
||||||
|
/// </summary>
|
||||||
|
public double[] range
|
||||||
|
{
|
||||||
|
get { return m_Range; }
|
||||||
|
set { if (value != null && value.Length == 2) { m_Range = value; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInRange(double value)
|
||||||
|
{
|
||||||
|
if (m_Range == null || m_Range.Length < 2) return true;
|
||||||
|
if (m_Range[0] != 0 || m_Range[1] != 0)
|
||||||
|
return value >= m_Range[0] && value <= m_Range[1];
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[SerializeField] private bool m_Show;
|
[SerializeField] private bool m_Show;
|
||||||
[SerializeField] private Shape m_Shape;
|
[SerializeField] private Shape m_Shape;
|
||||||
@@ -97,6 +116,9 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_IndicatorGap = 10;
|
[SerializeField] private float m_IndicatorGap = 10;
|
||||||
[SerializeField] private int m_CeilRate = 0;
|
[SerializeField] private int m_CeilRate = 0;
|
||||||
[SerializeField] private bool m_IsAxisTooltip;
|
[SerializeField] private bool m_IsAxisTooltip;
|
||||||
|
[SerializeField] private Color32 m_OutRangeColor = Color.red;
|
||||||
|
[SerializeField] private bool m_ConnectCenter = false;
|
||||||
|
[SerializeField] private bool m_LineGradient = true;
|
||||||
[SerializeField] private List<Indicator> m_IndicatorList = new List<Indicator>();
|
[SerializeField] private List<Indicator> m_IndicatorList = new List<Indicator>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [default:true]
|
/// [default:true]
|
||||||
@@ -214,6 +236,33 @@ namespace XCharts
|
|||||||
set { if (PropertyUtil.SetStruct(ref m_PositionType, value)) SetAllDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_PositionType, value)) SetAllDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// The color displayed when data out of range.
|
||||||
|
/// 数值超出范围时显示的颜色。
|
||||||
|
/// </summary>
|
||||||
|
public Color32 outRangeColor
|
||||||
|
{
|
||||||
|
get { return m_OutRangeColor; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_OutRangeColor, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Whether serie data connect to radar center with line.
|
||||||
|
/// 数值是否连线到中心点。
|
||||||
|
/// </summary>
|
||||||
|
public bool connectCenter
|
||||||
|
{
|
||||||
|
get { return m_ConnectCenter; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_ConnectCenter, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Whether need gradient for data line.
|
||||||
|
/// 数值线段是否需要渐变。
|
||||||
|
/// </summary>
|
||||||
|
public bool lineGradient
|
||||||
|
{
|
||||||
|
get { return m_LineGradient; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_LineGradient, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// the indicator list.
|
/// the indicator list.
|
||||||
/// 指示器列表。
|
/// 指示器列表。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -276,6 +325,12 @@ namespace XCharts
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInIndicatorRange(int index, double value)
|
||||||
|
{
|
||||||
|
var indicator = GetIndicator(index);
|
||||||
|
return indicator == null ? true : indicator.IsInRange(value);
|
||||||
|
}
|
||||||
|
|
||||||
public double GetIndicatorMin(int index)
|
public double GetIndicatorMin(int index)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < m_IndicatorList.Count)
|
if (index >= 0 && index < m_IndicatorList.Count)
|
||||||
|
|||||||
@@ -327,6 +327,7 @@ namespace XCharts
|
|||||||
[SerializeField] private bool m_Clip = false;
|
[SerializeField] private bool m_Clip = false;
|
||||||
[SerializeField] private bool m_Ignore = false;
|
[SerializeField] private bool m_Ignore = false;
|
||||||
[SerializeField] private double m_IgnoreValue = 0;
|
[SerializeField] private double m_IgnoreValue = 0;
|
||||||
|
[SerializeField] private bool m_IgnoreLineBreak = false;
|
||||||
[SerializeField] private bool m_ShowAsPositiveNumber = false;
|
[SerializeField] private bool m_ShowAsPositiveNumber = false;
|
||||||
[SerializeField] private bool m_Large = true;
|
[SerializeField] private bool m_Large = true;
|
||||||
[SerializeField] private int m_LargeThreshold = 200;
|
[SerializeField] private int m_LargeThreshold = 200;
|
||||||
@@ -362,6 +363,7 @@ namespace XCharts
|
|||||||
[NonSerialized] internal bool m_NeedUpdateFilterData;
|
[NonSerialized] internal bool m_NeedUpdateFilterData;
|
||||||
[NonSerialized] internal List<SerieData> m_FilterData = new List<SerieData>();
|
[NonSerialized] internal List<SerieData> m_FilterData = new List<SerieData>();
|
||||||
[NonSerialized] internal List<SerieData> m_SortedData = new List<SerieData>();
|
[NonSerialized] internal List<SerieData> m_SortedData = new List<SerieData>();
|
||||||
|
[NonSerialized] internal List<SerieData> m_RootData = new List<SerieData>();
|
||||||
[NonSerialized] private Dictionary<int, List<Vector3>> m_UpSmoothPoints = new Dictionary<int, List<Vector3>>();
|
[NonSerialized] private Dictionary<int, List<Vector3>> m_UpSmoothPoints = new Dictionary<int, List<Vector3>>();
|
||||||
[NonSerialized] private Dictionary<int, List<Vector3>> m_DownSmoothPoints = new Dictionary<int, List<Vector3>>();
|
[NonSerialized] private Dictionary<int, List<Vector3>> m_DownSmoothPoints = new Dictionary<int, List<Vector3>>();
|
||||||
[NonSerialized] private List<Vector3> m_DataPoints = new List<Vector3>();
|
[NonSerialized] private List<Vector3> m_DataPoints = new List<Vector3>();
|
||||||
@@ -771,6 +773,15 @@ namespace XCharts
|
|||||||
set { if (PropertyUtil.SetStruct(ref m_IgnoreValue, value)) SetVerticesDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_IgnoreValue, value)) SetVerticesDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 忽略数据时折线是断开还是连接。默认false为连接。
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
public bool ignoreLineBreak
|
||||||
|
{
|
||||||
|
get { return m_IgnoreLineBreak; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_IgnoreLineBreak, value)) SetVerticesDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 雷达图类型。
|
/// 雷达图类型。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RadarType radarType
|
public RadarType radarType
|
||||||
@@ -1131,12 +1142,12 @@ namespace XCharts
|
|||||||
/// The index of serie,start at 0.
|
/// The index of serie,start at 0.
|
||||||
/// 系列的索引,从0开始。
|
/// 系列的索引,从0开始。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int index { get; internal set; }
|
public int index { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the serie is highlighted.
|
/// Whether the serie is highlighted.
|
||||||
/// 该系列是否高亮,一般由图例悬停触发。
|
/// 该系列是否高亮,一般由图例悬停触发。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool highlighted { get; internal set; }
|
public bool highlighted { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the count of data list.
|
/// the count of data list.
|
||||||
/// 数据项个数。
|
/// 数据项个数。
|
||||||
@@ -1149,27 +1160,27 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的中心点位置。
|
/// 饼图的中心点位置。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 runtimeCenterPos { get; internal set; }
|
public Vector3 runtimeCenterPos { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的内径
|
/// 饼图的内径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimeInsideRadius { get; internal set; }
|
public float runtimeInsideRadius { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的外径
|
/// 饼图的外径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimeOutsideRadius { get; internal set; }
|
public float runtimeOutsideRadius { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 运行时的最大数据值
|
/// 运行时的最大数据值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double runtimeDataMax { get; internal set; }
|
public double runtimeDataMax { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 运行时的最小数据值
|
/// 运行时的最小数据值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double runtimeDataMin { get; internal set; }
|
public double runtimeDataMin { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的数据项之和
|
/// 饼图的数据项之和
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double runtimePieDataTotal { get; internal set; }
|
public double runtimePieDataTotal { get; set; }
|
||||||
public float runtimeWaveSpeed { get; internal set; }
|
public float runtimeWaveSpeed { get; internal set; }
|
||||||
public Painter runtimeCanvas { get; internal set; }
|
public Painter runtimeCanvas { get; internal set; }
|
||||||
public double runtimeCheckValue { get; set; }
|
public double runtimeCheckValue { get; set; }
|
||||||
@@ -1178,7 +1189,10 @@ namespace XCharts
|
|||||||
public float runtimeY { get; internal set; }
|
public float runtimeY { get; internal set; }
|
||||||
public float runtimeWidth { get; internal set; }
|
public float runtimeWidth { get; internal set; }
|
||||||
public float runtimeHeight { get; internal set; }
|
public float runtimeHeight { get; internal set; }
|
||||||
|
public Rect runtimeRect { get; internal set; }
|
||||||
|
public int runtimeVertCount { get; internal set; }
|
||||||
public List<SerieData> runtimeSortedData { get { return m_SortedData; } }
|
public List<SerieData> runtimeSortedData { get { return m_SortedData; } }
|
||||||
|
public List<SerieData> rootData { get { return m_RootData; } }
|
||||||
public bool nameDirty { get { return m_NameDirty; } }
|
public bool nameDirty { get { return m_NameDirty; } }
|
||||||
|
|
||||||
private void SetNameDirty()
|
private void SetNameDirty()
|
||||||
@@ -1245,7 +1259,7 @@ namespace XCharts
|
|||||||
var max = double.MinValue;
|
var max = double.MinValue;
|
||||||
foreach (var sdata in data)
|
foreach (var sdata in data)
|
||||||
{
|
{
|
||||||
if (sdata.show && sdata.data[1] > max)
|
if (sdata.show && !IsIgnoreValue(sdata.data[1]) && sdata.data[1] > max)
|
||||||
{
|
{
|
||||||
max = sdata.data[1];
|
max = sdata.data[1];
|
||||||
}
|
}
|
||||||
@@ -1264,7 +1278,7 @@ namespace XCharts
|
|||||||
var max = double.MinValue;
|
var max = double.MinValue;
|
||||||
foreach (var sdata in data)
|
foreach (var sdata in data)
|
||||||
{
|
{
|
||||||
if (sdata.show && sdata.data[0] > max)
|
if (sdata.show && !IsIgnoreValue(sdata.data[0]) && sdata.data[0] > max)
|
||||||
{
|
{
|
||||||
max = sdata.data[0];
|
max = sdata.data[0];
|
||||||
}
|
}
|
||||||
@@ -1283,7 +1297,7 @@ namespace XCharts
|
|||||||
var min = double.MaxValue;
|
var min = double.MaxValue;
|
||||||
foreach (var sdata in data)
|
foreach (var sdata in data)
|
||||||
{
|
{
|
||||||
if (sdata.show && sdata.data[1] < min)
|
if (sdata.show && !IsIgnoreValue(sdata.data[1]) && sdata.data[1] < min)
|
||||||
{
|
{
|
||||||
min = sdata.data[1];
|
min = sdata.data[1];
|
||||||
}
|
}
|
||||||
@@ -1302,7 +1316,7 @@ namespace XCharts
|
|||||||
var min = double.MaxValue;
|
var min = double.MaxValue;
|
||||||
foreach (var sdata in data)
|
foreach (var sdata in data)
|
||||||
{
|
{
|
||||||
if (sdata.show && sdata.data[0] < min)
|
if (sdata.show && !IsIgnoreValue(sdata.data[0]) && sdata.data[0] < min)
|
||||||
{
|
{
|
||||||
min = sdata.data[0];
|
min = sdata.data[0];
|
||||||
}
|
}
|
||||||
@@ -1321,9 +1335,8 @@ namespace XCharts
|
|||||||
double total = 0;
|
double total = 0;
|
||||||
foreach (var sdata in data)
|
foreach (var sdata in data)
|
||||||
{
|
{
|
||||||
if (sdata.show)
|
if (sdata.show && !IsIgnoreValue(sdata.data[1]))
|
||||||
total += sdata.GetCurrData(1, animation.GetUpdateAnimationDuration());
|
total += sdata.GetCurrData(1, animation.GetUpdateAnimationDuration());
|
||||||
//total += sdata.GetData(1);
|
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
@@ -1339,7 +1352,7 @@ namespace XCharts
|
|||||||
double total = 0;
|
double total = 0;
|
||||||
foreach (var sdata in data)
|
foreach (var sdata in data)
|
||||||
{
|
{
|
||||||
if (sdata.show)
|
if (sdata.show && !IsIgnoreValue(sdata.data[1]))
|
||||||
total += sdata.data[0];
|
total += sdata.data[0];
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
@@ -1356,6 +1369,7 @@ namespace XCharts
|
|||||||
RemoveData(0);
|
RemoveData(0);
|
||||||
}
|
}
|
||||||
m_Data.Clear();
|
m_Data.Clear();
|
||||||
|
m_NeedUpdateFilterData = true;
|
||||||
SetVerticesDirty();
|
SetVerticesDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1389,6 +1403,7 @@ namespace XCharts
|
|||||||
m_DownSmoothPoints.Remove(serieData.index);
|
m_DownSmoothPoints.Remove(serieData.index);
|
||||||
}
|
}
|
||||||
m_Data.RemoveAt(index);
|
m_Data.RemoveAt(index);
|
||||||
|
m_NeedUpdateFilterData = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1417,6 +1432,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (m_InsertDataToHead) m_Data.Insert(0, serieData);
|
if (m_InsertDataToHead) m_Data.Insert(0, serieData);
|
||||||
else m_Data.Add(serieData);
|
else m_Data.Add(serieData);
|
||||||
|
m_NeedUpdateFilterData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckDataName(string dataName)
|
private void CheckDataName(string dataName)
|
||||||
@@ -1517,6 +1533,32 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SerieData AddChildData(SerieData parent, double value, string name = null)
|
||||||
|
{
|
||||||
|
var serieData = new SerieData();
|
||||||
|
serieData.name = name;
|
||||||
|
serieData.index = m_Data.Count;
|
||||||
|
serieData.data = new List<double>() { parent.children.Count, value };
|
||||||
|
serieData.parentIndex = parent.index;
|
||||||
|
serieData.runtimeParent = parent;
|
||||||
|
AddSerieDataHeadOrTail(serieData);
|
||||||
|
parent.children.Add(serieData.index);
|
||||||
|
parent.runtimeChildren.Add(serieData);
|
||||||
|
return serieData;
|
||||||
|
}
|
||||||
|
public SerieData AddChildData(SerieData parent, List<double> value, string name = null)
|
||||||
|
{
|
||||||
|
var serieData = new SerieData();
|
||||||
|
serieData.name = name;
|
||||||
|
serieData.index = m_Data.Count;
|
||||||
|
serieData.data = new List<double>(value);
|
||||||
|
serieData.parentIndex = parent.index;
|
||||||
|
serieData.runtimeParent = parent;
|
||||||
|
AddSerieDataHeadOrTail(serieData);
|
||||||
|
parent.children.Add(serieData.index);
|
||||||
|
parent.runtimeChildren.Add(serieData);
|
||||||
|
return serieData;
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckMaxCache()
|
private void CheckMaxCache()
|
||||||
{
|
{
|
||||||
@@ -1633,6 +1675,31 @@ namespace XCharts
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SerieData GetSerieData(string id, DataZoom dataZoom = null)
|
||||||
|
{
|
||||||
|
var data = GetDataList(dataZoom);
|
||||||
|
foreach (var serieData in data)
|
||||||
|
{
|
||||||
|
var target = GetSerieData(serieData, id);
|
||||||
|
if (target != null) return target;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SerieData GetSerieData(SerieData parent, string id)
|
||||||
|
{
|
||||||
|
if (id.Equals(parent.id)) return parent;
|
||||||
|
foreach (var child in parent.children)
|
||||||
|
{
|
||||||
|
var data = GetSerieData(GetSerieData(child), id);
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得指定索引的维度X和维度Y的数据
|
/// 获得指定索引的维度X和维度Y的数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -98,6 +98,16 @@ namespace XCharts
|
|||||||
SeriesHelper.ClearNameDirty(this);
|
SeriesHelper.ClearNameDirty(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAllSerieDataCount()
|
||||||
|
{
|
||||||
|
var count = 0;
|
||||||
|
foreach (var serie in list)
|
||||||
|
{
|
||||||
|
count += serie.dataCount;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清空所有系列的数据
|
/// 清空所有系列的数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ namespace XCharts
|
|||||||
[SerializeField] private Sprite m_BackgroundImage;
|
[SerializeField] private Sprite m_BackgroundImage;
|
||||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.None);
|
[SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.None);
|
||||||
|
private DelegateTooltipPosition m_PositionFunction;
|
||||||
|
|
||||||
private GameObject m_GameObject;
|
private GameObject m_GameObject;
|
||||||
private GameObject m_Content;
|
private GameObject m_Content;
|
||||||
@@ -101,6 +102,7 @@ namespace XCharts
|
|||||||
/// {b} is the name of the data item serieData that is currently indicated or whose index is 0, or a category value (such as the X-axis of a line chart).
|
/// {b} is the name of the data item 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 a Serie that is currently indicated or whose index is 0.
|
/// {c} is the value of a Y-dimension (dimesion is 1) from a Serie that is currently indicated or whose index is 0.
|
||||||
/// {d} is the percentage value of Y-dimensions (dimesion is 1) from serie that is currently indicated or whose index is 0, with no % sign.
|
/// {d} is the percentage value of Y-dimensions (dimesion is 1) from serie that is currently indicated or whose index is 0, with no % sign.
|
||||||
|
/// {e} is the name of the data item serieData that is currently indicated or whose index is 0.
|
||||||
/// {.1} represents a dot from serie corresponding color that specifies index as 1.
|
/// {.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.
|
/// 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} 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).
|
||||||
@@ -115,6 +117,7 @@ namespace XCharts
|
|||||||
/// {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。
|
/// {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。
|
||||||
/// {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。
|
/// {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。
|
||||||
/// {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。
|
/// {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。
|
||||||
|
/// {e}为当前所指示或index为0的serie的数据项serieData的name。
|
||||||
/// {.1}表示指定index为1的serie对应颜色的圆点。
|
/// {.1}表示指定index为1的serie对应颜色的圆点。
|
||||||
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie。
|
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie。
|
||||||
/// {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。
|
/// {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。
|
||||||
@@ -298,6 +301,12 @@ namespace XCharts
|
|||||||
public int runtimeGridIndex { get; internal set; }
|
public int runtimeGridIndex { get; internal set; }
|
||||||
public int runtimePolarIndex { get; internal set; }
|
public int runtimePolarIndex { get; internal set; }
|
||||||
|
|
||||||
|
public DelegateTooltipPosition positionFunction
|
||||||
|
{
|
||||||
|
get { return m_PositionFunction; }
|
||||||
|
set { m_PositionFunction = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public static Tooltip defaultTooltip
|
public static Tooltip defaultTooltip
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -447,8 +456,13 @@ namespace XCharts
|
|||||||
public void UpdateContentPos(Vector2 pos)
|
public void UpdateContentPos(Vector2 pos)
|
||||||
{
|
{
|
||||||
if (m_Content)
|
if (m_Content)
|
||||||
|
{
|
||||||
|
if (m_PositionFunction != null)
|
||||||
|
m_Content.transform.localPosition = m_PositionFunction(pos);
|
||||||
|
else
|
||||||
m_Content.transform.localPosition = pos;
|
m_Content.transform.localPosition = pos;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得当前提示框的位置
|
/// 获得当前提示框的位置
|
||||||
|
|||||||
@@ -262,7 +262,6 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
public CoordinateChart chart;
|
public CoordinateChart chart;
|
||||||
private GameObject m_MarkLineLabelRoot;
|
private GameObject m_MarkLineLabelRoot;
|
||||||
private bool m_RefreshLabel = false;
|
|
||||||
|
|
||||||
public MarkLineHandler(CoordinateChart chart)
|
public MarkLineHandler(CoordinateChart chart)
|
||||||
{
|
{
|
||||||
@@ -309,15 +308,16 @@ namespace XCharts
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (m_RefreshLabel)
|
|
||||||
{
|
|
||||||
m_RefreshLabel = false;
|
|
||||||
foreach (var serie in chart.series.list)
|
foreach (var serie in chart.series.list)
|
||||||
{
|
{
|
||||||
if (!serie.show || !serie.markLine.show) continue;
|
var show = serie.show && serie.markLine.show;
|
||||||
foreach (var data in serie.markLine.data)
|
foreach (var data in serie.markLine.data)
|
||||||
{
|
{
|
||||||
if (data.runtimeLabel != null)
|
if (data.runtimeLabel != null)
|
||||||
|
{
|
||||||
|
if (data.runtimeLabel.gameObject.activeSelf != show)
|
||||||
|
data.runtimeLabel.gameObject.SetActive(show);
|
||||||
|
if (show)
|
||||||
{
|
{
|
||||||
data.runtimeLabel.SetPosition(MarkLineHelper.GetLabelPosition(data));
|
data.runtimeLabel.SetPosition(MarkLineHelper.GetLabelPosition(data));
|
||||||
data.runtimeLabel.SetText(MarkLineHelper.GetFormatterContent(serie, data));
|
data.runtimeLabel.SetText(MarkLineHelper.GetFormatterContent(serie, data));
|
||||||
@@ -514,13 +514,12 @@ namespace XCharts
|
|||||||
data.runtimeCurrentEndPosition = ep;
|
data.runtimeCurrentEndPosition = ep;
|
||||||
if (sp != Vector3.zero || ep != Vector3.zero)
|
if (sp != Vector3.zero || ep != Vector3.zero)
|
||||||
{
|
{
|
||||||
m_RefreshLabel = true;
|
|
||||||
chart.ClampInChart(ref sp);
|
chart.ClampInChart(ref sp);
|
||||||
chart.ClampInChart(ref ep);
|
chart.ClampInChart(ref ep);
|
||||||
var theme = chart.theme.axis;
|
var theme = chart.theme.axis;
|
||||||
var lineColor = ChartHelper.IsClearColor(data.lineStyle.color) ? serieColor : data.lineStyle.color;
|
var lineColor = ChartHelper.IsClearColor(data.lineStyle.color) ? serieColor : data.lineStyle.color;
|
||||||
var lineWidth = data.lineStyle.width == 0 ? theme.lineWidth : data.lineStyle.width;
|
var lineWidth = data.lineStyle.width == 0 ? theme.lineWidth : data.lineStyle.width;
|
||||||
ChartDrawer.DrawLineStyle(vh, data.lineStyle, sp, ep, lineColor, lineWidth, LineStyle.Type.Dashed);
|
ChartDrawer.DrawLineStyle(vh, data.lineStyle, sp, ep, lineWidth, LineStyle.Type.Dashed, lineColor, lineColor);
|
||||||
if (data.startSymbol != null && data.startSymbol.show)
|
if (data.startSymbol != null && data.startSymbol.show)
|
||||||
{
|
{
|
||||||
DrawMarkLineSymbol(vh, data.startSymbol, serie, grid, chart.theme, sp, sp, lineColor);
|
DrawMarkLineSymbol(vh, data.startSymbol, serie, grid, chart.theme, sp, sp, lineColor);
|
||||||
@@ -539,7 +538,7 @@ namespace XCharts
|
|||||||
var tickness = SerieHelper.GetSymbolBorder(serie, null, theme, false);
|
var tickness = SerieHelper.GetSymbolBorder(serie, null, theme, false);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, null, false);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, null, false);
|
||||||
chart.Internal_CheckClipAndDrawSymbol(vh, symbol.type, symbolSize, tickness, pos, lineColor, lineColor,
|
chart.Internal_CheckClipAndDrawSymbol(vh, symbol.type, symbolSize, tickness, pos, lineColor, lineColor,
|
||||||
symbol.gap, true, cornerRadius, grid, startPos);
|
ColorUtil.clearColor32, symbol.gap, true, cornerRadius, grid, startPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetStartEndPos(Axis xAxis, Axis yAxis, Grid grid, double value, ref Vector3 sp, ref Vector3 ep)
|
private void GetStartEndPos(Axis xAxis, Axis yAxis, Grid grid, double value, ref Vector3 sp, ref Vector3 ep)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace XCharts
|
|||||||
[SerializeField] private bool m_DataChangeEnable = true;
|
[SerializeField] private bool m_DataChangeEnable = true;
|
||||||
[SerializeField] private float m_DataChangeDuration = 500;
|
[SerializeField] private float m_DataChangeDuration = 500;
|
||||||
[SerializeField] private float m_ActualDuration;
|
[SerializeField] private float m_ActualDuration;
|
||||||
|
[SerializeField] private bool m_AlongWithLinePath;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义渐入动画延时函数。返回ms值。
|
/// 自定义渐入动画延时函数。返回ms值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -101,6 +102,10 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float dataChangeDuration { get { return m_DataChangeDuration; } set { m_DataChangeDuration = value < 0 ? 0 : value; } }
|
public float dataChangeDuration { get { return m_DataChangeDuration; } set { m_DataChangeDuration = value < 0 ? 0 : value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 是否沿着线的轨迹进行匀速动画。
|
||||||
|
/// </summary>
|
||||||
|
public bool alongWithLinePath { get { return m_AlongWithLinePath; } set { m_AlongWithLinePath = value; } }
|
||||||
|
/// <summary>
|
||||||
/// 渐入动画完成回调
|
/// 渐入动画完成回调
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action fadeInFinishCallback { get; set; }
|
public Action fadeInFinishCallback { get; set; }
|
||||||
@@ -123,6 +128,8 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_CurrDetailProgress;
|
[SerializeField] private float m_CurrDetailProgress;
|
||||||
[SerializeField] private float m_DestDetailProgress;
|
[SerializeField] private float m_DestDetailProgress;
|
||||||
private float m_CurrSymbolProgress;
|
private float m_CurrSymbolProgress;
|
||||||
|
private Vector3 m_LinePathLastPos;
|
||||||
|
private float m_LinePathCurrTotalDist = 0f;
|
||||||
|
|
||||||
public void FadeIn()
|
public void FadeIn()
|
||||||
{
|
{
|
||||||
@@ -343,12 +350,30 @@ namespace XCharts
|
|||||||
return !IsFinish() && detail > m_CurrDetailProgress;
|
return !IsFinish() && detail > m_CurrDetailProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLinePathStartPos(Vector3 pos)
|
||||||
|
{
|
||||||
|
if (m_AlongWithLinePath)
|
||||||
|
{
|
||||||
|
m_LinePathLastPos = pos;
|
||||||
|
m_LinePathCurrTotalDist = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool CheckDetailBreak(Vector3 pos, bool isYAxis)
|
public bool CheckDetailBreak(Vector3 pos, bool isYAxis)
|
||||||
{
|
{
|
||||||
if (IsFinish()) return false;
|
if (IsFinish()) return false;
|
||||||
|
if (m_AlongWithLinePath)
|
||||||
|
{
|
||||||
|
m_LinePathCurrTotalDist += Vector3.Distance(pos, m_LinePathLastPos);
|
||||||
|
m_LinePathLastPos = pos;
|
||||||
|
return CheckDetailBreak(m_LinePathCurrTotalDist);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (isYAxis) return pos.y > m_CurrDetailProgress;
|
if (isYAxis) return pos.y > m_CurrDetailProgress;
|
||||||
else return pos.x > m_CurrDetailProgress;
|
else return pos.x > m_CurrDetailProgress;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool NeedAnimation(int dataIndex)
|
public bool NeedAnimation(int dataIndex)
|
||||||
{
|
{
|
||||||
@@ -358,7 +383,7 @@ namespace XCharts
|
|||||||
else return dataIndex <= m_CurrDataProgress;
|
else return dataIndex <= m_CurrDataProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void CheckProgress(double total)
|
public void CheckProgress(double total)
|
||||||
{
|
{
|
||||||
if (IsFinish()) return;
|
if (IsFinish()) return;
|
||||||
if (!m_IsInit || m_IsPause || m_IsEnd) return;
|
if (!m_IsInit || m_IsPause || m_IsEnd) return;
|
||||||
@@ -386,7 +411,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal float GetCurrAnimationDuration(int dataIndex = -1)
|
public float GetCurrAnimationDuration(int dataIndex = -1)
|
||||||
{
|
{
|
||||||
if (dataIndex >= 0)
|
if (dataIndex >= 0)
|
||||||
{
|
{
|
||||||
@@ -397,7 +422,7 @@ namespace XCharts
|
|||||||
else return m_FadeInDuration > 0 ? m_FadeInDuration / 1000 : 1f;
|
else return m_FadeInDuration > 0 ? m_FadeInDuration / 1000 : 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal float CheckBarProgress(int dataIndex, float barHig, int dataCount, out bool isBarEnd)
|
public float CheckBarProgress(int dataIndex, float barHig, int dataCount, out bool isBarEnd)
|
||||||
{
|
{
|
||||||
isBarEnd = false;
|
isBarEnd = false;
|
||||||
var initHig = m_FadeOut ? barHig : 0;
|
var initHig = m_FadeOut ? barHig : 0;
|
||||||
@@ -443,7 +468,7 @@ namespace XCharts
|
|||||||
End();
|
End();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void CheckSymbol(float dest)
|
public void CheckSymbol(float dest)
|
||||||
{
|
{
|
||||||
if (!enable || m_IsEnd || m_IsPause || !m_IsInit) return;
|
if (!enable || m_IsEnd || m_IsPause || !m_IsInit) return;
|
||||||
if (IsInDelay()) return;
|
if (IsInDelay()) return;
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ namespace XCharts
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class SerieData : SubComponent
|
public class SerieData : SubComponent
|
||||||
{
|
{
|
||||||
|
[SerializeField] private int m_Index;
|
||||||
|
[SerializeField] private int m_ParentIndex = -1;
|
||||||
[SerializeField] private string m_Name;
|
[SerializeField] private string m_Name;
|
||||||
|
[SerializeField] private string m_Id;
|
||||||
[SerializeField] private bool m_Selected;
|
[SerializeField] private bool m_Selected;
|
||||||
[SerializeField] private bool m_Ignore = false;
|
[SerializeField] private bool m_Ignore = false;
|
||||||
[SerializeField] private float m_Radius;
|
[SerializeField] private float m_Radius;
|
||||||
@@ -33,19 +36,25 @@ namespace XCharts
|
|||||||
[SerializeField] private bool m_EnableSymbol = false;
|
[SerializeField] private bool m_EnableSymbol = false;
|
||||||
[SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
|
[SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
|
||||||
[SerializeField] private List<double> m_Data = new List<double>();
|
[SerializeField] private List<double> m_Data = new List<double>();
|
||||||
|
[SerializeField] private List<int> m_Children = new List<int>();
|
||||||
|
|
||||||
public ChartLabel labelObject { get; set; }
|
public ChartLabel labelObject { get; set; }
|
||||||
|
|
||||||
private bool m_Show = true;
|
private bool m_Show = true;
|
||||||
private float m_RtPieOutsideRadius;
|
private float m_RtPieOutsideRadius;
|
||||||
|
|
||||||
public int index { get; set; }
|
public int index { get { return m_Index; } set { m_Index = value; } }
|
||||||
|
public int parentIndex { get { return m_ParentIndex; } set { m_ParentIndex = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the name of data item.
|
/// the name of data item.
|
||||||
/// 数据项名称。
|
/// 数据项名称。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 数据项的唯一id。唯一id不是必须设置的。
|
||||||
|
/// </summary>
|
||||||
|
public string id { get { return m_Id; } set { m_Id = value; } }
|
||||||
|
/// <summary>
|
||||||
/// 数据项图例名称。当数据项名称不为空时,图例名称即为系列名称;反之则为索引index。
|
/// 数据项图例名称。当数据项名称不为空时,图例名称即为系列名称;反之则为索引index。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
@@ -113,6 +122,7 @@ namespace XCharts
|
|||||||
/// 可指定任意维数的数值列表。
|
/// 可指定任意维数的数值列表。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<double> data { get { return m_Data; } set { m_Data = value; } }
|
public List<double> data { get { return m_Data; } set { m_Data = value; } }
|
||||||
|
public List<int> children { get { return m_Children; } set { m_Children = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [default:true] Whether the data item is showed.
|
/// [default:true] Whether the data item is showed.
|
||||||
/// 该数据项是否要显示。
|
/// 该数据项是否要显示。
|
||||||
@@ -133,23 +143,23 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的开始角度(运行时自动计算)
|
/// 饼图数据项的开始角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimePieStartAngle { get; internal set; }
|
public float runtimePieStartAngle { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的结束角度(运行时自动计算)
|
/// 饼图数据项的结束角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimePieToAngle { get; internal set; }
|
public float runtimePieToAngle { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的一半时的角度(运行时自动计算)
|
/// 饼图数据项的一半时的角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimePieHalfAngle { get; internal set; }
|
public float runtimePieHalfAngle { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的当前角度(运行时自动计算)
|
/// 饼图数据项的当前角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimePieCurrAngle { get; internal set; }
|
public float runtimePieCurrAngle { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的内半径
|
/// 饼图数据项的内半径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimePieInsideRadius { get; internal set; }
|
public float runtimePieInsideRadius { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的外半径
|
/// 饼图数据项的外半径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -160,7 +170,7 @@ namespace XCharts
|
|||||||
if (radius > 0) return radius;
|
if (radius > 0) return radius;
|
||||||
else return m_RtPieOutsideRadius;
|
else return m_RtPieOutsideRadius;
|
||||||
}
|
}
|
||||||
internal set
|
set
|
||||||
{
|
{
|
||||||
m_RtPieOutsideRadius = value;
|
m_RtPieOutsideRadius = value;
|
||||||
}
|
}
|
||||||
@@ -168,24 +178,34 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的偏移半径
|
/// 饼图数据项的偏移半径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float runtimePieOffsetRadius { get; internal set; }
|
public float runtimePieOffsetRadius { get; set; }
|
||||||
public Vector3 runtimePosition { get; set; }
|
public Vector3 runtimePosition { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 绘制区域。
|
/// 绘制区域。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Rect runtimeRect { get; set; }
|
public Rect runtimeRect { get; set; }
|
||||||
|
public Rect runtimeSubRect { get; set; }
|
||||||
|
public int runtimeLevel { get; set; }
|
||||||
|
public SerieData runtimeParent { get; set; }
|
||||||
|
public Color32 runtimeColor { get; set; }
|
||||||
|
public double runtimeArea { get; set; }
|
||||||
public float runtimeAngle { get; set; }
|
public float runtimeAngle { get; set; }
|
||||||
public Vector3 runtiemPieOffsetCenter { get; set; }
|
public Vector3 runtiemPieOffsetCenter { get; set; }
|
||||||
public float runtimeStackHig { get; set; }
|
public float runtimeStackHig { get; set; }
|
||||||
public Image runtimeSymbol { get; set; }
|
public Image runtimeSymbol { get; set; }
|
||||||
|
public List<SerieData> runtimeChildren { get { return m_RuntimeChildren; } }
|
||||||
|
|
||||||
private List<double> m_PreviousData = new List<double>();
|
private List<double> m_PreviousData = new List<double>();
|
||||||
private List<float> m_DataUpdateTime = new List<float>();
|
private List<float> m_DataUpdateTime = new List<float>();
|
||||||
private List<bool> m_DataUpdateFlag = new List<bool>();
|
private List<bool> m_DataUpdateFlag = new List<bool>();
|
||||||
private List<Vector2> m_PolygonPoints = new List<Vector2>();
|
private List<Vector2> m_PolygonPoints = new List<Vector2>();
|
||||||
|
[System.NonSerialized]
|
||||||
|
private List<SerieData> m_RuntimeChildren = new List<SerieData>();
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
index = 0;
|
index = 0;
|
||||||
|
m_ParentIndex = -1;
|
||||||
labelObject = null;
|
labelObject = null;
|
||||||
highlighted = false;
|
highlighted = false;
|
||||||
m_Name = string.Empty;
|
m_Name = string.Empty;
|
||||||
@@ -200,6 +220,8 @@ namespace XCharts
|
|||||||
m_Radius = 0;
|
m_Radius = 0;
|
||||||
m_Data.Clear();
|
m_Data.Clear();
|
||||||
m_PreviousData.Clear();
|
m_PreviousData.Clear();
|
||||||
|
m_PolygonPoints.Clear();
|
||||||
|
m_RuntimeChildren.Clear();
|
||||||
m_DataUpdateTime.Clear();
|
m_DataUpdateTime.Clear();
|
||||||
m_DataUpdateFlag.Clear();
|
m_DataUpdateFlag.Clear();
|
||||||
m_IconStyle.Reset();
|
m_IconStyle.Reset();
|
||||||
@@ -350,6 +372,16 @@ namespace XCharts
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UpdateData(int dimension, double value)
|
||||||
|
{
|
||||||
|
if (dimension >= 0 && dimension < data.Count)
|
||||||
|
{
|
||||||
|
data[dimension] = value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckLastData()
|
private void CheckLastData()
|
||||||
{
|
{
|
||||||
if (m_PreviousData.Count != m_Data.Count)
|
if (m_PreviousData.Count != m_Data.Count)
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义标记。
|
/// 自定义标记。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Custom
|
Custom,
|
||||||
|
EmptyRect,
|
||||||
|
EmptyTriangle,
|
||||||
|
EmptyDiamond
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -227,6 +227,19 @@ namespace XCharts
|
|||||||
else return Color.clear;
|
else return Color.clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetColorPalette(List<Color32> colorList)
|
||||||
|
{
|
||||||
|
m_ColorPalette = colorList;
|
||||||
|
SetVerticesDirty();
|
||||||
|
}
|
||||||
|
public void SetColorPalette(List<string> hexColorStringList)
|
||||||
|
{
|
||||||
|
m_ColorPalette.Clear();
|
||||||
|
foreach (var hexColor in hexColorStringList)
|
||||||
|
m_ColorPalette.Add(ColorUtil.GetColor(hexColor));
|
||||||
|
SetVerticesDirty();
|
||||||
|
}
|
||||||
|
|
||||||
public void CheckWarning(StringBuilder sb)
|
public void CheckWarning(StringBuilder sb)
|
||||||
{
|
{
|
||||||
#if dUI_TextMeshPro
|
#if dUI_TextMeshPro
|
||||||
|
|||||||
@@ -49,8 +49,20 @@ namespace XCharts
|
|||||||
visualMap.location.align = Location.Align.BottomLeft;
|
visualMap.location.align = Location.Align.BottomLeft;
|
||||||
visualMap.location.bottom = 100;
|
visualMap.location.bottom = 100;
|
||||||
visualMap.location.left = 30;
|
visualMap.location.left = 30;
|
||||||
var colors = new List<string>{"#313695", "#4575b4", "#74add1", "#abd9e9", "#e0f3f8", "#ffffbf",
|
var colors = new List<string>
|
||||||
"#fee090", "#fdae61", "#f46d43", "#d73027", "#a50026"};
|
{
|
||||||
|
"#313695",
|
||||||
|
"#4575b4",
|
||||||
|
"#74add1",
|
||||||
|
"#abd9e9",
|
||||||
|
"#e0f3f8",
|
||||||
|
"#ffffbf",
|
||||||
|
"#fee090",
|
||||||
|
"#fdae61",
|
||||||
|
"#f46d43",
|
||||||
|
"#d73027",
|
||||||
|
"#a50026"
|
||||||
|
};
|
||||||
visualMap.inRange.Clear();
|
visualMap.inRange.Clear();
|
||||||
foreach (var str in colors)
|
foreach (var str in colors)
|
||||||
{
|
{
|
||||||
@@ -80,11 +92,27 @@ namespace XCharts
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected override void UpdateTooltip()
|
protected override void UpdateTooltip()
|
||||||
|
{
|
||||||
|
var dataIndex = GetDataIndex();
|
||||||
|
if (dataIndex < 0) return;
|
||||||
|
var content = TooltipHelper.GetFormatterContent(tooltip, dataIndex, this);
|
||||||
|
TooltipHelper.SetContentAndPosition(tooltip, content, chartRect);
|
||||||
|
tooltip.SetActive(true);
|
||||||
|
for (int i = 0; i < m_XAxes.Count; i++)
|
||||||
|
{
|
||||||
|
UpdateAxisTooltipLabel(i, m_XAxes[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < m_YAxes.Count; i++)
|
||||||
|
{
|
||||||
|
UpdateAxisTooltipLabel(i, m_YAxes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetDataIndex()
|
||||||
{
|
{
|
||||||
var xData = tooltip.runtimeXValues[0];
|
var xData = tooltip.runtimeXValues[0];
|
||||||
var yData = tooltip.runtimeYValues[0];
|
var yData = tooltip.runtimeYValues[0];
|
||||||
if (IsCategory() && (xData < 0 || yData < 0)) return;
|
if (IsCategory() && (xData < 0 || yData < 0)) return -1;
|
||||||
sb.Length = 0;
|
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.GetSerie(i);
|
var serie = m_Series.GetSerie(i);
|
||||||
@@ -96,30 +124,11 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (IsCategory())
|
if (IsCategory())
|
||||||
{
|
{
|
||||||
string key = serie.name;
|
return (int) xData * yCount + (int) yData;
|
||||||
var serieData = serie.data[(int)xData * yCount + (int)yData];
|
|
||||||
var value = serieData.data[2];
|
|
||||||
var color = visualMap.enable ? visualMap.GetColor(value) :
|
|
||||||
m_Theme.GetColor(serie.index);
|
|
||||||
sb.Append("\n")
|
|
||||||
.Append(key).Append(!string.IsNullOrEmpty(key) ? "\n" : "")
|
|
||||||
.Append("<color=#").Append(ChartCached.ColorToStr(color)).Append(">● </color>")
|
|
||||||
.Append(xAxis.data[(int)xData]).Append(": ")
|
|
||||||
.Append(ChartCached.FloatToStr(value, string.Empty));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TooltipHelper.SetContentAndPosition(tooltip, sb.ToString().Trim(), chartRect);
|
return -1;
|
||||||
tooltip.SetActive(true);
|
|
||||||
|
|
||||||
for (int i = 0; i < m_XAxes.Count; i++)
|
|
||||||
{
|
|
||||||
UpdateAxisTooltipLabel(i, m_XAxes[i]);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < m_YAxes.Count; i++)
|
|
||||||
{
|
|
||||||
UpdateAxisTooltipLabel(i, m_YAxes[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,8 @@ namespace XCharts
|
|||||||
int split = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
int split = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
||||||
if (axis.type == Axis.AxisType.Value)
|
if (axis.type == Axis.AxisType.Value)
|
||||||
{
|
{
|
||||||
if (minValue == 0 && maxValue == 0) return string.Empty;
|
if (minValue == 0 && maxValue == 0)
|
||||||
|
maxValue = axis.max != 0 ? axis.max : 1;
|
||||||
double value = 0;
|
double value = 0;
|
||||||
if (forcePercent) maxValue = 100;
|
if (forcePercent) maxValue = 100;
|
||||||
if (axis.interval > 0)
|
if (axis.interval > 0)
|
||||||
@@ -213,17 +214,21 @@ namespace XCharts
|
|||||||
if (splitNum == 0) return 0;
|
if (splitNum == 0) return 0;
|
||||||
if (axis.IsCategory())
|
if (axis.IsCategory())
|
||||||
{
|
{
|
||||||
var data = axis.GetDataList(dataZoom);
|
var dataCount = axis.GetDataList(dataZoom).Count;
|
||||||
var scaleNum = 0;
|
var scaleNum = 0;
|
||||||
|
|
||||||
if (axis.boundaryGap)
|
if (axis.boundaryGap)
|
||||||
{
|
{
|
||||||
scaleNum = data.Count % splitNum == 0 ? splitNum + 1 : splitNum + 2;
|
scaleNum = dataCount > 2 && dataCount % splitNum == 0
|
||||||
|
? splitNum + 1
|
||||||
|
: splitNum + 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (data.Count < splitNum) scaleNum = splitNum;
|
if (dataCount < splitNum) scaleNum = splitNum;
|
||||||
else scaleNum = data.Count % splitNum == 0 ? splitNum : splitNum + 1;
|
else scaleNum = dataCount > 2 && dataCount % splitNum == 0
|
||||||
|
? splitNum
|
||||||
|
: splitNum + 1;
|
||||||
}
|
}
|
||||||
return scaleNum;
|
return scaleNum;
|
||||||
}
|
}
|
||||||
@@ -396,7 +401,6 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (!axis.show) return false;
|
if (!axis.show) return false;
|
||||||
if (axis.IsCategory() && axis.GetDataList().Count <= 0) return false;
|
if (axis.IsCategory() && axis.GetDataList().Count <= 0) return false;
|
||||||
else if (axis.IsValue() && axis.runtimeMinValue == 0 && axis.runtimeMaxValue == 0) return false;
|
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,18 @@ namespace XCharts
|
|||||||
|
|
||||||
public static string CheckChart(BaseGraph chart)
|
public static string CheckChart(BaseGraph chart)
|
||||||
{
|
{
|
||||||
if (chart is BaseChart) return CheckChart((BaseChart)chart);
|
if (chart == null)
|
||||||
else return string.Empty;
|
return string.Empty;
|
||||||
|
if (chart is BaseChart)
|
||||||
|
return CheckChart((BaseChart)chart);
|
||||||
|
else
|
||||||
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string CheckChart(BaseChart chart)
|
public static string CheckChart(BaseChart chart)
|
||||||
{
|
{
|
||||||
|
if (chart == null)
|
||||||
|
return string.Empty;
|
||||||
var sb = ChartHelper.sb;
|
var sb = ChartHelper.sb;
|
||||||
sb.Length = 0;
|
sb.Length = 0;
|
||||||
CheckName(chart, sb);
|
CheckName(chart, sb);
|
||||||
@@ -39,10 +45,10 @@ namespace XCharts
|
|||||||
private static void CheckName(BaseChart chart, StringBuilder sb)
|
private static void CheckName(BaseChart chart, StringBuilder sb)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(chart.chartName)) return;
|
if (string.IsNullOrEmpty(chart.chartName)) return;
|
||||||
var list = XChartsMgr.Instance.GetCharts(chart.chartName);
|
if (XChartsMgr.Instance.IsRepeatChartName(chart))
|
||||||
if (list.Count > 1)
|
|
||||||
{
|
{
|
||||||
sb.AppendFormat("warning:chart name is repeated: {0}\n", chart.chartName);
|
var info = XChartsMgr.Instance.GetRepeatChartNameInfo(chart, chart.chartName);
|
||||||
|
sb.AppendFormat("warning:chart name is repeated: {0}\n{1}", chart.chartName, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace XCharts
|
|||||||
public static class FormatterHelper
|
public static class FormatterHelper
|
||||||
{
|
{
|
||||||
public const string PH_NN = "\n";
|
public const string PH_NN = "\n";
|
||||||
private static Regex s_Regex = new Regex(@"{([a-d|.]\d*)(:\d+(-\d+)?)?(:[c-g|x|p|r]\d*|:0\.#*)?}", RegexOptions.IgnoreCase);
|
private static Regex s_Regex = new Regex(@"{([a-e|.]\d*)(:\d+(-\d+)?)?(:[c-g|x|p|r]\d*|:0\.#*)?}", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexSub = new Regex(@"(0\.#*)|(\d+-\d+)|(\w+)|(\.)", RegexOptions.IgnoreCase);
|
private static Regex s_RegexSub = new Regex(@"(0\.#*)|(\d+-\d+)|(\w+)|(\.)", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexN = new Regex(@"^\d+", RegexOptions.IgnoreCase);
|
private static Regex s_RegexN = new Regex(@"^\d+", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexN_N = new Regex(@"\d+-\d+", RegexOptions.IgnoreCase);
|
private static Regex s_RegexN_N = new Regex(@"\d+-\d+", RegexOptions.IgnoreCase);
|
||||||
@@ -23,11 +23,11 @@ namespace XCharts
|
|||||||
private static Regex s_RegexNewLine = new Regex(@"[\\|/]+n|</br>|<br>|<br/>", RegexOptions.IgnoreCase);
|
private static Regex s_RegexNewLine = new Regex(@"[\\|/]+n|</br>|<br>|<br/>", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexForAxisLabel = new Regex(@"{value(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
private static Regex s_RegexForAxisLabel = new Regex(@"{value(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexSubForAxisLabel = new Regex(@"(value)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
private static Regex s_RegexSubForAxisLabel = new Regex(@"(value)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexForSerieLabel = new Regex(@"{[a-d|\.](:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
private static Regex s_RegexForSerieLabel = new Regex(@"{[a-e|\.](:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexSubForSerieLabel = new Regex(@"(\.)|([a-d])|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
private static Regex s_RegexSubForSerieLabel = new Regex(@"(\.)|([a-e])|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 替换字符串中的通配符,支持的通配符有{.}、{a}、{b}、{c}、{d}。
|
/// 替换字符串中的通配符,支持的通配符有{.}、{a}、{b}、{c}、{d}、{e}。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="content">要替换的字符串</param>
|
/// <param name="content">要替换的字符串</param>
|
||||||
/// <param name="dataIndex">选中的数据项serieData索引</param>
|
/// <param name="dataIndex">选中的数据项serieData索引</param>
|
||||||
@@ -84,15 +84,16 @@ namespace XCharts
|
|||||||
content = content.Replace(old, serie.name);
|
content = content.Replace(old, serie.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (p == 'b' || p == 'B')
|
else if (p == 'b' || p == 'B' || p == 'e' || p == 'E')
|
||||||
{
|
{
|
||||||
var bIndex = dataIndex;
|
var bIndex = dataIndex;
|
||||||
if (argsCount >= 2)
|
if (argsCount >= 2)
|
||||||
{
|
{
|
||||||
var args1Str = args[1].ToString();
|
var args1Str = args[1].ToString();
|
||||||
if (s_RegexN.IsMatch(args1Str)) bIndex = int.Parse(args1Str);
|
if (s_RegexN.IsMatch(args1Str))
|
||||||
|
bIndex = int.Parse(args1Str);
|
||||||
}
|
}
|
||||||
var needCategory = serie.type == SerieType.Line || serie.type == SerieType.Bar;
|
var needCategory = (p != 'e' && p != 'E') && (serie.type == SerieType.Line || serie.type == SerieType.Bar);
|
||||||
if (needCategory)
|
if (needCategory)
|
||||||
{
|
{
|
||||||
var category = (chart as CoordinateChart).GetTooltipCategory(dataIndex, serie, dataZoom);
|
var category = (chart as CoordinateChart).GetTooltipCategory(dataIndex, serie, dataZoom);
|
||||||
@@ -236,7 +237,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
content = content.Replace(old, serieName);
|
content = content.Replace(old, serieName);
|
||||||
}
|
}
|
||||||
else if (p == 'b' || p == 'B')
|
else if (p == 'b' || p == 'B' || p == 'e' || p == 'E')
|
||||||
{
|
{
|
||||||
content = content.Replace(old, dataName);
|
content = content.Replace(old, dataName);
|
||||||
}
|
}
|
||||||
@@ -247,6 +248,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (total != 0)
|
if (total != 0)
|
||||||
content = content.Replace(old, ChartCached.FloatToStr(value / total * 100, numericFormatter));
|
content = content.Replace(old, ChartCached.FloatToStr(value / total * 100, numericFormatter));
|
||||||
|
else
|
||||||
|
content = content.Replace(old, ChartCached.FloatToStr(0, numericFormatter));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,10 +11,14 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
public static class LegendHelper
|
public static class LegendHelper
|
||||||
{
|
{
|
||||||
public static Color GetContentColor(Legend legend, ChartTheme theme, bool active)
|
public static Color GetContentColor(int legendIndex, Legend legend, ChartTheme theme, bool active)
|
||||||
{
|
{
|
||||||
var textStyle = legend.textStyle;
|
var textStyle = legend.textStyle;
|
||||||
if (active) return !ChartHelper.IsClearColor(textStyle.color) ? textStyle.color : theme.legend.textColor;
|
if (active)
|
||||||
|
{
|
||||||
|
if (legend.textAutoColor) return theme.GetColor(legendIndex);
|
||||||
|
else return !ChartHelper.IsClearColor(textStyle.color) ? textStyle.color : theme.legend.textColor;
|
||||||
|
}
|
||||||
else return theme.legend.unableColor;
|
else return theme.legend.unableColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +38,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static LegendItem AddLegendItem(Legend legend, int i, string legendName, Transform parent,
|
public static LegendItem AddLegendItem(Legend legend, int i, string legendName, Transform parent,
|
||||||
ChartTheme theme, string content, Color itemColor, bool active)
|
ChartTheme theme, string content, Color itemColor, bool active, int legendIndex)
|
||||||
{
|
{
|
||||||
var objName = i + "_" + legendName;
|
var objName = i + "_" + legendName;
|
||||||
var anchorMin = new Vector2(0, 0.5f);
|
var anchorMin = new Vector2(0, 0.5f);
|
||||||
@@ -43,7 +47,7 @@ namespace XCharts
|
|||||||
var sizeDelta = new Vector2(100, 30);
|
var sizeDelta = new Vector2(100, 30);
|
||||||
var iconSizeDelta = new Vector2(legend.itemWidth, legend.itemHeight);
|
var iconSizeDelta = new Vector2(legend.itemWidth, legend.itemHeight);
|
||||||
var textStyle = legend.textStyle;
|
var textStyle = legend.textStyle;
|
||||||
var contentColor = GetContentColor(legend, theme, active);
|
var contentColor = GetContentColor(legendIndex, legend, theme, active);
|
||||||
|
|
||||||
var objAnchorMin = new Vector2(0, 1);
|
var objAnchorMin = new Vector2(0, 1);
|
||||||
var objAnchorMax = new Vector2(0, 1);
|
var objAnchorMax = new Vector2(0, 1);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace XCharts
|
|||||||
if (serieData.show && serieData.data.Count > dimension)
|
if (serieData.show && serieData.data.Count > dimension)
|
||||||
{
|
{
|
||||||
var value = serieData.data[dimension];
|
var value = serieData.data[dimension];
|
||||||
if (value < min) min = value;
|
if (value < min && !serie.IsIgnoreValue(value)) min = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return min == double.MaxValue ? 0 : min;
|
return min == double.MaxValue ? 0 : min;
|
||||||
@@ -39,7 +39,7 @@ namespace XCharts
|
|||||||
if (serieData.show && serieData.data.Count > dimension)
|
if (serieData.show && serieData.data.Count > dimension)
|
||||||
{
|
{
|
||||||
var value = serieData.data[dimension];
|
var value = serieData.data[dimension];
|
||||||
if (value < min)
|
if (value < min && !serie.IsIgnoreValue(value))
|
||||||
{
|
{
|
||||||
min = value;
|
min = value;
|
||||||
minData = serieData;
|
minData = serieData;
|
||||||
@@ -58,7 +58,7 @@ namespace XCharts
|
|||||||
if (serieData.show && serieData.data.Count > dimension)
|
if (serieData.show && serieData.data.Count > dimension)
|
||||||
{
|
{
|
||||||
var value = serieData.data[dimension];
|
var value = serieData.data[dimension];
|
||||||
if (value > max) max = value;
|
if (value > max && !serie.IsIgnoreValue(value)) max = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return max == double.MinValue ? 0 : max;
|
return max == double.MinValue ? 0 : max;
|
||||||
@@ -74,7 +74,7 @@ namespace XCharts
|
|||||||
if (serieData.show && serieData.data.Count > dimension)
|
if (serieData.show && serieData.data.Count > dimension)
|
||||||
{
|
{
|
||||||
var value = serieData.data[dimension];
|
var value = serieData.data[dimension];
|
||||||
if (value > max)
|
if (value > max && !serie.IsIgnoreValue(value))
|
||||||
{
|
{
|
||||||
max = value;
|
max = value;
|
||||||
maxData = serieData;
|
maxData = serieData;
|
||||||
@@ -93,7 +93,9 @@ namespace XCharts
|
|||||||
var serieData = dataList[i];
|
var serieData = dataList[i];
|
||||||
if (serieData.show && serieData.data.Count > dimension)
|
if (serieData.show && serieData.data.Count > dimension)
|
||||||
{
|
{
|
||||||
total += serieData.data[dimension];
|
var value = serieData.data[dimension];
|
||||||
|
if (!serie.IsIgnoreValue(value))
|
||||||
|
total += value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return total != 0 ? total / dataList.Count : 0;
|
return total != 0 ? total / dataList.Count : 0;
|
||||||
@@ -109,7 +111,9 @@ namespace XCharts
|
|||||||
var serieData = dataList[i];
|
var serieData = dataList[i];
|
||||||
if (serieData.show && serieData.data.Count > dimension)
|
if (serieData.show && serieData.data.Count > dimension)
|
||||||
{
|
{
|
||||||
s_TempList.Add(serieData.data[dimension]);
|
var value = serieData.data[dimension];
|
||||||
|
if (!serie.IsIgnoreValue(value))
|
||||||
|
s_TempList.Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s_TempList.Sort();
|
s_TempList.Sort();
|
||||||
@@ -139,11 +143,14 @@ namespace XCharts
|
|||||||
if (serieData.show && serieData.data.Count > dimension)
|
if (serieData.show && serieData.data.Count > dimension)
|
||||||
{
|
{
|
||||||
var value = serieData.data[dimension];
|
var value = serieData.data[dimension];
|
||||||
|
if (!serie.IsIgnoreValue(value))
|
||||||
|
{
|
||||||
if (value > max) max = value;
|
if (value > max) max = value;
|
||||||
if (value < min) min = value;
|
if (value < min) min = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the maximum and minimum values of all data in the serie.
|
/// Gets the maximum and minimum values of all data in the serie.
|
||||||
@@ -171,12 +178,15 @@ namespace XCharts
|
|||||||
for (int j = 0; j < count; j++)
|
for (int j = 0; j < count; j++)
|
||||||
{
|
{
|
||||||
var value = serieData.data[j];
|
var value = serieData.data[j];
|
||||||
|
if (!serie.IsIgnoreValue(value))
|
||||||
|
{
|
||||||
if (value > max) max = value;
|
if (value > max) max = value;
|
||||||
if (value < min) min = value;
|
if (value < min) min = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the data for the specified dimension of serie are all 0.
|
/// Whether the data for the specified dimension of serie are all 0.
|
||||||
@@ -225,6 +235,7 @@ namespace XCharts
|
|||||||
serie.runtimeHeight = chartHeight - runtimeTop - runtimeBottom;
|
serie.runtimeHeight = chartHeight - runtimeTop - runtimeBottom;
|
||||||
serie.runtimeCenterPos = new Vector3(serie.runtimeX + serie.runtimeWidth / 2,
|
serie.runtimeCenterPos = new Vector3(serie.runtimeX + serie.runtimeWidth / 2,
|
||||||
serie.runtimeY + serie.runtimeHeight / 2);
|
serie.runtimeY + serie.runtimeHeight / 2);
|
||||||
|
serie.runtimeRect = new Rect(serie.runtimeX, serie.runtimeY, serie.runtimeWidth, serie.runtimeHeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -233,6 +244,7 @@ namespace XCharts
|
|||||||
serie.runtimeWidth = chartWidth;
|
serie.runtimeWidth = chartWidth;
|
||||||
serie.runtimeHeight = chartHeight;
|
serie.runtimeHeight = chartHeight;
|
||||||
serie.runtimeCenterPos = chartPosition + new Vector3(chartWidth / 2, chartHeight / 2);
|
serie.runtimeCenterPos = chartPosition + new Vector3(chartWidth / 2, chartHeight / 2);
|
||||||
|
serie.runtimeRect = new Rect(serie.runtimeX, serie.runtimeY, serie.runtimeWidth, serie.runtimeHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,6 +431,14 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SerieLabel GetSerieEmphasisLabel(Serie serie, SerieData serieData)
|
||||||
|
{
|
||||||
|
if (!serie.IsPerformanceMode() && serieData.enableEmphasis && serieData.emphasis.show)
|
||||||
|
return serieData.emphasis.label;
|
||||||
|
else if (serie.emphasis.show) return serie.emphasis.label;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static IconStyle GetIconStyle(Serie serie, SerieData serieData)
|
public static IconStyle GetIconStyle(Serie serie, SerieData serieData)
|
||||||
{
|
{
|
||||||
if (serieData.enableIconStyle) return serieData.iconStyle;
|
if (serieData.enableIconStyle) return serieData.iconStyle;
|
||||||
@@ -622,13 +642,13 @@ namespace XCharts
|
|||||||
int start = 0, end = 0;
|
int start = 0, end = 0;
|
||||||
if (dataZoom.runtimeInvert)
|
if (dataZoom.runtimeInvert)
|
||||||
{
|
{
|
||||||
end = Mathf.CeilToInt(data.Count * dataZoom.end / 100);
|
end = Mathf.RoundToInt(data.Count * dataZoom.end / 100);
|
||||||
start = end - range;
|
start = end - range;
|
||||||
if (start < 0) start = 0;
|
if (start < 0) start = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start = Mathf.FloorToInt(data.Count * dataZoom.start / 100);
|
start = Mathf.RoundToInt(data.Count * dataZoom.start / 100);
|
||||||
end = start + range;
|
end = start + range;
|
||||||
if (end > data.Count) end = data.Count;
|
if (end > data.Count) end = data.Count;
|
||||||
}
|
}
|
||||||
@@ -646,6 +666,8 @@ namespace XCharts
|
|||||||
if (dataZoom.minShowNum > data.Count) range = data.Count;
|
if (dataZoom.minShowNum > data.Count) range = data.Count;
|
||||||
else range = dataZoom.minShowNum;
|
else range = dataZoom.minShowNum;
|
||||||
}
|
}
|
||||||
|
if (range > data.Count - start)
|
||||||
|
start = data.Count - range;
|
||||||
serie.m_FilterData = data.GetRange(start, range);
|
serie.m_FilterData = data.GetRange(start, range);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -690,7 +712,6 @@ namespace XCharts
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case SerieDataSortType.None:
|
case SerieDataSortType.None:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,9 +443,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var serie = series.GetSerie(i);
|
var serie = series.GetSerie(i);
|
||||||
if ((isPolar && serie.polarIndex != axisIndex)
|
if ((isPolar && serie.polarIndex != axisIndex)
|
||||||
|| (!isPolar && serie.yAxisIndex != axisIndex)) continue;
|
|| (!isPolar && serie.yAxisIndex != axisIndex)
|
||||||
if (series.IsActive(i))
|
|| !series.IsActive(i)) continue;
|
||||||
{
|
|
||||||
if (isPercentStack && SeriesHelper.IsPercentStack(series, serie.name, SerieType.Bar))
|
if (isPercentStack && SeriesHelper.IsPercentStack(series, serie.name, SerieType.Bar))
|
||||||
{
|
{
|
||||||
if (100 > max) max = 100;
|
if (100 > max) max = 100;
|
||||||
@@ -456,6 +455,7 @@ namespace XCharts
|
|||||||
var showData = serie.GetDataList(dataZoom);
|
var showData = serie.GetDataList(dataZoom);
|
||||||
foreach (var data in showData)
|
foreach (var data in showData)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (serie.type == SerieType.Candlestick)
|
if (serie.type == SerieType.Candlestick)
|
||||||
{
|
{
|
||||||
var dataMin = data.GetMinData(inverse);
|
var dataMin = data.GetMinData(inverse);
|
||||||
@@ -466,6 +466,8 @@ namespace XCharts
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var currData = data.GetData(yValue ? 1 : 0, inverse);
|
var currData = data.GetData(yValue ? 1 : 0, inverse);
|
||||||
|
if (!serie.IsIgnoreValue(currData))
|
||||||
|
{
|
||||||
if (currData > max) max = currData;
|
if (currData > max) max = currData;
|
||||||
if (currData < min) min = currData;
|
if (currData < min) min = currData;
|
||||||
}
|
}
|
||||||
@@ -510,6 +512,7 @@ namespace XCharts
|
|||||||
currData = yValue ? showData[j].GetData(1) : showData[j].GetData(0);
|
currData = yValue ? showData[j].GetData(1) : showData[j].GetData(0);
|
||||||
}
|
}
|
||||||
if (inverse) currData = -currData;
|
if (inverse) currData = -currData;
|
||||||
|
if (!serie.IsIgnoreValue(currData))
|
||||||
_serieTotalValueForMinMax[j] = _serieTotalValueForMinMax[j] + currData;
|
_serieTotalValueForMinMax[j] = _serieTotalValueForMinMax[j] + currData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void InitPieTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
|
private static void InitPieTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
|
||||||
ChartTheme theme)
|
ChartTheme theme)
|
||||||
{
|
{
|
||||||
@@ -234,6 +233,35 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void InitHeatmapTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
|
||||||
|
CoordinateChart chart)
|
||||||
|
{
|
||||||
|
if (serie.type != SerieType.Heatmap) return;
|
||||||
|
var xData = tooltip.runtimeXValues[0];
|
||||||
|
var yData = tooltip.runtimeYValues[0];
|
||||||
|
if (chart.IsCategory() && (xData < 0 || yData < 0)) return;
|
||||||
|
sb.Length = 0;
|
||||||
|
var xAxis = chart.GetXAxis(serie.xAxisIndex);
|
||||||
|
var yAxis = chart.GetYAxis(serie.yAxisIndex);
|
||||||
|
var xCount = xAxis.data.Count;
|
||||||
|
var yCount = yAxis.data.Count;
|
||||||
|
var visualMap = chart.visualMap;
|
||||||
|
if (chart.IsCategory())
|
||||||
|
{
|
||||||
|
string key = serie.name;
|
||||||
|
var serieData = serie.data[(int) xData * yCount + (int) yData];
|
||||||
|
var numericFormatter = GetItemNumericFormatter(tooltip, serie, serieData);
|
||||||
|
var value = serieData.data[2];
|
||||||
|
var color = visualMap.enable ? visualMap.GetColor(value) :
|
||||||
|
chart.theme.GetColor(serie.index);
|
||||||
|
sb.Append("\n")
|
||||||
|
.Append(key).Append(!string.IsNullOrEmpty(key) ? "\n" : "")
|
||||||
|
.Append("<color=#").Append(ChartCached.ColorToStr(color)).Append(">● </color>")
|
||||||
|
.Append(xAxis.data[(int) xData]).Append(": ")
|
||||||
|
.Append(ChartCached.FloatToStr(value, numericFormatter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void InitDefaultContent(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
|
private static void InitDefaultContent(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
|
||||||
BaseChart chart, DataZoom dataZoom = null, bool isCartesian = false,
|
BaseChart chart, DataZoom dataZoom = null, bool isCartesian = false,
|
||||||
Radar radar = null)
|
Radar radar = null)
|
||||||
@@ -259,6 +287,7 @@ namespace XCharts
|
|||||||
InitRingTooltip(ref sb, tooltip, serie, index, chart.theme);
|
InitRingTooltip(ref sb, tooltip, serie, index, chart.theme);
|
||||||
break;
|
break;
|
||||||
case SerieType.Heatmap:
|
case SerieType.Heatmap:
|
||||||
|
InitHeatmapTooltip(ref sb, tooltip, serie, index, chart as CoordinateChart);
|
||||||
break;
|
break;
|
||||||
case SerieType.Gauge:
|
case SerieType.Gauge:
|
||||||
InitGaugeTooltip(ref sb, tooltip, serie, index, chart.theme);
|
InitGaugeTooltip(ref sb, tooltip, serie, index, chart.theme);
|
||||||
@@ -335,8 +364,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
string content = itemFormatter;
|
string content = itemFormatter;
|
||||||
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, chart, null);
|
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, chart, null);
|
||||||
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar
|
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar ||
|
||||||
|| serie.type == SerieType.Ring ? dataIndex : serie.index;
|
serie.type == SerieType.Ring ? dataIndex : serie.index;
|
||||||
sb.Append(ChartCached.ColorToDotStr(chart.theme.GetColor(dotColorIndex)));
|
sb.Append(ChartCached.ColorToDotStr(chart.theme.GetColor(dotColorIndex)));
|
||||||
sb.Append(content);
|
sb.Append(content);
|
||||||
}
|
}
|
||||||
@@ -449,8 +478,8 @@ namespace XCharts
|
|||||||
string content = itemFormatter;
|
string content = itemFormatter;
|
||||||
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, chart, dataZoom);
|
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, chart, dataZoom);
|
||||||
if (!first) sb.Append(FormatterHelper.PH_NN);
|
if (!first) sb.Append(FormatterHelper.PH_NN);
|
||||||
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar
|
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar ||
|
||||||
|| serie.type == SerieType.Ring ? dataIndex : i;
|
serie.type == SerieType.Ring ? dataIndex : i;
|
||||||
sb.Append(ChartCached.ColorToDotStr(chart.theme.GetColor(dotColorIndex)));
|
sb.Append(ChartCached.ColorToDotStr(chart.theme.GetColor(dotColorIndex)));
|
||||||
sb.Append(content);
|
sb.Append(content);
|
||||||
first = false;
|
first = false;
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public static bool IsNeedGradient(VisualMap visualMap)
|
public static bool IsNeedGradient(VisualMap visualMap)
|
||||||
{
|
{
|
||||||
if (!visualMap.enable || visualMap.inRange.Count <= 0) return false;
|
if (!visualMap.enable || (visualMap.inRange.Count <= 0 && visualMap.pieces.Count <= 0)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,12 +74,17 @@ namespace XCharts
|
|||||||
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieBeforeCallback;
|
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieBeforeCallback;
|
||||||
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieAfterCallback;
|
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieAfterCallback;
|
||||||
protected Action<PointerEventData, int, int> m_OnPointerClickPie;
|
protected Action<PointerEventData, int, int> m_OnPointerClickPie;
|
||||||
|
protected Action<int, string, bool> m_OnLegendClick;
|
||||||
|
protected Action<int, string> m_OnLegendEnter;
|
||||||
|
protected Action<int, string> m_OnLegendExit;
|
||||||
|
|
||||||
protected bool m_RefreshLabel = false;
|
protected bool m_RefreshLabel = false;
|
||||||
internal bool m_ReinitLabel = false;
|
internal bool m_ReinitLabel = false;
|
||||||
internal bool m_ReinitTitle = false;
|
internal bool m_ReinitTitle = false;
|
||||||
internal bool m_CheckAnimation = false;
|
internal bool m_CheckAnimation = false;
|
||||||
internal bool m_IsPlayingAnimation = false;
|
internal bool m_IsPlayingAnimation = false;
|
||||||
|
internal int m_BasePainterVertCount;
|
||||||
|
internal int m_TopPainterVertCount;
|
||||||
internal protected List<string> m_LegendRealShowName = new List<string>();
|
internal protected List<string> m_LegendRealShowName = new List<string>();
|
||||||
protected List<Painter> m_PainterList = new List<Painter>();
|
protected List<Painter> m_PainterList = new List<Painter>();
|
||||||
internal Painter m_PainterTop;
|
internal Painter m_PainterTop;
|
||||||
@@ -109,6 +114,8 @@ namespace XCharts
|
|||||||
m_ComponentHandlers.Add(new VisualMapHandler(this));
|
m_ComponentHandlers.Add(new VisualMapHandler(this));
|
||||||
m_ComponentHandlers.Add(new DataZoomHandler(this));
|
m_ComponentHandlers.Add(new DataZoomHandler(this));
|
||||||
foreach (var draw in m_ComponentHandlers) draw.Init();
|
foreach (var draw in m_ComponentHandlers) draw.Init();
|
||||||
|
|
||||||
|
m_DebugInfo.Init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
@@ -161,6 +168,7 @@ namespace XCharts
|
|||||||
Internal_CheckAnimation();
|
Internal_CheckAnimation();
|
||||||
foreach (var draw in m_DrawSeries) draw.Update();
|
foreach (var draw in m_DrawSeries) draw.Update();
|
||||||
foreach (var draw in m_ComponentHandlers) draw.Update();
|
foreach (var draw in m_ComponentHandlers) draw.Update();
|
||||||
|
m_DebugInfo.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Painter GetPainter(int index)
|
public Painter GetPainter(int index)
|
||||||
@@ -224,6 +232,9 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
m_CheckTheme = m_Theme.theme;
|
m_CheckTheme = m_Theme.theme;
|
||||||
m_Theme.CopyTheme(m_CheckTheme);
|
m_Theme.CopyTheme(m_CheckTheme);
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
UnityEditor.EditorUtility.SetDirty(this);
|
||||||
|
#endif
|
||||||
SetAllComponentDirty();
|
SetAllComponentDirty();
|
||||||
OnThemeChanged();
|
OnThemeChanged();
|
||||||
}
|
}
|
||||||
@@ -450,7 +461,7 @@ namespace XCharts
|
|||||||
var active = IsActiveByLegend(datas[i]);
|
var active = IsActiveByLegend(datas[i]);
|
||||||
var bgColor = LegendHelper.GetIconColor(this, readIndex, datas[i], active);
|
var bgColor = LegendHelper.GetIconColor(this, readIndex, datas[i], active);
|
||||||
var item = LegendHelper.AddLegendItem(legend, i, datas[i], legendObject.transform, m_Theme,
|
var item = LegendHelper.AddLegendItem(legend, i, datas[i], legendObject.transform, m_Theme,
|
||||||
legendName, bgColor, active);
|
legendName, bgColor, active, readIndex);
|
||||||
legend.SetButton(legendName, item, totalLegend);
|
legend.SetButton(legendName, item, totalLegend);
|
||||||
ChartHelper.ClearEventListener(item.button.gameObject);
|
ChartHelper.ClearEventListener(item.button.gameObject);
|
||||||
ChartHelper.AddEventListener(item.button.gameObject, EventTriggerType.PointerDown, (data) =>
|
ChartHelper.AddEventListener(item.button.gameObject, EventTriggerType.PointerDown, (data) =>
|
||||||
@@ -517,32 +528,35 @@ namespace XCharts
|
|||||||
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
|
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
|
||||||
m_SerieLabelRoot.hideFlags = chartHideFlags;
|
m_SerieLabelRoot.hideFlags = chartHideFlags;
|
||||||
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
|
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
|
||||||
int count = 0;
|
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.list[i];
|
var serie = m_Series.list[i];
|
||||||
serie.index = i;
|
serie.index = i;
|
||||||
SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);
|
SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);
|
||||||
|
int count = 0;
|
||||||
for (int j = 0; j < serie.data.Count; j++)
|
for (int j = 0; j < serie.data.Count; j++)
|
||||||
{
|
{
|
||||||
var serieData = serie.data[j];
|
var serieData = serie.data[j];
|
||||||
serieData.index = j;
|
serieData.index = count;
|
||||||
serieData.labelObject = null;
|
serieData.labelObject = null;
|
||||||
AddSerieLabel(serie, serieData, count);
|
AddSerieLabel(serie, serieData, ref count);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SerieLabelHelper.UpdateLabelText(m_Series, m_Theme, m_LegendRealShowName);
|
SerieLabelHelper.UpdateLabelText(m_Series, m_Theme, m_LegendRealShowName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddSerieLabel(Serie serie, SerieData serieData, int count = -1)
|
|
||||||
|
protected void AddSerieLabel(Serie serie, SerieData serieData, ref int count)
|
||||||
{
|
{
|
||||||
if (m_SerieLabelRoot == null) return;
|
if (m_SerieLabelRoot == null) return;
|
||||||
if (count == -1) count = serie.dataCount;
|
if (count == -1) count = serie.dataCount;
|
||||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||||
|
var serieEmphasisLable = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
|
||||||
var iconStyle = SerieHelper.GetIconStyle(serie, serieData);
|
var iconStyle = SerieHelper.GetIconStyle(serie, serieData);
|
||||||
if (serie.IsPerformanceMode()) return;
|
if (serie.IsPerformanceMode()) return;
|
||||||
if (!serieLabel.show && !iconStyle.show) return;
|
if (!serieLabel.show && (serieEmphasisLable == null || !serieEmphasisLable.show) && !iconStyle.show) return;
|
||||||
|
if (serie.animation.enable && serie.animation.HasFadeOut()) return;
|
||||||
var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index);
|
var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index);
|
||||||
var color = Color.grey;
|
var color = Color.grey;
|
||||||
if (serie.type == SerieType.Pie)
|
if (serie.type == SerieType.Pie)
|
||||||
@@ -564,6 +578,12 @@ namespace XCharts
|
|||||||
item.SetIcon(iconImage);
|
item.SetIcon(iconImage);
|
||||||
item.SetIconActive(iconStyle.show);
|
item.SetIconActive(iconStyle.show);
|
||||||
serieData.labelObject = item;
|
serieData.labelObject = item;
|
||||||
|
|
||||||
|
foreach (var dataIndex in serieData.children)
|
||||||
|
{
|
||||||
|
AddSerieLabel(serie, serie.GetSerieData(dataIndex), ref count);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitSerieTitle()
|
private void InitSerieTitle()
|
||||||
@@ -779,6 +799,12 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnPointerClick(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
m_DebugInfo.clickChartCount++;
|
||||||
|
base.OnPointerClick(eventData);
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnPointerDown(PointerEventData eventData)
|
public override void OnPointerDown(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
base.OnPointerDown(eventData);
|
base.OnPointerDown(eventData);
|
||||||
@@ -824,6 +850,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
OnYMaxValueChanged();
|
OnYMaxValueChanged();
|
||||||
}
|
}
|
||||||
|
if(m_OnLegendClick != null)
|
||||||
|
m_OnLegendClick(index, legendName, show);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnLegendButtonEnter(int index, string legendName)
|
protected virtual void OnLegendButtonEnter(int index, string legendName)
|
||||||
@@ -839,6 +867,8 @@ namespace XCharts
|
|||||||
RefreshPainter(serie);
|
RefreshPainter(serie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(m_OnLegendEnter != null)
|
||||||
|
m_OnLegendEnter(index, legendName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnLegendButtonExit(int index, string legendName)
|
protected virtual void OnLegendButtonExit(int index, string legendName)
|
||||||
@@ -854,6 +884,8 @@ namespace XCharts
|
|||||||
RefreshPainter(serie);
|
RefreshPainter(serie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(m_OnLegendExit != null)
|
||||||
|
m_OnLegendExit(index, legendName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void UpdateTooltip()
|
protected virtual void UpdateTooltip()
|
||||||
@@ -871,6 +903,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
m_OnCustomDrawBaseCallback(vh);
|
m_OnCustomDrawBaseCallback(vh);
|
||||||
}
|
}
|
||||||
|
m_BasePainterVertCount = vh.currentVertCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnDrawPainterSerie(VertexHelper vh, Painter painter)
|
protected virtual void OnDrawPainterSerie(VertexHelper vh, Painter painter)
|
||||||
@@ -880,6 +913,7 @@ namespace XCharts
|
|||||||
var maxSeries = m_Series.Count;
|
var maxSeries = m_Series.Count;
|
||||||
var rate = Mathf.CeilToInt(maxSeries * 1.0f / maxPainter);
|
var rate = Mathf.CeilToInt(maxSeries * 1.0f / maxPainter);
|
||||||
m_PainterTop.Refresh();
|
m_PainterTop.Refresh();
|
||||||
|
m_DebugInfo.refreshCount++;
|
||||||
for (int i = painter.index * rate; i < (painter.index + 1) * rate && i < maxSeries; i++)
|
for (int i = painter.index * rate; i < (painter.index + 1) * rate && i < maxSeries; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.GetSerie(i);
|
var serie = m_Series.GetSerie(i);
|
||||||
@@ -892,6 +926,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
m_OnCustomDrawSerieAfterCallback(vh, serie);
|
m_OnCustomDrawSerieAfterCallback(vh, serie);
|
||||||
}
|
}
|
||||||
|
serie.runtimeVertCount = vh.currentVertCount;
|
||||||
}
|
}
|
||||||
m_RefreshLabel = true;
|
m_RefreshLabel = true;
|
||||||
}
|
}
|
||||||
@@ -907,6 +942,7 @@ namespace XCharts
|
|||||||
m_OnCustomDrawTopCallback(vh);
|
m_OnCustomDrawTopCallback(vh);
|
||||||
}
|
}
|
||||||
DrawTooltip(vh);
|
DrawTooltip(vh);
|
||||||
|
m_TopPainterVertCount = vh.currentVertCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void DrawPainterSerie(VertexHelper vh, Serie serie)
|
protected virtual void DrawPainterSerie(VertexHelper vh, Serie serie)
|
||||||
@@ -1011,17 +1047,20 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void DrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize,
|
public void DrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize,
|
||||||
float tickness, Vector3 pos, Color32 color, Color32 toColor, float gap, float[] cornerRadius)
|
float tickness, Vector3 pos, Color32 color, Color32 toColor, Color32 fillColor, float gap, float[] cornerRadius)
|
||||||
{
|
{
|
||||||
DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, gap, cornerRadius, Vector3.zero);
|
DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, fillColor, gap, cornerRadius, Vector3.zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize,
|
public void DrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize,
|
||||||
float tickness, Vector3 pos, Color32 color, Color32 toColor, float gap, float[] cornerRadius, Vector3 startPos)
|
float tickness, Vector3 pos, Color32 color, Color32 toColor, Color32 fillColor, float gap, float[] cornerRadius, Vector3 startPos)
|
||||||
{
|
{
|
||||||
var backgroundColor = ThemeHelper.GetBackgroundColor(m_Theme, m_Background);
|
var backgroundColor = ThemeHelper.GetBackgroundColor(m_Theme, m_Background);
|
||||||
|
if (ChartHelper.IsClearColor(fillColor))
|
||||||
|
fillColor = backgroundColor;
|
||||||
var smoothness = settings.cicleSmoothness;
|
var smoothness = settings.cicleSmoothness;
|
||||||
ChartDrawer.DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, gap,
|
ChartDrawer.DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, gap,
|
||||||
cornerRadius, backgroundColor, smoothness, startPos);
|
cornerRadius, fillColor, backgroundColor, smoothness, startPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawLabelBackground(VertexHelper vh, Serie serie, SerieData serieData)
|
public void DrawLabelBackground(VertexHelper vh, Serie serie, SerieData serieData)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace XCharts
|
|||||||
[SerializeField] protected bool m_DebugMode = false;
|
[SerializeField] protected bool m_DebugMode = false;
|
||||||
[SerializeField] protected bool m_EnableTextMeshPro = false;
|
[SerializeField] protected bool m_EnableTextMeshPro = false;
|
||||||
[SerializeField] protected Background m_Background = Background.defaultBackground;
|
[SerializeField] protected Background m_Background = Background.defaultBackground;
|
||||||
|
protected DebugInfo m_DebugInfo = new DebugInfo();
|
||||||
protected Painter m_Painter;
|
protected Painter m_Painter;
|
||||||
protected int m_SiblingIndex;
|
protected int m_SiblingIndex;
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ namespace XCharts
|
|||||||
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
|
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
|
||||||
protected Vector2 graphPivot { get { return m_GraphPivot; } }
|
protected Vector2 graphPivot { get { return m_GraphPivot; } }
|
||||||
public HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
|
public HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
|
||||||
|
public DebugInfo debug { get { return m_DebugInfo; } }
|
||||||
private ScrollRect m_ScrollRect;
|
private ScrollRect m_ScrollRect;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -728,12 +728,12 @@ namespace XCharts
|
|||||||
var labelName = AxisHelper.GetLabelName(xAxis, grid.runtimeWidth, i, xAxis.runtimeMinValue,
|
var labelName = AxisHelper.GetLabelName(xAxis, grid.runtimeWidth, i, xAxis.runtimeMinValue,
|
||||||
xAxis.runtimeMaxValue, dataZoom, isPercentStack);
|
xAxis.runtimeMaxValue, dataZoom, isPercentStack);
|
||||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, ChartCached.GetXAxisName(xAxisIndex, i),
|
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, ChartCached.GetXAxisName(xAxisIndex, i),
|
||||||
axisObj.transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(1, 0.5f),
|
axisObj.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||||
new Vector2(textWidth, textHeight), xAxis, theme.axis, labelName);
|
new Vector2(textWidth, textHeight), xAxis, theme.axis, labelName);
|
||||||
|
|
||||||
if (i == 0) xAxis.axisLabel.SetRelatedText(label.label, labelWidth);
|
if (i == 0) xAxis.axisLabel.SetRelatedText(label.label, labelWidth);
|
||||||
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||||
label.SetPosition(GetLabelXPosition(totalWidth + textWidth / 2 + gapWidth, i, xAxisIndex, xAxis));
|
label.SetPosition(GetLabelXPosition(totalWidth + gapWidth, i, xAxisIndex, xAxis));
|
||||||
xAxis.runtimeAxisLabelList.Add(label);
|
xAxis.runtimeAxisLabelList.Add(label);
|
||||||
totalWidth += labelWidth;
|
totalWidth += labelWidth;
|
||||||
}
|
}
|
||||||
@@ -848,7 +848,8 @@ namespace XCharts
|
|||||||
private Vector3 GetLabelYPosition(float scaleWid, int i, int yAxisIndex, YAxis yAxis)
|
private Vector3 GetLabelYPosition(float scaleWid, int i, int yAxisIndex, YAxis yAxis)
|
||||||
{
|
{
|
||||||
var grid = GetAxisGridOrDefault(yAxis);
|
var grid = GetAxisGridOrDefault(yAxis);
|
||||||
var startX = yAxis.IsLeft() ? grid.runtimeX : grid.runtimeX + grid.runtimeWidth;
|
var startX = grid.runtimeX + (yAxis.axisLabel.onZero ? m_XAxes[yAxisIndex].runtimeZeroXOffset : 0);
|
||||||
|
if (yAxis.IsRight()) startX += grid.runtimeWidth;
|
||||||
var posX = 0f;
|
var posX = 0f;
|
||||||
var inside = yAxis.axisLabel.inside;
|
var inside = yAxis.axisLabel.inside;
|
||||||
if ((inside && yAxis.IsLeft()) || (!inside && yAxis.IsRight()))
|
if ((inside && yAxis.IsLeft()) || (!inside && yAxis.IsRight()))
|
||||||
@@ -1081,7 +1082,7 @@ namespace XCharts
|
|||||||
new Vector2(grid.runtimeX, pY + scaleWidth),
|
new Vector2(grid.runtimeX, pY + scaleWidth),
|
||||||
yAxis.splitArea.GetColor(i, m_Theme.axis));
|
yAxis.splitArea.GetColor(i, m_Theme.axis));
|
||||||
}
|
}
|
||||||
if (yAxis.splitLine.show)
|
if (yAxis.splitLine.show && pY >= grid.runtimeY)
|
||||||
{
|
{
|
||||||
if (!xAxis.axisLine.show || !xAxis.axisLine.onZero || zeroPos.y != pY)
|
if (!xAxis.axisLine.show || !xAxis.axisLine.onZero || zeroPos.y != pY)
|
||||||
{
|
{
|
||||||
@@ -1199,7 +1200,7 @@ namespace XCharts
|
|||||||
new Vector2(pX + scaleWidth, grid.runtimeY),
|
new Vector2(pX + scaleWidth, grid.runtimeY),
|
||||||
xAxis.splitArea.GetColor(i, m_Theme.axis));
|
xAxis.splitArea.GetColor(i, m_Theme.axis));
|
||||||
}
|
}
|
||||||
if (xAxis.splitLine.show)
|
if (xAxis.splitLine.show && pX >= grid.runtimeX)
|
||||||
{
|
{
|
||||||
if (!yAxis.axisLine.show || !yAxis.axisLine.onZero || zeroPos.x != pX)
|
if (!yAxis.axisLine.show || !yAxis.axisLine.onZero || zeroPos.x != pX)
|
||||||
{
|
{
|
||||||
@@ -1464,10 +1465,11 @@ namespace XCharts
|
|||||||
if (!serie.show) continue;
|
if (!serie.show) continue;
|
||||||
if (serie.IsPerformanceMode()) continue;
|
if (serie.IsPerformanceMode()) continue;
|
||||||
if (!serie.IsCoordinateSerie()) continue;
|
if (!serie.IsCoordinateSerie()) continue;
|
||||||
|
DataZoomHelper.GetSerieRelatedDataZoom(serie, dataZooms, out var xDataZoom, out var yDataZoom);
|
||||||
for (int j = 0; j < serie.data.Count; j++)
|
var showData = serie.GetDataList(xDataZoom);
|
||||||
|
for (int j = 0; j < showData.Count; j++)
|
||||||
{
|
{
|
||||||
var serieData = serie.data[j];
|
var serieData = showData[j];
|
||||||
if (serieData.labelObject == null) continue;
|
if (serieData.labelObject == null) continue;
|
||||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData, serieData.highlighted);
|
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData, serieData.highlighted);
|
||||||
serieData.index = j;
|
serieData.index = j;
|
||||||
@@ -1546,9 +1548,13 @@ namespace XCharts
|
|||||||
if (!serie.IsCoordinateSerie()) continue;
|
if (!serie.IsCoordinateSerie()) continue;
|
||||||
var total = serie.yTotal;
|
var total = serie.yTotal;
|
||||||
var isPercentStack = SeriesHelper.IsPercentStack(m_Series, serie.stack, SerieType.Bar);
|
var isPercentStack = SeriesHelper.IsPercentStack(m_Series, serie.stack, SerieType.Bar);
|
||||||
for (int j = 0; j < serie.data.Count; j++)
|
DataZoomHelper.GetSerieRelatedDataZoom(serie, dataZooms, out var xDataZoom, out var yDataZoom);
|
||||||
|
var showData = serie.GetDataList(xDataZoom);
|
||||||
|
if (xDataZoom != null)
|
||||||
|
ChartHelper.HideAllObject(m_SerieLabelRoot, "label_" + i);
|
||||||
|
for (int j = 0; j < showData.Count; j++)
|
||||||
{
|
{
|
||||||
var serieData = serie.data[j];
|
var serieData = showData[j];
|
||||||
if (serieData.labelObject == null) continue;
|
if (serieData.labelObject == null) continue;
|
||||||
if (j >= serie.dataPoints.Count)
|
if (j >= serie.dataPoints.Count)
|
||||||
{
|
{
|
||||||
@@ -1556,6 +1562,7 @@ namespace XCharts
|
|||||||
serieData.SetIconActive(false);
|
serieData.SetIconActive(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
serieData.labelObject.SetActive(true);
|
||||||
var pos = serie.dataPoints[j];
|
var pos = serie.dataPoints[j];
|
||||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||||
var iconStyle = SerieHelper.GetIconStyle(serie, serieData);
|
var iconStyle = SerieHelper.GetIconStyle(serie, serieData);
|
||||||
@@ -1681,19 +1688,20 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Internal_CheckClipAndDrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize, float tickness,
|
public void Internal_CheckClipAndDrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize, float tickness,
|
||||||
Vector3 pos, Color32 color, Color32 toColor, float gap, bool clip, float[] cornerRadius, Grid grid, Vector3 startPos)
|
Vector3 pos, Color32 color, Color32 toColor, Color32 backgroundColor, float gap, bool clip, float[] cornerRadius,
|
||||||
|
Grid grid, Vector3 startPos)
|
||||||
{
|
{
|
||||||
if (!IsInChart(pos)) return;
|
if (!IsInChart(pos)) return;
|
||||||
if (!clip || (clip && (IsInGrid(grid, pos))))
|
if (!clip || (clip && (IsInGrid(grid, pos))))
|
||||||
DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, gap, cornerRadius, startPos);
|
DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, backgroundColor, gap, cornerRadius, startPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Internal_CheckClipAndDrawZebraLine(VertexHelper vh, Vector3 p1, Vector3 p2, float size, float zebraWidth,
|
public void Internal_CheckClipAndDrawZebraLine(VertexHelper vh, Vector3 p1, Vector3 p2, float size, float zebraWidth,
|
||||||
float zebraGap, Color32 color, bool clip, Grid grid)
|
float zebraGap, Color32 color, Color32 toColor, bool clip, Grid grid, float maxDistance)
|
||||||
{
|
{
|
||||||
ClampInChart(ref p1);
|
ClampInChart(ref p1);
|
||||||
ClampInChart(ref p2);
|
ClampInChart(ref p2);
|
||||||
UGL.DrawZebraLine(vh, p1, p2, size, zebraWidth, zebraGap, color);
|
UGL.DrawZebraLine(vh, p1, p2, size, zebraWidth, zebraGap, color, toColor, maxDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, Grid grid)
|
protected Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, Grid grid)
|
||||||
|
|||||||
@@ -329,17 +329,18 @@ namespace XCharts
|
|||||||
var center = new Vector3((plt.x + prb.x) / 2, (prt.y + plb.y) / 2);
|
var center = new Vector3((plt.x + prb.x) / 2, (prt.y + plb.y) / 2);
|
||||||
if (itemWidth > 0 && itemHeight > 0)
|
if (itemWidth > 0 && itemHeight > 0)
|
||||||
{
|
{
|
||||||
|
var invert = center.x < plb.x;
|
||||||
if (ItemStyleHelper.IsNeedCorner(itemStyle))
|
if (ItemStyleHelper.IsNeedCorner(itemStyle))
|
||||||
{
|
{
|
||||||
UGL.DrawRoundRectangle(vh, center, itemWidth, itemHeight, areaColor, areaToColor, 0,
|
UGL.DrawRoundRectangle(vh, center, itemWidth, itemHeight, areaColor, areaToColor, 0,
|
||||||
itemStyle.cornerRadius, isYAxis);
|
itemStyle.cornerRadius, isYAxis, m_Settings.cicleSmoothness, invert);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Internal_CheckClipAndDrawPolygon(vh, plb, plt, prt, prb, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, plb, plt, prt, prb, areaColor, areaToColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
||||||
itemStyle.borderToColor, 0, itemStyle.cornerRadius, isYAxis);
|
itemStyle.borderToColor, 0, itemStyle.cornerRadius, isYAxis, m_Settings.cicleSmoothness, invert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -356,10 +357,11 @@ namespace XCharts
|
|||||||
var center = new Vector3((plb.x + prt.x) / 2, (plt.y + prb.y) / 2);
|
var center = new Vector3((plb.x + prt.x) / 2, (plt.y + prb.y) / 2);
|
||||||
if (itemWidth > 0 && itemHeight > 0)
|
if (itemWidth > 0 && itemHeight > 0)
|
||||||
{
|
{
|
||||||
|
var invert = center.y < plb.y;
|
||||||
if (ItemStyleHelper.IsNeedCorner(itemStyle))
|
if (ItemStyleHelper.IsNeedCorner(itemStyle))
|
||||||
{
|
{
|
||||||
UGL.DrawRoundRectangle(vh, center, itemWidth, itemHeight, areaColor, areaToColor, 0,
|
UGL.DrawRoundRectangle(vh, center, itemWidth, itemHeight, areaColor, areaToColor, 0,
|
||||||
itemStyle.cornerRadius, isYAxis);
|
itemStyle.cornerRadius, isYAxis, m_Settings.cicleSmoothness, invert);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -367,7 +369,7 @@ namespace XCharts
|
|||||||
serie.clip, grid);
|
serie.clip, grid);
|
||||||
}
|
}
|
||||||
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
||||||
itemStyle.borderToColor, 0, itemStyle.cornerRadius, isYAxis);
|
itemStyle.borderToColor, 0, itemStyle.cornerRadius, isYAxis, m_Settings.cicleSmoothness, invert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -376,21 +378,22 @@ namespace XCharts
|
|||||||
bool highlight, float space, float barWidth, float pX, float pY, Vector3 plb, Vector3 plt, Vector3 prt,
|
bool highlight, float space, float barWidth, float pX, float pY, Vector3 plb, Vector3 plt, Vector3 prt,
|
||||||
Vector3 prb, bool isYAxis, Grid grid)
|
Vector3 prb, bool isYAxis, Grid grid)
|
||||||
{
|
{
|
||||||
var areaColor = SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
|
var barColor = SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
|
||||||
|
var barToColor = SerieHelper.GetItemToColor(serie, serieData, m_Theme, colorIndex, highlight);
|
||||||
DrawBarBackground(vh, serie, serieData, itemStyle, colorIndex, highlight, pX, pY, space, barWidth, isYAxis, grid);
|
DrawBarBackground(vh, serie, serieData, itemStyle, colorIndex, highlight, pX, pY, space, barWidth, isYAxis, grid);
|
||||||
if (isYAxis)
|
if (isYAxis)
|
||||||
{
|
{
|
||||||
plt = (plb + plt) / 2;
|
plt = (plb + plt) / 2;
|
||||||
prt = (prt + prb) / 2;
|
prt = (prt + prb) / 2;
|
||||||
Internal_CheckClipAndDrawZebraLine(vh, plt, prt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
Internal_CheckClipAndDrawZebraLine(vh, plt, prt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
||||||
areaColor, serie.clip, grid);
|
barColor, barToColor, serie.clip, grid, grid.runtimeWidth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plb = (prb + plb) / 2;
|
plb = (prb + plb) / 2;
|
||||||
plt = (plt + prt) / 2;
|
plt = (plt + prt) / 2;
|
||||||
Internal_CheckClipAndDrawZebraLine(vh, plb, plt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
Internal_CheckClipAndDrawZebraLine(vh, plb, plt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
||||||
areaColor, serie.clip, grid);
|
barColor, barToColor, serie.clip, grid, grid.runtimeHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,13 +40,14 @@ namespace XCharts
|
|||||||
? symbol.GetSelectedSize(serie.data[i].data, m_Theme.serie.lineSymbolSelectedSize)
|
? symbol.GetSelectedSize(serie.data[i].data, m_Theme.serie.lineSymbolSelectedSize)
|
||||||
: symbol.GetSize(serie.data[i].data, m_Theme.serie.lineSymbolSize);
|
: symbol.GetSize(serie.data[i].data, m_Theme.serie.lineSymbolSize);
|
||||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, m_Theme, serie.index, highlight);
|
var symbolColor = SerieHelper.GetItemColor(serie, serieData, m_Theme, serie.index, highlight);
|
||||||
|
|
||||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, m_Theme, serie.index, highlight);
|
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, m_Theme, serie.index, highlight);
|
||||||
|
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, m_Theme, serie.index, highlight, false);
|
||||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||||
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
||||||
Internal_CheckClipAndDrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serie.dataPoints[i], symbolColor,
|
Internal_CheckClipAndDrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serie.dataPoints[i], symbolColor,
|
||||||
symbolToColor, symbol.gap, clip, cornerRadius, grid, i > 0 ? serie.dataPoints[i - 1] : grid.runtimePosition);
|
symbolToColor, backgroundColor, symbol.gap, clip, cornerRadius, grid,
|
||||||
|
i > 0 ? serie.dataPoints[i - 1] : grid.runtimePosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,15 +168,11 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
var startIndex = 0;
|
var startIndex = 0;
|
||||||
var endIndex = serie.dataPoints.Count;
|
var endIndex = serie.dataPoints.Count;
|
||||||
var startPos = GetStartPos(serie.dataPoints, ref startIndex);
|
var startPos = GetStartPos(serie.dataPoints, ref startIndex, serie.ignoreLineBreak);
|
||||||
var endPos = GetEndPos(serie.dataPoints, ref endIndex);
|
var endPos = GetEndPos(serie.dataPoints, ref endIndex, serie.ignoreLineBreak);
|
||||||
lp = startPos;
|
lp = startPos;
|
||||||
stPos1 = stPos2 = lastDir = lastDnPos = Vector3.zero;
|
stPos1 = stPos2 = lastDir = lastDnPos = Vector3.zero;
|
||||||
smoothStartPosUp = smoothStartPosDn = Vector3.zero;
|
smoothStartPosUp = smoothStartPosDn = Vector3.zero;
|
||||||
float currDetailProgress = lp.x;
|
|
||||||
float totalDetailProgress = endPos.x;
|
|
||||||
serie.animation.InitProgress(serie.dataPoints.Count, currDetailProgress, totalDetailProgress);
|
|
||||||
serie.animation.SetDataFinish(startIndex);
|
|
||||||
|
|
||||||
Vector3 firstLastPos = Vector3.zero, lastNextPos = Vector3.zero;
|
Vector3 firstLastPos = Vector3.zero, lastNextPos = Vector3.zero;
|
||||||
if (serie.minShow > 0 && serie.minShow < showData.Count)
|
if (serie.minShow > 0 && serie.minShow < showData.Count)
|
||||||
@@ -215,15 +212,42 @@ namespace XCharts
|
|||||||
lastNextPos = endPos;
|
lastNextPos = endPos;
|
||||||
}
|
}
|
||||||
VisualMapHelper.AutoSetLineMinMax(visualMap, serie, xAxis, yAxis);
|
VisualMapHelper.AutoSetLineMinMax(visualMap, serie, xAxis, yAxis);
|
||||||
|
|
||||||
|
float currDetailProgress = lp.x;
|
||||||
|
float totalDetailProgress = endPos.x;
|
||||||
|
if (serie.animation.alongWithLinePath)
|
||||||
|
{
|
||||||
|
currDetailProgress = 0;
|
||||||
|
totalDetailProgress = 0;
|
||||||
|
var tempLp = startPos;
|
||||||
|
for (i = startIndex + 1; i < serie.dataPoints.Count; i++)
|
||||||
|
{
|
||||||
|
np = serie.dataPoints[i];
|
||||||
|
if (np != Vector3.zero)
|
||||||
|
{
|
||||||
|
totalDetailProgress += Vector3.Distance(np, tempLp);
|
||||||
|
tempLp = np;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
serie.animation.SetLinePathStartPos(startPos);
|
||||||
|
}
|
||||||
|
serie.animation.InitProgress(serie.dataPoints.Count, currDetailProgress, totalDetailProgress);
|
||||||
|
serie.animation.SetDataFinish(startIndex);
|
||||||
for (i = startIndex + 1; i < serie.dataPoints.Count; i++)
|
for (i = startIndex + 1; i < serie.dataPoints.Count; i++)
|
||||||
{
|
{
|
||||||
np = serie.dataPoints[i];
|
np = serie.dataPoints[i];
|
||||||
serie.ClearSmoothList(i);
|
serie.ClearSmoothList(i);
|
||||||
|
var isIgnoreBreak = false;
|
||||||
if (np == Vector3.zero)
|
if (np == Vector3.zero)
|
||||||
|
{
|
||||||
|
if (serie.ignoreLineBreak)
|
||||||
|
isIgnoreBreak = true;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
serie.animation.SetDataFinish(i);
|
serie.animation.SetDataFinish(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!serie.animation.NeedAnimation(i)) break;
|
if (!serie.animation.NeedAnimation(i)) break;
|
||||||
bool isFinish = true;
|
bool isFinish = true;
|
||||||
if (serie.areaStyle.tooltipHighlight && tooltip.show && i <= tooltip.runtimeDataIndex[0])
|
if (serie.areaStyle.tooltipHighlight && tooltip.show && i <= tooltip.runtimeDataIndex[0])
|
||||||
@@ -239,34 +263,54 @@ namespace XCharts
|
|||||||
switch (serie.lineType)
|
switch (serie.lineType)
|
||||||
{
|
{
|
||||||
case LineType.Normal:
|
case LineType.Normal:
|
||||||
lp = GetLastPos(serie.dataPoints, i, np);
|
lp = GetLastPos(serie.dataPoints, i, np, serie.ignoreLineBreak);
|
||||||
nnp = GetNNPos(serie.dataPoints, i, np);
|
nnp = GetNNPos(serie.dataPoints, i, np, serie.ignoreLineBreak);
|
||||||
isFinish = DrawNormalLine(vh, serie, xAxis, lp, np, nnp, i, lineColor,
|
if (lp == Vector3.zero && serie.ignoreLineBreak) isIgnoreBreak = true;
|
||||||
areaColor, areaToColor, zeroPos, startIndex);
|
isFinish = DrawNormalLine(vh, serie, xAxis, lp, np, nnp, i,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : lineColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaToColor,
|
||||||
|
zeroPos, startIndex);
|
||||||
break;
|
break;
|
||||||
case LineType.Smooth:
|
case LineType.Smooth:
|
||||||
case LineType.SmoothDash:
|
case LineType.SmoothDash:
|
||||||
llp = GetLLPos(serie.dataPoints, i, firstLastPos);
|
llp = GetLLPos(serie.dataPoints, i, firstLastPos, serie.ignoreLineBreak);
|
||||||
nnp = GetNNPos(serie.dataPoints, i, lastNextPos);
|
nnp = GetNNPos(serie.dataPoints, i, lastNextPos, serie.ignoreLineBreak);
|
||||||
|
if (lp == Vector3.zero && serie.ignoreLineBreak) isIgnoreBreak = true;
|
||||||
isFinish = DrawSmoothLine(vh, serie, xAxis, lp, np, llp, nnp, i,
|
isFinish = DrawSmoothLine(vh, serie, xAxis, lp, np, llp, nnp, i,
|
||||||
lineColor, areaColor, areaToColor, isStack, zeroPos, startIndex);
|
isIgnoreBreak ? ColorUtil.clearColor32 : lineColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaToColor,
|
||||||
|
isStack, zeroPos, startIndex);
|
||||||
break;
|
break;
|
||||||
case LineType.StepStart:
|
case LineType.StepStart:
|
||||||
case LineType.StepMiddle:
|
case LineType.StepMiddle:
|
||||||
case LineType.StepEnd:
|
case LineType.StepEnd:
|
||||||
nnp = GetNNPos(serie.dataPoints, i, np);
|
nnp = GetNNPos(serie.dataPoints, i, np, serie.ignoreLineBreak);
|
||||||
isFinish = DrawStepLine(vh, serie, xAxis, lp, np, nnp, i, lineColor,
|
if (lp == Vector3.zero && serie.ignoreLineBreak) isIgnoreBreak = true;
|
||||||
areaColor, areaToColor, zeroPos);
|
isFinish = DrawStepLine(vh, serie, xAxis, lp, np, nnp, i,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : lineColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaToColor,
|
||||||
|
zeroPos);
|
||||||
break;
|
break;
|
||||||
case LineType.Dash:
|
case LineType.Dash:
|
||||||
case LineType.Dot:
|
case LineType.Dot:
|
||||||
case LineType.DashDot:
|
case LineType.DashDot:
|
||||||
case LineType.DashDotDot:
|
case LineType.DashDotDot:
|
||||||
DrawOtherLine(vh, serie, xAxis, lp, np, i, lineColor, areaColor, areaToColor, zeroPos);
|
if (lp == Vector3.zero && serie.ignoreLineBreak) isIgnoreBreak = true;
|
||||||
|
DrawOtherLine(vh, serie, xAxis, lp, np, i,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : lineColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaColor,
|
||||||
|
isIgnoreBreak ? ColorUtil.clearColor32 : areaToColor,
|
||||||
|
zeroPos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isFinish) serie.animation.SetDataFinish(i);
|
if (isFinish) serie.animation.SetDataFinish(i);
|
||||||
if (np != Vector3.zero) lp = np;
|
if (np != Vector3.zero || serie.ignoreLineBreak)
|
||||||
|
{
|
||||||
|
lp = np;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
@@ -277,22 +321,22 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetNNPos(List<Vector3> dataPoints, int index, Vector3 np)
|
private Vector3 GetNNPos(List<Vector3> dataPoints, int index, Vector3 np, bool ignoreLineBreak)
|
||||||
{
|
{
|
||||||
int size = dataPoints.Count;
|
int size = dataPoints.Count;
|
||||||
if (index >= size) return np;
|
if (index >= size) return np;
|
||||||
for (int i = index + 1; i < size; i++)
|
for (int i = index + 1; i < size; i++)
|
||||||
{
|
{
|
||||||
if (dataPoints[i] != Vector3.zero) return dataPoints[i];
|
if (dataPoints[i] != Vector3.zero || ignoreLineBreak) return dataPoints[i];
|
||||||
}
|
}
|
||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetStartPos(List<Vector3> dataPoints, ref int start)
|
private Vector3 GetStartPos(List<Vector3> dataPoints, ref int start, bool ignoreLineBreak)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dataPoints.Count; i++)
|
for (int i = 0; i < dataPoints.Count; i++)
|
||||||
{
|
{
|
||||||
if (dataPoints[i] != Vector3.zero)
|
if (dataPoints[i] != Vector3.zero || ignoreLineBreak)
|
||||||
{
|
{
|
||||||
start = i;
|
start = i;
|
||||||
return dataPoints[i];
|
return dataPoints[i];
|
||||||
@@ -301,11 +345,11 @@ namespace XCharts
|
|||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetEndPos(List<Vector3> dataPoints, ref int end)
|
private Vector3 GetEndPos(List<Vector3> dataPoints, ref int end, bool ignoreLineBreak)
|
||||||
{
|
{
|
||||||
for (int i = dataPoints.Count - 1; i >= 0; i--)
|
for (int i = dataPoints.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (dataPoints[i] != Vector3.zero)
|
if (dataPoints[i] != Vector3.zero || ignoreLineBreak)
|
||||||
{
|
{
|
||||||
end = i;
|
end = i;
|
||||||
return dataPoints[i];
|
return dataPoints[i];
|
||||||
@@ -314,22 +358,22 @@ namespace XCharts
|
|||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetLastPos(List<Vector3> dataPoints, int index, Vector3 pos)
|
private Vector3 GetLastPos(List<Vector3> dataPoints, int index, Vector3 pos, bool ignoreLineBreak)
|
||||||
{
|
{
|
||||||
if (index <= 0) return pos;
|
if (index <= 0) return pos;
|
||||||
for (int i = index - 1; i >= 0; i--)
|
for (int i = index - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (dataPoints[i] != Vector3.zero) return dataPoints[i];
|
if (dataPoints[i] != Vector3.zero || ignoreLineBreak) return dataPoints[i];
|
||||||
}
|
}
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetLLPos(List<Vector3> dataPoints, int index, Vector3 lp)
|
private Vector3 GetLLPos(List<Vector3> dataPoints, int index, Vector3 lp, bool ignoreLineBreak)
|
||||||
{
|
{
|
||||||
if (index <= 1) return lp;
|
if (index <= 1) return lp;
|
||||||
for (int i = index - 2; i >= 0; i--)
|
for (int i = index - 2; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (dataPoints[i] != Vector3.zero) return dataPoints[i];
|
if (dataPoints[i] != Vector3.zero || ignoreLineBreak) return dataPoints[i];
|
||||||
}
|
}
|
||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
@@ -618,7 +662,7 @@ namespace XCharts
|
|||||||
case LineType.Normal:
|
case LineType.Normal:
|
||||||
nnp = i < serie.dataPoints.Count - 1 ? serie.dataPoints[i + 1] : np;
|
nnp = i < serie.dataPoints.Count - 1 ? serie.dataPoints[i + 1] : np;
|
||||||
isFinish = DrawNormalLine(vh, serie, yAxis, lp, np, nnp, i, lineColor,
|
isFinish = DrawNormalLine(vh, serie, yAxis, lp, np, nnp, i, lineColor,
|
||||||
areaColor, areaToColor, zeroPos);
|
areaColor, areaToColor, zeroPos, 0);
|
||||||
break;
|
break;
|
||||||
case LineType.Smooth:
|
case LineType.Smooth:
|
||||||
case LineType.SmoothDash:
|
case LineType.SmoothDash:
|
||||||
@@ -635,11 +679,11 @@ namespace XCharts
|
|||||||
areaColor, areaToColor, zeroPos);
|
areaColor, areaToColor, zeroPos);
|
||||||
break;
|
break;
|
||||||
case LineType.Dash:
|
case LineType.Dash:
|
||||||
UGL.DrawDashLine(vh, lp, np, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor);
|
UGL.DrawDashLine(vh, lp, np, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor, lineColor);
|
||||||
isFinish = true;
|
isFinish = true;
|
||||||
break;
|
break;
|
||||||
case LineType.Dot:
|
case LineType.Dot:
|
||||||
UGL.DrawDotLine(vh, lp, np, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor);
|
UGL.DrawDotLine(vh, lp, np, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor, lineColor);
|
||||||
isFinish = true;
|
isFinish = true;
|
||||||
break;
|
break;
|
||||||
case LineType.DashDot:
|
case LineType.DashDot:
|
||||||
@@ -678,7 +722,7 @@ namespace XCharts
|
|||||||
private bool lastIsDown;
|
private bool lastIsDown;
|
||||||
private bool DrawNormalLine(VertexHelper vh, Serie serie, Axis axis, Vector3 lp, Vector3 np, Vector3 nnp,
|
private bool DrawNormalLine(VertexHelper vh, Serie serie, Axis axis, Vector3 lp, Vector3 np, Vector3 nnp,
|
||||||
int dataIndex, Color32 lineColor, Color32 areaColor, Color32 areaToColor,
|
int dataIndex, Color32 lineColor, Color32 areaColor, Color32 areaToColor,
|
||||||
Vector3 zeroPos, int startIndex = 0)
|
Vector3 zeroPos, int startIndex)
|
||||||
{
|
{
|
||||||
var defaultLineColor = lineColor;
|
var defaultLineColor = lineColor;
|
||||||
var isSecond = dataIndex == startIndex + 1;
|
var isSecond = dataIndex == startIndex + 1;
|
||||||
@@ -789,6 +833,7 @@ namespace XCharts
|
|||||||
(!lastIsDown && IsInRightOrUp(isYAxis, lastDnPos, tp1)))
|
(!lastIsDown && IsInRightOrUp(isYAxis, lastDnPos, tp1)))
|
||||||
{
|
{
|
||||||
isStart = true;
|
isStart = true;
|
||||||
|
if (stPos1 != Vector3.zero && stPos2 != Vector3.zero)
|
||||||
Internal_CheckClipAndDrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -941,8 +986,8 @@ namespace XCharts
|
|||||||
Vector3 aep = isYAxis ? new Vector3(zeroPos.x, zeroPos.y + grid.runtimeHeight) : new Vector3(zeroPos.x + grid.runtimeWidth, zeroPos.y);
|
Vector3 aep = isYAxis ? new Vector3(zeroPos.x, zeroPos.y + grid.runtimeHeight) : new Vector3(zeroPos.x + grid.runtimeWidth, zeroPos.y);
|
||||||
var sindex = 0;
|
var sindex = 0;
|
||||||
var eindex = 0;
|
var eindex = 0;
|
||||||
var sp = GetStartPos(points, ref sindex);
|
var sp = GetStartPos(points, ref sindex, serie.ignoreLineBreak);
|
||||||
var ep = GetEndPos(points, ref eindex);
|
var ep = GetEndPos(points, ref eindex, serie.ignoreLineBreak);
|
||||||
var cross = ChartHelper.GetIntersection(lp, np, zeroPos, aep);
|
var cross = ChartHelper.GetIntersection(lp, np, zeroPos, aep);
|
||||||
if (cross == Vector3.zero || smoothDownPoints.Count <= 3)
|
if (cross == Vector3.zero || smoothDownPoints.Count <= 3)
|
||||||
{
|
{
|
||||||
@@ -1172,10 +1217,10 @@ namespace XCharts
|
|||||||
switch (serie.lineType)
|
switch (serie.lineType)
|
||||||
{
|
{
|
||||||
case LineType.Dash:
|
case LineType.Dash:
|
||||||
UGL.DrawDashLine(vh, lp, np, lineWidth, lineColor, 0, 0, posList);
|
UGL.DrawDashLine(vh, lp, np, lineWidth, lineColor, lineColor, 0, 0, posList);
|
||||||
break;
|
break;
|
||||||
case LineType.Dot:
|
case LineType.Dot:
|
||||||
UGL.DrawDotLine(vh, lp, np, lineWidth, lineColor, 0, 0, posList);
|
UGL.DrawDotLine(vh, lp, np, lineWidth, lineColor, lineColor, 0, 0, posList);
|
||||||
break;
|
break;
|
||||||
case LineType.DashDot:
|
case LineType.DashDot:
|
||||||
UGL.DrawDashDotLine(vh, lp, np, lineWidth, lineColor, 0, 0, 0, posList);
|
UGL.DrawDashDotLine(vh, lp, np, lineWidth, lineColor, 0, 0, 0, posList);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace XCharts
|
|||||||
var highlight = serie.highlighted || serieData.highlighted;
|
var highlight = serie.highlighted || serieData.highlighted;
|
||||||
var color = SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
|
var color = SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
|
||||||
var toColor = SerieHelper.GetItemToColor(serie, serieData, m_Theme, colorIndex, highlight);
|
var toColor = SerieHelper.GetItemToColor(serie, serieData, m_Theme, colorIndex, highlight);
|
||||||
|
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, m_Theme, colorIndex, highlight, false);
|
||||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||||
double xValue = serieData.GetCurrData(0, dataChangeDuration, xAxis.inverse);
|
double xValue = serieData.GetCurrData(0, dataChangeDuration, xAxis.inverse);
|
||||||
@@ -67,13 +68,13 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var nowSize = symbol.animationSize[count];
|
var nowSize = symbol.animationSize[count];
|
||||||
color.a = (byte)(255 * (symbolSize - nowSize) / symbolSize);
|
color.a = (byte)(255 * (symbolSize - nowSize) / symbolSize);
|
||||||
DrawSymbol(vh, symbol.type, nowSize, symbolBorder, pos, color, toColor, symbol.gap, cornerRadius);
|
DrawSymbol(vh, symbol.type, nowSize, symbolBorder, pos, color, toColor, backgroundColor, symbol.gap, cornerRadius);
|
||||||
}
|
}
|
||||||
RefreshPainter(serie);
|
RefreshPainter(serie);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, pos, color, toColor, symbol.gap, cornerRadius);
|
DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, pos, color, toColor, backgroundColor, symbol.gap, cornerRadius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using XUGL;
|
using XUGL;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,7 @@ namespace XCharts
|
|||||||
private static readonly string s_AxisLabelObjectName = "axis_label";
|
private static readonly string s_AxisLabelObjectName = "axis_label";
|
||||||
private bool m_UpdateTitleText = false;
|
private bool m_UpdateTitleText = false;
|
||||||
private bool m_UpdateLabelText = false;
|
private bool m_UpdateLabelText = false;
|
||||||
|
private Dictionary<int, int> m_LastSplitNumber = new Dictionary<int, int>();
|
||||||
|
|
||||||
public DrawSerieGauge(BaseChart chart)
|
public DrawSerieGauge(BaseChart chart)
|
||||||
{
|
{
|
||||||
@@ -61,6 +63,21 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (var serie in chart.series.list)
|
||||||
|
{
|
||||||
|
if (serie.type == SerieType.Gauge)
|
||||||
|
{
|
||||||
|
if (!m_LastSplitNumber.TryGetValue(serie.index, out var lastSplitNumber))
|
||||||
|
{
|
||||||
|
m_LastSplitNumber[serie.index] = lastSplitNumber;
|
||||||
|
}
|
||||||
|
else if (serie.splitNumber != lastSplitNumber)
|
||||||
|
{
|
||||||
|
m_LastSplitNumber[serie.index] = serie.splitNumber;
|
||||||
|
InitAxisLabel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawBase(VertexHelper vh)
|
public void DrawBase(VertexHelper vh)
|
||||||
|
|||||||
@@ -413,6 +413,7 @@ namespace XCharts
|
|||||||
|
|
||||||
private void DrawPieLabelLine(VertexHelper vh, Serie serie, SerieData serieData, Color color)
|
private void DrawPieLabelLine(VertexHelper vh, Serie serie, SerieData serieData, Color color)
|
||||||
{
|
{
|
||||||
|
if (serie.animation.enable && serie.animation.HasFadeOut()) return;
|
||||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||||
if (serieLabel.show
|
if (serieLabel.show
|
||||||
&& serieLabel.position == SerieLabel.Position.Outside
|
&& serieLabel.position == SerieLabel.Position.Outside
|
||||||
@@ -496,6 +497,7 @@ namespace XCharts
|
|||||||
private void DrawPieLabel(Serie serie, int dataIndex, SerieData serieData, Color serieColor)
|
private void DrawPieLabel(Serie serie, int dataIndex, SerieData serieData, Color serieColor)
|
||||||
{
|
{
|
||||||
if (serieData.labelObject == null) return;
|
if (serieData.labelObject == null) return;
|
||||||
|
if (serie.animation.enable && serie.animation.HasFadeOut()) return;
|
||||||
var currAngle = serieData.runtimePieHalfAngle;
|
var currAngle = serieData.runtimePieHalfAngle;
|
||||||
var isHighlight = (serieData.highlighted && serie.emphasis.label.show);
|
var isHighlight = (serieData.highlighted && serie.emphasis.label.show);
|
||||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||||
|
|||||||
@@ -266,6 +266,8 @@ namespace XCharts
|
|||||||
var offset = new Vector3(textStyle.offset.x, textStyle.offset.y);
|
var offset = new Vector3(textStyle.offset.x, textStyle.offset.y);
|
||||||
AxisHelper.AdjustCircleLabelPos(txt, pos, radar.runtimeCenterPos, txtHig, offset);
|
AxisHelper.AdjustCircleLabelPos(txt, pos, radar.runtimeCenterPos, txtHig, offset);
|
||||||
}
|
}
|
||||||
|
if(chart.tooltip.gameObject != null)
|
||||||
|
chart.tooltip.gameObject.transform.SetSiblingIndex(chart.transform.childCount-1);
|
||||||
chart.RefreshBasePainter();
|
chart.RefreshBasePainter();
|
||||||
};
|
};
|
||||||
radar.refreshComponent.Invoke();
|
radar.refreshComponent.Invoke();
|
||||||
@@ -313,8 +315,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else if (!serieNameSet.ContainsKey(dataName))
|
else if (!serieNameSet.ContainsKey(dataName))
|
||||||
{
|
{
|
||||||
serieNameSet.Add(dataName, serieNameCount);
|
|
||||||
serieNameCount++;
|
serieNameCount++;
|
||||||
|
serieNameSet.Add(dataName, serieNameCount);
|
||||||
serieIndex = serieNameCount;
|
serieIndex = serieNameCount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -387,10 +389,11 @@ namespace XCharts
|
|||||||
: serie.symbol.GetSize(null, chart.theme.serie.lineSymbolSize);
|
: serie.symbol.GetSize(null, chart.theme.serie.lineSymbolSize);
|
||||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||||
|
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, serieIndex, isHighlight, false);
|
||||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
||||||
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, point, symbolColor,
|
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, point, symbolColor,
|
||||||
symbolToColor, serie.symbol.gap, cornerRadius);
|
symbolToColor, backgroundColor, serie.symbol.gap, cornerRadius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,6 +442,8 @@ namespace XCharts
|
|||||||
var startPoint = Vector3.zero;
|
var startPoint = Vector3.zero;
|
||||||
var toPoint = Vector3.zero;
|
var toPoint = Vector3.zero;
|
||||||
var firstPoint = Vector3.zero;
|
var firstPoint = Vector3.zero;
|
||||||
|
var lastColor = ColorUtil.clearColor32;
|
||||||
|
var firstColor = ColorUtil.clearColor32;
|
||||||
|
|
||||||
var radar = chart.radars[serie.radarIndex];
|
var radar = chart.radars[serie.radarIndex];
|
||||||
var indicatorNum = radar.indicatorList.Count;
|
var indicatorNum = radar.indicatorList.Count;
|
||||||
@@ -479,8 +484,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else if (!serieNameSet.ContainsKey(dataName))
|
else if (!serieNameSet.ContainsKey(dataName))
|
||||||
{
|
{
|
||||||
serieNameSet.Add(dataName, serieNameCount);
|
|
||||||
serieNameCount++;
|
serieNameCount++;
|
||||||
|
serieNameSet.Add(dataName, serieNameCount);
|
||||||
serieIndex = serieNameCount;
|
serieIndex = serieNameCount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -503,8 +508,10 @@ namespace XCharts
|
|||||||
var value = serieData.GetCurrData(1, dataChangeDuration);
|
var value = serieData.GetCurrData(1, dataChangeDuration);
|
||||||
if (serieData.IsDataChanged()) dataChanging = true;
|
if (serieData.IsDataChanged()) dataChanging = true;
|
||||||
if (max == 0)
|
if (max == 0)
|
||||||
{
|
|
||||||
max = serie.runtimeDataMax;
|
max = serie.runtimeDataMax;
|
||||||
|
if (!radar.IsInIndicatorRange(j, serieData.GetData(1)))
|
||||||
|
{
|
||||||
|
lineColor = radar.outRangeColor;
|
||||||
}
|
}
|
||||||
var radius = (float)(max < 0 ? radar.runtimeDataRadius - radar.runtimeDataRadius * value / max
|
var radius = (float)(max < 0 ? radar.runtimeDataRadius - radar.runtimeDataRadius * value / max
|
||||||
: radar.runtimeDataRadius * value / max);
|
: radar.runtimeDataRadius * value / max);
|
||||||
@@ -515,6 +522,8 @@ namespace XCharts
|
|||||||
startPoint = new Vector3(p.x + radius * Mathf.Sin(currAngle),
|
startPoint = new Vector3(p.x + radius * Mathf.Sin(currAngle),
|
||||||
p.y + radius * Mathf.Cos(currAngle));
|
p.y + radius * Mathf.Cos(currAngle));
|
||||||
firstPoint = startPoint;
|
firstPoint = startPoint;
|
||||||
|
lastColor = lineColor;
|
||||||
|
firstColor = lineColor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -526,22 +535,28 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (serie.lineStyle.show)
|
if (serie.lineStyle.show)
|
||||||
{
|
{
|
||||||
ChartDrawer.DrawLineStyle(vh, serie.lineStyle, startPoint, toPoint, lineColor,
|
if (radar.connectCenter)
|
||||||
chart.theme.serie.lineWidth, LineStyle.Type.Solid);
|
ChartDrawer.DrawLineStyle(vh, serie.lineStyle, startPoint, centerPos,
|
||||||
|
chart.theme.serie.lineWidth, LineStyle.Type.Solid, lastColor, lastColor);
|
||||||
|
ChartDrawer.DrawLineStyle(vh, serie.lineStyle, startPoint, toPoint, chart.theme.serie.lineWidth,
|
||||||
|
LineStyle.Type.Solid, radar.lineGradient ? lastColor : lineColor, lineColor);
|
||||||
}
|
}
|
||||||
startPoint = toPoint;
|
startPoint = toPoint;
|
||||||
|
lastColor = lineColor;
|
||||||
}
|
}
|
||||||
serieData.labelPosition = startPoint;
|
serieData.labelPosition = startPoint;
|
||||||
pointList.Add(startPoint);
|
pointList.Add(startPoint);
|
||||||
|
|
||||||
if (serie.areaStyle.show && j == endIndex)
|
if (serie.areaStyle.show && j == endIndex)
|
||||||
{
|
{
|
||||||
UGL.DrawTriangle(vh, startPoint, firstPoint, centerPos, areaColor, areaColor, areaToColor);
|
UGL.DrawTriangle(vh, startPoint, firstPoint, centerPos, areaColor, areaColor, areaToColor);
|
||||||
}
|
}
|
||||||
if (serie.lineStyle.show && j == endIndex)
|
if (serie.lineStyle.show && j == endIndex)
|
||||||
{
|
{
|
||||||
ChartDrawer.DrawLineStyle(vh, serie.lineStyle, startPoint, firstPoint, lineColor,
|
if (radar.connectCenter)
|
||||||
chart.theme.serie.lineWidth, LineStyle.Type.Solid);
|
ChartDrawer.DrawLineStyle(vh, serie.lineStyle, startPoint, centerPos,
|
||||||
|
chart.theme.serie.lineWidth, LineStyle.Type.Solid, lastColor, lastColor);
|
||||||
|
ChartDrawer.DrawLineStyle(vh, serie.lineStyle, startPoint, firstPoint, chart.theme.serie.lineWidth,
|
||||||
|
LineStyle.Type.Solid, lineColor, radar.lineGradient ? firstColor : lineColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (serie.symbol.show && serie.symbol.type != SerieSymbolType.None)
|
if (serie.symbol.show && serie.symbol.type != SerieSymbolType.None)
|
||||||
@@ -558,10 +573,16 @@ namespace XCharts
|
|||||||
: serie.symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
: serie.symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
||||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||||
|
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, serieIndex, isHighlight, false);
|
||||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
||||||
|
if (!radar.IsInIndicatorRange(j, serieData.GetData(1)))
|
||||||
|
{
|
||||||
|
symbolColor = radar.outRangeColor;
|
||||||
|
symbolToColor = radar.outRangeColor;
|
||||||
|
}
|
||||||
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, serieData.labelPosition, symbolColor,
|
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, serieData.labelPosition, symbolColor,
|
||||||
symbolToColor, serie.symbol.gap, cornerRadius);
|
symbolToColor, backgroundColor, serie.symbol.gap, cornerRadius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
@@ -602,22 +623,19 @@ namespace XCharts
|
|||||||
: serie.symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
: serie.symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
||||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||||
|
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, serieIndex, isHighlight, false);
|
||||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
||||||
foreach (var point in pointList)
|
foreach (var point in pointList)
|
||||||
{
|
{
|
||||||
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, point, symbolColor,
|
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, point, symbolColor,
|
||||||
symbolToColor, serie.symbol.gap, cornerRadius);
|
symbolToColor, backgroundColor, serie.symbol.gap, cornerRadius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawRadar(VertexHelper vh, Radar radar)
|
private void DrawRadar(VertexHelper vh, Radar radar)
|
||||||
{
|
{
|
||||||
if (!radar.splitLine.show && !radar.splitArea.show)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float insideRadius = 0, outsideRadius = 0;
|
float insideRadius = 0, outsideRadius = 0;
|
||||||
float block = radar.runtimeRadius / radar.splitNumber;
|
float block = radar.runtimeRadius / radar.splitNumber;
|
||||||
int indicatorNum = radar.indicatorList.Count;
|
int indicatorNum = radar.indicatorList.Count;
|
||||||
@@ -632,7 +650,6 @@ namespace XCharts
|
|||||||
var splitLineType = radar.splitLine.GetType(chart.theme.radar.splitLineType);
|
var splitLineType = radar.splitLine.GetType(chart.theme.radar.splitLineType);
|
||||||
for (int i = 0; i < radar.splitNumber; i++)
|
for (int i = 0; i < radar.splitNumber; i++)
|
||||||
{
|
{
|
||||||
var isLast = i == radar.splitNumber - 1;
|
|
||||||
var color = radar.splitArea.GetColor(i, chart.theme.radar);
|
var color = radar.splitArea.GetColor(i, chart.theme.radar);
|
||||||
outsideRadius = insideRadius + block;
|
outsideRadius = insideRadius + block;
|
||||||
p1 = new Vector3(p.x + insideRadius * Mathf.Sin(0), p.y + insideRadius * Mathf.Cos(0));
|
p1 = new Vector3(p.x + insideRadius * Mathf.Sin(0), p.y + insideRadius * Mathf.Cos(0));
|
||||||
@@ -650,9 +667,6 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (radar.splitLine.NeedShow(i))
|
if (radar.splitLine.NeedShow(i))
|
||||||
{
|
{
|
||||||
if (isLast)
|
|
||||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, p2, p3, lineColor);
|
|
||||||
else
|
|
||||||
ChartDrawer.DrawLineStyle(vh, splitLineType, splitLineWidth, p2, p3, splitLineColor);
|
ChartDrawer.DrawLineStyle(vh, splitLineType, splitLineWidth, p2, p3, splitLineColor);
|
||||||
}
|
}
|
||||||
p1 = p4;
|
p1 = p4;
|
||||||
@@ -660,24 +674,20 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
insideRadius = outsideRadius;
|
insideRadius = outsideRadius;
|
||||||
}
|
}
|
||||||
|
if (radar.axisLine.show)
|
||||||
|
{
|
||||||
for (int j = 0; j <= indicatorNum; j++)
|
for (int j = 0; j <= indicatorNum; j++)
|
||||||
{
|
{
|
||||||
float currAngle = j * angle;
|
float currAngle = j * angle;
|
||||||
p3 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle),
|
p3 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle),
|
||||||
p.y + outsideRadius * Mathf.Cos(currAngle));
|
p.y + outsideRadius * Mathf.Cos(currAngle));
|
||||||
if (radar.splitLine.show)
|
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, p, p3, lineColor);
|
||||||
{
|
|
||||||
ChartDrawer.DrawLineStyle(vh, splitLineType, splitLineWidth, p, p3, splitLineColor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawCricleRadar(VertexHelper vh, Radar radar)
|
private void DrawCricleRadar(VertexHelper vh, Radar radar)
|
||||||
{
|
{
|
||||||
if (!radar.splitLine.show && !radar.splitArea.show)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float insideRadius = 0, outsideRadius = 0;
|
float insideRadius = 0, outsideRadius = 0;
|
||||||
float block = radar.runtimeRadius / radar.splitNumber;
|
float block = radar.runtimeRadius / radar.splitNumber;
|
||||||
int indicatorNum = radar.indicatorList.Count;
|
int indicatorNum = radar.indicatorList.Count;
|
||||||
@@ -685,7 +695,10 @@ namespace XCharts
|
|||||||
Vector3 p1;
|
Vector3 p1;
|
||||||
float angle = 2 * Mathf.PI / indicatorNum;
|
float angle = 2 * Mathf.PI / indicatorNum;
|
||||||
var lineColor = radar.axisLine.GetColor(chart.theme.radar.lineColor);
|
var lineColor = radar.axisLine.GetColor(chart.theme.radar.lineColor);
|
||||||
var lineWidth = radar.splitLine.GetWidth(chart.theme.radar.splitLineWidth);
|
var lineWidth = radar.axisLine.GetWidth(chart.theme.radar.lineWidth);
|
||||||
|
var lineType = radar.axisLine.GetType(chart.theme.radar.lineType);
|
||||||
|
var splitLineColor = radar.splitLine.GetColor(chart.theme.radar.splitLineColor);
|
||||||
|
var splitLineWidth = radar.splitLine.GetWidth(chart.theme.radar.splitLineWidth);
|
||||||
for (int i = 0; i < radar.splitNumber; i++)
|
for (int i = 0; i < radar.splitNumber; i++)
|
||||||
{
|
{
|
||||||
var color = radar.splitArea.GetColor(i, chart.theme.radiusAxis);
|
var color = radar.splitArea.GetColor(i, chart.theme.radiusAxis);
|
||||||
@@ -697,19 +710,19 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (radar.splitLine.show)
|
if (radar.splitLine.show)
|
||||||
{
|
{
|
||||||
UGL.DrawEmptyCricle(vh, p, outsideRadius, lineWidth, lineColor,
|
UGL.DrawEmptyCricle(vh, p, outsideRadius, splitLineWidth, splitLineColor,
|
||||||
Color.clear, chart.settings.cicleSmoothness);
|
Color.clear, chart.settings.cicleSmoothness);
|
||||||
}
|
}
|
||||||
insideRadius = outsideRadius;
|
insideRadius = outsideRadius;
|
||||||
}
|
}
|
||||||
|
if (radar.axisLine.show)
|
||||||
|
{
|
||||||
for (int j = 0; j <= indicatorNum; j++)
|
for (int j = 0; j <= indicatorNum; j++)
|
||||||
{
|
{
|
||||||
float currAngle = j * angle;
|
float currAngle = j * angle;
|
||||||
p1 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle),
|
p1 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle),
|
||||||
p.y + outsideRadius * Mathf.Cos(currAngle));
|
p.y + outsideRadius * Mathf.Cos(currAngle));
|
||||||
if (radar.splitLine.show)
|
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, p, p1, lineColor);
|
||||||
{
|
|
||||||
UGL.DrawLine(vh, p, p1, lineWidth / 2, lineColor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,14 @@ namespace XCharts
|
|||||||
itemStyle.backgroundColor, Color.clear, 0, 360, borderWidth, borderColor, 0,
|
itemStyle.backgroundColor, Color.clear, 0, 360, borderWidth, borderColor, 0,
|
||||||
chart.settings.cicleSmoothness, false, serie.clockwise);
|
chart.settings.cicleSmoothness, false, serie.clockwise);
|
||||||
}
|
}
|
||||||
|
var isGradient = !UGLHelper.IsValueEqualsColor(itemColor, itemToColor);
|
||||||
|
if (isGradient)
|
||||||
|
{
|
||||||
|
if (serie.clockwise)
|
||||||
|
itemToColor = Color.Lerp(itemColor, itemToColor, toDegree / (startDegree + 360));
|
||||||
|
else
|
||||||
|
itemToColor = Color.Lerp(itemToColor, itemColor, toDegree / (startDegree + 360));
|
||||||
|
}
|
||||||
UGL.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius, outsideRadius, itemColor, itemToColor,
|
UGL.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius, outsideRadius, itemColor, itemToColor,
|
||||||
Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness,
|
Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness,
|
||||||
roundCap, serie.clockwise);
|
roundCap, serie.clockwise);
|
||||||
@@ -128,7 +136,6 @@ namespace XCharts
|
|||||||
public bool CheckTootipArea(Vector2 local)
|
public bool CheckTootipArea(Vector2 local)
|
||||||
{
|
{
|
||||||
if (!chart.series.Contains(SerieType.Ring)) return false;
|
if (!chart.series.Contains(SerieType.Ring)) return false;
|
||||||
if (!PointerIsInRingSerie(chart.series, local)) return false;
|
|
||||||
if (m_IsEnterLegendButtom) return false;
|
if (m_IsEnterLegendButtom) return false;
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
chart.tooltip.runtimeDataIndex.Clear();
|
chart.tooltip.runtimeDataIndex.Clear();
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
/* */
|
/* */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The delegate function for AxisLabel's formatter. |
|
/// The delegate function for AxisLabel's formatter. |
|
||||||
/// AxisLabel的formatter自定义委托。
|
/// AxisLabel的formatter自定义委托函数。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="labelIndex">label索引</param>
|
/// <param name="labelIndex">label索引</param>
|
||||||
/// <param name="value">当前label对应的数值数据,Value轴或Time轴有效</param>
|
/// <param name="value">当前label对应的数值数据,Value轴或Time轴有效</param>
|
||||||
@@ -19,10 +21,16 @@ namespace XCharts
|
|||||||
public delegate string DelegateAxisLabelFormatter(int labelIndex, double value, string category);
|
public delegate string DelegateAxisLabelFormatter(int labelIndex, double value, string category);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The delegate function for SerieLabel‘s formatter.
|
/// The delegate function for SerieLabel‘s formatter.
|
||||||
/// SerieLabel的formatter自定义委托。
|
/// SerieLabel的formatter自定义委托函数。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataIndex">数据索引</param>
|
/// <param name="dataIndex">数据索引</param>
|
||||||
/// <param name="value">数值</param>
|
/// <param name="value">数值</param>
|
||||||
/// <returns>最终显示的文本内容</returns>
|
/// <returns>最终显示的文本内容</returns>
|
||||||
public delegate string DelegateSerieLabelFormatter(int dataIndex, double value);
|
public delegate string DelegateSerieLabelFormatter(int dataIndex, double value);
|
||||||
|
/// <summary>
|
||||||
|
/// Tooltip的position自定义委托函数。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pos">Tooltip的当前坐标</param>
|
||||||
|
/// <returns>Tooltip的最终坐标</returns>
|
||||||
|
public delegate Vector3 DelegateTooltipPosition(Vector3 pos);
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,12 @@ namespace XCharts
|
|||||||
#if dUI_TextMeshPro
|
#if dUI_TextMeshPro
|
||||||
if (m_TMPText != null) return 0; // TODO:
|
if (m_TMPText != null) return 0; // TODO:
|
||||||
#else
|
#else
|
||||||
if (m_Text != null) return m_Text.cachedTextGenerator.GetPreferredWidth(content, m_RelatedTextSettings);
|
if (m_Text != null)
|
||||||
|
{
|
||||||
|
var tg = m_Text.cachedTextGeneratorForLayout;
|
||||||
|
var setting = m_Text.GetGenerationSettings(Vector2.zero);
|
||||||
|
return tg.GetPreferredWidth(content, setting) / m_Text.pixelsPerUnit;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -270,6 +275,30 @@ namespace XCharts
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetPreferredText(string content, string suffix, float maxWidth)
|
||||||
|
{
|
||||||
|
#if dUI_TextMeshPro
|
||||||
|
if (m_TMPText != null) return content; // TODO:
|
||||||
|
#else
|
||||||
|
if (m_Text != null)
|
||||||
|
{
|
||||||
|
var sourWid = GetPreferredWidth(content);
|
||||||
|
if (sourWid < maxWidth) return content;
|
||||||
|
var suffixWid = GetPreferredWidth(suffix);
|
||||||
|
var textWid = maxWidth - 1.3f * suffixWid;
|
||||||
|
for (int i = content.Length; i > 0; i--)
|
||||||
|
{
|
||||||
|
var temp = content.Substring(0, i);
|
||||||
|
if (GetPreferredWidth(temp) < textWid)
|
||||||
|
{
|
||||||
|
return temp + suffix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
#if dUI_TextMeshPro
|
#if dUI_TextMeshPro
|
||||||
|
|
||||||
public void SetFont(TMP_FontAsset font)
|
public void SetFont(TMP_FontAsset font)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public static void DrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize,
|
public static void DrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize,
|
||||||
float tickness, Vector3 pos, Color32 color, Color32 toColor, float gap, float[] cornerRadius,
|
float tickness, Vector3 pos, Color32 color, Color32 toColor, float gap, float[] cornerRadius,
|
||||||
Color32 backgroundColor, float smoothness, Vector3 startPos)
|
Color32 centerFillColor, Color32 backgroundColor, float smoothness, Vector3 startPos)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@@ -38,11 +38,11 @@ namespace XCharts
|
|||||||
if (gap > 0)
|
if (gap > 0)
|
||||||
{
|
{
|
||||||
UGL.DrawCricle(vh, pos, symbolSize + gap, backgroundColor, smoothness);
|
UGL.DrawCricle(vh, pos, symbolSize + gap, backgroundColor, smoothness);
|
||||||
UGL.DrawEmptyCricle(vh, pos, symbolSize, tickness, color, color, backgroundColor, smoothness);
|
UGL.DrawEmptyCricle(vh, pos, symbolSize, tickness, color, color, centerFillColor, smoothness);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UGL.DrawEmptyCricle(vh, pos, symbolSize, tickness, color, color, backgroundColor, smoothness);
|
UGL.DrawEmptyCricle(vh, pos, symbolSize, tickness, color, color, centerFillColor, smoothness);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SerieSymbolType.Rect:
|
case SerieSymbolType.Rect:
|
||||||
@@ -56,6 +56,17 @@ namespace XCharts
|
|||||||
UGL.DrawRoundRectangle(vh, pos, symbolSize, symbolSize, color, color, 0, cornerRadius, true);
|
UGL.DrawRoundRectangle(vh, pos, symbolSize, symbolSize, color, color, 0, cornerRadius, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SerieSymbolType.EmptyRect:
|
||||||
|
if (gap > 0)
|
||||||
|
{
|
||||||
|
UGL.DrawSquare(vh, pos, symbolSize + gap, backgroundColor);
|
||||||
|
UGL.DrawBorder(vh, pos, symbolSize / 2, symbolSize / 2, tickness, color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UGL.DrawBorder(vh, pos, symbolSize / 2, symbolSize / 2, tickness, color);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SerieSymbolType.Triangle:
|
case SerieSymbolType.Triangle:
|
||||||
if (gap > 0)
|
if (gap > 0)
|
||||||
{
|
{
|
||||||
@@ -67,6 +78,19 @@ namespace XCharts
|
|||||||
UGL.DrawTriangle(vh, pos, symbolSize, color, toColor);
|
UGL.DrawTriangle(vh, pos, symbolSize, color, toColor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SerieSymbolType.EmptyTriangle:
|
||||||
|
if (gap > 0)
|
||||||
|
{
|
||||||
|
UGL.DrawTriangle(vh, pos, symbolSize + gap, backgroundColor);
|
||||||
|
UGL.DrawTriangle(vh, pos, symbolSize, color, toColor);
|
||||||
|
UGL.DrawTriangle(vh, pos, symbolSize - tickness, centerFillColor, centerFillColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UGL.DrawTriangle(vh, pos, symbolSize, color, toColor);
|
||||||
|
UGL.DrawTriangle(vh, pos, symbolSize - tickness, centerFillColor, centerFillColor);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SerieSymbolType.Diamond:
|
case SerieSymbolType.Diamond:
|
||||||
if (gap > 0)
|
if (gap > 0)
|
||||||
{
|
{
|
||||||
@@ -78,6 +102,19 @@ namespace XCharts
|
|||||||
UGL.DrawDiamond(vh, pos, symbolSize, color, toColor);
|
UGL.DrawDiamond(vh, pos, symbolSize, color, toColor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SerieSymbolType.EmptyDiamond:
|
||||||
|
if (gap > 0)
|
||||||
|
{
|
||||||
|
UGL.DrawDiamond(vh, pos, symbolSize + gap, backgroundColor);
|
||||||
|
UGL.DrawDiamond(vh, pos, symbolSize, color, toColor);
|
||||||
|
UGL.DrawDiamond(vh, pos, symbolSize - tickness, centerFillColor, centerFillColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UGL.DrawDiamond(vh, pos, symbolSize, color, toColor);
|
||||||
|
UGL.DrawDiamond(vh, pos, symbolSize - tickness, centerFillColor, centerFillColor);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SerieSymbolType.Arrow:
|
case SerieSymbolType.Arrow:
|
||||||
var arrowWidth = symbolSize * 2;
|
var arrowWidth = symbolSize * 2;
|
||||||
var arrowHeight = arrowWidth * 1.5f;
|
var arrowHeight = arrowWidth * 1.5f;
|
||||||
@@ -89,28 +126,44 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawLineStyle(VertexHelper vh, LineStyle lineStyle,
|
public static void DrawLineStyle(VertexHelper vh, LineStyle lineStyle, Vector3 startPos, Vector3 endPos,
|
||||||
Vector3 startPos, Vector3 endPos, Color32 defaultColor, float themeWidth, LineStyle.Type themeType)
|
Color32 defaultColor, float themeWidth, LineStyle.Type themeType)
|
||||||
{
|
{
|
||||||
var type = lineStyle.GetType(themeType);
|
var type = lineStyle.GetType(themeType);
|
||||||
var width = lineStyle.GetWidth(themeWidth);
|
var width = lineStyle.GetWidth(themeWidth);
|
||||||
var color = lineStyle.GetColor(defaultColor);
|
var color = lineStyle.GetColor(defaultColor);
|
||||||
DrawLineStyle(vh, type, width, startPos, endPos, color);
|
DrawLineStyle(vh, type, width, startPos, endPos, color, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawLineStyle(VertexHelper vh, LineStyle lineStyle, Vector3 startPos, Vector3 endPos,
|
||||||
|
float themeWidth, LineStyle.Type themeType, Color32 defaultColor, Color32 defaultToColor)
|
||||||
|
{
|
||||||
|
var type = lineStyle.GetType(themeType);
|
||||||
|
var width = lineStyle.GetWidth(themeWidth);
|
||||||
|
var color = lineStyle.GetColor(defaultColor);
|
||||||
|
var toColor = ChartHelper.IsClearColor(defaultToColor) ? color : defaultToColor;
|
||||||
|
DrawLineStyle(vh, type, width, startPos, endPos, color, toColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawLineStyle(VertexHelper vh, LineStyle.Type lineType, float lineWidth,
|
public static void DrawLineStyle(VertexHelper vh, LineStyle.Type lineType, float lineWidth,
|
||||||
Vector3 startPos, Vector3 endPos, Color32 color)
|
Vector3 startPos, Vector3 endPos, Color32 color)
|
||||||
|
{
|
||||||
|
DrawLineStyle(vh, lineType, lineWidth, startPos, endPos, color, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawLineStyle(VertexHelper vh, LineStyle.Type lineType, float lineWidth,
|
||||||
|
Vector3 startPos, Vector3 endPos, Color32 color, Color32 toColor)
|
||||||
{
|
{
|
||||||
switch (lineType)
|
switch (lineType)
|
||||||
{
|
{
|
||||||
case LineStyle.Type.Dashed:
|
case LineStyle.Type.Dashed:
|
||||||
UGL.DrawDashLine(vh, startPos, endPos, lineWidth, color);
|
UGL.DrawDashLine(vh, startPos, endPos, lineWidth, color, toColor);
|
||||||
break;
|
break;
|
||||||
case LineStyle.Type.Dotted:
|
case LineStyle.Type.Dotted:
|
||||||
UGL.DrawDotLine(vh, startPos, endPos, lineWidth, color);
|
UGL.DrawDotLine(vh, startPos, endPos, lineWidth, color, toColor);
|
||||||
break;
|
break;
|
||||||
case LineStyle.Type.Solid:
|
case LineStyle.Type.Solid:
|
||||||
UGL.DrawLine(vh, startPos, endPos, lineWidth, color);
|
UGL.DrawLine(vh, startPos, endPos, lineWidth, color, toColor);
|
||||||
break;
|
break;
|
||||||
case LineStyle.Type.DashDot:
|
case LineStyle.Type.DashDot:
|
||||||
UGL.DrawDashDotLine(vh, startPos, endPos, lineWidth, color);
|
UGL.DrawDashDotLine(vh, startPos, endPos, lineWidth, color);
|
||||||
|
|||||||
@@ -510,11 +510,12 @@ namespace XCharts
|
|||||||
: symbol.GetSize(serieData.data, m_Theme.serie.lineSymbolSize);
|
: symbol.GetSize(serieData.data, m_Theme.serie.lineSymbolSize);
|
||||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, m_Theme, n, highlight);
|
var symbolColor = SerieHelper.GetItemColor(serie, serieData, m_Theme, n, highlight);
|
||||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, m_Theme, n, highlight);
|
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, m_Theme, n, highlight);
|
||||||
|
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, m_Theme, n, highlight, false);
|
||||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||||
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
||||||
DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serieData.runtimePosition, symbolColor,
|
DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serieData.runtimePosition, symbolColor,
|
||||||
symbolToColor, symbol.gap, cornerRadius);
|
symbolToColor, backgroundColor, symbol.gap, cornerRadius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ namespace XCharts
|
|||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
public class XChartsMgr : MonoBehaviour
|
public class XChartsMgr : MonoBehaviour
|
||||||
{
|
{
|
||||||
internal static string _version = "2.3.0";
|
internal static string _version = "2.8.2";
|
||||||
internal static int _versionDate = 20210724;
|
internal static int _versionDate = 20220815;
|
||||||
public static string version { get { return _version; } }
|
public static string version { get { return _version; } }
|
||||||
public static int versionDate { get { return _versionDate; } }
|
public static int versionDate { get { return _versionDate; } }
|
||||||
public static string fullVersion { get { return version + "-" + versionDate; } }
|
public static string fullVersion { get { return version + "-" + versionDate; } }
|
||||||
@@ -57,7 +57,9 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var obj = GameObject.Find("_xcharts_");
|
var obj = GameObject.Find("_xcharts_");
|
||||||
if (obj == null) obj = new GameObject("_xcharts_");
|
if (obj == null) obj = new GameObject("_xcharts_");
|
||||||
|
obj.SetActive(false);
|
||||||
m_XCharts = obj.AddComponent<XChartsMgr>();
|
m_XCharts = obj.AddComponent<XChartsMgr>();
|
||||||
|
obj.SetActive(true);
|
||||||
}
|
}
|
||||||
m_XCharts.m_NowVersion = fullVersion;
|
m_XCharts.m_NowVersion = fullVersion;
|
||||||
}
|
}
|
||||||
@@ -279,7 +281,7 @@ namespace XCharts
|
|||||||
public List<BaseChart> GetCharts(string chartName)
|
public List<BaseChart> GetCharts(string chartName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(chartName)) return null;
|
if (string.IsNullOrEmpty(chartName)) return null;
|
||||||
return m_ChartList.FindAll(chart => chartName.Equals(chartName));
|
return m_ChartList.FindAll(chart => chartName.Equals(chart.chartName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveChart(string chartName)
|
public void RemoveChart(string chartName)
|
||||||
@@ -299,6 +301,33 @@ namespace XCharts
|
|||||||
return m_ChartList.Contains(chart);
|
return m_ChartList.Contains(chart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsRepeatChartName(BaseChart chart, string chartName = null)
|
||||||
|
{
|
||||||
|
if(chartName == null)
|
||||||
|
chartName = chart.chartName;
|
||||||
|
if (string.IsNullOrEmpty(chartName))
|
||||||
|
return false;
|
||||||
|
foreach (var temp in m_ChartList)
|
||||||
|
{
|
||||||
|
if (temp != chart && chartName.Equals(temp.chartName))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetRepeatChartNameInfo(BaseChart chart, string chartName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(chartName))
|
||||||
|
return string.Empty;
|
||||||
|
string result = "";
|
||||||
|
foreach (var temp in m_ChartList)
|
||||||
|
{
|
||||||
|
if (temp != chart && chartName.Equals(temp.chartName))
|
||||||
|
result += ChartHelper.GetFullName(temp.transform) + "\n";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static void RemoveAllChartObject()
|
public static void RemoveAllChartObject()
|
||||||
{
|
{
|
||||||
if (Instance.m_ChartList.Count == 0)
|
if (Instance.m_ChartList.Count == 0)
|
||||||
@@ -337,7 +366,7 @@ namespace XCharts
|
|||||||
// Search for potential alternative locations in the user project
|
// Search for potential alternative locations in the user project
|
||||||
string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories);
|
string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories);
|
||||||
string path = ValidateLocation(matchingPaths, packagePath);
|
string path = ValidateLocation(matchingPaths, packagePath);
|
||||||
if (path != null) return packagePath + path;
|
if (path != null) return Path.Combine(packagePath, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -34,10 +34,14 @@ namespace XCharts
|
|||||||
GUI.enabled = !m_EssentialResourcesImported;
|
GUI.enabled = !m_EssentialResourcesImported;
|
||||||
if (GUILayout.Button("Import XCharts Essentials"))
|
if (GUILayout.Button("Import XCharts Essentials"))
|
||||||
{
|
{
|
||||||
AssetDatabase.importPackageCompleted += ImportCallback;
|
|
||||||
|
|
||||||
string packageFullPath = GetPackageFullPath();
|
string packageFullPath = GetPackageFullPath();
|
||||||
AssetDatabase.ImportPackage(packageFullPath + "/Package Resources/XCharts Essential Resources.unitypackage", false);
|
var sourPath = Path.Combine(packageFullPath, "Resources");
|
||||||
|
var destPath = Path.Combine(Application.dataPath, "XCharts/Resources");
|
||||||
|
if (CopyFolder(sourPath, destPath))
|
||||||
|
{
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GUILayout.Space(5f);
|
GUILayout.Space(5f);
|
||||||
GUI.enabled = true;
|
GUI.enabled = true;
|
||||||
@@ -45,33 +49,38 @@ namespace XCharts
|
|||||||
GUILayout.EndVertical();
|
GUILayout.EndVertical();
|
||||||
}
|
}
|
||||||
GUILayout.EndVertical();
|
GUILayout.EndVertical();
|
||||||
|
GUILayout.Space(5f);
|
||||||
|
}
|
||||||
|
|
||||||
GUILayout.BeginVertical();
|
private static bool CopyFolder(string sourPath, string destPath)
|
||||||
{
|
{
|
||||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
try
|
||||||
{
|
{
|
||||||
GUILayout.Label("TextMeshPro", EditorStyles.boldLabel);
|
if (!Directory.Exists(destPath))
|
||||||
#if dUI_TextMeshPro
|
|
||||||
GUILayout.Label("TextMeshPro is now enabled. You can turn it off by clicking the button below.", new GUIStyle(EditorStyles.label) { wordWrap = true });
|
|
||||||
GUILayout.Space(5f);
|
|
||||||
if (GUILayout.Button("Disable TextMeshPro"))
|
|
||||||
{
|
{
|
||||||
XChartsMgr.DisableTextMeshPro();
|
Directory.CreateDirectory(destPath);
|
||||||
}
|
}
|
||||||
#else
|
var files = Directory.GetFiles(sourPath);
|
||||||
GUILayout.Label("TextMeshPro is not active. You can activate it by clicking the button below. Make sure TextMeshPro is already in your project before activating it.", new GUIStyle(EditorStyles.label) { wordWrap = true });
|
foreach (var file in files)
|
||||||
GUILayout.Space(5f);
|
|
||||||
if (GUILayout.Button("Enable TextMeshPro"))
|
|
||||||
{
|
{
|
||||||
XChartsMgr.EnableTextMeshPro();
|
var name = Path.GetFileName(file);
|
||||||
|
var path = Path.Combine(destPath, name);
|
||||||
|
File.Copy(file, path);
|
||||||
}
|
}
|
||||||
#endif
|
var folders = Directory.GetDirectories(sourPath);
|
||||||
GUILayout.Space(5f);
|
foreach (var folder in folders)
|
||||||
|
{
|
||||||
|
var name = Path.GetFileName(folder);
|
||||||
|
var path = Path.Combine(destPath, name);
|
||||||
|
CopyFolder(folder, path);
|
||||||
}
|
}
|
||||||
GUILayout.EndVertical();
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError("CopyFolder:" + e.Message);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
GUILayout.EndVertical();
|
|
||||||
GUILayout.Space(5f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RegisterResourceImportCallback()
|
internal void RegisterResourceImportCallback()
|
||||||
|
|||||||
@@ -55,6 +55,20 @@ namespace XUGL
|
|||||||
/// <param name="width">线宽</param>
|
/// <param name="width">线宽</param>
|
||||||
/// <param name="color">颜色</param>
|
/// <param name="color">颜色</param>
|
||||||
public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)
|
public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)
|
||||||
|
{
|
||||||
|
DrawLine(vh, startPoint, endPoint, width, color, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Draw a line. 画直线
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vh"></param>
|
||||||
|
/// <param name="startPoint">起点</param>
|
||||||
|
/// <param name="endPoint">终点</param>
|
||||||
|
/// <param name="width">线宽</param>
|
||||||
|
/// <param name="color">颜色</param>
|
||||||
|
/// <param name="toColor">渐变颜色</param>
|
||||||
|
public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)
|
||||||
{
|
{
|
||||||
if (startPoint == endPoint) return;
|
if (startPoint == endPoint) return;
|
||||||
Vector3 v = Vector3.Cross(endPoint - startPoint, Vector3.forward).normalized * width;
|
Vector3 v = Vector3.Cross(endPoint - startPoint, Vector3.forward).normalized * width;
|
||||||
@@ -65,7 +79,7 @@ namespace XUGL
|
|||||||
|
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
s_Vertex[j].color = color;
|
s_Vertex[j].color = j == 0 || j == 3 ? color : toColor;
|
||||||
s_Vertex[j].uv0 = s_ZeroVector2;
|
s_Vertex[j].uv0 = s_ZeroVector2;
|
||||||
}
|
}
|
||||||
vh.AddUIVertexQuad(s_Vertex);
|
vh.AddUIVertexQuad(s_Vertex);
|
||||||
@@ -119,12 +133,13 @@ namespace XUGL
|
|||||||
/// <param name="startPoint">起始点</param>
|
/// <param name="startPoint">起始点</param>
|
||||||
/// <param name="endPoint">结束点</param>
|
/// <param name="endPoint">结束点</param>
|
||||||
/// <param name="width">线宽</param>
|
/// <param name="width">线宽</param>
|
||||||
/// <param name="color">颜色</param>
|
/// <param name="color">起始颜色</param>
|
||||||
|
/// <param name="toColor">结束颜色</param>
|
||||||
/// <param name="lineLength">实线部分长度,默认为线宽的12倍</param>
|
/// <param name="lineLength">实线部分长度,默认为线宽的12倍</param>
|
||||||
/// <param name="gapLength">间隙部分长度,默认为线宽的3倍</param>
|
/// <param name="gapLength">间隙部分长度,默认为线宽的3倍</param>
|
||||||
/// <param name="posList">可选,输出的关键点</param>
|
/// <param name="posList">可选,输出的关键点</param>
|
||||||
public static void DrawDashLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width,
|
public static void DrawDashLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width,
|
||||||
Color32 color, float lineLength = 0f, float gapLength = 0f, List<Vector3> posList = null)
|
Color32 color, Color32 toColor, float lineLength = 0f, float gapLength = 0f, List<Vector3> posList = null)
|
||||||
{
|
{
|
||||||
float dist = Vector3.Distance(startPoint, endPoint);
|
float dist = Vector3.Distance(startPoint, endPoint);
|
||||||
if (dist < 0.1f) return;
|
if (dist < 0.1f) return;
|
||||||
@@ -133,17 +148,18 @@ namespace XUGL
|
|||||||
int segment = Mathf.CeilToInt(dist / (lineLength + gapLength));
|
int segment = Mathf.CeilToInt(dist / (lineLength + gapLength));
|
||||||
Vector3 dir = (endPoint - startPoint).normalized;
|
Vector3 dir = (endPoint - startPoint).normalized;
|
||||||
Vector3 sp = startPoint, np;
|
Vector3 sp = startPoint, np;
|
||||||
|
var isGradient = !color.Equals(toColor);
|
||||||
if (posList != null) posList.Clear();
|
if (posList != null) posList.Clear();
|
||||||
for (int i = 1; i <= segment; i++)
|
for (int i = 1; i <= segment; i++)
|
||||||
{
|
{
|
||||||
if (posList != null) posList.Add(sp);
|
if (posList != null) posList.Add(sp);
|
||||||
np = startPoint + dir * dist * i / segment;
|
np = startPoint + dir * dist * i / segment;
|
||||||
var dashep = np - dir * gapLength;
|
var dashep = np - dir * gapLength;
|
||||||
DrawLine(vh, sp, dashep, width, color);
|
DrawLine(vh, sp, dashep, width, isGradient ? Color32.Lerp(color, toColor, i * 1.0f / segment) : color);
|
||||||
sp = np;
|
sp = np;
|
||||||
}
|
}
|
||||||
if (posList != null) posList.Add(endPoint);
|
if (posList != null) posList.Add(endPoint);
|
||||||
DrawLine(vh, sp, endPoint, width, color);
|
DrawLine(vh, sp, endPoint, width, toColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -153,31 +169,34 @@ namespace XUGL
|
|||||||
/// <param name="startPoint">起始点</param>
|
/// <param name="startPoint">起始点</param>
|
||||||
/// <param name="endPoint">结束点</param>
|
/// <param name="endPoint">结束点</param>
|
||||||
/// <param name="width">线宽</param>
|
/// <param name="width">线宽</param>
|
||||||
/// <param name="color">颜色</param>
|
/// <param name="color">起始颜色</param>
|
||||||
|
/// <param name="toColor">结束颜色</param>
|
||||||
/// <param name="lineLength">实线部分长度,默认为线宽的3倍</param>
|
/// <param name="lineLength">实线部分长度,默认为线宽的3倍</param>
|
||||||
/// <param name="gapLength">间隙部分长度,默认为线宽的3倍</param>
|
/// <param name="gapLength">间隙部分长度,默认为线宽的3倍</param>
|
||||||
/// <param name="posList">可选,输出的关键点</param>
|
/// <param name="posList">可选,输出的关键点</param>
|
||||||
public static void DrawDotLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width,
|
public static void DrawDotLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width,
|
||||||
Color32 color, float lineLength = 0f, float gapLength = 0f, List<Vector3> posList = null)
|
Color32 color, Color32 toColor, float lineLength = 0f, float gapLength = 0f, List<Vector3> posList = null)
|
||||||
{
|
{
|
||||||
float dist = Vector3.Distance(startPoint, endPoint);
|
var dist = Vector3.Distance(startPoint, endPoint);
|
||||||
if (dist < 0.1f) return;
|
if (dist < 0.1f) return;
|
||||||
if (lineLength == 0) lineLength = 3 * width;
|
if (lineLength == 0) lineLength = 3 * width;
|
||||||
if (gapLength == 0) gapLength = 3 * width;
|
if (gapLength == 0) gapLength = 3 * width;
|
||||||
int segment = Mathf.CeilToInt(dist / (lineLength + gapLength));
|
var segment = Mathf.CeilToInt(dist / (lineLength + gapLength));
|
||||||
Vector3 dir = (endPoint - startPoint).normalized;
|
var dir = (endPoint - startPoint).normalized;
|
||||||
Vector3 sp = startPoint, np;
|
var sp = startPoint;
|
||||||
|
var np = Vector3.zero;
|
||||||
|
var isGradient = !color.Equals(toColor);
|
||||||
if (posList != null) posList.Clear();
|
if (posList != null) posList.Clear();
|
||||||
for (int i = 1; i <= segment; i++)
|
for (int i = 1; i <= segment; i++)
|
||||||
{
|
{
|
||||||
if (posList != null) posList.Add(sp);
|
if (posList != null) posList.Add(sp);
|
||||||
np = startPoint + dir * dist * i / segment;
|
np = startPoint + dir * dist * i / segment;
|
||||||
var dashep = np - dir * gapLength;
|
var dashep = np - dir * gapLength;
|
||||||
DrawLine(vh, sp, dashep, width, color);
|
DrawLine(vh, sp, dashep, width, isGradient ? Color32.Lerp(color, toColor, i * 1.0f / segment) : color);
|
||||||
sp = np;
|
sp = np;
|
||||||
}
|
}
|
||||||
if (posList != null) posList.Add(endPoint);
|
if (posList != null) posList.Add(endPoint);
|
||||||
DrawLine(vh, sp, endPoint, width, color);
|
DrawLine(vh, sp, endPoint, width, toColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -277,11 +296,28 @@ namespace XUGL
|
|||||||
/// <param name="width">线宽</param>
|
/// <param name="width">线宽</param>
|
||||||
/// <param name="zebraWidth">斑马条纹宽</param>
|
/// <param name="zebraWidth">斑马条纹宽</param>
|
||||||
/// <param name="zebraGap">间隙宽</param>
|
/// <param name="zebraGap">间隙宽</param>
|
||||||
/// <param name="color">颜色</param>
|
/// <param name="color">起始颜色</param>
|
||||||
|
/// <param name="toColor">结束颜色</param>
|
||||||
public static void DrawZebraLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width,
|
public static void DrawZebraLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width,
|
||||||
float zebraWidth, float zebraGap, Color32 color)
|
float zebraWidth, float zebraGap, Color32 color, Color32 toColor, float maxDistance)
|
||||||
{
|
{
|
||||||
DrawDotLine(vh, startPoint, endPoint, width, color, zebraWidth, zebraGap);
|
var dist = Vector3.Distance(startPoint, endPoint);
|
||||||
|
if (dist < 0.1f) return;
|
||||||
|
if (zebraWidth == 0) zebraWidth = 3 * width;
|
||||||
|
if (zebraGap == 0) zebraGap = 3 * width;
|
||||||
|
var allSegment = Mathf.CeilToInt(maxDistance / (zebraWidth + zebraGap));
|
||||||
|
var segment = Mathf.CeilToInt(dist / maxDistance * allSegment);
|
||||||
|
var dir = (endPoint - startPoint).normalized;
|
||||||
|
var sp = startPoint;
|
||||||
|
var np = Vector3.zero;
|
||||||
|
var isGradient = !color.Equals(toColor);
|
||||||
|
zebraWidth = (maxDistance - zebraGap * (allSegment - 1)) / allSegment;
|
||||||
|
for (int i = 1; i <= segment; i++)
|
||||||
|
{
|
||||||
|
np = sp + dir * zebraWidth;
|
||||||
|
DrawLine(vh, sp, np, width, isGradient ? Color32.Lerp(color, toColor, i * 1.0f / allSegment) : color);
|
||||||
|
sp = np + dir * zebraGap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -436,6 +472,20 @@ namespace XUGL
|
|||||||
DrawQuadrilateral(vh, p1, p2, p3, p4, color, toColor);
|
DrawQuadrilateral(vh, p1, p2, p3, p4, color, toColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)
|
||||||
|
{
|
||||||
|
DrawRectangle(vh, rect, 0, color);
|
||||||
|
}
|
||||||
|
public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color)
|
||||||
|
{
|
||||||
|
DrawRectangle(vh, rect, border, color, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color, Color32 toColor)
|
||||||
|
{
|
||||||
|
DrawRectangle(vh, rect.center, rect.width / 2 - border, rect.height / 2 - border, color, toColor, true);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draw a quadrilateral. 画任意的四边形
|
/// Draw a quadrilateral. 画任意的四边形
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -477,13 +527,34 @@ namespace XUGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void InitCornerRadius(float[] cornerRadius, float width, float height, bool horizontal,
|
private static void InitCornerRadius(float[] cornerRadius, float width, float height, bool horizontal,
|
||||||
ref float brLt, ref float brRt, ref float brRb, ref float brLb, ref bool needRound)
|
bool invert, ref float brLt, ref float brRt, ref float brRb, ref float brLb, ref bool needRound)
|
||||||
{
|
{
|
||||||
if (cornerRadius == null) return;
|
if (cornerRadius == null) return;
|
||||||
|
if (invert)
|
||||||
|
{
|
||||||
|
if (horizontal)
|
||||||
|
{
|
||||||
|
brLt = cornerRadius.Length > 0 ? cornerRadius[1] : 0;
|
||||||
|
brRt = cornerRadius.Length > 1 ? cornerRadius[0] : 0;
|
||||||
|
brRb = cornerRadius.Length > 2 ? cornerRadius[3] : 0;
|
||||||
|
brLb = cornerRadius.Length > 3 ? cornerRadius[2] : 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
brLt = cornerRadius.Length > 0 ? cornerRadius[3] : 0;
|
||||||
|
brRt = cornerRadius.Length > 1 ? cornerRadius[2] : 0;
|
||||||
|
brRb = cornerRadius.Length > 2 ? cornerRadius[1] : 0;
|
||||||
|
brLb = cornerRadius.Length > 3 ? cornerRadius[0] : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
brLt = cornerRadius.Length > 0 ? cornerRadius[0] : 0;
|
brLt = cornerRadius.Length > 0 ? cornerRadius[0] : 0;
|
||||||
brRt = cornerRadius.Length > 1 ? cornerRadius[1] : 0;
|
brRt = cornerRadius.Length > 1 ? cornerRadius[1] : 0;
|
||||||
brRb = cornerRadius.Length > 2 ? cornerRadius[2] : 0;
|
brRb = cornerRadius.Length > 2 ? cornerRadius[2] : 0;
|
||||||
brLb = cornerRadius.Length > 3 ? cornerRadius[3] : 0;
|
brLb = cornerRadius.Length > 3 ? cornerRadius[3] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
needRound = brLb != 0 || brRt != 0 || brRb != 0 || brLb != 0;
|
needRound = brLb != 0 || brRt != 0 || brRb != 0 || brLb != 0;
|
||||||
if (needRound)
|
if (needRound)
|
||||||
{
|
{
|
||||||
@@ -562,18 +633,22 @@ namespace XUGL
|
|||||||
/// <param name="rectWidth"></param>
|
/// <param name="rectWidth"></param>
|
||||||
/// <param name="rectHeight"></param>
|
/// <param name="rectHeight"></param>
|
||||||
/// <param name="color"></param>
|
/// <param name="color"></param>
|
||||||
|
/// <param name="toColor"></param>
|
||||||
/// <param name="rotate"></param>
|
/// <param name="rotate"></param>
|
||||||
/// <param name="cornerRadius"></param>
|
/// <param name="cornerRadius"></param>
|
||||||
|
/// <param name="isYAxis"></param>
|
||||||
|
/// <param name="smoothness"></param>
|
||||||
|
/// <param name="invertCorner"></param>
|
||||||
public static void DrawRoundRectangle(VertexHelper vh, Vector3 center, float rectWidth, float rectHeight,
|
public static void DrawRoundRectangle(VertexHelper vh, Vector3 center, float rectWidth, float rectHeight,
|
||||||
Color32 color, Color32 toColor, float rotate = 0, float[] cornerRadius = null, bool isYAxis = false,
|
Color32 color, Color32 toColor, float rotate = 0, float[] cornerRadius = null, bool isYAxis = false,
|
||||||
float smoothness = 2)
|
float smoothness = 2, bool invertCorner = false)
|
||||||
{
|
{
|
||||||
var isGradient = !UGLHelper.IsValueEqualsColor(color, toColor);
|
var isGradient = !UGLHelper.IsValueEqualsColor(color, toColor);
|
||||||
var halfWid = rectWidth / 2;
|
var halfWid = rectWidth / 2;
|
||||||
var halfHig = rectHeight / 2;
|
var halfHig = rectHeight / 2;
|
||||||
float brLt = 0, brRt = 0, brRb = 0, brLb = 0;
|
float brLt = 0, brRt = 0, brRb = 0, brLb = 0;
|
||||||
bool needRound = false;
|
bool needRound = false;
|
||||||
InitCornerRadius(cornerRadius, rectWidth, rectHeight, isYAxis, ref brLt, ref brRt, ref brRb,
|
InitCornerRadius(cornerRadius, rectWidth, rectHeight, isYAxis, invertCorner, ref brLt, ref brRt, ref brRb,
|
||||||
ref brLb, ref needRound);
|
ref brLb, ref needRound);
|
||||||
var tempCenter = Vector3.zero;
|
var tempCenter = Vector3.zero;
|
||||||
var lbIn = new Vector3(center.x - halfWid, center.y - halfHig);
|
var lbIn = new Vector3(center.x - halfWid, center.y - halfHig);
|
||||||
@@ -805,12 +880,33 @@ namespace XUGL
|
|||||||
/// <param name="color"></param>
|
/// <param name="color"></param>
|
||||||
/// <param name="rotate"></param>
|
/// <param name="rotate"></param>
|
||||||
/// <param name="cornerRadius"></param>
|
/// <param name="cornerRadius"></param>
|
||||||
|
/// <param name="invertCorner"></param>
|
||||||
public static void DrawBorder(VertexHelper vh, Vector3 center, float rectWidth, float rectHeight,
|
public static void DrawBorder(VertexHelper vh, Vector3 center, float rectWidth, float rectHeight,
|
||||||
float borderWidth, Color32 color, float rotate = 0, float[] cornerRadius = null,
|
float borderWidth, Color32 color, float rotate = 0, float[] cornerRadius = null,
|
||||||
bool horizontal = false, float smoothness = 1f)
|
bool horizontal = false, float smoothness = 1f, bool invertCorner = false)
|
||||||
{
|
{
|
||||||
DrawBorder(vh, center, rectWidth, rectHeight, borderWidth, color, s_ClearColor32, rotate,
|
DrawBorder(vh, center, rectWidth, rectHeight, borderWidth, color, s_ClearColor32, rotate,
|
||||||
cornerRadius, horizontal, smoothness);
|
cornerRadius, horizontal, smoothness, invertCorner);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制(圆角)边框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vh"></param>
|
||||||
|
/// <param name="rect"></param>
|
||||||
|
/// <param name="borderWidth"></param>
|
||||||
|
/// <param name="color"></param>
|
||||||
|
/// <param name="rotate"></param>
|
||||||
|
/// <param name="cornerRadius"></param>
|
||||||
|
/// <param name="horizontal"></param>
|
||||||
|
/// <param name="smoothness"></param>
|
||||||
|
/// <param name="invertCorner"></param>
|
||||||
|
public static void DrawBorder(VertexHelper vh, Rect rect,
|
||||||
|
float borderWidth, Color32 color, float rotate = 0, float[] cornerRadius = null,
|
||||||
|
bool horizontal = false, float smoothness = 1f, bool invertCorner = false)
|
||||||
|
{
|
||||||
|
DrawBorder(vh, rect.center, rect.width, rect.height, borderWidth, color, s_ClearColor32, rotate,
|
||||||
|
cornerRadius, horizontal, smoothness, invertCorner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -825,9 +921,12 @@ namespace XUGL
|
|||||||
/// <param name="toColor"></param>
|
/// <param name="toColor"></param>
|
||||||
/// <param name="rotate"></param>
|
/// <param name="rotate"></param>
|
||||||
/// <param name="cornerRadius"></param>
|
/// <param name="cornerRadius"></param>
|
||||||
|
/// <param name="horizontal"></param>
|
||||||
|
/// <param name="smoothness"></param>
|
||||||
|
/// <param name="invertCorner"></param>
|
||||||
public static void DrawBorder(VertexHelper vh, Vector3 center, float rectWidth, float rectHeight,
|
public static void DrawBorder(VertexHelper vh, Vector3 center, float rectWidth, float rectHeight,
|
||||||
float borderWidth, Color32 color, Color32 toColor, float rotate = 0, float[] cornerRadius = null,
|
float borderWidth, Color32 color, Color32 toColor, float rotate = 0, float[] cornerRadius = null,
|
||||||
bool horizontal = false, float smoothness = 1f)
|
bool horizontal = false, float smoothness = 1f, bool invertCorner = false)
|
||||||
{
|
{
|
||||||
if (borderWidth == 0 || UGLHelper.IsClearColor(color)) return;
|
if (borderWidth == 0 || UGLHelper.IsClearColor(color)) return;
|
||||||
var halfWid = rectWidth / 2;
|
var halfWid = rectWidth / 2;
|
||||||
@@ -842,7 +941,7 @@ namespace XUGL
|
|||||||
var rbOt = new Vector3(center.x + halfWid + borderWidth, center.y - halfHig - borderWidth);
|
var rbOt = new Vector3(center.x + halfWid + borderWidth, center.y - halfHig - borderWidth);
|
||||||
float brLt = 0, brRt = 0, brRb = 0, brLb = 0;
|
float brLt = 0, brRt = 0, brRb = 0, brLb = 0;
|
||||||
bool needRound = false;
|
bool needRound = false;
|
||||||
InitCornerRadius(cornerRadius, rectWidth, rectHeight, horizontal, ref brLt, ref brRt, ref brRb,
|
InitCornerRadius(cornerRadius, rectWidth, rectHeight, horizontal, invertCorner, ref brLt, ref brRt, ref brRb,
|
||||||
ref brLb, ref needRound);
|
ref brLb, ref needRound);
|
||||||
var tempCenter = Vector3.zero;
|
var tempCenter = Vector3.zero;
|
||||||
if (UGLHelper.IsClearColor(toColor))
|
if (UGLHelper.IsClearColor(toColor))
|
||||||
@@ -1084,7 +1183,8 @@ namespace XUGL
|
|||||||
float smoothness, int gradientType = 0, bool isYAxis = false)
|
float smoothness, int gradientType = 0, bool isYAxis = false)
|
||||||
{
|
{
|
||||||
if (radius == 0) return;
|
if (radius == 0) return;
|
||||||
if (space > 0 && Mathf.Abs(toDegree - startDegree) >= 360) space = 0;
|
var isCircle = Mathf.Abs(toDegree - startDegree) >= 360;
|
||||||
|
if (space > 0 && isCircle) space = 0;
|
||||||
radius -= borderWidth;
|
radius -= borderWidth;
|
||||||
smoothness = (smoothness < 0 ? 2f : smoothness);
|
smoothness = (smoothness < 0 ? 2f : smoothness);
|
||||||
int segments = (int) ((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness);
|
int segments = (int) ((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness);
|
||||||
@@ -1124,7 +1224,7 @@ namespace XUGL
|
|||||||
if (realToAngle < realStartAngle) realToAngle = realStartAngle;
|
if (realToAngle < realStartAngle) realToAngle = realStartAngle;
|
||||||
p2 = UGLHelper.GetPos(center, radius, realStartAngle);
|
p2 = UGLHelper.GetPos(center, radius, realStartAngle);
|
||||||
}
|
}
|
||||||
if (needBorder)
|
if (needBorder && !isCircle)
|
||||||
{
|
{
|
||||||
borderDiff = borderLineWidth / Mathf.Sin(halfAngle);
|
borderDiff = borderLineWidth / Mathf.Sin(halfAngle);
|
||||||
realCenter += borderDiff * middleDire;
|
realCenter += borderDiff * middleDire;
|
||||||
@@ -1160,9 +1260,9 @@ namespace XUGL
|
|||||||
{
|
{
|
||||||
p4 = new Vector3(p3.x, realCenter.y);
|
p4 = new Vector3(p3.x, realCenter.y);
|
||||||
var dist = p4.x - realCenter.x;
|
var dist = p4.x - realCenter.x;
|
||||||
var tcolor = Color32.Lerp(color, toColor, dist >= 0
|
var tcolor = Color32.Lerp(color, toColor, dist >= 0 ?
|
||||||
? dist / radius
|
dist / radius :
|
||||||
: Mathf.Min(radius + dist, radius) / radius);
|
Mathf.Min(radius + dist, radius) / radius);
|
||||||
if (isLeft && (i == segments || i == 0)) tcolor = toColor;
|
if (isLeft && (i == segments || i == 0)) tcolor = toColor;
|
||||||
DrawQuadrilateral(vh, lastP4, p2, p3, p4, lastColor, tcolor);
|
DrawQuadrilateral(vh, lastP4, p2, p3, p4, lastColor, tcolor);
|
||||||
lastP4 = p4;
|
lastP4 = p4;
|
||||||
@@ -1275,6 +1375,7 @@ namespace XUGL
|
|||||||
insideRadius += borderWidth;
|
insideRadius += borderWidth;
|
||||||
smoothness = smoothness < 0 ? 2f : smoothness;
|
smoothness = smoothness < 0 ? 2f : smoothness;
|
||||||
Vector3 p1, p2, p3, p4, e1, e2;
|
Vector3 p1, p2, p3, p4, e1, e2;
|
||||||
|
var isCircle = Mathf.Abs(toDegree - startDegree) >= 360;
|
||||||
var needBorder = borderWidth != 0;
|
var needBorder = borderWidth != 0;
|
||||||
var needSpace = space != 0;
|
var needSpace = space != 0;
|
||||||
var diffAngle = Mathf.Abs(toDegree - startDegree) * Mathf.Deg2Rad;
|
var diffAngle = Mathf.Abs(toDegree - startDegree) * Mathf.Deg2Rad;
|
||||||
@@ -1342,7 +1443,7 @@ namespace XUGL
|
|||||||
p2 = UGLHelper.GetPos(center, outsideRadius, realStartOutAngle, false);
|
p2 = UGLHelper.GetPos(center, outsideRadius, realStartOutAngle, false);
|
||||||
e2 = UGLHelper.GetPos(center, outsideRadius, realToOutAngle, false);
|
e2 = UGLHelper.GetPos(center, outsideRadius, realToOutAngle, false);
|
||||||
}
|
}
|
||||||
if (needBorder)
|
if (needBorder && !isCircle)
|
||||||
{
|
{
|
||||||
var borderDiff = borderWidth / Mathf.Sin(halfAngle);
|
var borderDiff = borderWidth / Mathf.Sin(halfAngle);
|
||||||
realCenter += Mathf.Abs(borderDiff) * middleDire;
|
realCenter += Mathf.Abs(borderDiff) * middleDire;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "com.monitor1394.xcharts",
|
"name": "com.monitor1394.xcharts",
|
||||||
"displayName": "XCharts",
|
"displayName": "XCharts",
|
||||||
"version": "2.3.0",
|
"version": "2.8.2",
|
||||||
"date": "20210724",
|
"date": "20220815",
|
||||||
"checkdate": "20210724",
|
"checkdate": "20220815",
|
||||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"description": "A charting and data visualization library for Unity.",
|
"description": "A charting and data visualization library for Unity.",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": "2.3.0",
|
"version": "2.8.2",
|
||||||
"date": "20210724",
|
"date": "20220815",
|
||||||
"checkdate": "20210724",
|
"checkdate": "20220815",
|
||||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||||
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
|
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
# Get start with XCharts in 5 minute
|
# Get start with XCharts in 5 minute
|
||||||
|
|
||||||
[Return homepage](https://github.com/monitor1394/unity-ugui-XCharts)
|
[Return 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 Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
|
||||||
|
|
||||||
## Installing XCharts
|
## Installing XCharts
|
||||||
|
|
||||||
@@ -116,9 +116,9 @@ See the complete code in `Examples`:`Example13_LineSimple.cs`
|
|||||||
|
|
||||||
You can also use the code to control more parameters. There are many more examples under `Examples`. All parameters in [XCharts Configuration](xcharts-configuration-EN.md) or `Inspector` can be controlled by code.
|
You can also use the code to control more parameters. There are many more examples under `Examples`. All parameters in [XCharts Configuration](xcharts-configuration-EN.md) or `Inspector` can be controlled by code.
|
||||||
|
|
||||||
In addition, unless customized, it is recommended to call the interfaces in the [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md), which do some internal correlation processing, such as refreshing the chart, etc. If you call the interface of an internal component, you'll need to handle other issues like refresh yourself.
|
In addition, unless customized, it is recommended to call the interfaces in the [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-api-EN.md), which do some internal correlation processing, such as refreshing the chart, etc. If you call the interface of an internal component, you'll need to handle other issues like refresh yourself.
|
||||||
|
|
||||||
[Return homepage](https://github.com/monitor1394/unity-ugui-XCharts)
|
[Return 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 Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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 Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# 教程:5分钟上手XCharts
|
# 教程:5分钟上手 XCharts 2.0
|
||||||
|
|
||||||
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
|
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
|
||||||
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
|
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)
|
||||||
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
|
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)
|
||||||
|
|
||||||
## 获取和引入 XCharts
|
## 获取和引入 XCharts
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ for (int i = 0; i < 10; i++)
|
|||||||
|
|
||||||
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](XCharts配置项手册.md)里面的所有参数都是可以通过代码控制的。
|
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](XCharts配置项手册.md)里面的所有参数都是可以通过代码控制的。
|
||||||
|
|
||||||
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
|
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XChartsAPI.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
|
||||||
|
|
||||||
## 使用TextMeshPro
|
## 使用TextMeshPro
|
||||||
|
|
||||||
@@ -172,6 +172,6 @@ serieData.itemStyle.color = Color.blue;
|
|||||||
```
|
```
|
||||||
|
|
||||||
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
|
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
|
||||||
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
|
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)
|
||||||
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
|
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 0}
|
m_GameObject: {fileID: 0}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 0}
|
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: UnityEditor:UnityEditor.PackageManager.UI:PackageManagerProjectSettings
|
m_EditorClassIdentifier:
|
||||||
m_ScopedRegistriesSettingsExpanded: 1
|
m_ScopedRegistriesSettingsExpanded: 1
|
||||||
oneTimeWarningShown: 0
|
oneTimeWarningShown: 0
|
||||||
m_Registries:
|
m_Registries:
|
||||||
- m_Id: main
|
- m_Id: main
|
||||||
m_Name:
|
m_Name:
|
||||||
m_Url: https://packages.unity.cn
|
m_Url: https://packages.unity.com
|
||||||
m_Scopes: []
|
m_Scopes: []
|
||||||
m_IsDefault: 1
|
m_IsDefault: 1
|
||||||
m_UserSelectedRegistryName:
|
m_UserSelectedRegistryName:
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 2019.4.13f1c1
|
m_EditorVersion: 2019.4.39f1
|
||||||
m_EditorVersionWithRevision: 2019.4.13f1c1 (ddecf0c37a3b)
|
m_EditorVersionWithRevision: 2019.4.39f1 (78d14dfa024b)
|
||||||
|
|||||||
30
README.md
30
README.md
@@ -12,7 +12,7 @@
|
|||||||
<a href="Assets/XCharts/README.md">English Doc</a>
|
<a href="Assets/XCharts/README.md">English Doc</a>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
|
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/LICENSE">
|
||||||
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
|
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
|
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
|
||||||
@@ -45,11 +45,11 @@
|
|||||||
|
|
||||||
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持折线图、柱状图、饼图、雷达图、散点图、热力图、仪表盘、环形图、极坐标、水位图、K线图等常见图表。
|
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持折线图、柱状图、饼图、雷达图、散点图、热力图、仪表盘、环形图、极坐标、水位图、K线图等常见图表。
|
||||||
|
|
||||||
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
|
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)
|
||||||
[XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
|
[XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)
|
||||||
[XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
|
[XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
|
||||||
[教程:5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程:5分钟上手XCharts.md)
|
[教程:5分钟上手 XCharts 2.0](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/教程:5分钟上手XCharts.md)
|
||||||
|
|
||||||
## XCharts 2.0
|
## XCharts 2.0
|
||||||
|
|
||||||
@@ -182,25 +182,25 @@ XCharts的图表由组件和数据组成。不同的组件和数据可以组合
|
|||||||
* 在Editor上快速创建一个图表:
|
* 在Editor上快速创建一个图表:
|
||||||
|
|
||||||
1. 在`Hierarchy`试图下右键或菜单栏`GameObject`下拉:`XCharts->LineChart`,即可快速创建一个简单的折线图出来。
|
1. 在`Hierarchy`试图下右键或菜单栏`GameObject`下拉:`XCharts->LineChart`,即可快速创建一个简单的折线图出来。
|
||||||
2. `Inspector` 视图下可以调整各个组件的参数,`Game` 视图会实时反馈调整的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md)。
|
2. `Inspector` 视图下可以调整各个组件的参数,`Game` 视图会实时反馈调整的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)。
|
||||||
|
|
||||||
* 更多的代码动态控制的例子请参考[教程:5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程:5分钟上手XCharts.md) 。
|
* 更多的代码动态控制的例子请参考[教程:5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/教程:5分钟上手XCharts.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/2.0/Assets/XCharts/Documentation/XCharts问答.md)
|
||||||
* 接口文档看这里☞ [XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
|
* 接口文档看这里☞ [XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/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/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)
|
||||||
* 更新日志看这里☞ [XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
|
* 更新日志看这里☞ [XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
|
||||||
* 新手教程看这里☞ [教程:5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程:5分钟上手XCharts.md)
|
* 新手教程看这里☞ [教程:5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/教程:5分钟上手XCharts.md)
|
||||||
|
|
||||||
## 日志
|
## 日志
|
||||||
|
|
||||||
[更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
|
[更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
|
||||||
|
|
||||||
## Licenses
|
## Licenses
|
||||||
|
|
||||||
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/LICENSE.md)
|
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/LICENSE.md)
|
||||||
|
|
||||||
## 其他
|
## 其他
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user