Compare commits

..

50 Commits

Author SHA1 Message Date
monitor1394
d77e1c3d91 v3.0.0-preivew9 2022-05-06 08:14:49 +08:00
monitor1394
d4b3f5eaa8 3.0.0-preview9 2022-05-06 08:12:15 +08:00
monitor1394
8a78867961 [doc] update doc 2022-05-05 13:23:33 +08:00
monitor1394
d9266b3c9c [refactor][optimize] item color 2022-05-05 13:10:04 +08:00
monitor1394
0801069f72 [add][line] line support dash (#197) 2022-05-04 20:47:02 +08:00
monitor1394
e92afac0de [add][legend] add the delegate callback for legend 2022-05-04 09:19:45 +08:00
monitor1394
d1fd4dcf44 [refactor] refactor symbol and label 2022-05-04 08:45:19 +08:00
monitor1394
43c31405b8 [bug][ring] fix ring label formatter (#195) 2022-05-01 10:54:14 +08:00
monitor1394
4e4d0bc85d [optimize][bar] bar support clip and min-max (#196) 2022-05-01 10:30:58 +08:00
monitor1394
96b0ec45d2 [optimize][tooltip] support background image 2022-04-29 15:54:47 +08:00
monitor1394
8c02ce14ac [bug] fix change color in runtime did not refresh 2022-04-27 08:26:05 +08:00
monitor1394
419c704b23 v3.0.0-preivew8 2022-04-26 08:26:37 +08:00
monitor1394
9dedc1db68 v3.0.0-preivew8 2022-04-26 08:24:45 +08:00
monitor1394
f11ee84517 [optimize][label] support label rotate 2022-04-19 13:30:24 +08:00
monitor1394
dfa978afe0 [optimize][visualmap] support horizontal gradient 2022-04-19 07:22:47 +08:00
monitor1394
4e6658ad70 [optimize][bar] optimize border and capsule 2022-04-18 08:20:16 +08:00
monitor1394
ef5988a851 [enhancement][liquid] support round rect vessel 2022-04-15 13:12:19 +08:00
monitor1394
5d6c5b5f79 [doc] update api doc 2022-04-14 21:42:40 +08:00
monitor1394
80e4475f65 [enhancement][line] line support end label 2022-04-14 21:32:44 +08:00
monitor1394
84cf39df4d [doc] update doc 2022-04-13 22:04:45 +08:00
monitor1394
d44bf55a87 [add][VisualMap] add workOnLine and workOnArea (#191) 2022-04-13 22:03:23 +08:00
monitor1394
ad273cf1b1 [optimize] optimize interact and performance 2022-04-13 13:33:09 +08:00
monitor1394
a3d2d3f1d5 [optimize] optimize interact and performance 2022-04-13 13:26:46 +08:00
monitor1394
7ca4ddcb88 [optimize] radar support area tooltip 2022-04-12 08:09:18 +08:00
monitor1394
9a3461084c [doc] update readme 2022-04-11 21:54:09 +08:00
monitor1394
09df6fa73d [doc] update doc 2022-04-11 21:49:18 +08:00
monitor1394
be4ed41ca6 [optimize] visualmap 2022-04-09 21:30:28 +08:00
monitor1394
e2b0c935e0 [optimize] tooltip 2022-04-09 11:03:41 +08:00
monitor1394
e4fac71987 v3.0.0-preivew7 2022-04-07 08:38:17 +08:00
monitor1394
20825c148f [doc] update api and configuration 2022-04-07 08:36:14 +08:00
monitor1394
5476fa8d09 [setting] update setting 2022-04-07 08:35:20 +08:00
monitor1394
80c77fc69a [optimize] Pie support startAngle 2022-04-07 08:35:03 +08:00
monitor1394
621bc3dcfd [bug] Fix pie color 2022-04-07 08:16:50 +08:00
monitor1394
1ed0ff377a fix add main component error 2022-03-31 21:54:34 +08:00
monitor1394
426d437e6d fixed axis label custom color 2022-03-30 13:15:24 +08:00
monitor1394
6c0dcbbcbb 3.0 2022-03-30 08:25:48 +08:00
monitor1394
4ade064266 3.0 2022-03-30 08:24:47 +08:00
monitor1394
1ad87920d0 3.0 2022-03-29 22:06:10 +08:00
monitor1394
b784900fda 3.0 2022-03-28 19:28:39 +08:00
monitor1394
acba2f5c1e 3.0 2022-03-27 12:49:20 +08:00
monitor1394
3bccbd0ab2 3.0 2022-03-26 22:28:23 +08:00
monitor1394
327661bfdd Create FUNDING.yml 2022-03-26 22:05:59 +08:00
monitor1394
ed393ea560 3.0 2022-03-26 21:34:38 +08:00
monitor1394
3fbf5bc906 3.0 2022-03-26 18:30:55 +08:00
monitor1394
b7efcf87cf 3.0 2022-03-26 18:26:34 +08:00
monitor1394
1aea9f3cfe 3.0 2022-03-26 17:20:52 +08:00
monitor1394
edd6d940b6 3.0 2022-03-26 17:11:12 +08:00
monitor1394
09f7557e1f 3.0 2022-03-25 13:36:10 +08:00
monitor1394
2e954490ec 3.0 2022-03-24 21:48:53 +08:00
monitor1394
f597a3f116 3.0 2022-03-24 08:37:06 +08:00
213 changed files with 9146 additions and 5653 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ['https://www.paypal.com/paypalme/monitor1394','https://github.com/XCharts-Team/XCharts/blob/master/Documentation/res/alipay.png']

View File

@@ -2,6 +2,19 @@
# 更新日志
[master](#master)
[v3.0.0-preivew9](#v3.0.0-preivew9)
[v3.0.0-preivew8](#v3.0.0-preivew8)
[v3.0.0-preivew7](#v3.0.0-preivew7)
[v3.0.0-preivew6](#v3.0.0-preivew6)
[v3.0.0-preivew5](#v3.0.0-preivew5)
[v3.0.0-preivew4](#v3.0.0-preivew4)
[v3.0.0-preivew3](#v3.0.0-preivew3)
[v3.0.0-preivew2](#v3.0.0-preivew2)
[v3.0.0-preivew1](#v3.0.0-preivew1)
[v2.7.0](#v2.7.0)
[v2.6.0](#v2.6.0)
[v2.5.0](#v2.5.0)
[v2.4.0](#v2.4.0)
[v2.3.0](#v2.3.0)
[v2.2.3](#v2.2.3)
[v2.2.2](#v2.2.2)
@@ -39,7 +52,114 @@
## master
* (2021.08.15) 修复`DataZoom`开启时重新添加数据后图表数据显示异常的问题 (#163)
## v3.0.0-preivew9
* (2022.05.06) 发布`v3.0.0-preivew9`版本
* (2022.05.05) 优化`ItemStyle`设置`color`时的一致性
* (2022.05.05) 增加`Line``Dash`,`Dot`等的支持 (#197)
* (2022.05.04) 增加`Legend`的委托回调
* (2022.05.04) 优化`Symbol``Label`
* (2022.05.01) 增加`Bar``clip`的支持 (#196)
* (2022.05.01) 修复`RingChart``Label`不刷新的问题 (#195)
* (2022.04.29) 增加`Tooltip`支持自定义背景图
* (2022.04.27) 修复`ItemStyle`代码修改`color`不刷新的问题
## v3.0.0-preivew8
* (2022.04.26) 发布`v3.0.0-preivew8`版本
* (2022.04.23) 移除`Serie``IconStyle`组件
* (2022.04.23) 强化`LabelStyle`,所有组件的`TextStyle`都升级为`LabelStyle`
* (2022.04.19) 增加`Label``rotate`支持设置旋转
* (2022.04.17) 修复`Bar`在数值为负数时动画无效的问题
* (2022.04.17) 增加`ItemStyle``BorderGap`支持设置边框间距
* (2022.04.16) 优化`Bar``Border``Capsule`胶囊柱图
* (2022.04.15) 增加`Liquid``Round Rect`圆角矩形水位图的支持
* (2022.04.14) 增加`Line``EndLabel`的支持
* (2022.04.13) 增加`VisualMap``workOnLine``workOnArea`支持折线和区域映射功能 (#191)
* (2022.04.12) 优化`Radar`支持`Area`区域触发`Tooltip`
* (2022.04.09) 优化`VisualMap`
* (2022.04.09) 优化`Tooltip`
## v3.0.0-preivew7
* (2022.04.07) 发布`v3.0.0-preivew7`版本
* (2022.04.07) 修复`Pie`颜色不刷新的问题
* (2022.03.31) 修复`Add Main Component`添加组件异常的问题
* (2022.03.30) 修复`Axis`无法自定义`Label`颜色的问题
## v3.0.0-preivew6
* (2022.03.30) 发布`v3.0.0-preivew6`版本
## v3.0.0-preivew5
* (2022.03.26) 发布`v3.0.0-preivew5`版本
## v3.0.0-preivew4
* (2022.03.21) 发布`v3.0.0-preivew4`版本
## v3.0.0-preivew3
* (2022.03.09) 发布`v3.0.0-preivew3`版本
## v3.0.0-preivew2
* (2022.01.08) 发布`v3.0.0-preivew2`版本
## v3.0.0-preivew1
* (2022.01.07) 发布`v3.0.0-preivew1`版本
## v2.7.0
* (2022.03.20) 发布`v2.7.0`版本
* (2022.02.21) 修复`Chart``chartName`重复检测问题 #183
* (2022.02.17) 修复`Axis``SplitLine`可能会显示在坐标系外的问题 #181
* (2022.02.08) 修复数据全0时`{d}`显示不正确的问题
* (2022.02.08) 修复`YAxis``AxisLabel``onZero`参数不生效的问题
* (2022.01.06) 优化`Zebra`斑马柱图
## v2.6.0
* (2021.12.30) 发布`v2.6.0`版本
* (2021.12.21) 修复`Emphasis`不生效的问题
* (2021.12.17) 修复`MarkLine`在运行时`Label`不自动刷新显示隐藏的问题 #178
* (2021.12.10) 完善`Radar``AxisLine``SplitLine`可单独控制
* (2021.12.08) 修复`Serie`隐藏后`Y`轴最大值不刷新的问题
* (2021.12.04) 增加`Symbol`新类型:`EmptyRect`,`EmptyTriangle`,`EmptyDiamond`
* (2021.12.04) 增加`Symbol``Empty`区域颜色可通过`ItemStyle``backgroundColor`设置的支持
* (2021.12.03) 修复`Formatter``{c}`通配符不生效的问题 #175
* (2021.12.03) 修复`Axis``boundaryGap`某些情况下显示的问题 #174
* (2021.11.30) 修复`Serie``ignore`某些情况下绘制异常的问题 #173
## v2.5.0
* (2021.11.27) 发布`v2.5.0`版本
* (2021.11.27) 增加`Tooltip``positionFunction`的坐标设置委托函数
* (2021.10.29) 移除`XCharts`首次导入时`TextMeshPro`的相关设置
* (2021.10.29) 增加`Tooltip`对通配符`{e}`的支持 #170
* (2021.09.08) 完善`RadarChart`
* (2021.09.07) 修复`PieChart`渐出动画结束时`label`没有消失的问题 #168
* (2021.09.06) 修复`GaugeChart`用代码改变`splitNumber`不会刷新`label`的问题 #167
## v2.4.0
### 版本要点
* 折线图支持忽略数据的连线是断开还是连接
* 折线图支持轨迹匀速动画
* 其他优化和问题修复
### 日志详情
* (2021.08.31) 发布`v2.4.0`版本
* (2021.08.31) 优化`RingChart`的渐变效果
* (2021.08.31) 修复`DataZoom`拖动时`SerieLabel`不刷新的问题 (#165)
* (2021.08.25) 修复`Theme`主题切换无法保持到场景上的问题 (#166)
* (2021.08.24) 增加`Animation``alongWithLinePath`参数设置折线轨迹匀速动画
* (2021.08.22) 增加`Serie``ignoreLineBreak`参数设置忽略数据连线是否断开 (#164)
* (2021.08.22) 修复`Axis``DataZoom`开启时`Label`可能不更新的问题 (#164)
* (2021.08.15) 优化`Axis``AxisLabel`文本旋转设置避免在DataZoom开启时偏移不一致 (#163)
* (2021.08.14) 增加`Legend``textAutoColor`设置文本颜色和`Serie`一致 (#163)
* (2021.08.12) 优化`BarChart`设置`Corner`时正负柱条圆角对称
@@ -217,7 +337,7 @@
## v1.6.0
* (2020.08.24) 发布`v1.6.0`版本
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md)进行升级)
* (2020.08.15) 优化`PieChart`绘制表现效果#85
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85

View File

@@ -39,6 +39,12 @@
## master
* (2022.04.23) Remove `Serie` `IconStyle` component
* (2022.04.23) Enhance `LabelStyle`, all components `TextStyle` will be upgraded to `LabelStyle`
* (2022.04.19) Added `Label` `rotate` to support setting rotation
* (2022.04.17) Fixed animation invalidation of `Bar` when the value is negative
* (2022.04.17) Added `BorderGap` support for `ItemStyle` to set border spacing
* (2022.04.16) Optimize the `Border` and `Capsule` histogram of `Bar`
* (2021.08.15) Fixed the problem of displaying exceptions after adding data again when `DataZoom` is enable (#163)
* (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)
@@ -215,7 +221,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
## v1.6.0
* (2020.08.24) Release `v1.6.0` version
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/XCharts-Team/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 [FAQ 29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md) to upgrade)
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
* (2020.08.11) Added `LiquidChart` data change animation#83
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85

View File

@@ -4,34 +4,34 @@
## 订阅服务
| |免费用户|个人`1``VIP`|个人`2``VIP` | 个人长期`VIP` |
| ----- |--|--|--|--|
| 订阅费用 | -- | `298`¥ | `498`¥ | `888`¥ |
| 席位时长 | -- | `1`个席位<br>`1`年 | `1`个席位<br>`2`年 | `1`个席位<br>`长期` |
||
| |免费用户|付费咨询|个人`1``VIP`|个人`2``VIP` | 个人长期`VIP` |
| ----- |--|--|--|--|--|
| 订阅费用 | -- | `98`¥ | `298`¥ | `498`¥ | `888`¥ |
| 席位时长 | -- | `1`个席位<br>`7`天,`7`小时* | `1`个席位<br>`1`年 | `1`个席位<br>`2`年 | `1`个席位<br>`长期` |
| <b>`服务方式:`</b>|
| 官方QQ群交流 | √ | √ | √ | √ |
| 专属VIP群交流 | | √ | √ | √ |
| 即时一对一交流 | | √ | √ | √ |
||
| 官方QQ群交流 | √ | √ | √ | √ | √ |
| 即时一对一交流 | | √ | √ | √ | √ |
| 专属VIP群交流 | | | √ | √ | √ |
| <b>`服务内容:`</b>|
| 可商用 | √ | √ | √ | √ |
| 可二次开发 | √ | √ | √ | √ |
| 有问必答 | | √ | √ | √ |
| 新手指导 | | √ | √ | √ |
| 开发指导 | | √ | √ | √ |
| 优化指导 | | √ | √ | √ |
| 其他技术支持 | | √ | √ | √ |
| 问题及时处理 | | √ | √ | √ |
| 需求优先考虑 | | √ | √ | √ |
| 可另付费定制 | | √ | √ | √ |
| 可另付费加急 | | √ | √ | √ |
| 付费模块85折 | | | | √ |
| 可商用 | √ | √ | √ | √ | √ |
| 可二次开发 | √ | √ | √ | √ | √ |
| 有问必答 | | √ | √ | √ | √ |
| 即时回应 | | √ | √ | √ | √ |
| 新手指导 | | √ | √ | √ | √ |
| 开发指导 | | √ | √ | √ | √ |
| 优化指导 | | √ | √ | √ | √ |
| 其他技术支持 | | | √ | √ | √ |
| 问题及时处理 | | | √ | √ | √ |
| 需求优先考虑 | | | √ | √ | √ |
| 可另付费定制 | | | √ | √ | √ |
| 可另付费加急 | | | √ | √ | √ |
| 付费图表优惠 | | | 95折 | 95折 | 85折 |
## 备注说明
1. __`付费定制`__ 是指用户可根据自己的需求定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并指定`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。
2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并可要求在`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。
3. __`付费咨询`__ 付费咨询有效期`7`天,且总咨询时长不超过`7`个小时。
## 捐助支持

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4d51993143e26422eb0a4015658033a3
guid: 1d5cdb90dc99540768bfb21ea8243d04
TextScriptImporter:
externalObjects: {}
userData:

View File

@@ -1,8 +1,8 @@
# XCharts Q&A
# XCharts FAQ
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)
[XCharts API](xcharts-api-EN.md)
[XCharts Configuration](xcharts-configuration-EN.md)
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
[XCharts API](XChartsAPI-EN.md)</br>
[XCharts Configuration](XChartsConfiguration-EN.md)
[QA 1: How to adjust the margin between the axis and the background?](#How-to-adjust-the-margin-between-the-axis-and-the=-background)
[QA 2: How to play agian the fadeIn animation?](#How-to-play-agian-the-fadeIn-animation)
@@ -156,6 +156,6 @@ The upgrade steps are as follows:
4. Upgrade `XCharts` to the latest version.
5. The custom color can be restored by importing `color.config` through `menu bar -> XCharts-> ImportColorConfig` (if `color.config` is not under `Assets` of the upgraded project, copy it to this directory).
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)
[XCharts API](xcharts-api-EN.md)
[XCharts Configuration](xcharts-configuration-EN.md)
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
[XCharts API](XChartsAPI-EN.md)</br>
[XCharts Configuration](XChartsConfiguration-EN.md)

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e803ae0ae73794ec6891fed7551fe01d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +1,8 @@
# XCharts问答
[返回首](https://github.com/XCharts-Team/XCharts)
[XChartsAPI接口](XChartsAPI.md)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts主](https://github.com/XCharts-Team/XCharts)
[XChartsAPI](XChartsAPI-ZH.md)
[XCharts配置项手册](XChartsConfiguration-ZH.md)
[QA 1如何调整坐标轴与背景的边距](#如何调整坐标轴与背景的边距)
[QA 2如何让初始动画重新播放](#如何让初始动画重新播放)
@@ -108,7 +108,7 @@
## 如何自定义Tooltip的显示内容
答:自定义总的内容可以通过`Tooltip``formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter``titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie``itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](XCharts配置项手册.md)。
答:自定义总的内容可以通过`Tooltip``formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter``titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie``itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](XChartsConfiguration-ZH.md)。
## 如何让Y轴显示多位小数
@@ -116,7 +116,7 @@
## 如何用代码动态更新数据
答:请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能相关API请查看文档[XChartsAPI接口](XChartsAPI.md) 。
答:请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能相关API请查看文档[XChartsAPI接口](XChartsAPI-ZH.md) 。
## 如何显示图例_为什么有时候图例无法显示
@@ -162,6 +162,6 @@
6. 升级`XCharts`到最新版本。
7. 通过`菜单栏->XCharts->ImportColorConfig``color.config`导入即可恢复自定义的颜色(如果`color.config`不在升级后的项目的`Assets`下的话需要拷贝到此目录下)。
[返回首](https://github.com/XCharts-Team/XCharts)
[XChartsAPI接口](XChartsAPI.md)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts主](https://github.com/XCharts-Team/XCharts)
[XChartsAPI](XChartsAPI-ZH.md)
[XCharts配置项手册](XChartsConfiguration-ZH.md)

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4df833a2a1e6c4a7da37a08379dd2e18
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,9 +1,9 @@
# 教程5分钟上手 XCharts 3.0
[返回首](https://github.com/XCharts-Team/XCharts)
[XCharts问答](https://github.com/XCharts-Team/XCharts/master/Documentation/XCharts问答.md)
[XChartsAPI接口](https://github.com/XCharts-Team/XCharts/master/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/XCharts-Team/XCharts/master/Documentation/XCharts配置项手册.md)
[XCharts主](https://github.com/XCharts-Team/XCharts)</br>
[XCharts问答](XChartsFAQ-ZH.md)</br>
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
[XCharts配置项手册](XChartsConfiguration-ZH.md)
## 获取和导入 XCharts
@@ -64,7 +64,7 @@
功能越丰富就越需要更多的组件和参数支持。XCharts有多达几十种的主组件和子组件每个组件有几个至几十个不等的可配置参数以支持各种灵活而复杂的功能。
首次接触XCharts者可在 `Inspector` 视图下可以添加和调整各个组件,`Game` 视图会实时反馈调整的效果,以熟悉各种组件实现的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](XCharts配置项手册.md)。
首次接触XCharts者可在 `Inspector` 视图下可以添加和调整各个组件,`Game` 视图会实时反馈调整的效果,以熟悉各种组件实现的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](XChartsConfiguration-ZH.md)。
## 如何快速调整参数
@@ -146,9 +146,9 @@ for (int i = 0; i < 10; i++)
完整代码请查阅`Examples``Example13_LineSimple.cs`
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](XCharts配置项手册.md)里面的所有参数都是可以通过代码控制的。
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](XChartsConfiguration-ZH.md)里面的所有参数都是可以通过代码控制的。
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/XCharts-Team/XCharts/master/Documentation/XChartsAPI.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/XCharts-Team/XCharts/master/Documentation/XChartsAPI-ZH.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
## 使用TextMeshPro
@@ -225,7 +225,7 @@ itemStyle.color = Color.blue;
```
[返回首](https://github.com/XCharts-Team/XCharts)
[XCharts问答](https://github.com/XCharts-Team/XCharts/master/Documentation/XCharts问答.md)
[XChartsAPI接口](https://github.com/XCharts-Team/XCharts/master/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/XCharts-Team/XCharts/master/Documentation/XCharts配置项手册.md)
[XCharts主](https://github.com/XCharts-Team/XCharts)</br>
[XCharts问答](XChartsFAQ-ZH.md)</br>
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
[XCharts配置项手册](XChartsConfiguration-ZH.md)

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a772f2d2a3f994d439db4a07365b9554
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,231 @@
# 教程5分钟上手 XCharts 3.0
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
[XCharts问答](XChartsFAQ-ZH.md)</br>
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
[XCharts配置项手册](XChartsConfiguration-ZH.md)
## 获取和导入 XCharts
1. 直接放入XCharts源码到项目
下载好XCharts源码后直接将XCharts目录拷贝到Unity项目工程的Assets目录下。
2. 通过`Assets/Import Package`导入XCharts
下载好XCharts的.unitypackage文件后打开Unity菜单栏 Assets-->Import Package-->选中.unitypackage导入即可开始使用XCharts。
3. 通过`Package Manager`导入XCharts
对于Unity 2018.3以上版本,可通过 Package Manager来导入XCharts打开Package Manager后通过 `Add package form git URL...`输入XCharts的github URL: https://github.com/XCharts-Team/XCharts.git#master 稍等片刻后即可使用XCharts。
也可以直接将package加入到`manifest.json`文件:打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
``` json
"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git#master",
```
如需更新`XCharts`,删除`manifest.json`文件部分Unity版本可能是packages-lock.json文件的`lock`下的`com.monitor1394.xcharts`相关内容即会重新下载编译。
## 添加一个简单图表
在`Hierarchy`试图下右键或菜单栏`GameObject`下拉:`XCharts->LineChart`
![op_addchart](res/op_addchart.png)
即可快速创建一个简单的折线图出来:
![linechart1](res/linechart1.png)
## 添加多个Seire
如何在上图的基础上添加两条折线呢,只需`Add Serie`按钮,选择对应的`Serie`类型即可:
![op_addserie](res/op_addserie.png)
![linechart2](res/linechart2.png)
## 添加其他组件
默认图表没有`Legend`,需要`Legend`组件可通过`Add Component`按钮添加:
![op_addcomponent](res/op_addcomponent.png)
## 添加Serie组件
如果需要给折线图区域填充颜色,可单独给`Serie`添加`Component`
![op_addseriecomponent](res/op_addseriecomponent.png)
![linechart3](res/linechart3.png)
## 添加SerieData组件
如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加`Component`。比如我们给第一个折线图的第二个数据单独显示`Label`
![op_addseriedatacomponent](res/op_addseriedatacomponent.png)
![linechart4](res/linechart4.png)
## 更多组件和配置参数
功能越丰富就越需要更多的组件和参数支持。XCharts有多达几十种的主组件和子组件每个组件有几个至几十个不等的可配置参数以支持各种灵活而复杂的功能。
首次接触XCharts者可在 `Inspector` 视图下可以添加和调整各个组件,`Game` 视图会实时反馈调整的效果,以熟悉各种组件实现的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](XChartsConfiguration-ZH.md)。
## 如何快速调整参数
`XCharts`是配置参数驱动。想要什么效果,你只需要去调整对应组件下的配置参数就可以,不需要去改`Hierarchy`试图下的节点,因为那些节点是由`XCharts`内部根据配置参数生成的。你改了也会变还原。
快速定位你想要改的效果对应的组件。这就需要对组件有一定的了解。比如我们想要让X轴的轴线末端显示箭头如何定位第一步X轴定位到`XAxis0`;第二步,轴线定位到`AxisLine`;最后,再去看`AxisLine`组件下有没有这样的参数可以实现这个效果。
`XCharts`提供从全局`Theme`、系列`Serie`、单个数据项`SerieData`全方位的参数配置。优先级从大到小为:`SerieData`->`Serie`->`Theme`。以`ItemStyle`的颜色例,如果`SerieData`的`ItemStyle`配置有颜色值,则优先用这个颜色值。
## 用代码添加折线图
给`gameObject`挂上`LineChart`脚本:
```C#
var chart = gameObject.GetComponent<LineChart>();
if (chart == null)
{
chart = gameObject.AddComponent<LineChart>();
chart.Init();
}
```
调整大小:
```C#
chart.SetSize(580, 300);//代码动态设置尺寸或直接操作chart.rectTransform或直接在Inspector上改
```
设置标题:
```C#
var title = chart.GetOrAddChartComponent<Title>();
title.text = "Simple Line";
```
设置提示框和图例是否显示:
```C#
var tooltip = chart.GetOrAddChartComponent<Tooltip>();
tooltip.show = true;
var legend = chart.GetOrAddChartComponent<Legend>();
legend.show = false;
```
设置坐标轴:
```C#
var xAxis = chart.GetOrAddChartComponent<XAxis>();
xAxis.splitNumber = 10;
xAxis.boundaryGap = true;
xAxis.type = Axis.AxisType.Category;
var yAxis = chart.GetOrAddChartComponent<YAxis>();
yAxis.type = Axis.AxisType.Value;
```
清空默认数据,添加`Line`类型的`Serie`用于接收数据:
```C#
chart.RemoveData();
chart.AddSerie<Line>("line");
```
添加10个数据
```C#
for (int i = 0; i < 10; i++)
{
chart.AddXAxisData("x" + i);
chart.AddData(0, Random.Range(10, 20));
}
```
这样一个简单的折线图就出来了:
![linechart-simple](res/linechart-simple.png)
如果一个Chart里面有多个系列时则Axis的data只需要加一次不要多个循环加重复了。记住Axis的数据个数要和Serie的数据个数一致。
完整代码请查阅`Examples``Example13_LineSimple.cs`
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](XChartsConfiguration-ZH.md)里面的所有参数都是可以通过代码控制的。
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/XCharts-Team/XCharts/master/Documentation/XChartsAPI-ZH.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
## 使用TextMeshPro
XCharts支持TextMeshPro但默认是不开启的需要自己手动切换。可通过一下两种方式开启和关闭
![textmeshpro1](res/op_textmeshpro.png)
![textmeshpro2](res/op_textmeshpro2.png)
开启后需要设置好TextMeshPro要用的全局字体也可以在主题Theme里单独设置
![textmeshpro-font](res/op_textmeshpro3.png)
建议在项目初就规划好是否使用TextMeshPro在有很多图表的情况下再切换可能导致某些图表无法正常初始化这时可能需要每个图表单独的使用`Remove All Chart Object`来清理让图表重新初始化。
## 用代码改图表参数
`Inspector`上看到的所有参数都可以用代码来修改关键是要定位好你要改的参数是在组件上、还是serie上、还是在具体的数据项上改。
### 改主组件上的参数
需要先获取组件,再修改里面的参数:
```C#
var title = chart.GetOrAddChartComponent<Title>();
title.text = "Simple LineChart";
title.subText = "normal line";
var xAxis = chart.GetOrAddChartComponent<XAxis>();
xAxis.splitNumber = 10;
xAxis.boundaryGap = true;
xAxis.type = Axis.AxisType.Category;
```
### 改Serie的参数
新添加Serie
```C#
var serie = chart.AddSerie<Pie>();
serie.center[0] = 0.5f;
serie.center[1] = 0.5f;
serie.radius[0] = 80;
serie.radius[1] = 90;
serie.animation.dataChangeEnable = true;
serie.roundCap = true;
```
已存在的Serie
```C#
var serie = chart.GetSerie<Pie>();
serie.center[0] = 0.5f;
serie.center[1] = 0.5f;
serie.radius[0] = 80;
serie.radius[1] = 90;
serie.animation.dataChangeEnable = true;
serie.roundCap = true;
```
给Serie添加额外组件
```C#
serie.AddExtraComponent<AreaStyle>();
var label = serie1.AddExtraComponent<LabelStyle>();
label.offset = new Vector3(0,20,0);
```
### 改数据项SerieData上的参数
```C#
var serieData = chart.AddData(0, 20);
//var serieData = serie.GetSerieData(0); //从已有数据中获取
serieData.radius = 10;
var itemStyle = serieData.GetOrAddComponent<ItemStyle>(); //启用SerieData的Component
itemStyle.color = Color.blue;
```
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
[XCharts问答](XChartsFAQ-ZH.md)</br>
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
[XCharts配置项手册](XChartsConfiguration-ZH.md)

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2ab7eabdc796a45aea5bc457dc9e27f8
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 529e55126e1d04a629b14d857f76fffd
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 3fa7a80a30cd846139159beaadba05f2
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ca54a17a3a60f4b36b0be43df9f1c33d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -11,6 +11,15 @@ namespace XCharts.Editor
[CustomEditor(typeof(BaseChart), true)]
public class BaseChartEditor : UnityEditor.Editor
{
class Styles
{
public static readonly GUIContent btnAddSerie = new GUIContent("Add Serie", "");
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
public static readonly GUIContent btnCovertXYAxis = new GUIContent("Covert XY Axis", "");
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Chart Object", "");
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
}
protected BaseChart m_Chart;
protected SerializedProperty m_Script;
protected SerializedProperty m_EnableTextMeshPro;
@@ -28,6 +37,7 @@ namespace XCharts.Editor
private bool m_CheckWarning = false;
private int m_LastComponentCount = 0;
private int m_LastSerieCount = 0;
private string m_VersionString = "";
private StringBuilder sb = new StringBuilder();
MainComponentListEditor m_ComponentList;
SerieListEditor m_SerieList;
@@ -51,6 +61,10 @@ namespace XCharts.Editor
RefreshSeries();
m_SerieList = new SerieListEditor(this);
m_SerieList.Init(m_Chart, serializedObject, m_Series);
m_VersionString = "v" + XChartsMgr.fullVersion;
if (m_EnableTextMeshPro.boolValue)
m_VersionString += "-tmp";
}
public List<SerializedProperty> RefreshComponent()
@@ -97,8 +111,6 @@ namespace XCharts.Editor
m_SerieList.UpdateSeriesProperty(m_Series);
}
OnStartInspectorGUI();
EditorGUILayout.Space();
OnDebugInspectorGUI();
EditorGUILayout.Space();
serializedObject.ApplyModifiedProperties();
@@ -113,18 +125,23 @@ namespace XCharts.Editor
EditorGUILayout.PropertyField(m_Script);
EditorGUILayout.PropertyField(m_ChartName);
EditorGUILayout.PropertyField(m_RaycastTarget);
if (XChartsMgr.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox("chart name is repeated: " + m_ChartName.stringValue, MessageType.Error);
EditorGUILayout.EndHorizontal();
}
}
EditorGUILayout.PropertyField(m_Theme);
EditorGUILayout.PropertyField(m_Settings);
m_ComponentList.OnGUI();
m_SerieList.OnGUI();
}
protected virtual void OnDebugInspectorGUI()
{
EditorGUILayout.PropertyField(m_DebugInfo, true);
EditorGUILayout.Space();
AddSerie();
AddComponent();
CheckWarning();
@@ -165,16 +182,12 @@ namespace XCharts.Editor
private void ShowVersion()
{
sb.Length = 0;
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
if(m_EnableTextMeshPro.boolValue)
sb.Append("-tmp");
EditorGUILayout.HelpBox(sb.ToString(), MessageType.None);
EditorGUILayout.HelpBox(m_VersionString, MessageType.None);
}
private void AddComponent()
{
if (GUILayout.Button("Add Component"))
if (GUILayout.Button(Styles.btnAddComponent))
{
var menu = new GenericMenu();
foreach (var type in GetMainComponentTypeNames())
@@ -197,7 +210,7 @@ namespace XCharts.Editor
}
private void AddSerie()
{
if (GUILayout.Button("Add Serie"))
if (GUILayout.Button(Styles.btnAddSerie))
{
var menu = new GenericMenu();
foreach (var type in GetSerieTypeNames())
@@ -260,22 +273,22 @@ namespace XCharts.Editor
{
if (m_Chart.HasChartComponent<XAxis>() && m_Chart.HasChartComponent<YAxis>())
{
if (GUILayout.Button("Covert XY Axis"))
if (GUILayout.Button(Styles.btnCovertXYAxis))
m_Chart.CovertXYAxis(0);
}
if (GUILayout.Button("Rebuild Chart Object"))
if (GUILayout.Button(Styles.btnRebuildChartObject))
{
m_Chart.RebuildChartObject();
}
if (m_CheckWarning)
{
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Check Warning"))
if (GUILayout.Button(Styles.btnCheckWarning))
{
m_CheckWarning = true;
m_Chart.CheckWarning();
}
if (GUILayout.Button("Hide Warning"))
if (GUILayout.Button(Styles.btnHideWarning))
{
m_CheckWarning = false;
}
@@ -296,7 +309,7 @@ namespace XCharts.Editor
}
else
{
if (GUILayout.Button("Check warning"))
if (GUILayout.Button(Styles.btnCheckWarning))
{
m_CheckWarning = true;
m_Chart.CheckWarning();

View File

@@ -18,7 +18,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_FoldSeries");
PropertyField(prop, "m_ShowDebugInfo");
PropertyField(prop, "m_ShowAllChartObject");
PropertyField(prop, "m_DebugInfoTextStyle");
PropertyField(prop, "m_LabelStyle");
--EditorGUI.indentLevel;
}
}

View File

@@ -18,6 +18,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_Layer");
PropertyField(prop, "m_Align");
PropertyField(prop, "m_Sprite");
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");

View File

@@ -0,0 +1,28 @@

using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ImageStyle), true)]
public class ImageStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ImageStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Sprite");
PropertyField(prop, "m_Type");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6e994b64b93384ae4bfa9a7a85ba8914
guid: 4649856b17dfd4f628eb975040fb791c
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -24,6 +24,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_CenterColor");
PropertyField(prop, "m_CenterGap");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderGap");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_BorderColor0");
PropertyField(prop, "m_BorderToColor");

View File

@@ -17,10 +17,13 @@ namespace XCharts.Editor
++EditorGUI.indentLevel;
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_LineAngle");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineGap");
PropertyField(prop, "m_LineLength1");
PropertyField(prop, "m_LineLength2");
PropertyField(prop, "m_StartSymbol");
PropertyField(prop, "m_EndSymbol");
--EditorGUI.indentLevel;
}
}

View File

@@ -16,19 +16,26 @@ namespace XCharts.Editor
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Position");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_AutoOffset");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_BackgroundWidth");
PropertyField(prop, "m_BackgroundHeight");
PropertyField(prop, "m_PaddingLeftRight");
PropertyField(prop, "m_PaddingTopBottom");
PropertyField(prop, "m_AutoOffset");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Icon");
PropertyField(prop, "m_Background");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_TextPadding");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(EndLabelStyle), true)]
public class EndLabelStyleDrawer : LabelStyleDrawer
{
public override string ClassName { get { return "End Label"; } }
}
}

View File

@@ -0,0 +1,25 @@

using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(SerieDataBaseInfo), true)]
public class SerieDataBaseInfoDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "BaseInfo"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", false))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_Selected");
PropertyField(prop, "m_Radius");
--EditorGUI.indentLevel;
}
}
}
}

View File

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

View File

@@ -0,0 +1,53 @@

using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
public class SerieSymbolDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Symbol"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
PropertyField(prop, "m_Type");
if (type == SymbolType.Custom)
{
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_Width");
// PropertyField(prop, "m_Height");
// PropertyField(prop, "m_Offset");
}
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_SizeType");
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
{
case SymbolSizeType.Custom:
PropertyField(prop, "m_Size");
PropertyField(prop, "m_SelectedSize");
break;
case SymbolSizeType.FromData:
PropertyField(prop, "m_DataIndex");
PropertyField(prop, "m_DataScale");
PropertyField(prop, "m_SelectedDataScale");
break;
case SymbolSizeType.Function:
break;
}
PropertyField(prop, "m_StartIndex");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_ForceShowLast");
PropertyField(prop, "m_Repeat");
--EditorGUI.indentLevel;
}
}
}
}

View File

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

View File

@@ -23,29 +23,12 @@ namespace XCharts.Editor
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_Width");
// PropertyField(prop, "m_Height");
PropertyField(prop, "m_Height");
// PropertyField(prop, "m_Offset");
}
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Size");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_SizeType");
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
{
case SymbolSizeType.Custom:
PropertyField(prop, "m_Size");
PropertyField(prop, "m_SelectedSize");
break;
case SymbolSizeType.FromData:
PropertyField(prop, "m_DataIndex");
PropertyField(prop, "m_DataScale");
PropertyField(prop, "m_SelectedDataScale");
break;
case SymbolSizeType.Function:
break;
}
PropertyField(prop, "m_StartIndex");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_ForceShowLast");
PropertyField(prop, "m_Repeat");
--EditorGUI.indentLevel;
}
}

View File

@@ -0,0 +1,26 @@

using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TextPadding), true)]
public class TextPaddingDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Padding"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Right");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_Left");
--EditorGUI.indentLevel;
}
}
}
}

View File

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

View File

@@ -15,7 +15,7 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
#if dUI_TextMeshPro
@@ -24,11 +24,8 @@ namespace XCharts.Editor
PropertyField(prop, "m_Font");
#endif
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_ExtraWidth");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_AutoBackgroundColor");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_LineSpacing");
#if dUI_TextMeshPro
@@ -37,8 +34,8 @@ namespace XCharts.Editor
#else
PropertyField(prop, "m_FontStyle");
PropertyField(prop, "m_Alignment");
PropertyField(prop, "m_AutoWrap");
PropertyField(prop, "m_AutoAlign");
PropertyField(prop, "m_AutoWrap");
#endif
--EditorGUI.indentLevel;
}

View File

@@ -44,6 +44,7 @@ namespace XCharts.Editor
XCThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
}
PropertyField(prop, "m_SharedTheme");
PropertyField(prop, "m_TransparentBackground");
PropertyField(prop, "m_EnableCustomTheme");
using (new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
{

View File

@@ -5,19 +5,8 @@ using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TitleStyle), true)]
public class TitleStyleDrawer : BasePropertyDrawer
public class TitleStyleDrawer : LabelStyleDrawer
{
public override string ClassName { get { return "TitleStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_OffsetCenter");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -80,7 +80,6 @@ namespace XCharts.Editor
PropertyField("m_AxisLabel");
PropertyField("m_SplitLine");
PropertyField("m_SplitArea");
PropertyField("m_IconStyle");
PropertyListField("m_Icons", true);
if (type == Axis.AxisType.Category)
{
@@ -153,17 +152,22 @@ namespace XCharts.Editor
++EditorGUI.indentLevel;
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_ShowStartLabel");
PropertyField(prop, "m_ShowEndLabel");
PropertyField(prop, "m_TextLimit");
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Icon");
PropertyField(prop, "m_Background");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_TextPadding");
--EditorGUI.indentLevel;
}
}
@@ -180,9 +184,7 @@ namespace XCharts.Editor
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_Location");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_LabelStyle");
--EditorGUI.indentLevel;
}
}

View File

@@ -46,9 +46,9 @@ namespace XCharts.Editor
PropertyField("m_Bottom");
PropertyField("m_LineStyle");
PropertyField("m_AreaStyle");
PropertyField("m_LabelStyle");
PropertyListField("m_XAxisIndexs", true);
PropertyListField("m_YAxisIndexs", true);
PropertyField("m_TextStyle");
}
else
{

View File

@@ -19,7 +19,7 @@ namespace XCharts.Editor
PropertyField("m_Orient");
PropertyField("m_Formatter");
PropertyField("m_Location");
PropertyField("m_TextStyle");
PropertyField("m_LabelStyle");
PropertyListField("m_Icons");
PropertyListField("m_Data");
--EditorGUI.indentLevel;

View File

@@ -14,8 +14,8 @@ namespace XCharts.Editor
PropertyField("m_SubText");
PropertyField("m_ItemGap");
PropertyField("m_Location");
PropertyField("m_TextStyle");
PropertyField("m_SubTextStyle");
PropertyField("m_LabelStyle");
PropertyField("m_SubLabelStyle");
--EditorGUI.indentLevel;
}
}

View File

@@ -17,16 +17,17 @@ namespace XCharts.Editor
PropertyField("m_TitleFormatter");
PropertyField("m_ItemFormatter");
PropertyField("m_NumericFormatter");
PropertyField("m_TitleHeight");
PropertyField("m_ItemHeight");
PropertyFiledMore(() =>
{
PropertyField("m_TitleHeight");
PropertyField("m_ItemHeight");
PropertyField("m_Marker");
PropertyField("m_BorderWidth");
PropertyField("m_BorderColor");
PropertyField("m_PaddingLeftRight");
PropertyField("m_PaddingTopBottom");
PropertyField("m_BackgroundImage");
PropertyField("m_BackgroundType");
PropertyField("m_BackgroundColor");
PropertyField("m_FixedWidth");
PropertyField("m_FixedHeight");
@@ -40,9 +41,9 @@ namespace XCharts.Editor
PropertyField("m_FixedY");
});
PropertyField("m_LineStyle");
PropertyField("m_LabelTextStyle");
PropertyField("m_TitleTextStyle");
PropertyListField("m_ColumnsTextStyle");
PropertyField("m_IndicatorLabelStyle");
PropertyField("m_TitleLabelStyle");
PropertyListField("m_ContentLabelStyles");
--EditorGUI.indentLevel;
}
}

View File

@@ -20,8 +20,10 @@ namespace XCharts.Editor
PropertyField("m_Max");
PropertyField("m_SplitNumber");
PropertyField("m_Dimension");
PropertyField("m_Show");
if (baseProperty.FindPropertyRelative("m_Show").boolValue)
PropertyField("m_WorkOnLine");
PropertyField("m_WorkOnArea");
PropertyField("m_ShowUI");
if (baseProperty.FindPropertyRelative("m_ShowUI").boolValue)
{
PropertyField("m_SelectedMode");
PropertyTwoFiled("m_Range");
@@ -42,7 +44,7 @@ namespace XCharts.Editor
}
}
[CustomPropertyDrawer(typeof(VisualMap.Pieces), true)]
[CustomPropertyDrawer(typeof(VisualMapPieces), true)]
public class PiecesDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Pieces"; } }

View File

@@ -26,7 +26,7 @@ namespace XCharts.Editor
PropertyField("m_BarZebraWidth");
PropertyField("m_BarZebraGap");
}
PropertyField("m_Clip");
PropertyFiledMore(() =>
{
PropertyFieldLimitMin("m_MinShow", 0);
@@ -38,7 +38,6 @@ namespace XCharts.Editor
PropertyField("m_ShowAsPositiveNumber");
PropertyField("m_Large");
PropertyField("m_LargeThreshold");
PropertyField("m_Clip");
PropertyField("m_PlaceHolder");
});
PropertyField("m_ItemStyle");

View File

@@ -18,6 +18,7 @@ namespace XCharts.Editor
PropertyField("m_YAxisIndex");
}
PropertyField("m_LineType");
//PropertyField("m_Clip");
PropertyFiledMore(() =>
{
PropertyFieldLimitMin("m_MinShow", 0);
@@ -32,7 +33,6 @@ namespace XCharts.Editor
PropertyField("m_ShowAsPositiveNumber");
PropertyField("m_Large");
PropertyField("m_LargeThreshold");
PropertyField("m_Clip");
});
PropertyField("m_Symbol");
PropertyField("m_LineStyle");

View File

@@ -11,6 +11,7 @@ namespace XCharts.Editor
PropertyField("m_Gap");
PropertyTwoFiled("m_Center");
PropertyTwoFiled("m_Radius");
//PropertyField("m_StartAngle");
PropertyFiledMore(() =>
{

View File

@@ -26,7 +26,7 @@ namespace XCharts.Editor
this.chart = chart;
this.serie = target;
this.baseProperty = property;
m_DisplayName = string.Format("serie {0}: {1}", serie.index, serie.GetType().Name);
m_DisplayName = string.Format("Serie {0}: {1}", serie.index, serie.GetType().Name);
//m_Inspector = inspector;
showProperty = baseProperty.FindPropertyRelative("m_Show");
if (showProperty == null)

View File

@@ -195,7 +195,7 @@ namespace XCharts.Editor
var m_Id = serieData.FindPropertyRelative("m_Id");
var m_ParentId = serieData.FindPropertyRelative("m_ParentId");
var m_IconStyle = serieData.FindPropertyRelative("m_IconStyles");
var m_BaseInfo = serieData.FindPropertyRelative("m_BaseInfos");
var m_Label = serieData.FindPropertyRelative("m_Labels");
var m_ItemStyle = serieData.FindPropertyRelative("m_ItemStyles");
var m_Emphasis = serieData.FindPropertyRelative("m_Emphases");
@@ -208,19 +208,19 @@ namespace XCharts.Editor
PropertyField(m_Id);
PropertyField(m_ParentId);
var componentNum = m_IconStyle.arraySize + m_Label.arraySize + m_ItemStyle.arraySize + m_Emphasis.arraySize
var componentNum = m_BaseInfo.arraySize + m_Label.arraySize + m_ItemStyle.arraySize + m_Emphasis.arraySize
+ m_Symbol.arraySize + m_LineStyle.arraySize + m_AreaStyle.arraySize;
var title = "Component";
if (componentNum == 0) title += " (None)";
m_DataComponentFoldout = ChartEditorHelper.DrawHeader(title, m_DataComponentFoldout, false, null, null,
new HeaderMenuInfo("Add BaseInfo", () =>
{
serie.GetSerieData(index).GetOrAddComponent<SerieDataBaseInfo>();
}, m_BaseInfo.arraySize == 0),
new HeaderMenuInfo("Add ItemStyle", () =>
{
serie.GetSerieData(index).GetOrAddComponent<ItemStyle>();
}, m_ItemStyle.arraySize == 0),
new HeaderMenuInfo("Add IconStyle", () =>
{
serie.GetSerieData(index).GetOrAddComponent<IconStyle>();
}, m_IconStyle.arraySize == 0),
new HeaderMenuInfo("Add Label", () =>
{
serie.GetSerieData(index).GetOrAddComponent<LabelStyle>();
@@ -231,7 +231,7 @@ namespace XCharts.Editor
}, m_Emphasis.arraySize == 0),
new HeaderMenuInfo("Add Symbol", () =>
{
serie.GetSerieData(index).GetOrAddComponent<SymbolStyle>();
serie.GetSerieData(index).GetOrAddComponent<SerieSymbol>();
}, m_Symbol.arraySize == 0),
new HeaderMenuInfo("Add LineStyle", () =>
{
@@ -245,14 +245,14 @@ namespace XCharts.Editor
{
serie.GetSerieData(index).GetOrAddComponent<TitleStyle>();
}, m_TitleStyle.arraySize == 0),
new HeaderMenuInfo("Remove BaseInfo", () =>
{
serie.GetSerieData(index).RemoveComponent<SerieDataBaseInfo>();
}, m_BaseInfo.arraySize > 0),
new HeaderMenuInfo("Remove ItemStyle", () =>
{
serie.GetSerieData(index).RemoveComponent<ItemStyle>();
}, m_ItemStyle.arraySize > 0),
new HeaderMenuInfo("Remove IconStyle", () =>
{
serie.GetSerieData(index).RemoveComponent<IconStyle>();
}, m_IconStyle.arraySize > 0),
new HeaderMenuInfo("Remove Label", () =>
{
serie.GetSerieData(index).RemoveComponent<LabelStyle>();
@@ -263,7 +263,7 @@ namespace XCharts.Editor
}, m_Emphasis.arraySize > 0),
new HeaderMenuInfo("Remove Symbol", () =>
{
serie.GetSerieData(index).RemoveComponent<SymbolStyle>();
serie.GetSerieData(index).RemoveComponent<SerieSymbol>();
}, m_Symbol.arraySize > 0),
new HeaderMenuInfo("Remove LineStyle", () =>
{
@@ -283,8 +283,8 @@ namespace XCharts.Editor
}, componentNum > 0));
if (m_DataComponentFoldout)
{
if (m_IconStyle.arraySize > 0)
PropertyField(m_IconStyle.GetArrayElementAtIndex(0));
if (m_BaseInfo.arraySize > 0)
PropertyField(m_BaseInfo.GetArrayElementAtIndex(0));
if (m_Label.arraySize > 0)
PropertyField(m_Label.GetArrayElementAtIndex(0));
if (m_ItemStyle.arraySize > 0)

View File

@@ -12,6 +12,7 @@ namespace XCharts.Editor
PropertyField("m_YAxisIndex");
PropertyField("m_BarWidth");
PropertyField("m_BarGap");
PropertyField("m_Clip");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");
}

View File

@@ -10,6 +10,7 @@ namespace XCharts.Editor
PropertyField("m_XAxisIndex");
PropertyField("m_YAxisIndex");
PropertyField("m_LineType");
//PropertyField("m_Clip");
PropertyField("m_LineStyle");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");

View File

@@ -27,7 +27,7 @@ namespace XCharts.Editor
public static void CheckAddedAsset(string assetPath)
{
var fileName = Path.GetFileName(assetPath);
if (fileName.Equals("XChartsSettings.asset"))
if (fileName.Equals("XCSettings.asset"))
{
XCThemeMgr.ReloadThemeList();
return;
@@ -43,6 +43,7 @@ namespace XCharts.Editor
public static void CheckDeletedAsset(string assetPath)
{
if (!IsThemeAsset(assetPath)) return;
if (XCSettings.Instance == null) return;
var themes = XCSettings.customThemes;
var changed = false;

View File

@@ -194,7 +194,8 @@ namespace XCharts.Editor
else if (a.StartsWith("selected:"))
{
string selected = a.Substring(9, a.Length - 9);
serieData.selected = bool.Parse(selected);
var baseInfo = serieData.GetOrAddComponent<SerieDataBaseInfo>();
baseInfo.selected = bool.Parse(selected);
}
}
serie.AddSerieData(serieData);

View File

@@ -48,7 +48,6 @@ namespace XCharts.Editor
static SettingsProvider[] CreateXCSettingsProvider()
{
var providers = new System.Collections.Generic.List<SettingsProvider> { new XCResourceImporterProvider() };
if (GetSettings() != null)
{
var provider = new AssetSettingsProvider("Project/XCharts/Settings", GetSettings);

View File

@@ -55,6 +55,7 @@ namespace XCharts.Editor
{
var parent = GetParent();
if (parent == null) return null;
XCThemeMgr.CheckReloadTheme();
var chart = new GameObject();
chart.name = GetName(parent, chartName);
var t = chart.AddComponent<T>();
@@ -192,20 +193,5 @@ namespace XCharts.Editor
XChartsMgr.ModifyTMPRefence(true);
XChartsMgr.DisableTextMeshPro();
}
[MenuItem("XCharts/Theme/Export Default Theme")]
public static void ExportDefaultTheme()
{
var profile = ScriptableObject.CreateInstance<Theme>();
profile.name = "Default";
profile.themeName = "Default";
profile.themeType = ThemeType.Default;
var themeName = XCSettings.THEME_ASSET_NAME_PREFIX + profile.themeName;
var path = XCSettings.THEME_ASSET_FOLDER + "/" + themeName + ".asset";
AssetDatabase.CreateAsset(profile, path);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
}
}

View File

@@ -270,6 +270,7 @@ namespace XCharts.Example
var visualMap = chart.GetOrAddChartComponent<VisualMap>();
visualMap.show = true;
visualMap.showUI = true;
visualMap.orient = Orient.Vertical;
visualMap.calculable = true;
visualMap.min = 0;

View File

@@ -222,7 +222,7 @@ namespace XCharts.Example
yield return new WaitForSeconds(1);
serie.label.textStyle.color = Color.white;
serie.label.textStyle.backgroundColor = Color.grey;
serie.label.background.color = Color.grey;
serie.labelDirty = true;
chart.RefreshChart();
yield return new WaitForSeconds(1);

View File

@@ -8,7 +8,16 @@ namespace XCharts.Example
[ExecuteInEditMode]
public class Example13_LineSimple : MonoBehaviour
{
void Awake()
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
AddData();
//OnTestBtn();
}
}
void AddData()
{
var chart = gameObject.GetComponent<LineChart>();
if (chart == null)

View File

@@ -62,7 +62,7 @@ namespace XCharts.Example
legend.orient = Orient.Vertical;
chart.RemoveData();
serie = chart.AddSerie<Bar>( "访问来源");
serie = chart.AddSerie<Bar>("访问来源");
serie.radius[0] = 0;
serie.radius[1] = 110;
serie.center[0] = 0.5f;
@@ -118,12 +118,12 @@ namespace XCharts.Example
chart.RefreshChart();
yield return new WaitForSeconds(1);
serie.data[0].selected = true;
serie.data[0].GetOrAddComponent<SerieDataBaseInfo>().selected = true;
chart.RefreshChart();
yield return new WaitForSeconds(1);
serie.gap = 0f;
serie.data[0].selected = false;
serie.data[0].GetOrAddComponent<SerieDataBaseInfo>().selected = false;
chart.RefreshChart();
yield return new WaitForSeconds(1);
}
@@ -132,7 +132,7 @@ namespace XCharts.Example
{
chart.GetChartComponent<Title>().subText = "多图组合";
serie1 = chart.AddSerie<Pie>( "访问来源2");
serie1 = chart.AddSerie<Pie>("访问来源2");
chart.AddData(1, 335, "直达");
chart.AddData(1, 679, "营销广告");
chart.AddData(1, 1548, "搜索引擎");

View File

@@ -29,7 +29,8 @@ namespace XCharts.Example
var serieData = chart.AddData(0, 20);
//var serieData = serie1.GetSerieData(0);
serieData.radius = 10;
var baseInfo = serieData.GetOrAddComponent<SerieDataBaseInfo>();
baseInfo.radius = 10;
var itemStyle = serieData.GetOrAddComponent<ItemStyle>();
itemStyle.color = Color.blue;
}

View File

@@ -45,56 +45,80 @@
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表以及3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
[XCharts3.0 教程](Documentation/XChartsTutorial01-ZH.md)
[XCharts3.0 API](Documentation/XChartsAPI-ZH.md)
[XCharts3.0 问答](Documentation/XChartsFAQ-ZH.md)
[XCharts3.0 配置项手册](Documentation/XChartsConfiguration-ZH.md)
[XCharts3.0 更新日志](CHANGELOG.md)
## 特性
* 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
* 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
* 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
* 支持直线图、曲线图、面积图、阶梯线图等折线图。
* 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
* 支持环形图、玫瑰图等饼图。
* 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
* 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
* 支持主题定制、导入和导出,内置两种默认主题。
* 支持自定义图表内容绘制提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
* 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
* 支持万级大数据绘制。
* 支持`TexMeshPro`
## XCharts3.0 比 2.0 的改进
* 更具可读、可扩展和可维护性的底层框架。
* 更强大的性能。
* 更小的存储文件。
* 更好的交互体验。
* 更多的组件支持。
* 更合理的组件调整。
* 更灵活的组件插拔。
* 更方便的二次开发。
* 更丰富的Demo示例。
- 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
- 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
- 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
- 支持直线图、曲线图、面积图、阶梯线图等折线图。
- 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
- 支持环形图、玫瑰图等饼图。
- 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
- 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
- 支持主题定制、导入和导出,内置两种默认主题。
- 支持自定义图表内容绘制提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
- 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
- 支持万级大数据绘制。
- 支持`TexMeshPro`
## XCharts3.0 新功能
* 增加Time时间轴。
* 增加SingleAxis单轴。
* 增加多种坐标系Grid、Polar、Radar、SingleAxis。
* 增加多种动画方式。
* 增加更细致的图表交互。
* 增加国际化支持。
* 增加Widgets小组件。
* 增加多扩展图表。
- 增加Time时间轴。
- 增加SingleAxis单轴。
- 增加多种坐标系Grid、Polar、Radar、SingleAxis。
- 增加多种动画方式。
- 增加多种图表交互。
- 增加国际化支持。
- 增加Widgets小组件。
- 增加多扩展图表。
## XCharts3.0 相比 XCharts2.0 的改进
- 更健壮的底层框架。
- 更强大的性能。
- 更小的序列化文件。
- 更好的交互体验。
- 更多的组件支持。
- 更合理的组件调整。
- 更灵活的组件插拔。
- 更方便的二次开发。
- 更丰富的Demo示例。
## XCharts3.0 和 2.0 数据对比
| Case | XCharts2.0 | XCharts3.0 | Note |
| -- | -- | -- | -- |
| 2000数据折线图的帧频 | 20 | 83 | 性能提升 3 倍 |
| 2000数据折线图的顶点数 | 36.5k | 6.7k | 顶点数减少 4 倍 |
| 2000数据折线图的Prefab大小 | 11.1MB | 802KB | 序列化文件大小减少 10 倍 |
| 单条折线图数据最大容量 | 4.1k | 19k | 单Serie数据容量提升 4 倍 |
| 支持的图表 | 11种 |23种 | 支持的图表多 1 倍 |
## 注意
- XCharts3.0 不兼容 XCharts2.0 版本建议旧项目还是继续使用XCharts2.0新项目使用XCharts3.0。
- XCharts2.0 进入维护阶段后续只修复严重bug理论上不再加新功能。
- XCharts 理论上支持Unity 5.6及以上版本但由于版本测试有限难免疏漏发现版本兼容问题可提Issue。
- XCharts 内置图表都为常见的图表可以免费使用扩展图表大部分为不常使用的图表有需要的可付费获取感谢对XCharts的支持。
- 本仓库只包含XCharts源码不包含Demo示例部分。需要查看Demo示例请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)
## 截图
[XCharts Demo 项目](https://github.com/XCharts-Team/XCharts-Demo)
![buildinchart](https://github.com/XCharts-Team/XCharts-Demo/blob/master/buildinchart.png)
![extendchart](https://github.com/XCharts-Team/XCharts-Demo/blob/master/extendchart.png)
更多示例请看 [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo),也可以到 [在线Demo](https://xcharts-team.github.io/demo/) 查看WebGL下的运行效果。
## 使用
[XCharts教程5分钟上手教程](Documentation/XCharts教程5分钟上手教程.md)
[XCharts教程5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
## 日志

View File

@@ -48,10 +48,5 @@ MonoBehaviour:
m_PieTooltipExtraRadius: 8
m_PieSelectedOffset: 8
m_CustomThemes:
- {fileID: 0}
- {fileID: 11400000, guid: 289d2fc7f4ce24f73b9ed8ec52639f72, type: 2}
- {fileID: 11400000, guid: e1dc23a10de1e4c5dbfbaf74c4dfd218, type: 2}
- {fileID: 0}
- {fileID: 0}
- {fileID: 11400000, guid: 0a4f01779f9b24f48846f968fe013a57, type: 2}
- {fileID: 11400000, guid: 4d093c897dc514d12aca94b6b17cb4fa, type: 2}

View File

@@ -13,6 +13,8 @@ namespace XCharts.Runtime
protected override void DefaultChart()
{
AddChartComponentWhenNoExist<PolarCoord>();
AddChartComponentWhenNoExist<AngleAxis>();
AddChartComponentWhenNoExist<RadiusAxis>();
var tooltip = GetChartComponent<Tooltip>();
tooltip.type = Tooltip.Type.Corss;

View File

@@ -9,32 +9,32 @@ namespace XCharts.Runtime
{
/// <summary>
/// he default. An animation playback mode will be selected according to the actual situation.
/// 默认。内部会根据实际情况选择一种动画播放方式。
/// |默认。内部会根据实际情况选择一种动画播放方式。
/// </summary>
Default,
/// <summary>
/// Play the animation from left to right.
/// 从左往右播放动画。
/// |从左往右播放动画。
/// </summary>
LeftToRight,
/// <summary>
/// Play the animation from bottom to top.
/// 从下往上播放动画。
/// |从下往上播放动画。
/// </summary>
BottomToTop,
/// <summary>
/// Play animations from the inside out.
/// 由内到外播放动画。
/// |由内到外播放动画。
/// </summary>
InsideOut,
/// <summary>
/// Play the animation along the path.
/// 沿着路径播放动画。
/// |沿着路径播放动画。
/// </summary>
AlongPath,
/// <summary>
/// Play the animation clockwise.
/// 顺时针播放动画。
/// |顺时针播放动画。
/// </summary>
Clockwise,
}
@@ -46,7 +46,7 @@ namespace XCharts.Runtime
/// <summary>
/// the animation of serie.
/// 动画表现。
/// |动画表现。
/// </summary>
[System.Serializable]
public class AnimationStyle : ChildComponent
@@ -83,42 +83,42 @@ namespace XCharts.Runtime
/// <summary>
/// Whether to enable animation.
/// 是否开启动画效果。
/// |是否开启动画效果。
/// </summary>
public bool enable { get { return m_Enable; } set { m_Enable = value; } }
/// <summary>
/// The type of animation.
/// 动画类型。
/// |动画类型。
/// </summary>
public AnimationType type { get { return m_Type; } set { m_Type = value; } }
/// <summary>
/// Easing method used for the first animation.
/// 动画的缓动效果。
/// Easing method used for the first animation.
/// |动画的缓动效果。
/// </summary>
//public Easing easing { get { return m_Easting; } set { m_Easting = value; } }
/// <summary>
/// The milliseconds duration of the fadeIn animation.
/// 设定的渐入动画时长毫秒。如果要设置单个数据项的渐入时长可以用代码定制customFadeInDuration。
/// |设定的渐入动画时长毫秒。如果要设置单个数据项的渐入时长可以用代码定制customFadeInDuration。
/// </summary>
public float fadeInDuration { get { return m_FadeInDuration; } set { m_FadeInDuration = value < 0 ? 0 : value; } }
/// <summary>
/// The milliseconds duration of the fadeOut animation.
/// 设定的渐出动画时长毫秒。如果要设置单个数据项的渐出时长可以用代码定制customFadeOutDuration。
/// |设定的渐出动画时长毫秒。如果要设置单个数据项的渐出时长可以用代码定制customFadeOutDuration。
/// </summary>
public float fadeOutDuration { get { return m_FadeOutDuration; } set { m_FadeOutDuration = value < 0 ? 0 : value; } }
/// <summary>
/// The milliseconds actual duration of the first animation.
/// 实际的动画时长(毫秒)。
/// |实际的动画时长(毫秒)。
/// </summary>
public float actualDuration { get { return m_ActualDuration; } }
/// <summary>
/// Whether to set graphic number threshold to animation. Animation will be disabled when graphic number is larger than threshold.
/// 是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。
/// |是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。
/// </summary>
public int threshold { get { return m_Threshold; } set { m_Threshold = value; } }
/// <summary>
/// The milliseconds delay before updating the first animation.
/// 渐入动画延时毫秒。如果要设置单个数据项的延时可以用代码定制customFadeInDelay。
/// |渐入动画延时毫秒。如果要设置单个数据项的延时可以用代码定制customFadeInDelay。
/// </summary>
public float fadeInDelay { get { return m_FadeInDelay; } set { m_FadeInDelay = value < 0 ? 0 : value; } }
/// <summary>
@@ -131,7 +131,7 @@ namespace XCharts.Runtime
public bool dataChangeEnable { get { return m_DataChangeEnable; } set { m_DataChangeEnable = value; } }
/// <summary>
/// The milliseconds duration of the data change animation.
/// 数据变更的动画时长(毫秒)。
/// |数据变更的动画时长(毫秒)。
/// </summary>
public float dataChangeDuration { get { return m_DataChangeDuration; } set { m_DataChangeDuration = value < 0 ? 0 : value; } }
/// <summary>
@@ -532,18 +532,21 @@ namespace XCharts.Runtime
isEnd = true;
}
}
else if (currHig - destProgress > 0)
else
{
currHig = destProgress;
isEnd = true;
if ((destProgress - startProgress > 0 && currHig > destProgress)
|| (destProgress - startProgress < 0 && currHig < destProgress))
{
currHig = destProgress;
isEnd = true;
}
}
SetDataCurrProgress(dataIndex, currHig);
return currHig;
}
}
internal void CheckSymbol(float dest)
public void CheckSymbol(float dest)
{
if (!enable || m_IsEnd || m_IsPause || !m_IsInit)
return;

View File

@@ -18,7 +18,7 @@ namespace XCharts.Runtime
return destProgress;
}
var isDataAnimationEnd = true;
float currHig = serie.animation.CheckItemProgress(dataIndex, destProgress, ref isDataAnimationEnd, startPorgress);
var currHig = serie.animation.CheckItemProgress(dataIndex, destProgress, ref isDataAnimationEnd, startPorgress);
if (!isDataAnimationEnd)
{
serie.animation.context.isAllItemAnimationEnd = false;

View File

@@ -6,17 +6,18 @@ namespace XCharts.Runtime
{
/// <summary>
/// Angle axis of Polar Coordinate.
/// 极坐标系的角度轴。
/// |极坐标系的角度轴。
/// </summary>
[System.Serializable]
[RequireChartComponent(typeof(PolarCoord))]
[ComponentHandler(typeof(AngleAxisHandler), true)]
public class AngleAxis : Axis
{
[SerializeField] private float m_StartAngle = 0;
/// <summary>
/// Starting angle of axis. 0 degrees by default, standing for right position of center.
/// 起始刻度的角度,默认为 0 度,即圆心的正右方。
/// Starting angle of axis. 0 degrees by default, standing for right position of center.
/// |起始刻度的角度,默认为 0 度,即圆心的正右方。
/// </summary>
public float startAngle
{

View File

@@ -86,14 +86,14 @@ namespace XCharts.Runtime
bool inside = axis.axisLabel.inside;
var labelName = AxisHelper.GetLabelName(axis, total, i, axis.context.minValue, axis.context.maxValue,
null, isPercentStack);
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(scaleAngle, txtHig), axis,
chart.theme.axis, labelName);
label.label.SetAlignment(axis.axisLabel.textStyle.GetAlignment(TextAnchor.MiddleCenter));
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform,
new Vector2(scaleAngle, txtHig), axis,
chart.theme.axis, labelName, Color.clear);
label.text.SetAlignment(axis.axisLabel.textStyle.GetAlignment(TextAnchor.MiddleCenter));
var pos = ChartHelper.GetPos(cenPos, radius + margin,
isCategory ? (totalAngle + scaleAngle / 2) : totalAngle, true);
AxisHelper.AdjustCircleLabelPos(label, pos, cenPos, txtHig, Vector3.zero);
if (i == 0) axis.axisLabel.SetRelatedText(label.label, scaleAngle);
if (i == 0) axis.axisLabel.SetRelatedText(label.text, scaleAngle);
axis.context.labelObjectList.Add(label);
totalAngle += scaleAngle;

View File

@@ -7,64 +7,64 @@ namespace XCharts.Runtime
{
/// <summary>
/// The axis in rectangular coordinate.
/// 直角坐标系的坐标轴组件。
/// |直角坐标系的坐标轴组件。
/// </summary>
[System.Serializable]
public class Axis : MainComponent
{
/// <summary>
/// the type of axis.
/// 坐标轴类型。
/// |坐标轴类型。
/// </summary>
public enum AxisType
{
/// <summary>
/// Numerical axis, suitable for continuous data.
/// 数值轴。适用于连续数据。
/// ||数值轴。适用于连续数据。
/// </summary>
Value,
/// <summary>
/// Category axis, suitable for discrete category data. Data should only be set via data for this type.
/// 类目轴。适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。
/// ||类目轴。适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。
/// </summary>
Category,
/// <summary>
/// Log axis, suitable for log data.
/// 对数轴。适用于对数数据。
/// |对数轴。适用于对数数据。
/// </summary>
Log,
/// <summary>
/// Time axis, suitable for continuous time series data.
/// 时间轴。适用于连续的时序数据。
/// |时间轴。适用于连续的时序数据。
/// </summary>
Time
}
/// <summary>
/// the type of axis min and max value.
/// 坐标轴最大最小刻度显示类型。
/// |坐标轴最大最小刻度显示类型。
/// </summary>
public enum AxisMinMaxType
{
/// <summary>
/// 0 - maximum.
/// 0-最大值。
/// |0-最大值。
/// </summary>
Default,
/// <summary>
/// minimum - maximum.
/// 最小值-最大值。
/// |最小值-最大值。
/// </summary>
MinMax,
/// <summary>
/// Customize the minimum and maximum.
/// 自定义最小值最大值。
/// |自定义最小值最大值。
/// </summary>
Custom
}
/// <summary>
/// the position of axis in grid.
/// 坐标轴在Grid中的位置
/// |坐标轴在Grid中的位置
/// </summary>
public enum AxisPosition
{
@@ -82,10 +82,10 @@ namespace XCharts.Runtime
[SerializeField] protected int m_ParallelIndex;
[SerializeField] protected AxisPosition m_Position;
[SerializeField] protected float m_Offset;
[SerializeField] protected float m_Min;
[SerializeField] protected float m_Max;
[SerializeField] protected double m_Min;
[SerializeField] protected double m_Max;
[SerializeField] protected int m_SplitNumber = 0;
[SerializeField] protected float m_Interval = 0;
[SerializeField] protected double m_Interval = 0;
[SerializeField] protected bool m_BoundaryGap = true;
[SerializeField] protected int m_MaxCache = 0;
[SerializeField] protected float m_LogBase = 10;
@@ -94,7 +94,6 @@ namespace XCharts.Runtime
[SerializeField] protected bool m_Inverse = false;
[SerializeField] private bool m_Clockwise = true;
[SerializeField] private bool m_InsertDataToHead;
[SerializeField] private IconStyle m_IconStyle = new IconStyle();
[SerializeField] protected List<Sprite> m_Icons = new List<Sprite>();
[SerializeField] protected List<string> m_Data = new List<string>();
[SerializeField] protected AxisLine m_AxisLine = AxisLine.defaultAxisLine;
@@ -108,7 +107,7 @@ namespace XCharts.Runtime
/// <summary>
/// Whether to show axis.
/// 是否显示坐标轴。
/// |是否显示坐标轴。
/// </summary>
public bool show
{
@@ -116,8 +115,8 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetAllDirty(); }
}
/// <summary>
/// the type of axis.
/// 坐标轴类型。
/// the type of axis.
/// |坐标轴类型。
/// </summary>
public AxisType type
{
@@ -126,7 +125,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the type of axis minmax.
/// 坐标轴刻度最大最小值显示类型。
/// |坐标轴刻度最大最小值显示类型。
/// </summary>
public AxisMinMaxType minMaxType
{
@@ -135,7 +134,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The index of the grid on which the axis are located, by default, is in the first grid.
/// 坐标轴所在的 grid 的索引,默认位于第一个 grid。
/// |坐标轴所在的 grid 的索引,默认位于第一个 grid。
/// </summary>
public int gridIndex
{
@@ -144,7 +143,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The index of the polar on which the axis are located, by default, is in the first polar.
/// 坐标轴所在的 ploar 的索引,默认位于第一个 polar。
/// |坐标轴所在的 ploar 的索引,默认位于第一个 polar。
/// </summary>
public int polarIndex
{
@@ -153,7 +152,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The index of the parallel on which the axis are located, by default, is in the first parallel.
/// 坐标轴所在的 parallel 的索引,默认位于第一个 parallel。
/// |坐标轴所在的 parallel 的索引,默认位于第一个 parallel。
/// </summary>
public int parallelIndex
{
@@ -162,7 +161,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the position of axis in grid.
/// 坐标轴在Grid中的位置。
/// |坐标轴在Grid中的位置。
/// </summary>
public AxisPosition position
{
@@ -171,7 +170,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the offset of axis from the default position. Useful when the same position has multiple axes.
/// 坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
/// |坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
/// </summary>
public float offset
{
@@ -180,25 +179,25 @@ namespace XCharts.Runtime
}
/// <summary>
/// The minimun value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最小值当minMaxType为Custom时有效。
/// |设定的坐标轴刻度最小值当minMaxType为Custom时有效。
/// </summary>
public float min
public double min
{
get { return m_Min; }
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetAllDirty(); }
}
/// <summary>
/// The maximum value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最大值当minMaxType为Custom时有效。
/// |设定的坐标轴刻度最大值当minMaxType为Custom时有效。
/// </summary>
public float max
public double max
{
get { return m_Max; }
set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetAllDirty(); }
}
/// <summary>
/// Number of segments that the axis is split into.
/// 坐标轴的期望的分割段数。默认为0表示自动分割。
/// |坐标轴的期望的分割段数。默认为0表示自动分割。
/// </summary>
public int splitNumber
{
@@ -207,16 +206,16 @@ namespace XCharts.Runtime
}
/// <summary>
/// Compulsively set segmentation interval for axis.This is unavailable for category axis.
/// 强制设置坐标轴分割间隔。无法在类目轴中使用。
/// |强制设置坐标轴分割间隔。无法在类目轴中使用。
/// </summary>
public float interval
public double interval
{
get { return m_Interval; }
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetAllDirty(); }
}
/// <summary>
/// The boundary gap on both sides of a coordinate axis, which is valid only for category axis with type: 'Category'.
/// 坐标轴两边是否留白。只对类目轴有效。
/// The boundary gap on both sides of a coordinate axis, which is valid only for category axis with type: 'Category'.
/// |坐标轴两边是否留白。只对类目轴有效。
/// </summary>
public bool boundaryGap
{
@@ -225,7 +224,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Base of logarithm, which is valid only for numeric axes with type: 'Log'.
/// 对数轴的底数只在对数轴type:'Log')中有效。
/// |对数轴的底数只在对数轴type:'Log')中有效。
/// </summary>
public float logBase
{
@@ -238,7 +237,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// On the log axis, if base e is the natural number, and is true, logBase fails.
/// 对数轴是否以自然数 e 为底数,为 true 时 logBase 失效。
/// |对数轴是否以自然数 e 为底数,为 true 时 logBase 失效。
/// </summary>
public bool logBaseE
{
@@ -247,8 +246,8 @@ namespace XCharts.Runtime
}
/// <summary>
/// The max number of axis data cache.
/// The first data will be remove when the size of axis data is larger then maxCache.
/// 可缓存的最大数据量。默认为0没有限制大于0时超过指定值会移除旧数据再插入新数据。
/// |The first data will be remove when the size of axis data is larger then maxCache.
/// |可缓存的最大数据量。默认为0没有限制大于0时超过指定值会移除旧数据再插入新数据。
/// </summary>
public int maxCache
{
@@ -257,7 +256,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
/// 最大最小值向上取整的倍率。默认为0时自动计算。
/// |最大最小值向上取整的倍率。默认为0时自动计算。
/// </summary>
public int ceilRate
{
@@ -266,7 +265,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Whether the axis are reversed or not. Invalid in `Category` axis.
/// 是否反向坐标轴。在类目轴中无效。
/// |是否反向坐标轴。在类目轴中无效。
/// </summary>
public bool inverse
{
@@ -275,7 +274,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Whether the positive position of axis is in clockwise. True for clockwise by default.
/// 刻度增长是否按顺时针,默认顺时针。
/// |刻度增长是否按顺时针,默认顺时针。
/// </summary>
public bool clockwise
{
@@ -284,7 +283,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Category data, available in type: 'Category' axis.
/// 类目数据在类目轴type: 'category')中有效。
/// |类目数据在类目轴type: 'category')中有效。
/// </summary>
public List<string> data
{
@@ -301,7 +300,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// axis Line.
/// 坐标轴轴线。
/// |坐标轴轴线。
/// /// </summary>
public AxisLine axisLine
{
@@ -310,7 +309,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// axis name.
/// 坐标轴名称。
/// |坐标轴名称。
/// </summary>
public AxisName axisName
{
@@ -319,7 +318,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// axis tick.
/// 坐标轴刻度。
/// |坐标轴刻度。
/// </summary>
public AxisTick axisTick
{
@@ -328,7 +327,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// axis label.
/// 坐标轴刻度标签。
/// |坐标轴刻度标签。
/// </summary>
public AxisLabel axisLabel
{
@@ -337,7 +336,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// axis split line.
/// 坐标轴分割线。
/// |坐标轴分割线。
/// </summary>
public AxisSplitLine splitLine
{
@@ -346,7 +345,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// axis split area.
/// 坐标轴分割区域。
/// |坐标轴分割区域。
/// </summary>
public AxisSplitArea splitArea
{
@@ -355,21 +354,13 @@ namespace XCharts.Runtime
}
/// <summary>
/// Whether to add new data at the head or at the end of the list.
/// 添加新数据时是在列表的头部还是尾部加入。
/// |添加新数据时是在列表的头部还是尾部加入。
/// </summary>
public bool insertDataToHead
{
get { return m_InsertDataToHead; }
set { if (PropertyUtil.SetStruct(ref m_InsertDataToHead, value)) SetAllDirty(); }
}
/// <summary>
/// 图标样式。
/// </summary>
public IconStyle iconStyle
{
get { return m_IconStyle; }
set { if (PropertyUtil.SetClass(ref m_IconStyle, value)) SetAllDirty(); }
}
public override bool vertsDirty
{
@@ -432,7 +423,6 @@ namespace XCharts.Runtime
axis.logBaseE = logBaseE;
axis.ceilRate = ceilRate;
axis.insertDataToHead = insertDataToHead;
axis.iconStyle = iconStyle.Clone();
axis.axisLine = axisLine.Clone();
axis.axisName = axisName.Clone();
axis.axisTick = axisTick.Clone();
@@ -461,7 +451,6 @@ namespace XCharts.Runtime
logBaseE = axis.logBaseE;
ceilRate = axis.ceilRate;
insertDataToHead = axis.insertDataToHead;
iconStyle.Copy(axis.iconStyle);
axisLine.Copy(axis.axisLine);
axisName.Copy(axis.axisName);
axisTick.Copy(axis.axisTick);

View File

@@ -7,43 +7,45 @@ namespace XCharts.Runtime
{
public class AxisContext : MainComponentContext
{
internal Orient orient { get; set; }
public float x { get; internal set; }
public float y { get; internal set; }
public float width { get; internal set; }
public float height { get; internal set; }
public Vector3 position { get; internal set; }
public float left { get; internal set; }
public float right { get; internal set; }
public float bottom { get; internal set; }
public float top { get; internal set; }
public Orient orient;
public float x;
public float y;
public float zeroX;
public float zeroY;
public float width;
public float height;
public Vector3 position;
public float left;
public float right;
public float bottom;
public float top;
/// <summary>
/// the current minimun value.
/// 当前最小值。
/// |当前最小值。
/// </summary>
public double minValue { get; internal set; }
public double minValue;
/// <summary>
/// the current maximum value.
/// 当前最大值。
/// |当前最大值。
/// </summary>
public double maxValue { get; internal set; }
public double maxValue;
/// <summary>
/// the offset of zero position.
/// 坐标轴原点在坐标轴的偏移。
/// |坐标轴原点在坐标轴的偏移。
/// </summary>
public float offset { get; internal set; }
public double minMaxRange { get; internal set; }
public float scaleWidth { get; internal set; }
public float startAngle { get; set; }
public double pointerValue { get; internal set; }
public Vector3 pointerLabelPosition { get; internal set; }
public double axisTooltipValue { get; internal set; }
public float offset;
public double minMaxRange;
public float scaleWidth;
public float startAngle;
public double pointerValue;
public Vector3 pointerLabelPosition;
public double axisTooltipValue;
public List<string> runtimeData { get { return m_RuntimeData; } }
public List<double> labelValueList { get { return m_LabelValueList; } }
public List<ChartLabel> labelObjectList { get { return m_AxisLabelList; } }
internal List<string> filterData;
internal bool lastCheckInverse { get; set; }
internal bool lastCheckInverse;
internal bool isNeedUpdateFilterData;
private int filterStart;
@@ -104,7 +106,12 @@ namespace XCharts.Runtime
else
range = dataZoom.minShowNum;
}
filterData = data.GetRange(start, range);
if (range > data.Count - start - 1)
start = data.Count - range - 1;
if (start >= 0)
filterData = data.GetRange(start, range);
else
filterData = data;
}
else
{

View File

@@ -34,7 +34,7 @@ namespace XCharts
return;
if (!grid.context.isPointerEnter)
{
axis.context.pointerValue = 0;
axis.context.pointerValue = double.PositiveInfinity;
}
else
{
@@ -166,6 +166,10 @@ namespace XCharts
: (float)(Math.Abs(axis.context.minValue) * (grid.context.width
/ (Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
);
axis.context.x = grid.context.x;
axis.context.y = grid.context.y;
axis.context.zeroY = grid.context.y;
axis.context.zeroX = grid.context.x - (float)(axis.context.minValue * grid.context.width / axis.context.minMaxRange);
}
if (grid != null && axis is YAxis && axis.IsValue())
{
@@ -176,6 +180,10 @@ namespace XCharts
: (float)(Math.Abs(axis.context.minValue) * (grid.context.height
/ (Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
);
axis.context.x = grid.context.x;
axis.context.y = grid.context.y;
axis.context.zeroX = grid.context.x;
axis.context.zeroY = grid.context.y - (float)(axis.context.minValue * grid.context.height / axis.context.minMaxRange);
}
}
var dataZoom = chart.GetDataZoomOfAxis(axis);
@@ -296,12 +304,12 @@ namespace XCharts
if (i == 0)
{
var dist = GetLabelPosition(0, 1).x - pos.x;
label.SetLabelActive(dist > label.label.GetPreferredWidth());
label.SetTextActive(dist > label.text.GetPreferredWidth());
}
else if (i == axis.context.labelValueList.Count - 1)
{
var dist = pos.x - GetLabelPosition(0, i - 1).x;
label.SetLabelActive(dist > label.label.GetPreferredWidth());
label.SetTextActive(dist > label.text.GetPreferredWidth());
}
}
else
@@ -309,12 +317,12 @@ namespace XCharts
if (i == 0)
{
var dist = GetLabelPosition(0, 1).y - pos.y;
label.SetLabelActive(dist > label.label.GetPreferredHeight());
label.SetTextActive(dist > label.text.GetPreferredHeight());
}
else if (i == axis.context.labelValueList.Count - 1)
{
var dist = pos.y - GetLabelPosition(0, i - 1).y;
label.SetLabelActive(dist > label.label.GetPreferredHeight());
label.SetTextActive(dist > label.text.GetPreferredHeight());
}
}
}
@@ -361,82 +369,36 @@ namespace XCharts
? axis.axisLabel.height
: 20f;
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
var inside = axis.axisLabel.inside;
var defaultAlignment = orient == Orient.Horizonal ? TextAnchor.MiddleCenter :
((inside && axis.IsLeft()) || (!inside && axis.IsRight())
? TextAnchor.MiddleLeft
: TextAnchor.MiddleRight);
if (axis.IsCategory() && axis.boundaryGap)
{
splitNumber -= 1;
}
for (int i = 0; i < splitNumber; i++)
{
ChartLabel label;
var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
var inside = axis.axisLabel.inside;
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
var labelName = AxisHelper.GetLabelName(axis, axisLength, i,
axis.context.minValue,
axis.context.maxValue,
dataZoom, isPercentStack);
if (orient == Orient.Horizonal)
{
label = ChartHelper.AddAxisLabelObject(splitNumber, i,
ChartCached.GetAxisLabelName(i),
axisObj.transform,
new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new Vector2(textWidth, textHeight),
axis, chart.theme.axis, labelName);
}
else
{
if ((inside && axis.IsLeft()) || (!inside && axis.IsRight()))
{
label = ChartHelper.AddAxisLabelObject(splitNumber, i,
ChartCached.GetAxisLabelName(i),
axisObj.transform,
Vector2.zero,
Vector2.zero,
new Vector2(0, 0.5f),
new Vector2(textWidth, textHeight),
axis, chart.theme.axis, labelName);
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleLeft));
}
else
{
label = ChartHelper.AddAxisLabelObject(splitNumber, i,
ChartCached.GetAxisLabelName(i),
axisObj.transform,
Vector2.zero,
Vector2.zero,
new Vector2(1, 0.5f),
new Vector2(textWidth, textHeight),
axis, chart.theme.axis, labelName);
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleRight));
}
}
var label = ChartHelper.AddAxisLabelObject(splitNumber, i,
ChartCached.GetAxisLabelName(i),
axisObj.transform,
new Vector2(textWidth, textHeight),
axis, chart.theme.axis, labelName,
Color.clear,
defaultAlignment);
if (i == 0)
axis.axisLabel.SetRelatedText(label.label, labelWidth);
axis.axisLabel.SetRelatedText(label.text, labelWidth);
var pos = handler.GetLabelPosition(totalWidth + gapWidth, i);
if (orient == Orient.Horizonal)
{
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
}
else
{
if (axis.IsRight())
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleLeft));
else
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleRight));
}
label.SetPosition(pos);
handler.CheckValueLabelActive(axis, i, label, pos);
@@ -446,59 +408,41 @@ namespace XCharts
}
if (axis.axisName.show)
{
ChartText axisName = null;
var axisNameTextStyle = axis.axisName.textStyle;
var offset = axisNameTextStyle.offset;
ChartLabel label = null;
var relativedDist = (relativedAxis == null ? 0 : relativedAxis.context.offset);
var zeroPos = new Vector3(axisStartX, axisStartY + relativedDist);
var offset = axis.axisName.labelStyle.offset;
var autoColor = axis.axisLine.GetColor(chart.theme.axis.lineColor);
if (orient == Orient.Horizonal)
{
switch (axis.axisName.location)
switch (axis.axisName.labelStyle.position)
{
case AxisName.Location.Start:
case LabelStyle.Position.Start:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform,
new Vector2(1, 0.5f),
new Vector2(1, 0.5f),
new Vector2(1, 0.5f),
new Vector2(100, 20),
axisNameTextStyle, chart.theme.axis);
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleRight));
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Top
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleRight);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.position == Axis.AxisPosition.Top
? new Vector2(zeroPos.x - offset.x, axisStartY + relativedLength + offset.y + axis.offset)
: new Vector2(zeroPos.x - offset.x, zeroPos.y + offset.y + axis.offset));
break;
case AxisName.Location.Middle:
case LabelStyle.Position.Middle:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform,
new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new Vector2(100, 20),
axisNameTextStyle, chart.theme.axis);
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Top
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.position == Axis.AxisPosition.Top
? new Vector2(axisStartX + axisLength / 2 + offset.x, axisStartY + relativedLength - offset.y + axis.offset)
: new Vector2(axisStartX + axisLength / 2 + offset.x, axisStartY - offset.y + axis.offset));
break;
case AxisName.Location.End:
default:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform,
new Vector2(0, 0.5f),
new Vector2(0, 0.5f),
new Vector2(0, 0.5f),
new Vector2(100, 20),
axisNameTextStyle, chart.theme.axis);
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleLeft));
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Top
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleLeft);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.position == Axis.AxisPosition.Top
? new Vector2(axisStartX + axisLength + offset.x, axisStartY + relativedLength + offset.y + axis.offset)
: new Vector2(axisStartX + axisLength + offset.x, zeroPos.y + offset.y + axis.offset));
break;
@@ -506,43 +450,39 @@ namespace XCharts
}
else
{
switch (axis.axisName.location)
switch (axis.axisName.labelStyle.position)
{
case AxisName.Location.Start:
case LabelStyle.Position.Start:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), axisNameTextStyle,
chart.theme.axis);
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Right ?
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.position == Axis.AxisPosition.Right ?
new Vector2(axisStartX + relativedLength + offset.x + axis.offset, axisStartY - offset.y) :
new Vector2(zeroPos.x + offset.x + axis.offset, axisStartY - offset.y));
break;
case AxisName.Location.Middle:
case LabelStyle.Position.Middle:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(1, 0.5f),
new Vector2(1, 0.5f), new Vector2(1, 0.5f), new Vector2(100, 20), axisNameTextStyle,
chart.theme.axis);
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleRight));
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Right ?
new Vector2(axisStartX + relativedLength - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y) :
new Vector2(axisStartX - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y));
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.position == Axis.AxisPosition.Right ?
new Vector2(axisStartX + relativedLength - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y) :
new Vector2(axisStartX - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y));
break;
case AxisName.Location.End:
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), axisNameTextStyle,
chart.theme.axis);
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Right ?
default:
//LabelStyle.Position
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.position == Axis.AxisPosition.Right ?
new Vector2(axisStartX + relativedLength + offset.x + axis.offset, axisStartY + axisLength + offset.y) :
new Vector2(zeroPos.x + offset.x + axis.offset, axisStartY + axisLength + offset.y));
break;
}
}
axisName.SetText(axis.axisName.name);
}
}
@@ -573,7 +513,7 @@ namespace XCharts
else
current += axisStartY - axis.axisLabel.distance - fontSize / 2;
return new Vector3(axisStartX + scaleWid, current) + axis.axisLabel.textStyle.offsetv3;
return new Vector3(axisStartX + scaleWid, current);
}
else
{
@@ -588,7 +528,7 @@ namespace XCharts
else
current += axisStartX - axis.axisLabel.distance;
return new Vector3(current, axisStartY + scaleWid) + axis.axisLabel.textStyle.offsetv3;
return new Vector3(current, axisStartY + scaleWid);
}
}

View File

@@ -403,33 +403,11 @@ namespace XCharts.Runtime
return true;
}
public static void AdjustCircleLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
{
var txtWidth = txt.GetPreferredWidth();
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
txt.SetSizeDelta(sizeDelta);
var diff = pos.x - cenPos.x;
if (diff < -1f) //left
{
pos = new Vector3(pos.x - txtWidth / 2, pos.y);
}
else if (diff > 1f) //right
{
pos = new Vector3(pos.x + txtWidth / 2, pos.y);
}
else
{
float y = pos.y > cenPos.y ? pos.y + txtHig / 2 : pos.y - txtHig / 2;
pos = new Vector3(pos.x, y);
}
txt.SetLocalPosition(pos + offset);
}
public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
{
var txtWidth = txt.label.GetPreferredWidth();
var sizeDelta = new Vector2(txtWidth, txt.label.GetPreferredHeight());
txt.label.SetSizeDelta(sizeDelta);
var txtWidth = txt.text.GetPreferredWidth();
var sizeDelta = new Vector2(txtWidth, txt.text.GetPreferredHeight());
txt.text.SetSizeDelta(sizeDelta);
var diff = pos.x - cenPos.x;
if (diff < -1f) //left
{
@@ -447,11 +425,11 @@ namespace XCharts.Runtime
txt.SetPosition(pos + offset);
}
public static void AdjustRadiusAxisLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
{
var txtWidth = txt.GetPreferredWidth();
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
txt.SetSizeDelta(sizeDelta);
var txtWidth = txt.text.GetPreferredWidth();
var sizeDelta = new Vector2(txtWidth, txt.text.GetPreferredHeight());
txt.text.SetSizeDelta(sizeDelta);
var diff = pos.y - cenPos.y;
if (diff > 20f) //left
{
@@ -466,7 +444,7 @@ namespace XCharts.Runtime
float y = pos.y > cenPos.y ? pos.y + txtHig / 2 : pos.y - txtHig / 2;
pos = new Vector3(pos.x, y);
}
txt.SetLocalPosition(pos);
txt.SetPosition(pos);
}
public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)
@@ -490,6 +468,22 @@ namespace XCharts.Runtime
}
}
public static double GetAxisPositionValue(GridCoord grid, Axis axis, Vector3 pos)
{
if (axis is YAxis)
return GetAxisPositionValue(pos.y, grid.context.height, axis.context.minMaxRange, grid.context.y, axis.context.offset);
else if (axis is XAxis)
return GetAxisPositionValue(pos.x, grid.context.width, axis.context.minMaxRange, grid.context.x, axis.context.offset);
else
return 0;
}
public static double GetAxisPositionValue(float xy, float axisLength, double axisRange, float axisStart, float axisOffset)
{
var yRate = axisRange / axisLength;
return yRate * (xy - axisStart - axisOffset);
}
/// <summary>
/// 获得数值value在坐标轴上的坐标位置
/// </summary>
@@ -517,7 +511,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// 获得数值value在坐标轴上对的长度
/// 获得数值value在坐标轴上对的长度
/// </summary>
/// <param name="grid"></param>
/// <param name="axis"></param>
@@ -555,10 +549,10 @@ namespace XCharts.Runtime
var yDataHig = 0f;
if (axis.context.minMaxRange != 0)
{
if (!realLength || (realLength && axis.context.minValue > 0))
yDataHig = (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight);
if (realLength)
yDataHig = (float)(value * gridHeight / axis.context.minMaxRange);
else
yDataHig = (float)(value / axis.context.minMaxRange * gridHeight);
yDataHig = (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight);
}
return includeGridXY
? gridXY + yDataHig

View File

@@ -7,39 +7,22 @@ namespace XCharts.Runtime
{
/// <summary>
/// Settings related to axis label.
/// 坐标轴刻度标签的相关设置。
/// |坐标轴刻度标签的相关设置。
/// </summary>
[Serializable]
public class AxisLabel : ChildComponent
public class AxisLabel : LabelStyle
{
[SerializeField] private bool m_Show = true;
[SerializeField] private string m_Formatter;
[SerializeField] private int m_Interval = 0;
[SerializeField] private bool m_Inside = false;
[SerializeField] private float m_Distance;
[SerializeField] private string m_NumericFormatter = "";
[SerializeField] private bool m_ShowAsPositiveNumber = false;
[SerializeField] private bool m_OnZero = false;
[SerializeField] private float m_Width = 0f;
[SerializeField] private float m_Height = 0f;
[SerializeField] private bool m_ShowStartLabel = true;
[SerializeField] private bool m_ShowEndLabel = true;
[SerializeField] private TextLimit m_TextLimit = new TextLimit();
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
private AxisLabelFormatterFunction m_FormatterFunction;
/// <summary>
/// Set this to false to prevent the axis label from appearing.
/// 是否显示刻度标签。
/// </summary>
public bool show
{
get { return m_Show; }
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
}
/// <summary>
/// The display interval of the axis label.
/// 坐标轴刻度标签的显示间隔在类目轴中有效。0表示显示所有标签1表示隔一个隔显示一个标签以此类推。
/// |坐标轴刻度标签的显示间隔在类目轴中有效。0表示显示所有标签1表示隔一个隔显示一个标签以此类推。
/// </summary>
public int interval
{
@@ -48,48 +31,16 @@ namespace XCharts.Runtime
}
/// <summary>
/// Set this to true so the axis labels face the inside direction.
/// 刻度标签是否朝内,默认朝外。
/// |刻度标签是否朝内,默认朝外。
/// </summary>
public bool inside
{
get { return m_Inside; }
set { if (PropertyUtil.SetStruct(ref m_Inside, value)) SetComponentDirty(); }
}
/// <summary>
/// The distance between the axis label and the axis line.
/// 刻度标签与轴线之间的距离。
/// </summary>
public float distance
{
get { return m_Distance; }
set { if (PropertyUtil.SetStruct(ref m_Distance, value)) SetComponentDirty(); }
}
/// <summary>
/// 图例内容字符串模版格式器。支持用 \n 换行。
/// 模板变量为图例名称 {value}。
/// </summary>
public string formatter
{
get { return m_Formatter; }
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetComponentDirty(); }
}
/// <summary>
/// Standard numeric format strings.
/// 标准数字格式字符串。用于将数值格式化显示为字符串。
/// 使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。
/// 参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings
/// </summary>
/// <value></value>
public string numericFormatter
{
get { return m_NumericFormatter; }
set { if (PropertyUtil.SetClass(ref m_NumericFormatter, value)) SetComponentDirty(); }
}
/// <summary>
/// Show negative number as positive number.
/// 将负数数值显示为正数。一般和`Serie`的`showAsPositiveNumber`配合使用。
/// |将负数数值显示为正数。一般和`Serie`的`showAsPositiveNumber`配合使用。
/// </summary>
public bool showAsPositiveNumber
{
@@ -106,24 +57,8 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetComponentDirty(); }
}
/// <summary>
/// 文本的宽。为0时会自动匹配。
/// </summary>
public float width
{
get { return m_Width; }
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetComponentDirty(); }
}
/// <summary>
/// 文本的高。为0时会自动匹配。
/// </summary>
public float height
{
get { return m_Height; }
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetComponentDirty(); }
}
/// <summary>
/// Whether to display the first label.
/// 是否显示第一个文本。
/// |是否显示第一个文本。
/// </summary>
public bool showStartLabel
{
@@ -132,7 +67,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Whether to display the last label.
/// 是否显示最后一个文本。
/// |是否显示最后一个文本。
/// </summary>
public bool showEndLabel
{
@@ -148,21 +83,6 @@ namespace XCharts.Runtime
set { if (value != null) { m_TextLimit = value; SetComponentDirty(); } }
}
/// <summary>
/// The text style of axis name.
/// 文本样式。
/// </summary>
public TextStyle textStyle
{
get { return m_TextStyle; }
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetComponentDirty(); }
}
public AxisLabelFormatterFunction formatterFunction
{
set { m_FormatterFunction = value; }
}
public override bool componentDirty { get { return m_ComponentDirty || m_TextLimit.componentDirty; } }
public override void ClearComponentDirty()
{
@@ -185,7 +105,7 @@ namespace XCharts.Runtime
}
}
public AxisLabel Clone()
public new AxisLabel Clone()
{
var axisLabel = new AxisLabel();
axisLabel.show = show;

View File

@@ -5,7 +5,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// Settings related to axis line.
/// 坐标轴轴线。
/// |坐标轴轴线。
/// </summary>
[System.Serializable]
public class AxisLine : BaseLine
@@ -16,7 +16,7 @@ namespace XCharts.Runtime
/// <summary>
/// When mutiple axes exists, this option can be used to specify which axis can be "onZero" to.
/// X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上,只有在另一个轴为数值轴且包含 0 刻度时有效。
/// |X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上,只有在另一个轴为数值轴且包含 0 刻度时有效。
/// </summary>
public bool onZero
{
@@ -24,8 +24,8 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether to show the arrow symbol of axis.
/// 是否显示箭头。
/// Whether to show the arrow symbol of axis.
/// |是否显示箭头。
/// </summary>
public bool showArrow
{
@@ -34,7 +34,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the arrow of line.
/// 轴线箭头。
/// |轴线箭头。
/// </summary>
public ArrowStyle arrow
{

View File

@@ -6,30 +6,18 @@ namespace XCharts.Runtime
{
/// <summary>
/// the name of axis.
/// 坐标轴名称。
/// |坐标轴名称。
/// </summary>
[Serializable]
public class AxisName : ChildComponent
{
/// <summary>
/// the location of axis name.
/// 坐标轴名称显示位置。
/// </summary>
public enum Location
{
Start,
Middle,
End
}
[SerializeField] private bool m_Show;
[SerializeField] private string m_Name;
[SerializeField] private string m_Formatter;
[SerializeField] private Location m_Location;
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle();
/// <summary>
/// Whether to show axis name.
/// 是否显示坐标名称。
/// Whether to show axis name.
/// |是否显示坐标名称。
/// </summary>
public bool show
{
@@ -38,53 +26,35 @@ namespace XCharts.Runtime
}
/// <summary>
/// the name of axis.
/// 坐标轴名称。
/// |坐标轴名称。
/// </summary>
public string name
{
get { return m_Name; }
set { if (PropertyUtil.SetClass(ref m_Name, value)) SetComponentDirty(); }
}
/// <summary>
/// The formatter of indicator's name.
/// 指示器名称显示的格式器。可用在雷达图。
/// </summary>
public string formatter
{
get { return m_Formatter; }
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetComponentDirty(); }
}
/// <summary>
/// Location of axis name.
/// 坐标轴名称显示位置。
/// </summary>
public Location location
{
get { return m_Location; }
set { if (PropertyUtil.SetStruct(ref m_Location, value)) SetComponentDirty(); }
}
/// <summary>
/// The text style of axis name.
/// 文本样式。
/// |文本样式。
/// </summary>
public TextStyle textStyle
public LabelStyle labelStyle
{
get { return m_TextStyle; }
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetComponentDirty(); }
get { return m_LabelStyle; }
set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
}
public static AxisName defaultAxisName
{
get
{
return new AxisName()
var axisName = new AxisName()
{
m_Show = false,
m_Name = "axisName",
m_Location = Location.End,
m_TextStyle = new TextStyle(),
m_LabelStyle = new LabelStyle()
};
axisName.labelStyle.position = LabelStyle.Position.End;
return axisName;
}
}
@@ -93,8 +63,7 @@ namespace XCharts.Runtime
var axisName = new AxisName();
axisName.show = show;
axisName.name = name;
axisName.location = location;
axisName.textStyle.Copy(textStyle);
axisName.m_LabelStyle.Copy(m_LabelStyle);
return axisName;
}
@@ -102,8 +71,7 @@ namespace XCharts.Runtime
{
show = axisName.show;
name = axisName.name;
location = axisName.location;
textStyle.Copy(axisName.textStyle);
m_LabelStyle.Copy(axisName.labelStyle);
}
}
}

View File

@@ -7,7 +7,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// Split area of axis in grid area, not shown by default.
/// 坐标轴在 grid 区域中的分隔区域,默认不显示。
/// |坐标轴在 grid 区域中的分隔区域,默认不显示。
/// </summary>
[Serializable]
public class AxisSplitArea : ChildComponent
@@ -17,7 +17,7 @@ namespace XCharts.Runtime
/// <summary>
/// Set this to true to show the splitArea.
/// 是否显示分隔区域。
/// |是否显示分隔区域。
/// </summary>
public bool show
{
@@ -26,9 +26,9 @@ namespace XCharts.Runtime
}
/// <summary>
/// Color of split area. SplitArea color could also be set in color array,
/// which the split lines would take as their colors in turns.
/// Dark and light colors in turns are used by default.
/// 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
/// which the split lines would take as their colors in turns.
/// |Dark and light colors in turns are used by default.
/// |分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
/// </summary>
public List<Color32> color
{

View File

@@ -6,7 +6,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// Split line of axis in grid area.
/// 坐标轴在 grid 区域中的分隔线。
/// |坐标轴在 grid 区域中的分隔线。
/// </summary>
[Serializable]
public class AxisSplitLine : BaseLine
@@ -17,7 +17,7 @@ namespace XCharts.Runtime
/// <summary>
/// The distance between the split line and axis line.
/// 刻度线与轴线的距离。
/// |刻度线与轴线的距离。
/// </summary>
public float distance { get { return m_Distance; } set { m_Distance = value; } }
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }

View File

@@ -6,7 +6,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// Settings related to axis tick.
/// 坐标轴刻度相关设置。
/// |坐标轴刻度相关设置。
/// </summary>
[System.Serializable]
public class AxisTick : BaseLine
@@ -21,13 +21,13 @@ namespace XCharts.Runtime
/// <summary>
/// The distance between the tick line and axis line.
/// 刻度线与轴线的距离。
/// |刻度线与轴线的距离。
/// </summary>
public float distance { get { return m_Distance; } set { m_Distance = value; } }
/// <summary>
/// Align axis tick with label, which is available only when boundaryGap is set to be true in category axis.
/// 类目轴中在 boundaryGap 为 true 的时候有效,可以保证刻度线和标签对齐。
/// |类目轴中在 boundaryGap 为 true 的时候有效,可以保证刻度线和标签对齐。
/// </summary>
public bool alignWithLabel
{
@@ -36,7 +36,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Set this to true so the axis labels face the inside direction.
/// 坐标轴刻度是否朝内,默认朝外。
/// |坐标轴刻度是否朝内,默认朝外。
/// </summary>
public bool inside
{
@@ -45,7 +45,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Whether to display the first tick.
/// 是否显示第一个刻度。
/// |是否显示第一个刻度。
/// </summary>
public bool showStartTick
{
@@ -54,7 +54,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Whether to display the last tick.
/// 是否显示最后一个刻度。
/// |是否显示最后一个刻度。
/// </summary>
public bool showEndTick
{
@@ -63,7 +63,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Number of segments that the axis is split into.
/// 分隔线之间分割的刻度数。
/// |分隔线之间分割的刻度数。
/// </summary>
public int splitNumber
{

View File

@@ -24,7 +24,6 @@ namespace XCharts.Runtime
splitLine.show = false;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = true;
iconStyle.show = false;
}

View File

@@ -5,9 +5,10 @@ namespace XCharts.Runtime
{
/// <summary>
/// Radial axis of polar coordinate.
/// 极坐标系的径向轴。
/// |极坐标系的径向轴。
/// </summary>
[System.Serializable]
[RequireChartComponent(typeof(PolarCoord))]
[ComponentHandler(typeof(RadiusAxisHandler), true)]
public class RadiusAxis : Axis
{

View File

@@ -36,12 +36,11 @@ namespace XCharts.Runtime
axis.context.pointerValue = double.PositiveInfinity;
return;
}
var angleAxis = ComponentHelper.GetAngleAxis(chart.components, polar.index);
if (angleAxis == null)
return;
var startAngle = angleAxis.context.startAngle;
var dist = Vector3.Distance(chart.pointerPos, polar.context.center);
axis.context.pointerValue = axis.context.minValue + (dist / polar.context.radius) * axis.context.minMaxRange;
axis.context.pointerLabelPosition = GetLabelPosition(polar, axis, angleAxis.context.startAngle, dist);
@@ -110,18 +109,17 @@ namespace XCharts.Runtime
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
var labelName = AxisHelper.GetLabelName(axis, radius, i, axis.context.minValue, axis.context.maxValue,
null, isPercentStack);
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(labelWidth, txtHig), axis, chart.theme.axis,
labelName);
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform,
new Vector2(labelWidth, txtHig), axis, chart.theme.axis, labelName, Color.clear);
if (i == 0)
axis.axisLabel.SetRelatedText(label.label, labelWidth);
axis.axisLabel.SetRelatedText(label.text, labelWidth);
label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
label.text.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
label.SetText(labelName);
label.SetPosition(GetLabelPosition(polar, axis, angleAxis.context.startAngle, totalWidth));
label.SetActive(true);
label.SetLabelActive(true);
label.SetTextActive(true);
axis.context.labelObjectList.Add(label);

View File

@@ -6,7 +6,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// Single axis.
/// 单轴。
/// |单轴。
/// </summary>
[System.Serializable]
[ComponentHandler(typeof(SingleAxisHander), true)]
@@ -22,7 +22,7 @@ namespace XCharts.Runtime
/// <summary>
/// Orientation of the axis. By default, it's 'Horizontal'. You can set it to be 'Vertical' to make a vertical axis.
/// 坐标轴朝向。默认为水平朝向。
/// |坐标轴朝向。默认为水平朝向。
/// </summary>
public Orient orient
{
@@ -31,7 +31,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Distance between component and the left side of the container.
/// 组件离容器左侧的距离。
/// |组件离容器左侧的距离。
/// </summary>
public float left
{
@@ -40,7 +40,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Distance between component and the right side of the container.
/// 组件离容器右侧的距离。
/// |组件离容器右侧的距离。
/// </summary>
public float right
{
@@ -49,7 +49,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Distance between component and the top side of the container.
/// 组件离容器上侧的距离。
/// |组件离容器上侧的距离。
/// </summary>
public float top
{
@@ -58,7 +58,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Distance between component and the bottom side of the container.
/// 组件离容器下侧的距离。
/// |组件离容器下侧的距离。
/// </summary>
public float bottom
{
@@ -140,7 +140,6 @@ namespace XCharts.Runtime
axisLabel.textLimit.enable = true;
axisTick.showStartTick = true;
axisTick.showEndTick = true;
iconStyle.show = false;
}
}
}

View File

@@ -6,7 +6,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// <para>直角坐标系 grid 中的 x 轴。</para>
/// |直角坐标系 grid 中的 x 轴。
/// </summary>
[System.Serializable]
[RequireChartComponent(typeof(GridCoord))]
@@ -28,7 +28,6 @@ namespace XCharts.Runtime
splitLine.show = false;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = true;
iconStyle.show = false;
}
}
}

View File

@@ -5,9 +5,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// <para>
/// 直角坐标系 grid 中的 y 轴。
/// </para>
/// |直角坐标系 grid 中的 y 轴。
/// </summary>
[System.Serializable]
[RequireChartComponent(typeof(GridCoord), typeof(XAxis))]
@@ -28,7 +26,6 @@ namespace XCharts.Runtime
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = false;
axisTick.showStartTick = true;
iconStyle.show = false;
}
}
}

View File

@@ -7,7 +7,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// Background component.
///
/// |
/// 背景组件。
/// </summary>
[Serializable]
@@ -22,8 +22,8 @@ namespace XCharts.Runtime
[SerializeField] private bool m_HideThemeBackgroundColor = true;
/// <summary>
/// Whether to enable the background component.
/// 是否启用背景组件。
/// Whether to enable the background component.
/// |是否启用背景组件。
/// </summary>
public bool show
{
@@ -32,7 +32,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the image of background.
/// 背景图。
/// |背景图。
/// </summary>
public Sprite image
{
@@ -42,7 +42,7 @@ namespace XCharts.Runtime
/// <summary>
/// the fill type of background image.
/// 背景图填充类型。
/// |背景图填充类型。
/// </summary>
public Image.Type imageType
{
@@ -61,7 +61,7 @@ namespace XCharts.Runtime
/// <summary>
/// Whether to hide the background color set in the theme when the background component is on.
/// 当background组件开启时是否隐藏主题中设置的背景色。
/// |当background组件开启时是否隐藏主题中设置的背景色。
/// </summary>
public bool hideThemeBackgroundColor
{
@@ -71,7 +71,7 @@ namespace XCharts.Runtime
public override void SetDefaultValue()
{
m_Show = false;
m_Show = true;
m_Image = null;
m_ImageType = Image.Type.Sliced;
m_ImageColor = Color.white;

View File

@@ -33,32 +33,6 @@ namespace XCharts.Runtime
component.refreshComponent();
}
//protected void DrawBackground(VertexHelper vh)
//{
//TODO: CooridateChart
// if (SeriesHelper.IsAnyClipSerie(m_Series))
// {
// var xLineDiff = xAxis0.axisLine.GetWidth(m_Theme.axis.lineWidth);
// var yLineDiff = yAxis0.axisLine.GetWidth(m_Theme.axis.lineWidth);
// var xSplitDiff = xAxis0.splitLine.GetWidth(m_Theme.axis.splitLineWidth);
// var ySplitDiff = yAxis0.splitLine.GetWidth(m_Theme.axis.splitLineWidth);
// foreach (var grid in m_Grids)
// {
// var cpty = grid.context.runtimeY + grid.context.runtimeHeight + ySplitDiff;
// var cp1 = new Vector3(grid.context.runtimeX - yLineDiff, grid.context.runtimeY - xLineDiff);
// var cp2 = new Vector3(grid.context.runtimeX - yLineDiff, cpty);
// var cp3 = new Vector3(grid.context.runtimeX + grid.context.runtimeWidth + xSplitDiff, cpty);
// var cp4 = new Vector3(grid.context.runtimeX + grid.context.runtimeWidth + xSplitDiff, grid.context.runtimeY - xLineDiff);
// var backgroundColor = ThemeHelper.GetBackgroundColor(m_Theme, m_Background);
// UGL.DrawQuadrilateral(vh, cp1, cp2, cp3, cp4, backgroundColor);
// }
// }
// else
// {
// base.DrawBackground(vh);
// }
// }
public override void DrawBase(VertexHelper vh)
{
if (!component.show)

View File

@@ -6,30 +6,30 @@ namespace XCharts.Runtime
{
/// <summary>
/// The style of area.
/// 区域填充样式。
/// |区域填充样式。
/// </summary>
[System.Serializable]
public class AreaStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
{
/// <summary>
/// Origin position of area.
/// 图形区域的起始位置。默认情况下,图形会从坐标轴轴线到数据间进行填充。如果需要填充的区域是坐标轴最大值到数据间,或者坐标轴最小值到数据间,则可以通过这个配置项进行设置。
/// |图形区域的起始位置。默认情况下,图形会从坐标轴轴线到数据间进行填充。如果需要填充的区域是坐标轴最大值到数据间,或者坐标轴最小值到数据间,则可以通过这个配置项进行设置。
/// </summary>
public enum AreaOrigin
{
/// <summary>
/// to fill between axis line to data.
/// 填充坐标轴轴线到数据间的区域。
/// |填充坐标轴轴线到数据间的区域。
/// </summary>
Auto,
/// <summary>
/// to fill between min axis value (when not inverse) to data.
/// 填充坐标轴底部到数据间的区域。
/// |填充坐标轴底部到数据间的区域。
/// </summary>
Start,
/// <summary>
/// to fill between max axis value (when not inverse) to data.
/// 填充坐标轴顶部到数据间的区域。
/// |填充坐标轴顶部到数据间的区域。
/// </summary>
End
}
@@ -43,7 +43,7 @@ namespace XCharts.Runtime
/// <summary>
/// Set this to false to prevent the areafrom showing.
/// 是否显示区域填充。
/// |是否显示区域填充。
/// </summary>
public bool show
{
@@ -52,7 +52,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the origin of area.
/// 区域填充的起始位置。
/// |区域填充的起始位置。
/// </summary>
public AreaOrigin origin
{
@@ -61,7 +61,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the color of area,default use serie color.
/// 区域填充的颜色如果toColor不是默认值则表示渐变色的起点颜色。
/// |区域填充的颜色如果toColor不是默认值则表示渐变色的起点颜色。
/// </summary>
public Color32 color
{
@@ -70,7 +70,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Gradient color, start color to toColor.
/// 渐变色的终点颜色。
/// |渐变色的终点颜色。
/// </summary>
public Color32 toColor
{
@@ -79,7 +79,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0.
/// 图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
/// |图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
/// </summary>
public float opacity
{
@@ -88,7 +88,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// the color of area,default use serie color.
/// 高亮时区域填充的颜色如果highlightToColor不是默认值则表示渐变色的起点颜色。
/// |高亮时区域填充的颜色如果highlightToColor不是默认值则表示渐变色的起点颜色。
/// </summary>
public Color32 highlightColor
{
@@ -97,7 +97,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Gradient color, start highlightColor to highlightToColor.
/// 高亮时渐变色的终点颜色。
/// |高亮时渐变色的终点颜色。
/// </summary>
public Color32 highlightToColor
{

View File

@@ -17,7 +17,7 @@ namespace XCharts.Runtime
/// <summary>
/// The widht of arrow.
/// 箭头宽。
/// |箭头宽。
/// </summary>
public float width
{
@@ -26,7 +26,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The height of arrow.
/// 箭头高。
/// |箭头高。
/// </summary>
public float height
{
@@ -35,7 +35,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The offset of arrow.
/// 箭头偏移。
/// |箭头偏移。
/// </summary>
public float offset
{
@@ -44,7 +44,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The dent of arrow.
/// 箭头的凹度。
/// |箭头的凹度。
/// </summary>
public float dent
{
@@ -54,7 +54,7 @@ namespace XCharts.Runtime
/// <summary>
/// the color of arrow.
/// 箭头颜色。
/// |箭头颜色。
/// </summary>
public Color32 color
{

View File

@@ -5,7 +5,7 @@ namespace XCharts.Runtime
{
/// <summary>
/// Settings related to base line.
/// 线条基础配置。
/// |线条基础配置。
/// </summary>
[System.Serializable]
public class BaseLine : ChildComponent
@@ -15,7 +15,7 @@ namespace XCharts.Runtime
/// <summary>
/// Set this to false to prevent the axis line from showing.
/// 是否显示坐标轴轴线。
/// |是否显示坐标轴轴线。
/// </summary>
public bool show
{

View File

@@ -7,5 +7,12 @@ namespace XCharts.Runtime
[System.Serializable]
public class EndLabelStyle : LabelStyle
{
public EndLabelStyle()
{
m_Offset = new Vector3(5, 0, 0);
m_TextStyle.alignment = TextAnchor.MiddleLeft;
m_NumericFormatter = "f0";
m_Formatter = "{a}:{c}";
}
}
}

View File

@@ -5,17 +5,26 @@ using UnityEngine.UI;
namespace XCharts.Runtime
{
[System.Serializable]
public class IconStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
public class IconStyle : ChildComponent
{
public enum Layer
{
UnderLabel,
AboveLabel
/// <summary>
/// The icon is display under the label text.
/// 图标在标签文字下
/// </summary>
UnderText,
/// <summary>
/// The icon is display above the label text.
/// 图标在标签文字上
/// </summary>
AboveText
}
[SerializeField] private bool m_Show = false;
[SerializeField] private Layer m_Layer;
[SerializeField] private Align m_Align = Align.Left;
[SerializeField] private Sprite m_Sprite;
[SerializeField] private Image.Type m_Type;
[SerializeField] private Color m_Color = Color.white;
[SerializeField] private float m_Width = 20;
[SerializeField] private float m_Height = 20;
@@ -25,7 +34,7 @@ namespace XCharts.Runtime
public void Reset()
{
m_Show = false;
m_Layer = Layer.UnderLabel;
m_Layer = Layer.UnderText;
m_Sprite = null;
m_Color = Color.white;
m_Width = 20;
@@ -35,7 +44,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Whether the data icon is show.
/// 是否显示图标。
/// |是否显示图标。
/// </summary>
public bool show { get { return m_Show; } set { m_Show = value; } }
/// <summary>
@@ -44,10 +53,15 @@ namespace XCharts.Runtime
public Layer layer { get { return m_Layer; } set { m_Layer = value; } }
/// <summary>
/// The image of icon.
/// 图标的图片。
/// |图标的图片。
/// </summary>
public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
/// <summary>
/// How to display the icon.
/// |图片的显示类型。
/// </summary>
public Image.Type type { get { return m_Type; } set { m_Type = value; } }
/// <summary>
/// 图标颜色。
/// </summary>
public Color color { get { return m_Color; } set { m_Color = value; } }
@@ -77,6 +91,7 @@ namespace XCharts.Runtime
iconStyle.show = show;
iconStyle.layer = layer;
iconStyle.sprite = sprite;
iconStyle.type = type;
iconStyle.color = color;
iconStyle.width = width;
iconStyle.height = height;
@@ -91,6 +106,7 @@ namespace XCharts.Runtime
show = iconStyle.show;
layer = iconStyle.layer;
sprite = iconStyle.sprite;
type = iconStyle.type;
color = iconStyle.color;
width = iconStyle.width;
height = iconStyle.height;

View File

@@ -0,0 +1,82 @@

using UnityEngine;
using UnityEngine.UI;
namespace XCharts.Runtime
{
[System.Serializable]
public class ImageStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
{
[SerializeField] private bool m_Show = true;
[SerializeField] private Sprite m_Sprite;
[SerializeField] private Image.Type m_Type;
[SerializeField] private bool m_AutoColor;
[SerializeField] private Color m_Color = Color.clear;
[SerializeField] private float m_Width = 0;
[SerializeField] private float m_Height = 0;
public void Reset()
{
m_Show = false;
m_Type = Image.Type.Simple;
m_Sprite = null;
m_AutoColor = false;
m_Color = Color.white;
m_Width = 0;
m_Height = 0;
}
/// <summary>
/// Whether the data icon is show.
/// |是否显示图标。
/// </summary>
public bool show { get { return m_Show; } set { m_Show = value; } }
/// <summary>
/// The image of icon.
/// |图标的图片。
/// </summary>
public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
/// <summary>
/// How to display the image.
/// |图片的显示类型。
/// </summary>
public Image.Type type { get { return m_Type; } set { m_Type = value; } }
/// <summary>
/// 是否自动颜色。
/// </summary>
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
/// <summary>
/// 图标颜色。
/// </summary>
public Color color { get { return m_Color; } set { m_Color = value; } }
/// <summary>
/// 图标宽。
/// </summary>
public float width { get { return m_Width; } set { m_Width = value; } }
/// <summary>
/// 图标高。
/// </summary>
public float height { get { return m_Height; } set { m_Height = value; } }
public ImageStyle Clone()
{
var imageStyle = new ImageStyle();
imageStyle.type = type;
imageStyle.sprite = sprite;
imageStyle.autoColor = autoColor;
imageStyle.color = color;
imageStyle.width = width;
imageStyle.height = height;
return imageStyle;
}
public void Copy(ImageStyle imageStyle)
{
type = imageStyle.type;
sprite = imageStyle.sprite;
autoColor = imageStyle.autoColor;
color = imageStyle.color;
width = imageStyle.width;
height = imageStyle.height;
}
}
}

View File

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

View File

@@ -18,6 +18,7 @@ namespace XCharts.Runtime
[SerializeField] private Color32 m_CenterColor;
[SerializeField] private float m_CenterGap;
[SerializeField] private float m_BorderWidth = 0;
[SerializeField] private float m_BorderGap = 0;
[SerializeField] private Color32 m_BorderColor;
[SerializeField] private Color32 m_BorderColor0;
[SerializeField] private Color32 m_BorderToColor;
@@ -39,6 +40,7 @@ namespace XCharts.Runtime
m_CenterColor = Color.clear;
m_CenterGap = 0;
m_BorderWidth = 0;
m_BorderGap = 0;
m_BorderColor = Color.clear;
m_BorderColor0 = Color.clear;
m_BorderToColor = Color.clear;
@@ -83,7 +85,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Gradient color1.
/// 渐变色的颜色1。
/// |渐变色的颜色1。
/// </summary>
public Color32 toColor
{
@@ -92,7 +94,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Gradient color2.Only valid in line diagrams.
/// 渐变色的颜色2。只在折线图中有效。
/// |渐变色的颜色2。只在折线图中有效。
/// </summary>
public Color32 toColor2
{
@@ -108,6 +110,14 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetVerticesDirty(); }
}
/// <summary>
/// 数据项背景宽度。
/// </summary>
public float backgroundWidth
{
get { return m_BackgroundWidth; }
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetVerticesDirty(); }
}
/// <summary>
/// 中心区域颜色。
/// </summary>
public Color32 centerColor
@@ -124,14 +134,6 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_CenterGap, value)) SetVerticesDirty(); }
}
/// <summary>
/// 数据项背景宽度。
/// </summary>
public float backgroundWidth
{
get { return m_BackgroundWidth; }
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetVerticesDirty(); }
}
/// <summary>
/// 边框的颜色。
/// </summary>
public Color32 borderColor
@@ -164,6 +166,14 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_BorderWidth, value)) SetVerticesDirty(); }
}
/// <summary>
/// 边框间隙。
/// </summary>
public float borderGap
{
get { return m_BorderGap; }
set { if (PropertyUtil.SetStruct(ref m_BorderGap, value)) SetVerticesDirty(); }
}
/// <summary>
/// 透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
/// </summary>
public float opacity
@@ -189,7 +199,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// Standard numeric format strings.
/// 标准数字格式字符串。用于将数值格式化显示为字符串。
/// |标准数字格式字符串。用于将数值格式化显示为字符串。
/// 使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。
/// 参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings
/// </summary>
@@ -201,7 +211,7 @@ namespace XCharts.Runtime
}
/// <summary>
/// The radius of rounded corner. Its unit is px. Use array to respectively specify the 4 corner radiuses((clockwise upper left, upper right, bottom right and bottom left)).
/// 圆角半径。用数组分别指定4个圆角半径顺时针左上右上右下左下
/// |圆角半径。用数组分别指定4个圆角半径顺时针左上右上右下左下
/// </summary>
public float[] cornerRadius
{
@@ -231,6 +241,16 @@ namespace XCharts.Runtime
return color;
}
public Color32 GetToColor()
{
if (m_Opacity == 1 || m_ToColor.a == 0)
return m_ToColor;
var color = m_ToColor;
color.a = (byte)(color.a * m_Opacity);
return color;
}
public Color32 GetColor0()
{
if (m_Opacity == 1 || m_Color0.a == 0)
@@ -316,14 +336,11 @@ namespace XCharts.Runtime
}
return color;
}
}
public static class ItemStyleHelper
{
public static bool IsNeedCorner(ItemStyle itemStyle)
public bool IsNeedCorner()
{
if (itemStyle.cornerRadius == null) return false;
foreach (var value in itemStyle.cornerRadius)
if (m_CornerRadius == null) return false;
foreach (var value in m_CornerRadius)
{
if (value != 0) return true;
}

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