mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 07:50:16 +00:00
Merge branch 'master' into 3.0
This commit is contained in:
47
CHANGELOG.md
47
CHANGELOG.md
@@ -2,6 +2,7 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.1.0](#v3.1.0)
|
||||
[v3.0.1](#v3.0.1)
|
||||
[v3.0.0](#v3.0.0)
|
||||
[v3.0.0-preivew9](#v3.0.0-preivew9)
|
||||
@@ -13,6 +14,8 @@
|
||||
[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.8.1](#v2.8.1)
|
||||
[v2.8.0](#v2.8.0)
|
||||
[v2.7.0](#v2.7.0)
|
||||
[v2.6.0](#v2.6.0)
|
||||
[v2.5.0](#v2.5.0)
|
||||
@@ -54,6 +57,34 @@
|
||||
|
||||
## master
|
||||
|
||||
## 3.1.0
|
||||
|
||||
* (2022.07.12) 发布`v3.1.0`版本
|
||||
* (2022.07.12) 修复`Serie`的`ignoreLineBreak`不生效的问题
|
||||
* (2022.07.07) 优化`Axis`的`minMaxType`指定为`MinMax`时支持精确到小数
|
||||
* (2022.07.05) 修复`Chart`里有多个坐标系时绘制异常的问题 (#210)
|
||||
* (2022.07.04) 增加`Settings`的`axisMaxSplitNumber`参数设置`Axis`的最大分隔段数
|
||||
* (2022.07.04) 修复`Axis`在设置`offset`后`Tick`绘制位置异常的问题 (#209)
|
||||
* (2022.07.03) 优化`AxisLabel`的`formatterFunction`自定义委托
|
||||
* (2022.07.03) 增加`AxisName`的`onZero`参数支持设置坐标轴名称位置是否和Y轴0刻度一致 (#207)
|
||||
* (2022.07.02) 修复`PieChart`用代码动态创建时`Legend`不正常的问题 (#206)
|
||||
* (2022.07.02) 修复`YAxis`的`AxisLabel`设置`onZero`不生效的问题
|
||||
* (2022.07.02) 修复`AxisLabel`代码设置`distance`属性后一直刷新的问题
|
||||
* (2022.06.30) 修复`Runtime`下代码创建图表时组件无法初始化的问题
|
||||
* (2022.06.29) 增加`Tooltip`的`itemFormatter`支持`{c0}`显示各维度数据 (#205)
|
||||
* (2022.06.28) 优化`Pie`设置`avoidLabelOverlap`时的文本表现 (#56)
|
||||
* (2022.06.25) 优化`Line`的平滑曲线表现 (#169)
|
||||
* (2022.06.25) 修复`DataZoom`开启时`Tooltip`显示数据不一致的问题 (#203)
|
||||
* (2022.06.25) 修复`Toolip`在类目轴无数据时绘制异常的问题 (#204)
|
||||
* (2022.06.25) 优化`Serie`设置`PlaceHolder`时的`Tooltip`表现
|
||||
* (2022.06.25) 增加`Since`标识配置参数从哪个版本开始支持
|
||||
* (2022.06.24) 优化`Painter`绘制层,`Top`层细分为`Upper`和`Top`层
|
||||
* (2022.06.24) 增加`Legend`对`Background`和`Padding`的支持
|
||||
* (2022.06.21) 增加`TextStyle`对`TextMeshPro`的`Sprite Asset`支持 (#201)
|
||||
* (2022.06.20) 优化`Tooltip`的边界限制 (#202)
|
||||
* (2022.06.20) 修复`TextMeshPro`开启时编译错误
|
||||
* (2022.06.20) 修复`Animation`的渐出动画不生效的问题
|
||||
|
||||
## v3.0.1
|
||||
|
||||
* (2022.06.16) 发布`v3.0.1`版本
|
||||
@@ -145,6 +176,22 @@
|
||||
|
||||
* (2022.01.07) 发布`v3.0.0-preivew1`版本
|
||||
|
||||
## v2.8.1
|
||||
|
||||
* (2022.05.06) 发布`v2.8.1`版本
|
||||
* (2022.05.03) 增加`Legend`的`onLegendClick`,`onLegendEnter`和`onLegendExit`委托回调
|
||||
* (2022.04.21) 修复`RingChart`的`Tooltip`异常的问题 #192
|
||||
* (2022.04.21) 修复`DataZoom`设置`minShowNum`时可能会报错的问题
|
||||
|
||||
## v2.8.0
|
||||
|
||||
* (2022.04.10) 发布`v2.8.0`版本
|
||||
* (2022.04.10) 增加`Debug`调试信息面板
|
||||
* (2022.04.09) 修复`VisualMap`某些情况下不生效的问题
|
||||
* (2022.04.08) 优化`XCharts`初始化 #190
|
||||
* (2022.04.08) 修复`Radar`的颜色异常问题 #187
|
||||
* (2022.03.24) 修复`Axis`的精度问题 #184
|
||||
|
||||
## v2.7.0
|
||||
|
||||
* (2022.03.20) 发布`v2.7.0`版本
|
||||
|
||||
@@ -2,8 +2,24 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.1.0](#v3.1.0)
|
||||
[v3.0.1](#v3.0.1)
|
||||
[v3.0.0](#v3.0.0)
|
||||
[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.8.1](#v2.8.1)
|
||||
[v2.8.0](#v2.8.0)
|
||||
[v2.7.0](#v2.7.0)
|
||||
[v2.6.0](#v2.6.0)
|
||||
[v2.5.0](#v2.5.0)
|
||||
[v2.4.0](#v2.4.0)
|
||||
[v2.3.0](#v2.3.0)
|
||||
[v2.2.3](#v2.2.3)
|
||||
[v2.2.2](#v2.2.2)
|
||||
@@ -39,6 +55,36 @@
|
||||
[v0.5.0](#v0.5.0)
|
||||
[v0.1.0](#v0.1.0)
|
||||
|
||||
## master
|
||||
|
||||
## 3.1.0
|
||||
|
||||
* (2022.07.12) Release `v3.1.0` version
|
||||
* (2022.07.12) Fixed `Serie` `ignoreLineBreak` not working
|
||||
* (2022.07.07) Optimized `Axis` `minMaxType` to support precision to decimals when specified as `MinMax`
|
||||
* (2022.07.05) Fixed drawing exception when there are multiple coordinate systems in `Chart` (#210)
|
||||
* (2022.07.04) Added the axisMaxSplitNumber parameter of `Settings` to set the maximum number of partitions for `Axis`
|
||||
* (2022.07.04) Fixed Axis` Tick `drawing position after setting `offset`(#209)
|
||||
* (2022.07.03) Optimize the `AxisLabel` formatterFunction custom delegate
|
||||
* (2022.07.03) added the `onZero` parameter of `AxisName` to support setting the coordinate AxisName and position to match the Y-axis 0 scale (#207)
|
||||
* (2022.07.02) Fixed bug where `Legend` was not working when `PieChart` was being created dynamically with code (#206)
|
||||
* (2022.07.02) Fixed `YAxis` AxisLabel setting `onZero` not working
|
||||
* (2022.07.02) Fixed `AxisLabel` code refreshing after setting `distance` property
|
||||
* (2022.06.30) Fixed an issue where components could not be initialized when creating diagrams under `Runtime` code
|
||||
* (2022.06.29) Added `itemFormatter` support for `{c0}` in `Tooltip` to display dimension data (#205)
|
||||
* (2022.06.28) Optimize text performance when `Pie` sets up `avoidLabelOverlap` (#56)
|
||||
* (2022.06.25) Optimize smooth curve representation of `Line` (#169)
|
||||
* (2022.06.25) Fixed inconsistent display of `Tooltip` when `DataZoom` is enabled (#203)
|
||||
* (2022.06.25) Fixed `Toolip` drawing exception when there is no data in the category axis (#204)
|
||||
* (2022.06.25) Optimize `Serie` setting `PlaceHolder` for `Tooltip` performance
|
||||
* (2022.06.25) Added `Since` to identify the version from which the configuration parameter is supported
|
||||
* (2022.06.24) Optimize `Painter` drawing layer, `Top` layer is subdivided into `Upper` and `Top` layers
|
||||
* (2022.06.24) Added `Legend` support for `Background` and `Padding`
|
||||
* (2022.06.21) Added `TextStyle` support for `Sprite Asset` of `TextMeshPro` (#201)
|
||||
* (2022.06.20) Optimize boundary limits for `Tooltip` (#202)
|
||||
* (2022.06.20) Fixes compilation error when `TextMeshPro` is turned on
|
||||
* (2022.06.20) Fixed issue where the fade Animation of `Animation` would not work
|
||||
|
||||
## v3.0.1
|
||||
|
||||
* (2022.06.16) Release `v3.0.1` version
|
||||
@@ -70,6 +116,95 @@
|
||||
* Added `Widgets`.
|
||||
* Added multiple extension charts.
|
||||
|
||||
## v3.0.0_preview9
|
||||
|
||||
## v3.0.0_preview8
|
||||
|
||||
## v3.0.0_preview7
|
||||
|
||||
## v3.0.0_preview6
|
||||
|
||||
## v3.0.0_preview5
|
||||
|
||||
## v3.0.0_preview4
|
||||
|
||||
## v3.0.0_preview3
|
||||
|
||||
## v3.0.0_preview2
|
||||
|
||||
## v3.0.0_preview1
|
||||
|
||||
## v2.8.1
|
||||
|
||||
* (2022.05.03) Added `onLegendClick`, `onLegendEnter` and `onLegendExit` delegate callbacks for `Legend`
|
||||
* (2022.04.21) Fixed bug #192 with `RingChart` `Tooltip` exception
|
||||
* (2022.04.21) Fixed error when setting `minShowNum` in `DataZoom`
|
||||
|
||||
## v2.8.0
|
||||
|
||||
* (2022.04.10) Added the debug information panel
|
||||
* (2022.04.09) Fixed `VisualMap` not working in some cases
|
||||
* (2022.04.08) Optimized `XCharts` initialization #190
|
||||
* (2022.04.08) Fixed color error #187 in `Radar`
|
||||
* (2022.03.24) Fixed `Axis` precision issue #184
|
||||
|
||||
## v2.7.0
|
||||
|
||||
* (2022.03.20) Release `v2.7.0` version
|
||||
* (2022.02.21) Fixed chart name repeat check error #183
|
||||
* (2022.02.17) Fixed bug where axis split line might be displayed outside the coordinate system #181
|
||||
* (2022.02.08) Fixed {d} formatter error when value is 0
|
||||
* (2022.02.08) Fixed `YAxis` `AxisLabel`'s `onZero` does not work
|
||||
* (2022.01.06) Improved `Zebra` bar chart
|
||||
|
||||
## v2.6.0
|
||||
|
||||
* (2021.12.30) Release `v2.6.0` version
|
||||
* (2021.12.21) Fixed `Emphasis` dont work
|
||||
* (2021.12.17) Fixed `MarkLine` does not auto refresh label active when serie hide #178
|
||||
* (2021.12.10) Improved `Radar`'s `AxisLine` and `SplitLine` to be controlled separately
|
||||
* (2021.12.08) Fixed y axis does not refresh when serie hidden
|
||||
* (2021.12.04) Added `Symbol` new types: `EmptyRect`, `EmptyTriangle`, `EmptyDiamond`
|
||||
* (2021.12.04) Added setting symbol empty area color by itemStyle's backgroundColor
|
||||
* (2021.12.03) Fixed formatter `{c}` not work #175
|
||||
* (2021.12.03) Fixed axis `boundaryGap` display error in some cases #174
|
||||
* (2021.11.30) Fixed serie `ignore` display error in some cases #173
|
||||
|
||||
## v2.5.0
|
||||
|
||||
* (2021.11.27) Release `v2.5.0` version
|
||||
* (2021.11.27) Added `Tooltip` delegate function `positionFunction`
|
||||
* (2021.10.29) Removed settings for `TextMeshPro` when package first imported
|
||||
* (2021.10.29) Added support for `{e}` in `Tooltip` #170
|
||||
* (2021.09.08) Improved `RadarChart`
|
||||
* (2021.09.07) Fixed bug where `label` does not disappear at the end of `PieChart` fade animation #168
|
||||
* (2021.09.06) Fixed bug where `GaugeChart` changing `splitNumber` with code does not refresh `label` #167
|
||||
|
||||
## v2.4.0
|
||||
|
||||
### Main points
|
||||
|
||||
* LineChart support the line of ignore data is disconnected or connected
|
||||
* LineChart support animation at a constant speed
|
||||
* Other optimizations and bug fixes
|
||||
|
||||
### Details
|
||||
|
||||
* (2021.08.31) Release `v2.4.0` version
|
||||
* (2021.08.31) Optimized the gradient effect of `RingChart`
|
||||
* (2021.08.31) Fixed bug where `SerieLabel` does not refresh when `DataZoom` is dragged (#165)
|
||||
* (2021.08.25) Fixed an issue where the theme switch could not be save to the scene (#166)
|
||||
* (2021.08.24) Added `Animation`'s `alongWithLinePath`
|
||||
* (2021.08.22) Added `Serie`'s `ignoreLineBreak` (#164)
|
||||
* (2021.08.22) Fixed `Axis` label may not be updated when `DataZoom` is turn on (#164)
|
||||
* (2021.08.15) Improved `Axis`'s `AxisLabel` text rotate setting to avoid inconsistency offset in `DataZoom` (#163)
|
||||
* (2021.08.14) Added `Legend`'s `textAutoColor` to set the text color match with `Serie` color (#163)
|
||||
* (2021.08.12) Optimize `BarChart` setting `Corner` when the positive and negative columns are fillet symmetric
|
||||
* (2021.08.03) Fixed y axis not displaying when all data is 0
|
||||
* (2021.07.29) Fixed ignored data will also participate in calculations when `ignore` is enabled (#161)
|
||||
* (2021.07.29) Improved `BarChart`'s `Zebra` gradient support
|
||||
* (2021.07.26) Fixed issue where `XCharts` path could not be found when `TextMeshPro Enable` (#160)
|
||||
|
||||
## v2.3.0
|
||||
|
||||
### Main points
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01f7eaa065d094f1f8955111a9bc447b
|
||||
guid: 7425bc5c378354c95bb116c36dc1b5f8
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -49,7 +49,7 @@ A powerful, easy-to-use, configurable charting and data visualization library fo
|
||||
[XCharts3.0 API](XChartsAPI-EN.md)
|
||||
[XCharts3.0 FAQ](XChartsFAQ-EN.md)
|
||||
[XCharts3.0 Configurate](XChartsConfiguration-EN.md)
|
||||
[XCharts3.0 Changelog](../CHANGELOG.md)
|
||||
[XCharts3.0 Changelog](CHANGELOG.md)
|
||||
[XCharts3.0 Support](SUPPORT.md)
|
||||
|
||||
## Features
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29f30ecf23bb44bc5b0820dc5ee7a23e
|
||||
guid: 56516e67d6e88401e949d4e63792c638
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -1,13 +1,14 @@
|
||||
# 订阅服务
|
||||
|
||||
如需技术支持,可订阅`个人VIP`服务。扫后面的二维码后可加VIP群`867291970`,验证信息请输入付费的账号。 企业商务合作可联系QQ:3525422251(XCharts技术支持)。
|
||||
如需技术支持,可订阅`个人VIP`服务。扫后面的二维码后可加VIP群`867291970`,验证信息请输入付费的账号。
|
||||
企业商务合作可联系QQ:3525422251(XCharts技术支持)。
|
||||
|
||||
## 订阅VIP服务
|
||||
|
||||
订阅服务分个人订阅和企业订阅:
|
||||
|
||||
- 个人订阅:个人VIP属于个人,不可转让,`XCharts`团队只服务于订阅当事人。
|
||||
- 企业订阅:企业VIP属于企业,席位内可安排固定职员,职员离职可重新安排,`XCharts`团队通过专属企业群为企业服务。
|
||||
- `个人`订阅:`个人VIP`属于个人,不可转让,`XCharts`团队只服务于订阅当事人。
|
||||
- `企业`订阅:`企业VIP`属于企业,席位内可安排固定职员,职员离职后席位可重新安排,`XCharts`团队通过专属企业群为企业服务。
|
||||
|
||||
订阅服务的优势?
|
||||
|
||||
@@ -39,15 +40,15 @@
|
||||
| 可另付费定制 | | | √ | √ | √ |
|
||||
| 可另付费加急 | | | √ | √ | √ |
|
||||
| VIP专有功能教程和文档 | | | √待开放 | √待开放 | √待开放 |
|
||||
| 扩展图表购买 | | | 按需购买 | 全部免费 | 按需购买 |
|
||||
| 扩展图表购买 | | | 按需购买 | __全部免费__ | 按需购买 |
|
||||
| 扩展图表源码 | | | 永久持有 | 永久持有 | 永久持有 |
|
||||
| 扩展图表更新 | | | 1年持续更新</br>1年后需订阅 | 1年持续更新</br>1年后需订阅 | 1年持续更新</br>1年后需订阅 |
|
||||
| 扩展图表更新 | | | 1年更新支持 | 1年更新支持 | 1年更新支持 |
|
||||
|
||||
## 购买扩展图表
|
||||
|
||||
扩展图表为另付费购买图表,只对订阅了`VIP`服务的用户开放购买。对于`SVIP`的订阅用户,所有扩展图表仓库可免费使用,不用再单独购买。
|
||||
|
||||
对所有已购买的扩展图表,源码可永久持有,并获得持续一年的更新支持,超过一年后想要更新支持需要继续订阅`VIP`服务,如不继续订阅`VIP`服务,会从`GitHub`的`Team`中移除,不再能访问扩展图表的源码仓库。
|
||||
对所有已购买的扩展图表,源码可永久持有,并获得持续一年的更新支持,一年后如需更新支持服务,可继续订阅`VIP`服务。
|
||||
|
||||
|编号|扩展图表|价格|备注|
|
||||
|--|--|--|--|
|
||||
@@ -66,7 +67,7 @@
|
||||
1. __`付费定制`__ 是指用户可根据自己的需求定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
|
||||
2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并可要求在`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。
|
||||
3. __`付费咨询`__ 付费咨询有效期`7`天,且总咨询时长不超过`7`个小时。
|
||||
4. __`扩展图表`__ 购买后代码可永久持有和商用,更新支持1年。超过1年后还需要更新支持的话,需要订阅`VIP`服务。
|
||||
4. __`扩展图表`__ 购买后代码可永久持有和商用,1年的更新支持。
|
||||
|
||||
## 捐助支持
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
- [SimplifiedBarChart](#SimplifiedBarChart)
|
||||
- [SimplifiedCandlestickChart](#SimplifiedCandlestickChart)
|
||||
- [SimplifiedLineChart](#SimplifiedLineChart)
|
||||
- [Since](#Since)
|
||||
- [SVG](#SVG)
|
||||
- [SVGImage](#SVGImage)
|
||||
- [SVGPath](#SVGPath)
|
||||
@@ -120,7 +121,7 @@ Inherits or Implemented: [MainComponentHandler](#MainComponentHandler)
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `AdjustCircleLabelPos()` |public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)</br> |
|
||||
| `AdjustMinMaxValue()` |public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, int ceilRate = 0)</br>调整最大最小值 |
|
||||
| `AdjustMinMaxValue()` |public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, double ceilRate = 0)</br>调整最大最小值 |
|
||||
| `AdjustRadiusAxisLabelPos()` |public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)</br> |
|
||||
| `GetAxisLineArrowOffset()` |public static float GetAxisLineArrowOffset(Axis axis)</br>包含箭头偏移的轴线长度 |
|
||||
| `GetAxisPosition()` |public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)</br> |
|
||||
@@ -237,6 +238,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `RefreshPainter()` |public void RefreshPainter(int index)</br> |
|
||||
| `RefreshPainter()` |public void RefreshPainter(Serie serie)</br> |
|
||||
| `RefreshTopPainter()` |public void RefreshTopPainter()</br> |
|
||||
| `RefreshUpperPainter()` |public void RefreshUpperPainter()</br> |
|
||||
| `RemoveAllChartComponent()` |public void RemoveAllChartComponent()</br> |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(MainComponent component)</br> |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(Type type, int index = 0)</br> |
|
||||
@@ -257,6 +259,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `SetSerieActive()` |public void SetSerieActive(string serieName, bool active)</br>Whether to show serie. |
|
||||
| `SetSeriePainterMaterial()` |public void SetSeriePainterMaterial(Material material)</br>设置Serie Painter的材质球 |
|
||||
| `SetTopPainterMaterial()` |public void SetTopPainterMaterial(Material material)</br>设置Top Painter的材质球 |
|
||||
| `SetUpperPainterMaterial()` |public void SetUpperPainterMaterial(Material material)</br>设置Upper Painter的材质球 |
|
||||
| `TryAddChartComponent()` |public bool TryAddChartComponent(Type type)</br> |
|
||||
| `TryGetChartComponent<T>()` |public bool TryGetChartComponent<T>(out T component, int index = 0)</br> |
|
||||
| `UdpateXAxisIcon()` |public void UdpateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)</br>Update xAxis icon. |
|
||||
@@ -340,9 +343,9 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `GetFullName()` |public static string GetFullName(Transform transform)</br> |
|
||||
| `GetHighlightColor()` |public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)</br> |
|
||||
| `GetLastValue()` |public static Vector3 GetLastValue(List<Vector3> list)</br> |
|
||||
| `GetMaxDivisibleValue()` |public static double GetMaxDivisibleValue(double max, int ceilRate)</br> |
|
||||
| `GetMaxDivisibleValue()` |public static double GetMaxDivisibleValue(double max, double ceilRate)</br> |
|
||||
| `GetMaxLogValue()` |public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)</br> |
|
||||
| `GetMinDivisibleValue()` |public static double GetMinDivisibleValue(double min, int ceilRate)</br> |
|
||||
| `GetMinDivisibleValue()` |public static double GetMinDivisibleValue(double min, double ceilRate)</br> |
|
||||
| `GetMinLogValue()` |public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)</br> |
|
||||
| `GetPointList()` |public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)</br> |
|
||||
| `GetPos()` |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)</br> |
|
||||
@@ -373,6 +376,7 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `SetActive()` |public static void SetActive(Image image, bool active)</br> |
|
||||
| `SetActive()` |public static void SetActive(Text text, bool active)</br> |
|
||||
| `SetActive()` |public static void SetActive(Transform transform, bool active)</br>通过设置scale实现是否显示,优化性能,减少GC |
|
||||
| `SetBackground()` |public static void SetBackground(Image background, ImageStyle imageStyle)</br> |
|
||||
| `SetColorOpacity()` |public static void SetColorOpacity(ref Color32 color, float opacity)</br> |
|
||||
|
||||
## `ChartLabel`
|
||||
@@ -546,6 +550,7 @@ Inherits or Implemented: [MainComponentContext](#MainComponentContext)
|
||||
| `GetContentColor()` |public static Color GetContentColor(BaseChart chart, int legendIndex, string legendName, Legend legend, ThemeStyle theme, bool active)</br> |
|
||||
| `GetIconColor()` |public static Color GetIconColor(BaseChart chart, Legend legend, int readIndex, string legendName, bool active)</br> |
|
||||
| `ResetItemPosition()` |public static void ResetItemPosition(Legend legend, Vector3 chartPos, float chartWidth, float chartHeight)</br> |
|
||||
| `SetLegendBackground()` |public static void SetLegendBackground(Legend legend, ImageStyle style)</br> |
|
||||
|
||||
## `LegendItem`
|
||||
|
||||
@@ -554,6 +559,7 @@ Inherits or Implemented: [MainComponentContext](#MainComponentContext)
|
||||
| `GetIconColor()` |public Color GetIconColor()</br> |
|
||||
| `GetIconRect()` |public Rect GetIconRect()</br> |
|
||||
| `SetActive()` |public void SetActive(bool active)</br> |
|
||||
| `SetBackground()` |public void SetBackground(ImageStyle imageStyle)</br> |
|
||||
| `SetButton()` |public void SetButton(Button button)</br> |
|
||||
| `SetContent()` |public bool SetContent(string content)</br> |
|
||||
| `SetContentBackgroundColor()` |public void SetContentBackgroundColor(Color color)</br> |
|
||||
@@ -818,7 +824,7 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `CopySerie()` |public static void CopySerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `GetAllMinMaxData()` |public static void GetAllMinMaxData(Serie serie, int ceilRate = 0, DataZoom dataZoom = null)</br> |
|
||||
| `GetAllMinMaxData()` |public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)</br> |
|
||||
| `GetAreaColor()` |public static Color32 GetAreaColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetAreaStyle()` |public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetAreaToColor()` |public static Color32 GetAreaToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
@@ -852,7 +858,7 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `IsDownPoint()` |public static bool IsDownPoint(Serie serie, int index)</br> |
|
||||
| `UpdateCenter()` |public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)</br>更新运行时中心点和半径 |
|
||||
| `UpdateFilterData()` |public static void UpdateFilterData(Serie serie, DataZoom dataZoom)</br>根据dataZoom更新数据列表缓存 |
|
||||
| `UpdateMinMaxData()` |public static void UpdateMinMaxData(Serie serie, int dimension, int ceilRate = 0, DataZoom dataZoom = null)</br>获得指定维数的最大最小值 |
|
||||
| `UpdateMinMaxData()` |public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)</br>获得指定维数的最大最小值 |
|
||||
| `UpdateRect()` |public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)</br> |
|
||||
| `UpdateSerieRuntimeFilterData()` |public static void UpdateSerieRuntimeFilterData(Serie serie, bool filterInvisible = true)</br> |
|
||||
|
||||
@@ -885,7 +891,6 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `GetLegalSerieNameList()` |public static List<string> GetLegalSerieNameList(List<Serie> series)</br> |
|
||||
| `GetMaxSerieDataCount()` |public static int GetMaxSerieDataCount(List<Serie> series)</br> |
|
||||
| `GetNameColor()` |public static Color GetNameColor(BaseChart chart, int index, string name)</br> |
|
||||
| `GetSerieByVesselIndex()` |public static Serie GetSerieByVesselIndex(List<Serie> series, int vesselIndex)</br> |
|
||||
| `GetStackSeries()` |public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)</br>获得堆叠系列列表 |
|
||||
| `IsAnyClipSerie()` |public static bool IsAnyClipSerie(List<Serie> series)</br>是否有需裁剪的serie。 |
|
||||
| `IsLegalLegendName()` |public static bool IsLegalLegendName(string name)</br> |
|
||||
@@ -905,6 +910,14 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
|
||||
Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
|
||||
## `Since`
|
||||
|
||||
Inherits or Implemented: [Attribute](#Attribute)
|
||||
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `Since()` |public Since(string version)</br> |
|
||||
|
||||
## `SVG`
|
||||
|
||||
|public method|description|
|
||||
@@ -941,7 +954,7 @@ Inherits or Implemented: [MaskableGraphic](#MaskableGraphic)
|
||||
|--|--|
|
||||
| `GetItemNumericFormatter()` |public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)</br> |
|
||||
| `GetLineColor()` |public static Color32 GetLineColor(Tooltip tooltip, ThemeStyle theme)</br> |
|
||||
| `IsIgnoreItemFormatter()` |public static bool IsIgnoreItemFormatter(string itemFormatter)</br> |
|
||||
| `IsIgnoreFormatter()` |public static bool IsIgnoreFormatter(string itemFormatter)</br> |
|
||||
| `LimitInRect()` |public static void LimitInRect(Tooltip tooltip, Rect chartRect)</br> |
|
||||
|
||||
## `TooltipView`
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
- [SimplifiedBarChart](#SimplifiedBarChart)
|
||||
- [SimplifiedCandlestickChart](#SimplifiedCandlestickChart)
|
||||
- [SimplifiedLineChart](#SimplifiedLineChart)
|
||||
- [Since](#Since)
|
||||
- [SVG](#SVG)
|
||||
- [SVGImage](#SVGImage)
|
||||
- [SVGPath](#SVGPath)
|
||||
@@ -120,7 +121,7 @@ Inherits or Implemented: [MainComponentHandler](#MainComponentHandler)
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `AdjustCircleLabelPos()` |public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)</br> |
|
||||
| `AdjustMinMaxValue()` |public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, int ceilRate = 0)</br>调整最大最小值 |
|
||||
| `AdjustMinMaxValue()` |public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, double ceilRate = 0)</br>调整最大最小值 |
|
||||
| `AdjustRadiusAxisLabelPos()` |public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)</br> |
|
||||
| `GetAxisLineArrowOffset()` |public static float GetAxisLineArrowOffset(Axis axis)</br>包含箭头偏移的轴线长度 |
|
||||
| `GetAxisPosition()` |public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)</br> |
|
||||
@@ -237,6 +238,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `RefreshPainter()` |public void RefreshPainter(int index)</br> |
|
||||
| `RefreshPainter()` |public void RefreshPainter(Serie serie)</br> |
|
||||
| `RefreshTopPainter()` |public void RefreshTopPainter()</br> |
|
||||
| `RefreshUpperPainter()` |public void RefreshUpperPainter()</br> |
|
||||
| `RemoveAllChartComponent()` |public void RemoveAllChartComponent()</br> |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(MainComponent component)</br> |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(Type type, int index = 0)</br> |
|
||||
@@ -257,6 +259,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `SetSerieActive()` |public void SetSerieActive(string serieName, bool active)</br>设置指定系列是否显示。 |
|
||||
| `SetSeriePainterMaterial()` |public void SetSeriePainterMaterial(Material material)</br>设置Serie Painter的材质球 |
|
||||
| `SetTopPainterMaterial()` |public void SetTopPainterMaterial(Material material)</br>设置Top Painter的材质球 |
|
||||
| `SetUpperPainterMaterial()` |public void SetUpperPainterMaterial(Material material)</br>设置Upper Painter的材质球 |
|
||||
| `TryAddChartComponent()` |public bool TryAddChartComponent(Type type)</br> |
|
||||
| `TryGetChartComponent<T>()` |public bool TryGetChartComponent<T>(out T component, int index = 0)</br> |
|
||||
| `UdpateXAxisIcon()` |public void UdpateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)</br>更新X轴图标。 |
|
||||
@@ -340,9 +343,9 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `GetFullName()` |public static string GetFullName(Transform transform)</br> |
|
||||
| `GetHighlightColor()` |public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)</br> |
|
||||
| `GetLastValue()` |public static Vector3 GetLastValue(List<Vector3> list)</br> |
|
||||
| `GetMaxDivisibleValue()` |public static double GetMaxDivisibleValue(double max, int ceilRate)</br> |
|
||||
| `GetMaxDivisibleValue()` |public static double GetMaxDivisibleValue(double max, double ceilRate)</br> |
|
||||
| `GetMaxLogValue()` |public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)</br> |
|
||||
| `GetMinDivisibleValue()` |public static double GetMinDivisibleValue(double min, int ceilRate)</br> |
|
||||
| `GetMinDivisibleValue()` |public static double GetMinDivisibleValue(double min, double ceilRate)</br> |
|
||||
| `GetMinLogValue()` |public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)</br> |
|
||||
| `GetPointList()` |public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)</br> |
|
||||
| `GetPos()` |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)</br> |
|
||||
@@ -373,6 +376,7 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `SetActive()` |public static void SetActive(Image image, bool active)</br> |
|
||||
| `SetActive()` |public static void SetActive(Text text, bool active)</br> |
|
||||
| `SetActive()` |public static void SetActive(Transform transform, bool active)</br>通过设置scale实现是否显示,优化性能,减少GC |
|
||||
| `SetBackground()` |public static void SetBackground(Image background, ImageStyle imageStyle)</br> |
|
||||
| `SetColorOpacity()` |public static void SetColorOpacity(ref Color32 color, float opacity)</br> |
|
||||
|
||||
## `ChartLabel`
|
||||
@@ -546,6 +550,7 @@ Inherits or Implemented: [MainComponentContext](#MainComponentContext)
|
||||
| `GetContentColor()` |public static Color GetContentColor(BaseChart chart, int legendIndex, string legendName, Legend legend, ThemeStyle theme, bool active)</br> |
|
||||
| `GetIconColor()` |public static Color GetIconColor(BaseChart chart, Legend legend, int readIndex, string legendName, bool active)</br> |
|
||||
| `ResetItemPosition()` |public static void ResetItemPosition(Legend legend, Vector3 chartPos, float chartWidth, float chartHeight)</br> |
|
||||
| `SetLegendBackground()` |public static void SetLegendBackground(Legend legend, ImageStyle style)</br> |
|
||||
|
||||
## `LegendItem`
|
||||
|
||||
@@ -554,6 +559,7 @@ Inherits or Implemented: [MainComponentContext](#MainComponentContext)
|
||||
| `GetIconColor()` |public Color GetIconColor()</br> |
|
||||
| `GetIconRect()` |public Rect GetIconRect()</br> |
|
||||
| `SetActive()` |public void SetActive(bool active)</br> |
|
||||
| `SetBackground()` |public void SetBackground(ImageStyle imageStyle)</br> |
|
||||
| `SetButton()` |public void SetButton(Button button)</br> |
|
||||
| `SetContent()` |public bool SetContent(string content)</br> |
|
||||
| `SetContentBackgroundColor()` |public void SetContentBackgroundColor(Color color)</br> |
|
||||
@@ -818,7 +824,7 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `CopySerie()` |public static void CopySerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `GetAllMinMaxData()` |public static void GetAllMinMaxData(Serie serie, int ceilRate = 0, DataZoom dataZoom = null)</br> |
|
||||
| `GetAllMinMaxData()` |public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)</br> |
|
||||
| `GetAreaColor()` |public static Color32 GetAreaColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetAreaStyle()` |public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetAreaToColor()` |public static Color32 GetAreaToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
@@ -852,7 +858,7 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `IsDownPoint()` |public static bool IsDownPoint(Serie serie, int index)</br> |
|
||||
| `UpdateCenter()` |public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)</br>更新运行时中心点和半径 |
|
||||
| `UpdateFilterData()` |public static void UpdateFilterData(Serie serie, DataZoom dataZoom)</br>根据dataZoom更新数据列表缓存 |
|
||||
| `UpdateMinMaxData()` |public static void UpdateMinMaxData(Serie serie, int dimension, int ceilRate = 0, DataZoom dataZoom = null)</br>获得指定维数的最大最小值 |
|
||||
| `UpdateMinMaxData()` |public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)</br>获得指定维数的最大最小值 |
|
||||
| `UpdateRect()` |public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)</br> |
|
||||
| `UpdateSerieRuntimeFilterData()` |public static void UpdateSerieRuntimeFilterData(Serie serie, bool filterInvisible = true)</br> |
|
||||
|
||||
@@ -885,7 +891,6 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `GetLegalSerieNameList()` |public static List<string> GetLegalSerieNameList(List<Serie> series)</br> |
|
||||
| `GetMaxSerieDataCount()` |public static int GetMaxSerieDataCount(List<Serie> series)</br> |
|
||||
| `GetNameColor()` |public static Color GetNameColor(BaseChart chart, int index, string name)</br> |
|
||||
| `GetSerieByVesselIndex()` |public static Serie GetSerieByVesselIndex(List<Serie> series, int vesselIndex)</br> |
|
||||
| `GetStackSeries()` |public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)</br>获得堆叠系列列表 |
|
||||
| `IsAnyClipSerie()` |public static bool IsAnyClipSerie(List<Serie> series)</br>是否有需裁剪的serie。 |
|
||||
| `IsLegalLegendName()` |public static bool IsLegalLegendName(string name)</br> |
|
||||
@@ -905,6 +910,14 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
|
||||
Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
|
||||
## `Since`
|
||||
|
||||
Inherits or Implemented: [Attribute](#Attribute)
|
||||
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `Since()` |public Since(string version)</br> |
|
||||
|
||||
## `SVG`
|
||||
|
||||
|public method|description|
|
||||
@@ -941,7 +954,7 @@ Inherits or Implemented: [MaskableGraphic](#MaskableGraphic)
|
||||
|--|--|
|
||||
| `GetItemNumericFormatter()` |public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)</br> |
|
||||
| `GetLineColor()` |public static Color32 GetLineColor(Tooltip tooltip, ThemeStyle theme)</br> |
|
||||
| `IsIgnoreItemFormatter()` |public static bool IsIgnoreItemFormatter(string itemFormatter)</br> |
|
||||
| `IsIgnoreFormatter()` |public static bool IsIgnoreFormatter(string itemFormatter)</br> |
|
||||
| `LimitInRect()` |public static void LimitInRect(Tooltip tooltip, Rect chartRect)</br> |
|
||||
|
||||
## `TooltipView`
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,9 @@
|
||||
[QA 26:如何使用背景组件?有什么条件限制?](#如何使用背景组件_有什么条件限制)
|
||||
[QA 27:Mesh can not have more than 65000 vertices?](#Mesh_cannot_have_more_than_65000_vertices)
|
||||
[QA 28:为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
|
||||
[QA 29:如何修改Serie的Symbol的颜色?](#如何修改Serie的Symbol的颜色)
|
||||
[QA 30:导入或更新XCharts时TMP报错怎么办?](#导入或更新XCharts时TMP报错怎么办)
|
||||
[QA 31:支持空数据吗?如何实现折线图断开的效果?](#支持空数据吗_如何实现折线图断开的效果)
|
||||
|
||||
## 如何调整坐标轴与背景的边距
|
||||
|
||||
@@ -67,7 +70,7 @@
|
||||
|
||||
## 如何调整图表的对齐方式
|
||||
|
||||
答:默认为左下角对齐,暂不支持调整。可以通过包一层parent来辅助控制。(最新版本`1.5.0`及以上已支持任意锚点,可和做UI一样任意调整对其方式)。
|
||||
答:调整RectTransform的锚点,和UGUI的其他组件的用法一致。
|
||||
|
||||
## 可以显示超过1000以上的大数据吗
|
||||
|
||||
@@ -87,7 +90,7 @@
|
||||
|
||||
## 如何在数据项顶上显示文本
|
||||
|
||||
答:通过设置`Serie`下的`Label`。
|
||||
答:通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
|
||||
|
||||
## 如何给数据项自定义图标
|
||||
|
||||
@@ -123,7 +126,7 @@
|
||||
|
||||
## 如何做成预设
|
||||
|
||||
答:请删除chart下所有的子组件再拖成预设。
|
||||
答:做成prefab前,执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
|
||||
|
||||
## 如何在图表上画点画线等自定义内容
|
||||
|
||||
@@ -149,6 +152,21 @@
|
||||
|
||||
答:检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
|
||||
|
||||
## 如何修改Serie的Symbol的颜色
|
||||
|
||||
答:`Symbol` 的颜色是使用的 `ItemStyle` 的 `color`。
|
||||
|
||||
## 导入或更新XCharts时TMP报错怎么办
|
||||
|
||||
答:XCharts默认时不开启TMP,所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决:
|
||||
|
||||
1. 找到`XCharts.Runtime.asmdef`和`XCharts.Editor.asmdef`,手动加上 `TextMeshPro`的引用
|
||||
2. 移除`PlayerSetting`中`Scripting Define Symbols`的`dUI_TextMeshPro`宏
|
||||
|
||||
## 支持空数据吗_如何实现折线图断开的效果
|
||||
|
||||
答:`Serie`的`data`是`double`类型,所以无法表示空数据。可通过开启`Serie`的`ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)
|
||||
[XChartsAPI](XChartsAPI-ZH.md)
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -172,6 +172,7 @@ XCharts内部有自动刷新机制,但也是在一定条件下。如果自己
|
||||
|
||||
1. `chart.RefreshAllComponent()`:刷新图表组件,会重新初始化所有组件,不建议频繁待用。
|
||||
2. `chart.RefreshChart()`:刷新图表绘制,只刷新绘制部分,不会刷新组件文本,位置等部分。
|
||||
3. 各个组件也可以通过`SetAllDirty()`只刷新自己。
|
||||
|
||||
## 使用TextMeshPro
|
||||
|
||||
|
||||
BIN
Documentation/res/xcharts3.0.png
Normal file
BIN
Documentation/res/xcharts3.0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
76
Documentation/res/xcharts3.0.png.meta
Normal file
76
Documentation/res/xcharts3.0.png.meta
Normal file
@@ -0,0 +1,76 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d824662da0d024d1f95c8d10c870e3ca
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapU: -1
|
||||
wrapV: -1
|
||||
wrapW: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -22,11 +22,13 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_MaxPainter");
|
||||
PropertyField(prop, "m_BasePainterMaterial");
|
||||
PropertyField(prop, "m_SeriePainterMaterial");
|
||||
PropertyField(prop, "m_UpperPainterMaterial");
|
||||
PropertyField(prop, "m_TopPainterMaterial");
|
||||
PropertyField(prop, "m_LineSmoothStyle");
|
||||
PropertyField(prop, "m_LineSmoothness");
|
||||
PropertyField(prop, "m_LineSegmentDistance");
|
||||
PropertyField(prop, "m_CicleSmoothness");
|
||||
PropertyField(prop, "m_AxisMaxSplitNumber");
|
||||
PropertyField(prop, "m_LegendIconLineWidth");
|
||||
PropertyListField(prop, "m_LegendIconCornerRadius", true);
|
||||
--EditorGUI.indentLevel;
|
||||
|
||||
@@ -4,8 +4,8 @@ using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(TextPadding), true)]
|
||||
public class TextPaddingDrawer : BasePropertyDrawer
|
||||
[CustomPropertyDrawer(typeof(Padding), true)]
|
||||
public class PaddingDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Padding"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
@@ -22,4 +22,9 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(TextPadding), true)]
|
||||
public class TextPaddingDrawer : PaddingDrawer
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_LineSpacing");
|
||||
#if dUI_TextMeshPro
|
||||
PropertyField(prop, "m_TMPFontStyle");
|
||||
PropertyField(prop, "m_TMPSpriteAsset");
|
||||
PropertyField(prop, "m_TMPAlignment");
|
||||
#else
|
||||
PropertyField(prop, "m_FontStyle");
|
||||
|
||||
@@ -181,6 +181,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Name");
|
||||
PropertyField(prop, "m_OnZero");
|
||||
PropertyField(prop, "m_LabelStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Formatter");
|
||||
PropertyField("m_Location");
|
||||
PropertyField("m_LabelStyle");
|
||||
PropertyField("m_Background");
|
||||
PropertyField("m_Padding");
|
||||
PropertyListField("m_Icons");
|
||||
PropertyListField("m_Colors");
|
||||
PropertyListField("m_Data");
|
||||
|
||||
@@ -20,13 +20,18 @@ namespace XCharts.Editor
|
||||
var canvasObject = new GameObject();
|
||||
canvasObject.name = "Canvas";
|
||||
canvas = canvasObject.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
canvas.renderMode = RenderMode.ScreenSpaceCamera;
|
||||
var mainCamera = GameObject.FindGameObjectWithTag("MainCamera");
|
||||
canvas.worldCamera = mainCamera == null? null : mainCamera.GetComponent<Camera>();
|
||||
canvasObject.AddComponent<CanvasScaler>();
|
||||
canvasObject.AddComponent<GraphicRaycaster>();
|
||||
var eventSystem = new GameObject();
|
||||
eventSystem.name = "EventSystem";
|
||||
eventSystem.AddComponent<EventSystem>();
|
||||
eventSystem.AddComponent<StandaloneInputModule>();
|
||||
if (GameObject.Find("EventSystem") == null)
|
||||
{
|
||||
var eventSystem = new GameObject();
|
||||
eventSystem.name = "EventSystem";
|
||||
eventSystem.AddComponent<EventSystem>();
|
||||
eventSystem.AddComponent<StandaloneInputModule>();
|
||||
}
|
||||
return canvas.transform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace XCharts.Example
|
||||
{
|
||||
public int maxCacheDataNumber = 100;
|
||||
public float initDataTime = 2;
|
||||
public bool insertDataToHead = true;
|
||||
public bool insertDataToHead = false;
|
||||
|
||||
private BaseChart chart;
|
||||
private float updateTime;
|
||||
|
||||
95
Examples/Example_DynamicChart.cs
Normal file
95
Examples/Example_DynamicChart.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
public class Example_DynamicChart : MonoBehaviour
|
||||
{
|
||||
BaseChart chart;
|
||||
|
||||
void Awake() { }
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
AddPieChart("Dynamic PieChart");
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.L))
|
||||
{
|
||||
AddLineChart("Dynamic LineChart");
|
||||
}
|
||||
}
|
||||
|
||||
GameObject CreateChartObject(string chartName)
|
||||
{
|
||||
for (int i = transform.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Destroy(transform.GetChild(i).gameObject);
|
||||
}
|
||||
var chartObject = new GameObject();
|
||||
chartObject.name = chartName;
|
||||
chartObject.transform.SetParent(transform);
|
||||
chartObject.transform.localScale = Vector3.one;
|
||||
chartObject.transform.localPosition = Vector3.zero;
|
||||
return chartObject;
|
||||
}
|
||||
|
||||
void AddPieChart(string chartName)
|
||||
{
|
||||
var chartObject = CreateChartObject(chartName);
|
||||
var chart = chartObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
|
||||
chart.GetOrAddChartComponent<Title>().show = true;
|
||||
chart.GetOrAddChartComponent<Title>().text = chartName;
|
||||
|
||||
chart.GetOrAddChartComponent<Tooltip>().show = true;
|
||||
chart.GetOrAddChartComponent<Legend>().show = true;
|
||||
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Pie>();
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
chart.AddData(0, Random.Range(10, 20), "pie" + (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
void AddLineChart(string chartName)
|
||||
{
|
||||
var chartObject = CreateChartObject(chartName);
|
||||
var chart = chartObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
|
||||
chart.GetOrAddChartComponent<Title>().show = true;
|
||||
chart.GetOrAddChartComponent<Title>().text = chartName;
|
||||
|
||||
chart.GetOrAddChartComponent<Legend>().show = false;
|
||||
|
||||
var tooltip = chart.GetOrAddChartComponent<Tooltip>();
|
||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.show = true;
|
||||
yAxis.show = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + (i + 1));
|
||||
chart.AddData(0, Random.Range(10, 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Examples/Example_DynamicChart.cs.meta
Normal file
11
Examples/Example_DynamicChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37d46ee8250bd4bdf84966a435e543dd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
README.md
63
README.md
@@ -9,7 +9,7 @@
|
||||
<br>
|
||||
Unity数据可视化图表插件。
|
||||
<br>
|
||||
<a href="Documentation/README-EN.md">English README</a>
|
||||
<a href="Documentation/README.md">English README</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/XCharts-Team/XCharts/blob/master/LICENSE">
|
||||
@@ -43,7 +43,7 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十种常见免费内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`等多种扩展图表。
|
||||
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`等多种扩展图表。
|
||||
|
||||
[XCharts3.0 教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
[XCharts3.0 API](Documentation/XChartsAPI-ZH.md)
|
||||
@@ -55,8 +55,8 @@
|
||||
## 特性
|
||||
|
||||
- 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
||||
- 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
||||
- 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||
- 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种内置图表。
|
||||
- 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种扩展图表。
|
||||
- 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
||||
- 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
||||
- 支持环形图、玫瑰图等饼图。
|
||||
@@ -68,7 +68,15 @@
|
||||
- 支持万级大数据绘制。
|
||||
- 支持`TexMeshPro`。
|
||||
|
||||
## `XCharts3.0` 新功能
|
||||
## 截图
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
更多示例请看 [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) 仓库,也可以在浏览器查看`WebGL`下的运行效果 [在线Demo](https://xcharts-team.github.io/demo/) 。
|
||||
|
||||
## `XCharts3.0`
|
||||
|
||||
- 增加`Time`时间轴。
|
||||
- 增加`SingleAxis`单轴。
|
||||
@@ -79,7 +87,7 @@
|
||||
- 增加`Widgets`小组件。
|
||||
- 增加多种扩展图表。
|
||||
|
||||
## `XCharts3.0` 相比 `XCharts2.0` 的改进
|
||||
## `XCharts3.0` 相比 `XCharts2.0`
|
||||
|
||||
- 更健壮的底层框架。
|
||||
- 更强大的性能。
|
||||
@@ -92,40 +100,25 @@
|
||||
- 更高效的二次开发。
|
||||
- 更丰富的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`。
|
||||
- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。
|
||||
- `XCharts2.0` 进入维护阶段,后续只修复严重`bug`,理论上不再加新功能。
|
||||
- `XCharts` 理论上支持`Unity 5.6`及以上版本,但由于版本测试有限难免疏漏,发现版本兼容问题可提`Issue`。
|
||||
- `XCharts` 内置图表都为常见的图表,可以免费使用;扩展图表大部分为不常使用的图表,有需要的可付费获取,详情[☞ 看这里](Documentation/SUPPORT.md)
|
||||
- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`示例请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)
|
||||
|
||||
## 截图
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
更多示例请看 [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo),也可以到 [在线Demo](https://xcharts-team.github.io/demo/) 查看`WebGL`下的运行效果。
|
||||
- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`示例请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。
|
||||
|
||||
## 使用
|
||||
|
||||
1. 导入`XCharts`的`unitypackage`或者源码到项目
|
||||
2. 在`Hierarchy`视图下右键选择`XCharts->LineChart`,即可创建一个默认的折线图
|
||||
3. 在`Inspector`试图可以调整各个组件的参数,并在`Game`视图看到实时效果
|
||||
1. 导入`XCharts`的`unitypackage`或者源码到项目。
|
||||
2. 在`Hierarchy`视图下右键选择`XCharts->LineChart`,即可创建一个默认的折线图。
|
||||
3. 在`Inspector`视图可以调整各个组件的参数,并在`Game`视图看到实时效果。
|
||||
|
||||
更多教程请看:[XCharts教程:5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
|
||||
首次使用,建议认真看一遍教程。
|
||||
|
||||
## FAQ
|
||||
|
||||
1. `XCharts`可以免费使用吗?
|
||||
@@ -137,17 +130,19 @@
|
||||
3. 这个插件除了用在`Unity`,还能用在其他平台(如`Winform`或`WPF`)吗?
|
||||
答:目前只支持在`Unity`平台使用。理论上任何支持`UGUI`的`Unity`版本都能运行`XCharts`。
|
||||
|
||||
## 日志
|
||||
|
||||
[更新日志](CHANGELOG.md)
|
||||
|
||||
## Licenses
|
||||
|
||||
[MIT License](LICENSE.md)
|
||||
|
||||
可免费商用,可二次开发
|
||||
|
||||
## 日志
|
||||
|
||||
[更新日志](CHANGELOG.md)
|
||||
|
||||
## 其他
|
||||
|
||||
邮箱:`monitor1394@gmail.com`
|
||||
QQ群:XCharts交流群(`202030963`)
|
||||
VIP群:XCharts技术支持VIP群(`867291970`)
|
||||
捐助和技术支持:[☞ 看这里](Documentation/SUPPORT.md)
|
||||
捐助、合作和技术支持:[☞ 看这里](Documentation/SUPPORT.md)
|
||||
|
||||
@@ -350,9 +350,11 @@ namespace XCharts.Runtime
|
||||
#endif
|
||||
if (!m_Enable || m_IsEnd)
|
||||
return true;
|
||||
|
||||
if (IsIndexAnimation())
|
||||
return m_CurrDetailProgress > m_DestDetailProgress;
|
||||
{
|
||||
if (m_FadeOut) return m_CurrDetailProgress <= m_DestDetailProgress;
|
||||
else return m_CurrDetailProgress > m_DestDetailProgress;
|
||||
}
|
||||
if (IsItemAnimation())
|
||||
return false;
|
||||
return true;
|
||||
|
||||
@@ -19,12 +19,12 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <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 设置类目数据。serie的数据第0维数据对应坐标轴data的index。
|
||||
/// </summary>
|
||||
Category,
|
||||
/// <summary>
|
||||
@@ -74,12 +74,12 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] protected AxisType m_Type;
|
||||
[SerializeField] protected AxisMinMaxType m_MinMaxType;
|
||||
[SerializeField] protected Axis.AxisType m_Type;
|
||||
[SerializeField] protected Axis.AxisMinMaxType m_MinMaxType;
|
||||
[SerializeField] protected int m_GridIndex;
|
||||
[SerializeField] protected int m_PolarIndex;
|
||||
[SerializeField] protected int m_ParallelIndex;
|
||||
[SerializeField] protected AxisPosition m_Position;
|
||||
[SerializeField] protected Axis.AxisPosition m_Position;
|
||||
[SerializeField] protected float m_Offset;
|
||||
[SerializeField] protected double m_Min;
|
||||
[SerializeField] protected double m_Max;
|
||||
@@ -89,7 +89,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected int m_MaxCache = 0;
|
||||
[SerializeField] protected float m_LogBase = 10;
|
||||
[SerializeField] protected bool m_LogBaseE = false;
|
||||
[SerializeField] protected int m_CeilRate = 0;
|
||||
[SerializeField] protected double m_CeilRate = 0;
|
||||
[SerializeField] protected bool m_Inverse = false;
|
||||
[SerializeField] private bool m_Clockwise = true;
|
||||
[SerializeField] private bool m_InsertDataToHead;
|
||||
@@ -257,7 +257,7 @@ namespace XCharts.Runtime
|
||||
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
|
||||
/// |最大最小值向上取整的倍率。默认为0时自动计算。
|
||||
/// </summary>
|
||||
public int ceilRate
|
||||
public double ceilRate
|
||||
{
|
||||
get { return m_CeilRate; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CeilRate, value < 0 ? 0 : value)) SetAllDirty(); }
|
||||
@@ -393,6 +393,7 @@ namespace XCharts.Runtime
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
axisLabel.ClearVerticesDirty();
|
||||
axisLine.ClearVerticesDirty();
|
||||
axisTick.ClearVerticesDirty();
|
||||
splitLine.ClearVerticesDirty();
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace XCharts.Runtime
|
||||
public List<string> runtimeData { get { return m_RuntimeData; } }
|
||||
public List<double> labelValueList { get { return m_LabelValueList; } }
|
||||
public List<ChartLabel> labelObjectList { get { return m_AxisLabelList; } }
|
||||
public int dataZoomStartIndex;
|
||||
|
||||
internal List<string> filterData;
|
||||
internal bool lastCheckInverse;
|
||||
@@ -107,17 +108,25 @@ namespace XCharts.Runtime
|
||||
if (range > data.Count - start - 1)
|
||||
start = data.Count - range - 1;
|
||||
if (start >= 0)
|
||||
{
|
||||
dataZoomStartIndex = start;
|
||||
filterData = data.GetRange(start, range);
|
||||
}
|
||||
else
|
||||
{
|
||||
dataZoomStartIndex = 0;
|
||||
filterData = data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dataZoomStartIndex = 0;
|
||||
filterData = data;
|
||||
}
|
||||
}
|
||||
else if (end == 0)
|
||||
{
|
||||
dataZoomStartIndex = 0;
|
||||
filterData = m_EmptyFliter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace XCharts
|
||||
axis.UpdateLabelText(runtimeWidth, dataZoom, isPercentStack);
|
||||
}
|
||||
|
||||
internal static void UpdateAxisTickValueList(Axis axis)
|
||||
internal void UpdateAxisTickValueList(Axis axis)
|
||||
{
|
||||
if (axis.IsTime())
|
||||
{
|
||||
@@ -267,12 +267,13 @@ namespace XCharts
|
||||
list.Add(axis.context.minValue);
|
||||
value = Math.Ceiling(axis.context.minValue / tick) * tick;
|
||||
}
|
||||
var maxSplitNumber = chart.settings.axisMaxSplitNumber;
|
||||
while (value <= axis.context.maxValue)
|
||||
{
|
||||
list.Add(value);
|
||||
value += tick;
|
||||
|
||||
if (list.Count > 20)
|
||||
if (maxSplitNumber > 0 && list.Count > maxSplitNumber)
|
||||
break;
|
||||
}
|
||||
if (!ChartHelper.IsEquals(axis.context.maxValue, list[list.Count - 1]))
|
||||
@@ -424,7 +425,8 @@ namespace XCharts
|
||||
var autoColor = axis.axisLine.GetColor(chart.theme.axis.lineColor);
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
var posY = GetAxisLineXOrY() + offset.y;
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
var posY = !axis.axisName.onZero && grid != null? grid.context.y : GetAxisLineXOrY() + offset.y;
|
||||
switch (axis.axisName.labelStyle.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
@@ -460,7 +462,8 @@ namespace XCharts
|
||||
}
|
||||
else
|
||||
{
|
||||
var posX = GetAxisLineXOrY() + offset.x;
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
var posX = !axis.axisName.onZero && grid != null? grid.context.x : GetAxisLineXOrY() + offset.x;
|
||||
switch (axis.axisName.labelStyle.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
@@ -610,12 +613,12 @@ namespace XCharts
|
||||
if ((axis.axisTick.inside && axis.IsBottom()) ||
|
||||
(!axis.axisTick.inside && axis.IsTop()))
|
||||
{
|
||||
sY = startY + axis.offset + lineWidth;
|
||||
sY = startY + lineWidth;
|
||||
eY = sY + tickLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
sY = startY + axis.offset - lineWidth;
|
||||
sY = startY - lineWidth;
|
||||
eY = sY - tickLength;
|
||||
}
|
||||
|
||||
@@ -637,12 +640,12 @@ namespace XCharts
|
||||
if ((axis.axisTick.inside && axis.IsLeft()) ||
|
||||
(!axis.axisTick.inside && axis.IsRight()))
|
||||
{
|
||||
sX = startX + axis.offset + lineWidth;
|
||||
sX = startX + lineWidth;
|
||||
eX = sX + tickLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
sX = startX + axis.offset - lineWidth;
|
||||
sX = startX - lineWidth;
|
||||
eX = sX - tickLength;
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, int ceilRate = 0)
|
||||
public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, double ceilRate = 0)
|
||||
{
|
||||
if (axis.type == Axis.AxisType.Log)
|
||||
{
|
||||
|
||||
@@ -145,22 +145,18 @@ namespace XCharts.Runtime
|
||||
|
||||
public string GetFormatterContent(int labelIndex, string category)
|
||||
{
|
||||
if (m_FormatterFunction != null)
|
||||
{
|
||||
return m_FormatterFunction(labelIndex, 0, category);
|
||||
}
|
||||
if (string.IsNullOrEmpty(category))
|
||||
return category;
|
||||
return GetFormatterFunctionContent(labelIndex, category, category);
|
||||
|
||||
if (string.IsNullOrEmpty(m_Formatter))
|
||||
{
|
||||
return m_TextLimit.GetLimitContent(category);
|
||||
return GetFormatterFunctionContent(labelIndex, category, m_TextLimit.GetLimitContent(category));
|
||||
}
|
||||
else
|
||||
{
|
||||
var content = m_Formatter;
|
||||
FormatterHelper.ReplaceAxisLabelContent(ref content, category);
|
||||
return m_TextLimit.GetLimitContent(content);
|
||||
return GetFormatterFunctionContent(labelIndex, category, m_TextLimit.GetLimitContent(content));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,15 +166,11 @@ namespace XCharts.Runtime
|
||||
{
|
||||
value = Math.Abs(value);
|
||||
}
|
||||
if (m_FormatterFunction != null)
|
||||
{
|
||||
return m_FormatterFunction(labelIndex, value, null);
|
||||
}
|
||||
if (string.IsNullOrEmpty(m_Formatter))
|
||||
{
|
||||
if (isLog)
|
||||
{
|
||||
return ChartCached.NumberToStr(value, numericFormatter);
|
||||
return GetFormatterFunctionContent(labelIndex, value, ChartCached.NumberToStr(value, numericFormatter));
|
||||
}
|
||||
if (minValue >= -1 && minValue <= 1 && maxValue >= -1 && maxValue <= 1)
|
||||
{
|
||||
@@ -186,24 +178,20 @@ namespace XCharts.Runtime
|
||||
int maxAcc = ChartHelper.GetFloatAccuracy(maxValue);
|
||||
int curAcc = ChartHelper.GetFloatAccuracy(value);
|
||||
int acc = Mathf.Max(Mathf.Max(minAcc, maxAcc), curAcc);
|
||||
return ChartCached.FloatToStr(value, numericFormatter, acc);
|
||||
return GetFormatterFunctionContent(labelIndex, value, ChartCached.FloatToStr(value, numericFormatter, acc));
|
||||
}
|
||||
return ChartCached.NumberToStr(value, numericFormatter);
|
||||
return GetFormatterFunctionContent(labelIndex, value, ChartCached.NumberToStr(value, numericFormatter));
|
||||
}
|
||||
else
|
||||
{
|
||||
var content = m_Formatter;
|
||||
FormatterHelper.ReplaceAxisLabelContent(ref content, numericFormatter, value);
|
||||
return content;
|
||||
return GetFormatterFunctionContent(labelIndex, value, content);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFormatterDateTime(int labelIndex, double value, double minValue, double maxValue)
|
||||
{
|
||||
if (m_FormatterFunction != null)
|
||||
{
|
||||
return m_FormatterFunction(labelIndex, value, null);
|
||||
}
|
||||
var timestamp = (int) value;
|
||||
var dateTime = DateTimeUtil.GetDateTime(timestamp);
|
||||
var dateString = string.Empty;
|
||||
@@ -219,12 +207,24 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var content = m_Formatter;
|
||||
FormatterHelper.ReplaceAxisLabelContent(ref content, dateString);
|
||||
return m_TextLimit.GetLimitContent(content);
|
||||
return GetFormatterFunctionContent(labelIndex, value, m_TextLimit.GetLimitContent(content));
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_TextLimit.GetLimitContent(dateString);
|
||||
return GetFormatterFunctionContent(labelIndex, value, m_TextLimit.GetLimitContent(dateString));
|
||||
}
|
||||
}
|
||||
|
||||
private string GetFormatterFunctionContent(int labelIndex, string category, string currentContent)
|
||||
{
|
||||
return m_FormatterFunction == null ? currentContent :
|
||||
m_FormatterFunction(labelIndex, labelIndex, category, currentContent);
|
||||
}
|
||||
|
||||
private string GetFormatterFunctionContent(int labelIndex, double value, string currentContent)
|
||||
{
|
||||
return m_FormatterFunction == null ? currentContent :
|
||||
m_FormatterFunction(labelIndex, labelIndex, null, currentContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,12 @@ namespace XCharts.Runtime
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField][Since("v3.1.0")] private bool m_OnZero;
|
||||
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show axis name.
|
||||
/// |是否显示坐标名称。
|
||||
/// |是否显示坐标轴名称。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
@@ -33,6 +34,15 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetClass(ref m_Name, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether the axis name position are the same with 0 position of YAxis.
|
||||
/// |坐标轴名称的位置是否保持和Y轴0刻度一致。
|
||||
/// </summary>
|
||||
public bool onZero
|
||||
{
|
||||
get { return m_OnZero; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The text style of axis name.
|
||||
/// |文本样式。
|
||||
/// </summary>
|
||||
|
||||
@@ -72,7 +72,8 @@ namespace XCharts.Runtime
|
||||
if (grid == null)
|
||||
return Vector3.zero;
|
||||
|
||||
return GetLabelPosition(i, Orient.Vertical, component, null,
|
||||
var xAxis = chart.GetChartComponent<XAxis>(component.index);
|
||||
return GetLabelPosition(i, Orient.Vertical, component, xAxis,
|
||||
chart.theme.axis,
|
||||
scaleWid,
|
||||
grid.context.x,
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private AreaOrigin m_Origin;
|
||||
[SerializeField] private AreaStyle.AreaOrigin m_Origin;
|
||||
[SerializeField] private Color32 m_Color;
|
||||
[SerializeField] private Color32 m_ToColor;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 0.6f;
|
||||
|
||||
79
Runtime/Component/Child/Padding.cs
Normal file
79
Runtime/Component/Child/Padding.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// padding setting of item or text.
|
||||
/// |边距设置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Padding : ChildComponent
|
||||
{
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] protected float m_Top = 0;
|
||||
[SerializeField] protected float m_Right = 2f;
|
||||
[SerializeField] protected float m_Left = 2f;
|
||||
[SerializeField] protected float m_Bottom = 0;
|
||||
|
||||
public Padding() { }
|
||||
|
||||
public Padding(float top, float right, float bottom, float left)
|
||||
{
|
||||
SetPadding(top, right, bottom, left);
|
||||
}
|
||||
|
||||
public void SetPadding(float top, float right, float bottom, float left)
|
||||
{
|
||||
m_Top = top;;
|
||||
m_Right = right;
|
||||
m_Bottom = bottom;
|
||||
m_Left = left;
|
||||
}
|
||||
/// <summary>
|
||||
/// show padding.
|
||||
/// 是否显示。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of top.
|
||||
/// |顶部间距。
|
||||
/// </summary>
|
||||
public float top
|
||||
{
|
||||
get { return m_Top; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of right.
|
||||
/// |右部间距。
|
||||
/// </summary>
|
||||
public float right
|
||||
{
|
||||
get { return m_Right; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of bottom.
|
||||
/// |底部间距。
|
||||
/// </summary>
|
||||
public float bottom
|
||||
{
|
||||
get { return m_Bottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of left.
|
||||
/// |左边间距。
|
||||
/// </summary>
|
||||
public float left
|
||||
{
|
||||
get { return m_Left; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetComponentDirty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Child/Padding.cs.meta
Normal file
11
Runtime/Component/Child/Padding.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4249907274734533ba65edb14987472
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -8,72 +8,13 @@ namespace XCharts.Runtime
|
||||
/// |文本的内边距设置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TextPadding : ChildComponent
|
||||
public class TextPadding : Padding
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private float m_Top = 2;
|
||||
[SerializeField] private float m_Right = 4;
|
||||
[SerializeField] private float m_Left = 4;
|
||||
[SerializeField] private float m_Bottom = 2;
|
||||
|
||||
public TextPadding() { }
|
||||
|
||||
public TextPadding(float top, float right, float bottom, float left)
|
||||
{
|
||||
SetPadding(top, right, bottom, left);
|
||||
}
|
||||
|
||||
public void SetPadding(float top, float right, float bottom, float left)
|
||||
{
|
||||
m_Top = top;;
|
||||
m_Right = right;
|
||||
m_Bottom = bottom;
|
||||
m_Left = left;
|
||||
}
|
||||
/// <summary>
|
||||
/// show padding.
|
||||
/// 是否显示。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of top.
|
||||
/// |顶部间距。
|
||||
/// </summary>
|
||||
public float top
|
||||
{
|
||||
get { return m_Top; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of right.
|
||||
/// |右部间距。
|
||||
/// </summary>
|
||||
public float right
|
||||
{
|
||||
get { return m_Right; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of bottom.
|
||||
/// |底部间距。
|
||||
/// </summary>
|
||||
public float bottom
|
||||
{
|
||||
get { return m_Bottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// padding of left.
|
||||
/// |左边间距。
|
||||
/// </summary>
|
||||
public float left
|
||||
{
|
||||
get { return m_Left; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetComponentDirty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private TMP_FontAsset m_TMPFont;
|
||||
[SerializeField] private FontStyles m_TMPFontStyle = FontStyles.Normal;
|
||||
[SerializeField] private TextAlignmentOptions m_TMPAlignment = TextAlignmentOptions.Left;
|
||||
[SerializeField][Since("v3.1.0")] private TMP_SpriteAsset m_TMPSpriteAsset;
|
||||
#endif
|
||||
public bool show
|
||||
{
|
||||
@@ -149,11 +150,20 @@ namespace XCharts.Runtime
|
||||
/// the text alignment of TextMeshPro.
|
||||
/// |TextMeshPro字体对齐方式。
|
||||
/// </summary>
|
||||
public TextAlignmentOptions tmpFontStyle
|
||||
public TextAlignmentOptions tmpAlignment
|
||||
{
|
||||
get { return m_TMPAlignment; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_TMPAlignment, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sprite asset of TextMeshPro.
|
||||
/// |TextMeshPro的Sprite Asset。
|
||||
/// </summary>
|
||||
public TMP_SpriteAsset tmpSpriteAsset
|
||||
{
|
||||
get { return m_TMPSpriteAsset; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TMPSpriteAsset, value)) SetComponentDirty(); }
|
||||
}
|
||||
#endif
|
||||
|
||||
public TextStyle() { }
|
||||
@@ -198,6 +208,7 @@ namespace XCharts.Runtime
|
||||
#if dUI_TextMeshPro
|
||||
m_TMPFont = textStyle.tmpFont;
|
||||
m_TMPFontStyle = textStyle.tmpFontStyle;
|
||||
m_TMPSpriteAsset = textStyle.tmpSpriteAsset;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ namespace XCharts.Runtime
|
||||
/// |是否显示注解组件。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); } }
|
||||
/// <summary>
|
||||
/// The items of comment.
|
||||
/// |注解项。每个注解组件可以设置多个注解项。
|
||||
/// </summary>
|
||||
public List<CommentItem> items { get { return m_Items; } set { m_Items = value; SetComponentDirty(); } }
|
||||
/// <summary>
|
||||
/// The text style of all comments.
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawTop(VertexHelper vh)
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
for (int i = 0; i < component.items.Count; i++)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace XCharts.Runtime
|
||||
public override void InitComponent()
|
||||
{
|
||||
var dataZoom = component;
|
||||
dataZoom.painter = chart.m_PainterTop;
|
||||
dataZoom.painter = chart.m_PainterUpper;
|
||||
dataZoom.refreshComponent = delegate()
|
||||
{
|
||||
var dataZoomObject = ChartHelper.AddObject(s_DefaultDataZoom + dataZoom.index, chart.transform,
|
||||
@@ -62,7 +62,7 @@ namespace XCharts.Runtime
|
||||
CheckDataZoomLabel(component);
|
||||
}
|
||||
|
||||
public override void DrawTop(VertexHelper vh)
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
if (chart == null)
|
||||
return;
|
||||
|
||||
@@ -40,10 +40,35 @@ namespace XCharts.Runtime
|
||||
private ChartLabel m_Label;
|
||||
private List<float> m_FpsList = new List<float>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether show debug component.
|
||||
/// |是否显示Debug组件。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// Whether show children components of chart in hierarchy view.
|
||||
/// |是否在Hierarchy试图显示所有chart下的节点。
|
||||
/// </summary>
|
||||
public bool showAllChartObject { get { return m_ShowAllChartObject; } set { m_ShowAllChartObject = value; } }
|
||||
/// <summary>
|
||||
/// Whether to fold series in inspector view.
|
||||
/// |是否在Inspector上折叠Serie。
|
||||
/// </summary>
|
||||
public bool foldSeries { get { return m_FoldSeries; } set { m_FoldSeries = value; } }
|
||||
/// <summary>
|
||||
/// frame rate.
|
||||
/// |当前帧率。
|
||||
/// </summary>
|
||||
public float fps { get; private set; }
|
||||
/// <summary>
|
||||
/// The average frame rate.
|
||||
/// |平均帧率。
|
||||
/// </summary>
|
||||
public float avgFps { get; private set; }
|
||||
/// <summary>
|
||||
/// The fefresh count of chart per second.
|
||||
/// |图表每秒刷新次数。
|
||||
/// </summary>
|
||||
public int refreshCount { get; internal set; }
|
||||
internal int clickChartCount { get; set; }
|
||||
|
||||
@@ -107,13 +132,6 @@ namespace XCharts.Runtime
|
||||
SetValueWithKInfo(s_Sb, "s-vert", vertCount);
|
||||
SetValueWithKInfo(s_Sb, "t-vert", m_Chart.m_TopPainterVertCount, false);
|
||||
|
||||
var serie0 = m_Chart.GetSerie(0);
|
||||
for (int i = 0; i < serie0.dataCount; i++)
|
||||
{
|
||||
var serieData = serie0.data[i];
|
||||
s_Sb.AppendFormat("{0}:{1}\n", i, serieData.interact.targetVaue);
|
||||
}
|
||||
|
||||
m_Label.SetText(s_Sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace XCharts.Runtime
|
||||
public Position position
|
||||
{
|
||||
get { return m_Position; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Position, value)) SetVerticesDirty(); }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Position, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// formatter of label.
|
||||
@@ -133,7 +133,7 @@ namespace XCharts.Runtime
|
||||
public string formatter
|
||||
{
|
||||
get { return m_Formatter; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetVerticesDirty(); }
|
||||
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// offset to the host graphic element.
|
||||
@@ -142,7 +142,7 @@ namespace XCharts.Runtime
|
||||
public Vector3 offset
|
||||
{
|
||||
get { return m_Offset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetVerticesDirty(); }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Rotation of label.
|
||||
@@ -159,7 +159,7 @@ namespace XCharts.Runtime
|
||||
public float distance
|
||||
{
|
||||
get { return m_Distance; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Distance, value)) SetVerticesDirty(); }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Distance, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the width of label. If set as default value 0, it means than the label width auto set as the text width.
|
||||
|
||||
@@ -18,16 +18,6 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetLabel(ChartText labelObject, LabelStyle label, ThemeStyle theme,
|
||||
Color textColor, float rotate)
|
||||
{
|
||||
if (labelObject == null) return;
|
||||
labelObject.SetColor(textColor);
|
||||
labelObject.SetLocalEulerAngles(new Vector3(0, 0, rotate));
|
||||
labelObject.SetFontSize(label.textStyle.GetFontSize(theme.common));
|
||||
labelObject.SetFontStyle(label.textStyle.fontStyle);
|
||||
}
|
||||
|
||||
public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)
|
||||
{
|
||||
return serie.show && serieData.context.canShowLabel && !serie.IsIgnoreValue(serieData, dimesion);
|
||||
@@ -43,18 +33,23 @@ namespace XCharts.Runtime
|
||||
var numericFormatter = serieLabel == null ? "" : serieLabel.numericFormatter;
|
||||
var serieName = serie.serieName;
|
||||
var dataName = serieData != null ? serieData.name : null;
|
||||
if (serieLabel.formatterFunction != null)
|
||||
{
|
||||
return serieLabel.formatterFunction(serieData.index, dataValue, null);
|
||||
}
|
||||
if (string.IsNullOrEmpty(serieLabel.formatter))
|
||||
return ChartCached.NumberToStr(dataValue, numericFormatter);
|
||||
{
|
||||
var currentContent = ChartCached.NumberToStr(dataValue, numericFormatter);
|
||||
if (serieLabel.formatterFunction == null)
|
||||
return currentContent;
|
||||
else
|
||||
return serieLabel.formatterFunction(serieData.index, dataValue, null, currentContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
var content = serieLabel.formatter;
|
||||
FormatterHelper.ReplaceSerieLabelContent(ref content, numericFormatter, serie.dataCount, dataValue,
|
||||
dataTotal, serieName, dataName, dataName, color);
|
||||
return content;
|
||||
dataTotal, serieName, dataName, dataName, color, serieData);
|
||||
if (serieLabel.formatterFunction == null)
|
||||
return content;
|
||||
else
|
||||
return serieLabel.formatterFunction(serieData.index, dataValue, null, content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +127,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!serie.avoidLabelOverlap) return;
|
||||
var lastCheckPos = Vector3.zero;
|
||||
var lastX = 0f;
|
||||
var data = serie.data;
|
||||
var splitCount = 0;
|
||||
for (int n = 0; n < data.Count; n++)
|
||||
@@ -143,19 +139,20 @@ namespace XCharts.Runtime
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int n = 0; n < splitCount; n++)
|
||||
{
|
||||
CheckSerieDataLabel(serie, data[n], false, theme, ref lastCheckPos);
|
||||
CheckSerieDataLabel(serie, data[n], splitCount, false, theme, ref lastCheckPos, ref lastX);
|
||||
}
|
||||
lastCheckPos = Vector3.zero;
|
||||
for (int n = data.Count - 1; n >= splitCount; n--)
|
||||
{
|
||||
CheckSerieDataLabel(serie, data[n], true, theme, ref lastCheckPos);
|
||||
CheckSerieDataLabel(serie, data[n], data.Count - splitCount, true, theme, ref lastCheckPos, ref lastX);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckSerieDataLabel(Serie serie, SerieData serieData, bool isLeft, ComponentTheme theme,
|
||||
ref Vector3 lastCheckPos)
|
||||
private static void CheckSerieDataLabel(Serie serie, SerieData serieData, int total, bool isLeft, ComponentTheme theme,
|
||||
ref Vector3 lastCheckPos, ref float lastX)
|
||||
{
|
||||
if (!serieData.context.canShowLabel)
|
||||
{
|
||||
@@ -164,12 +161,12 @@ namespace XCharts.Runtime
|
||||
}
|
||||
if (!serieData.show) return;
|
||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||
var labelLine = SerieHelper.GetSerieLabelLine(serie, serieData);
|
||||
var fontSize = serieLabel.textStyle.GetFontSize(theme);
|
||||
var isOutside = serieLabel.position == LabelStyle.Position.Outside ||
|
||||
serieLabel.position == LabelStyle.Position.Default;
|
||||
if (!serieLabel.show) return;
|
||||
if (!isOutside) return;
|
||||
var labelLine = SerieHelper.GetSerieLabelLine(serie, serieData);
|
||||
var fontSize = serieData.labelObject.GetHeight();
|
||||
if (lastCheckPos == Vector3.zero)
|
||||
{
|
||||
lastCheckPos = serieData.context.labelPosition;
|
||||
@@ -185,7 +182,25 @@ namespace XCharts.Runtime
|
||||
var diffX = labelRadius * labelRadius - diff * diff;
|
||||
diffX = diffX <= 0 ? 0 : diffX;
|
||||
var x1 = serie.context.center.x + Mathf.Sqrt(diffX) * (isLeft ? -1 : 1);
|
||||
serieData.context.labelPosition = new Vector3(x1, y1);
|
||||
var newPos = new Vector3(x1, y1);
|
||||
serieData.context.labelPosition = newPos;
|
||||
var angle = ChartHelper.GetAngle360(Vector2.up, newPos - serie.context.center);
|
||||
if (angle >= 180 && angle <= 270)
|
||||
{
|
||||
serieData.context.labelPosition = new Vector3(isLeft?(++lastX): (--lastX), y1);
|
||||
}
|
||||
else if (angle < 180 && angle >= 90)
|
||||
{
|
||||
serieData.context.labelPosition = new Vector3(isLeft?(++lastX): (--lastX), y1);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastX = x1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lastX = serieData.context.labelPosition.x;
|
||||
}
|
||||
lastCheckPos = serieData.context.labelPosition;
|
||||
serieData.labelObject.SetPosition(SerieLabelHelper.GetRealLabelPosition(serie, serieData, serieLabel, labelLine));
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b81cddd3452545748563f9c6ea9be69
|
||||
guid: 654a13ef33a064e4fbf078742f397b20
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -80,6 +80,8 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private List<string> m_Data = new List<string>();
|
||||
[SerializeField] private List<Sprite> m_Icons = new List<Sprite>();
|
||||
[SerializeField] private List<Color> m_Colors = new List<Color>();
|
||||
[SerializeField][Since("v3.1.0")] protected ImageStyle m_Background = new ImageStyle() { show = false };
|
||||
[SerializeField][Since("v3.1.0")] protected Padding m_Padding = new Padding();
|
||||
|
||||
public LegendContext context = new LegendContext();
|
||||
|
||||
@@ -95,7 +97,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// Type of legend.
|
||||
/// |图例类型。
|
||||
/// [default:Type.Auto]
|
||||
/// </summary>
|
||||
public Type iconType
|
||||
{
|
||||
@@ -105,7 +106,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
|
||||
/// |选择模式。控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
|
||||
/// [default:SelectedMode.Multiple]
|
||||
/// </summary>
|
||||
public SelectedMode selectedMode
|
||||
{
|
||||
@@ -115,7 +115,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// Specify whether the layout of legend component is horizontal or vertical.
|
||||
/// |布局方式是横还是竖。
|
||||
/// [default:Orient.Horizonal]
|
||||
/// </summary>
|
||||
public Orient orient
|
||||
{
|
||||
@@ -125,7 +124,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// The location of legend.
|
||||
/// |图例显示的位置。
|
||||
/// [default:Location.defaultTop]
|
||||
/// </summary>
|
||||
public Location location
|
||||
{
|
||||
@@ -135,7 +133,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// Image width of legend symbol.
|
||||
/// |图例标记的图形宽度。
|
||||
/// [default:24f]
|
||||
/// </summary>
|
||||
public float itemWidth
|
||||
{
|
||||
@@ -145,7 +142,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// Image height of legend symbol.
|
||||
/// |图例标记的图形高度。
|
||||
/// [default:12f]
|
||||
/// </summary>
|
||||
public float itemHeight
|
||||
{
|
||||
@@ -155,7 +151,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout.
|
||||
/// |图例每项之间的间隔。横向布局时为水平间隔,纵向布局时为纵向间隔。
|
||||
/// [default:10f]
|
||||
/// </summary>
|
||||
public float itemGap
|
||||
{
|
||||
@@ -165,7 +160,6 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// Whether the legend symbol matches the color automatically.
|
||||
/// |图例标记的图形是否自动匹配颜色。
|
||||
/// [default:true]
|
||||
/// </summary>
|
||||
public bool itemAutoColor
|
||||
{
|
||||
@@ -187,7 +181,6 @@ namespace XCharts.Runtime
|
||||
/// 使用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; }
|
||||
@@ -213,9 +206,27 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sytle of background.
|
||||
/// |背景图样式。
|
||||
/// </summary>
|
||||
public ImageStyle background
|
||||
{
|
||||
get { return m_Background; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Background, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the paddinng of item and background.
|
||||
/// |图例标记和背景的间距。
|
||||
/// </summary>
|
||||
public Padding padding
|
||||
{
|
||||
get { return m_Padding; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Padding, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// If data is not specified, it will be auto collected from series.
|
||||
/// |图例的数据数组。数组项通常为一个字符串,每一项代表一个系列的 name(如果是饼图,也可以是饼图单个数据的 name)。
|
||||
/// 如果 data 没有被指定,会自动从当前系列中获取。指定data时里面的数据项和serie匹配时才会生效。
|
||||
/// </summary>
|
||||
@@ -234,7 +245,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the colors of legend item.
|
||||
/// 图例标记的颜色列表。
|
||||
/// |图例标记的颜色列表。
|
||||
/// </summary>
|
||||
public List<Color> colors
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
@@ -14,6 +15,7 @@ namespace XCharts.Runtime
|
||||
/// 运行时图例的总高度
|
||||
/// </summary>
|
||||
public float height { get; internal set; }
|
||||
public Vector2 center { get; internal set; }
|
||||
/// <summary>
|
||||
/// the button list of legend.
|
||||
/// |图例按钮列表。
|
||||
@@ -27,5 +29,6 @@ namespace XCharts.Runtime
|
||||
/// 单列高度
|
||||
/// </summary>
|
||||
internal float eachHeight { get; set; }
|
||||
public Image background { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,9 @@ namespace XCharts.Runtime
|
||||
legend.gameObject = legendObject;
|
||||
legendObject.hideFlags = chart.chartHideFlags;
|
||||
SeriesHelper.UpdateSerieNameList(chart, ref chart.m_LegendRealShowName);
|
||||
legend.context.background = ChartHelper.AddIcon("background", legendObject.transform, 0, 0);
|
||||
legend.context.background.transform.SetSiblingIndex(0);
|
||||
ChartHelper.SetBackground(legend.context.background, legend.background);
|
||||
List<string> datas;
|
||||
if (legend.show && legend.data.Count > 0)
|
||||
{
|
||||
|
||||
@@ -48,10 +48,11 @@ namespace XCharts.Runtime
|
||||
var objAnchorMin = new Vector2(0, 1);
|
||||
var objAnchorMax = new Vector2(0, 1);
|
||||
var objPivot = new Vector2(0, 1);
|
||||
var btnObj = ChartHelper.AddObject(objName, parent, objAnchorMin, objAnchorMax, objPivot, sizeDelta, i);
|
||||
var btnObj = ChartHelper.AddObject(objName, parent, objAnchorMin, objAnchorMax, objPivot, sizeDelta);
|
||||
var iconObj = ChartHelper.AddObject("icon", btnObj.transform, anchorMin, anchorMax, pivot, iconSizeDelta);
|
||||
var img = ChartHelper.GetOrAddComponent<Image>(btnObj);
|
||||
img.color = Color.clear;
|
||||
img.raycastTarget = true;
|
||||
ChartHelper.GetOrAddComponent<Button>(btnObj);
|
||||
ChartHelper.GetOrAddComponent<Image>(iconObj);
|
||||
|
||||
@@ -69,9 +70,22 @@ namespace XCharts.Runtime
|
||||
item.SetIconImage(legend.GetIcon(i));
|
||||
item.SetContentPosition(legend.labelStyle.offset);
|
||||
item.SetContent(content);
|
||||
//item.SetBackground(legend.background);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static void SetLegendBackground(Legend legend, ImageStyle style)
|
||||
{
|
||||
var background = legend.context.background;
|
||||
if (background == null) return;
|
||||
ChartHelper.SetActive(background, style.show);
|
||||
if (!style.show) return;
|
||||
var rect = background.gameObject.GetComponent<RectTransform>();
|
||||
rect.localPosition = legend.context.center;
|
||||
rect.sizeDelta = new Vector2(legend.context.width, legend.context.height);
|
||||
ChartHelper.SetBackground(background, style);
|
||||
}
|
||||
|
||||
public static void ResetItemPosition(Legend legend, Vector3 chartPos, float chartWidth, float chartHeight)
|
||||
{
|
||||
legend.location.UpdateRuntimeData(chartWidth, chartHeight);
|
||||
@@ -122,8 +136,19 @@ namespace XCharts.Runtime
|
||||
startY = chartPos.y + legendRuntimeHeight + legend.location.runtimeBottom;
|
||||
break;
|
||||
}
|
||||
if (!legend.padding.show)
|
||||
{
|
||||
legend.context.center = new Vector2(startX + legend.context.width / 2, startY - legend.context.height / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
legend.context.center = new Vector2(startX + legend.context.width / 2 - legend.padding.left,
|
||||
startY - legend.context.height / 2 + legend.padding.top);
|
||||
}
|
||||
|
||||
if (isVertical) SetVerticalItemPosition(legend, legendMaxHeight, startX, startY);
|
||||
else SetHorizonalItemPosition(legend, legendMaxWidth, startX, startY);
|
||||
SetLegendBackground(legend, legend.background);
|
||||
}
|
||||
|
||||
private static void SetVerticalItemPosition(Legend legend, float legendMaxHeight, float startX, float startY)
|
||||
@@ -214,6 +239,11 @@ namespace XCharts.Runtime
|
||||
legend.context.height = realHeight > 0 ? realHeight : height;
|
||||
legend.context.width = realWidth + width;
|
||||
}
|
||||
if (legend.padding.show)
|
||||
{
|
||||
legend.context.width += legend.padding.left + legend.padding.right;
|
||||
legend.context.height += legend.padding.top + legend.padding.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsBeyondWidth(Legend legend, float maxWidth)
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void InitMarkArea(MarkArea markArea)
|
||||
{
|
||||
markArea.painter = chart.m_PainterTop;
|
||||
markArea.painter = chart.m_PainterUpper;
|
||||
markArea.refreshComponent = delegate()
|
||||
{
|
||||
var label = ChartHelper.AddChartLabel("label", m_MarkLineLabelRoot.transform, markArea.label, chart.theme.axis,
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace XCharts.Runtime
|
||||
InitMarkLine(component);
|
||||
}
|
||||
|
||||
public override void DrawTop(VertexHelper vh)
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
DrawMarkLine(vh, component);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void InitMarkLineLabel(Serie serie, MarkLineData data, Color serieColor)
|
||||
{
|
||||
data.painter = chart.m_PainterTop;
|
||||
data.painter = chart.m_PainterUpper;
|
||||
data.refreshComponent = delegate()
|
||||
{
|
||||
var textName = string.Format("markLine_{0}_{1}", serie.index, data.index);
|
||||
|
||||
@@ -8,18 +8,19 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var serieLabel = data.label;
|
||||
var numericFormatter = serieLabel.numericFormatter;
|
||||
if (serieLabel.formatterFunction != null)
|
||||
{
|
||||
return serieLabel.formatterFunction(data.index, data.runtimeValue, null);
|
||||
}
|
||||
if (string.IsNullOrEmpty(serieLabel.formatter))
|
||||
return ChartCached.NumberToStr(data.runtimeValue, numericFormatter);
|
||||
{
|
||||
var content = ChartCached.NumberToStr(data.runtimeValue, numericFormatter);
|
||||
return serieLabel.formatterFunction == null? content:
|
||||
serieLabel.formatterFunction(data.index, data.runtimeValue, null, content);
|
||||
}
|
||||
else
|
||||
{
|
||||
var content = serieLabel.formatter;
|
||||
FormatterHelper.ReplaceSerieLabelContent(ref content, numericFormatter, serie.dataCount, data.runtimeValue,
|
||||
0, serie.serieName, data.name, data.name, Color.clear);
|
||||
return content;
|
||||
0, serie.serieName, data.name, data.name, Color.clear, null);
|
||||
return serieLabel.formatterFunction == null? content:
|
||||
serieLabel.formatterFunction(data.index, data.runtimeValue, null, content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace XCharts.Runtime
|
||||
/// The name of indicator.
|
||||
/// |指示器名称。
|
||||
/// </summary>
|
||||
public string name { get { return FormatterHelper.TrimAndReplaceLine(m_Name); } set { m_Name = value; } }
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
/// <summary>
|
||||
/// The maximum value of indicator, with default value of 0, but we recommend to set it manually.
|
||||
/// |指示器的最大值,默认为 0 无限制。
|
||||
@@ -103,7 +103,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private bool m_Indicator = true;
|
||||
[SerializeField] private PositionType m_PositionType = PositionType.Vertice;
|
||||
[SerializeField] private float m_IndicatorGap = 10;
|
||||
[SerializeField] private int m_CeilRate = 0;
|
||||
[SerializeField] private double m_CeilRate = 0;
|
||||
[SerializeField] private bool m_IsAxisTooltip;
|
||||
[SerializeField] private Color32 m_OutRangeColor = Color.red;
|
||||
[SerializeField] private bool m_ConnectCenter = false;
|
||||
@@ -214,7 +214,7 @@ namespace XCharts.Runtime
|
||||
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
|
||||
/// |最大最小值向上取整的倍率。默认为0时自动计算。
|
||||
/// </summary>
|
||||
public int ceilRate
|
||||
public double ceilRate
|
||||
{
|
||||
get { return m_CeilRate; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_CeilRate, value < 0 ? 0 : value)) SetAllDirty(); }
|
||||
|
||||
@@ -15,13 +15,15 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected bool m_ReversePainter = false;
|
||||
[SerializeField] protected Material m_BasePainterMaterial;
|
||||
[SerializeField] protected Material m_SeriePainterMaterial;
|
||||
[SerializeField] protected Material m_UpperPainterMaterial;
|
||||
[SerializeField] protected Material m_TopPainterMaterial;
|
||||
[SerializeField][Range(1, 10)] protected float m_LineSmoothStyle = 3f;
|
||||
[SerializeField][Range(1, 10)] protected float m_LineSmoothStyle = 2.5f;
|
||||
[SerializeField][Range(1f, 20)] protected float m_LineSmoothness = 2f;
|
||||
[SerializeField][Range(0.5f, 20)] protected float m_LineSegmentDistance = 3f;
|
||||
[SerializeField][Range(1, 10)] protected float m_CicleSmoothness = 2f;
|
||||
[SerializeField] protected float m_LegendIconLineWidth = 2;
|
||||
[SerializeField] private float[] m_LegendIconCornerRadius = new float[] { 0.25f, 0.25f, 0.25f, 0.25f };
|
||||
[SerializeField][Since("v3.1.0")] protected float m_AxisMaxSplitNumber = 50;
|
||||
|
||||
public bool show { get { return m_Show; } }
|
||||
/// <summary>
|
||||
@@ -58,7 +60,7 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetClass(ref m_SeriePainterMaterial, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Top Pointer 材质球,设置后会影响Tooltip等。
|
||||
/// Top Pointer 材质球。
|
||||
/// </summary>
|
||||
public Material topPainterMaterial
|
||||
{
|
||||
@@ -66,6 +68,14 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetClass(ref m_TopPainterMaterial, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Upper Pointer 材质球。
|
||||
/// </summary>
|
||||
public Material upperPainterMaterial
|
||||
{
|
||||
get { return m_UpperPainterMaterial; }
|
||||
set { if (PropertyUtil.SetClass(ref m_UpperPainterMaterial, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Curve smoothing factor. By adjusting the smoothing coefficient, the curvature of the curve can be changed,
|
||||
/// and different curves with slightly different appearance can be obtained.
|
||||
/// |曲线平滑系数。通过调整平滑系数可以改变曲线的曲率,得到外观稍微有变化的不同曲线。
|
||||
@@ -128,12 +138,23 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetClass(ref m_LegendIconCornerRadius, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the max splitnumber of axis.
|
||||
/// |坐标轴最大分隔段数。段数过大时可能会生成较多的label节点。
|
||||
/// </summary>
|
||||
public float axisMaxSplitNumber
|
||||
{
|
||||
get { return m_AxisMaxSplitNumber; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AxisMaxSplitNumber, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public void Copy(Settings settings)
|
||||
{
|
||||
m_ReversePainter = settings.reversePainter;
|
||||
m_MaxPainter = settings.maxPainter;
|
||||
m_BasePainterMaterial = settings.basePainterMaterial;
|
||||
m_SeriePainterMaterial = settings.seriePainterMaterial;
|
||||
m_UpperPainterMaterial = settings.upperPainterMaterial;
|
||||
m_TopPainterMaterial = settings.topPainterMaterial;
|
||||
m_LineSmoothStyle = settings.lineSmoothStyle;
|
||||
m_LineSmoothness = settings.lineSmoothness;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace XCharts.Runtime
|
||||
var titleObject = ChartHelper.AddObject(objName, chart.transform, anchorMin, anchorMax,
|
||||
pivot, chart.chartSizeDelta);
|
||||
title.gameObject = titleObject;
|
||||
title.gameObject.transform.SetSiblingIndex(chart.m_PainterTop.transform.GetSiblingIndex() + 1);
|
||||
title.gameObject.transform.SetSiblingIndex(chart.m_PainterUpper.transform.GetSiblingIndex() + 1);
|
||||
anchorMin = title.location.runtimeAnchorMin;
|
||||
anchorMax = title.location.runtimeAnchorMax;
|
||||
pivot = title.location.runtimePivot;
|
||||
|
||||
@@ -140,7 +140,23 @@ namespace XCharts.Runtime
|
||||
/// The placeholder {I} can be set separately to indicate that the title is ignored and not displayed.
|
||||
/// Template see itemFormatter.
|
||||
/// |提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。
|
||||
/// 模板变量参考Toolip的itemFormatter。
|
||||
/// 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。</br>
|
||||
/// {.}为当前所指示或index为0的serie的对应颜色的圆点。</br>
|
||||
/// {a}为当前所指示或index为0的serie的系列名name。</br>
|
||||
/// {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。</br>
|
||||
/// {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。</br>
|
||||
/// {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。</br>
|
||||
/// {e}为当前所指示或index为0的serie的数据项serieData的name。</br>
|
||||
/// {f}为数据总和。</br>
|
||||
/// {g}为数据总个数。</br>
|
||||
/// {.1}表示指定index为1的serie对应颜色的圆点。</br>
|
||||
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie。</br>
|
||||
/// {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。</br>
|
||||
/// {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。</br>
|
||||
/// {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。</br>
|
||||
/// {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。</br>
|
||||
/// 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public string titleFormatter { get { return m_TitleFormatter; } set { m_TitleFormatter = value; } }
|
||||
/// <summary>
|
||||
@@ -160,22 +176,21 @@ namespace XCharts.Runtime
|
||||
/// {d1:2: F2} indicates that a formatted string with a value specified separately is F2 (numericFormatter is used when numericFormatter is not specified).</br>
|
||||
/// {d:0.##} indicates that a formatted string with a value specified separately is 0.## (used for percentage, reserved 2 valid digits while avoiding the situation similar to "100.00%" when using f2 ).</br>
|
||||
/// Example: "{a}, {c}", "{a1}, {c1: f1}", "{a1}, {c1:0: f1}", "{a1} : {c1:1-1: f1}"</br>
|
||||
/// |提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。
|
||||
/// 模板变量有{.}、{a}、{b}、{c}、{d}、{e}。</br>
|
||||
/// {.}为当前所指示或index为0的serie的对应颜色的圆点。</br>
|
||||
/// {a}为当前所指示或index为0的serie的系列名name。</br>
|
||||
/// {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。</br>
|
||||
/// {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。</br>
|
||||
/// {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。</br>
|
||||
/// {e}为当前所指示或index为0的serie的数据项serieData的name。</br>
|
||||
/// {f}为数据总和。</br>
|
||||
/// {.1}表示指定index为1的serie对应颜色的圆点。</br>
|
||||
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie。</br>
|
||||
/// {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。</br>
|
||||
/// {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。</br>
|
||||
/// {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。</br>
|
||||
/// {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。</br>
|
||||
/// 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|
||||
/// |提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。
|
||||
/// 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。</br>
|
||||
/// {i}或-表示忽略当前项。
|
||||
/// {.}为当前所指示的serie或数据项的对应颜色的圆点。</br>
|
||||
/// {a}为当前所指示的serie或数据项的系列名name。</br>
|
||||
/// {b}为当前所指示的serie或数据项的数据项serieData的name,或者类目值(如折线图的X轴)。</br>
|
||||
/// {c}为当前所指示的serie或数据项的y维(dimesion为1)的数值。</br>
|
||||
/// {d}为当前所指示的serie或数据项的y维(dimesion为1)百分比值,注意不带%号。</br>
|
||||
/// {e}为当前所指示的serie或数据项的数据项serieData的name。</br>
|
||||
/// {f}为当前所指示的serie的默认维度的数据总和。</br>
|
||||
/// {g}为当前所指示的serie的数据总个数。</br>
|
||||
/// {c0}表示当前数据项维度为0的数据。</br>
|
||||
/// {c1}表示当前数据项维度为1的数据。</br>
|
||||
/// |表示多个列的分隔。<br>
|
||||
/// 示例:"{i}", "{.}|{a}|{c}", "{.}|{b}|{c2:f2}"
|
||||
/// </summary>
|
||||
public string itemFormatter { get { return m_ItemFormatter; } set { m_ItemFormatter = value; } }
|
||||
/// <summary>
|
||||
|
||||
@@ -26,14 +26,14 @@ namespace XCharts.Runtime
|
||||
component.view.Update();
|
||||
}
|
||||
|
||||
public override void DrawTop(VertexHelper vh)
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
DrawTooltipIndicator(vh, component);
|
||||
}
|
||||
|
||||
private void InitTooltip(Tooltip tooltip)
|
||||
{
|
||||
tooltip.painter = chart.m_PainterTop;
|
||||
tooltip.painter = chart.m_PainterUpper;
|
||||
tooltip.refreshComponent = delegate()
|
||||
{
|
||||
var objName = ChartCached.GetComponentObjectName(tooltip);
|
||||
@@ -126,7 +126,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.RefreshTopPainter();
|
||||
chart.RefreshUpperPainter();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ namespace XCharts.Runtime
|
||||
private ISerieContainer GetPointerContainerAndSeries(Tooltip tooltip, List<Serie> list)
|
||||
{
|
||||
list.Clear();
|
||||
ISerieContainer target = null;
|
||||
for (int i = chart.components.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var component = chart.components[i];
|
||||
@@ -210,14 +211,14 @@ namespace XCharts.Runtime
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
if (serie is INeedSerieContainer &&
|
||||
(serie as INeedSerieContainer).containterInstanceId == component.instanceId)
|
||||
(serie as INeedSerieContainer).containterInstanceId == component.instanceId &&
|
||||
!serie.placeHolder)
|
||||
{
|
||||
var isTriggerAxis = tooltip.IsTriggerAxis();
|
||||
if (container is GridCoord)
|
||||
{
|
||||
var xAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
var yAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
serie.context.pointerEnter = true;
|
||||
UpdateAxisPointerDataIndex(serie, xAxis, yAxis, container as GridCoord, isTriggerAxis);
|
||||
}
|
||||
else if (container is PolarCoord)
|
||||
@@ -230,11 +231,11 @@ namespace XCharts.Runtime
|
||||
chart.RefreshTopPainter();
|
||||
}
|
||||
}
|
||||
return container;
|
||||
target = container;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return target;
|
||||
}
|
||||
|
||||
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
||||
@@ -242,11 +243,16 @@ namespace XCharts.Runtime
|
||||
serie.context.pointerAxisDataIndexs.Clear();
|
||||
if (yAxis.IsCategory())
|
||||
{
|
||||
serie.context.pointerAxisDataIndexs.Add((int) yAxis.context.pointerValue);
|
||||
yAxis.context.axisTooltipValue = yAxis.context.pointerValue;
|
||||
if (isTriggerAxis)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerAxisDataIndexs.Add((int) yAxis.context.pointerValue);
|
||||
yAxis.context.axisTooltipValue = yAxis.context.pointerValue;
|
||||
}
|
||||
}
|
||||
else if (yAxis.IsTime())
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
if (isTriggerAxis)
|
||||
GetSerieDataIndexByAxis(serie, yAxis, grid);
|
||||
else
|
||||
@@ -254,11 +260,16 @@ namespace XCharts.Runtime
|
||||
}
|
||||
else if (xAxis.IsCategory())
|
||||
{
|
||||
serie.context.pointerAxisDataIndexs.Add((int) xAxis.context.pointerValue);
|
||||
xAxis.context.axisTooltipValue = xAxis.context.pointerValue;
|
||||
if (isTriggerAxis)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerAxisDataIndexs.Add(serie.context.dataZoomStartIndex + (int) xAxis.context.pointerValue);
|
||||
xAxis.context.axisTooltipValue = xAxis.context.pointerValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
if (isTriggerAxis)
|
||||
GetSerieDataIndexByAxis(serie, xAxis, grid);
|
||||
else
|
||||
@@ -436,7 +447,7 @@ namespace XCharts.Runtime
|
||||
var axis = component as Axis;
|
||||
if (axis.gridIndex == gridIndex && axis.IsCategory())
|
||||
{
|
||||
dataIndex = (int) axis.context.pointerValue;
|
||||
dataIndex = axis.context.dataZoomStartIndex + (int) axis.context.pointerValue;
|
||||
category = axis.GetData(dataIndex);
|
||||
return true;
|
||||
}
|
||||
@@ -449,6 +460,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!tooltip.show) return;
|
||||
if (tooltip.type == Tooltip.Type.None) return;
|
||||
if (!IsAnySerieNeedTooltip()) return;
|
||||
if (m_PointerContainer is GridCoord)
|
||||
{
|
||||
var grid = m_PointerContainer as GridCoord;
|
||||
@@ -477,6 +489,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void DrawXAxisIndicator(VertexHelper vh, Tooltip tooltip, GridCoord grid)
|
||||
{
|
||||
|
||||
var xAxes = chart.GetChartComponents<XAxis>();
|
||||
var lineType = tooltip.lineStyle.GetType(chart.theme.tooltip.lineType);
|
||||
var lineWidth = tooltip.lineStyle.GetWidth(chart.theme.tooltip.lineWidth);
|
||||
@@ -485,6 +498,8 @@ namespace XCharts.Runtime
|
||||
var xAxis = component as XAxis;
|
||||
if (xAxis.gridIndex == grid.index)
|
||||
{
|
||||
if (double.IsInfinity(xAxis.context.pointerValue))
|
||||
continue;
|
||||
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
|
||||
int dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
|
||||
float splitWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, dataCount, dataZoom);
|
||||
@@ -499,22 +514,7 @@ namespace XCharts.Runtime
|
||||
Vector2 sp = new Vector2(pX, grid.context.y);
|
||||
Vector2 ep = new Vector2(pX, grid.context.y + grid.context.height);
|
||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme);
|
||||
// if (xAxis.IsCategory() && tooltip.type == Tooltip.Type.Corss)
|
||||
// {
|
||||
// float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
||||
// pX = (float)(grid.context.x + splitWidth * xAxis.context.pointerValue -
|
||||
// (xAxis.boundaryGap ? 0 : splitWidth / 2));
|
||||
// float pY = grid.context.y + grid.context.height;
|
||||
// Vector3 p1 = new Vector3(pX, grid.context.y);
|
||||
// Vector3 p2 = new Vector3(pX, pY);
|
||||
// Vector3 p3 = new Vector3(pX + tooltipSplitWid, pY);
|
||||
// Vector3 p4 = new Vector3(pX + tooltipSplitWid, grid.context.y);
|
||||
// UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, chart.theme.tooltip.areaColor);
|
||||
// }
|
||||
// else
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||
}
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||
if (tooltip.type == Tooltip.Type.Corss)
|
||||
{
|
||||
sp = new Vector2(grid.context.x, chart.pointerPos.y);
|
||||
@@ -523,7 +523,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
break;
|
||||
case Tooltip.Type.Shadow:
|
||||
if (xAxis.IsCategory())
|
||||
if (xAxis.IsCategory() && !double.IsInfinity(xAxis.context.pointerValue))
|
||||
{
|
||||
float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
||||
pX = (float) (grid.context.x + splitWidth * xAxis.context.pointerValue -
|
||||
@@ -540,17 +540,27 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsAnySerieNeedTooltip()
|
||||
{
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
if (serie.context.pointerEnter) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private void DrawYAxisIndicator(VertexHelper vh, Tooltip tooltip, GridCoord grid)
|
||||
{
|
||||
var yAxes = chart.GetChartComponents<YAxis>();
|
||||
var lineType = tooltip.lineStyle.GetType(chart.theme.tooltip.lineType);
|
||||
var lineWidth = tooltip.lineStyle.GetWidth(chart.theme.tooltip.lineWidth);
|
||||
|
||||
foreach (var component in yAxes)
|
||||
{
|
||||
var yAxis = component as YAxis;
|
||||
if (yAxis.gridIndex == grid.index)
|
||||
{
|
||||
if (double.IsInfinity(yAxis.context.pointerValue))
|
||||
continue;
|
||||
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
|
||||
int dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
|
||||
float splitWidth = AxisHelper.GetDataWidth(yAxis, grid.context.height, dataCount, dataZoom);
|
||||
@@ -563,22 +573,7 @@ namespace XCharts.Runtime
|
||||
Vector2 sp = new Vector2(grid.context.x, pY);
|
||||
Vector2 ep = new Vector2(grid.context.x + grid.context.width, pY);
|
||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme);
|
||||
// if (yAxis.IsCategory() && tooltip.type == Tooltip.Type.Corss)
|
||||
// {
|
||||
// float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
||||
// float pX = grid.context.x + grid.context.width;
|
||||
// pY = (float)(grid.context.y + splitWidth * yAxis.context.pointerValue -
|
||||
// (yAxis.boundaryGap ? 0 : splitWidth / 2));
|
||||
// Vector3 p1 = new Vector3(grid.context.x, pY);
|
||||
// Vector3 p2 = new Vector3(grid.context.x, pY + tooltipSplitWid);
|
||||
// Vector3 p3 = new Vector3(pX, pY + tooltipSplitWid);
|
||||
// Vector3 p4 = new Vector3(pX, pY);
|
||||
// UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, chart.theme.tooltip.areaColor);
|
||||
// }
|
||||
// else
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||
}
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||
if (tooltip.type == Tooltip.Type.Corss)
|
||||
{
|
||||
sp = new Vector2(chart.pointerPos.x, grid.context.y);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tooltip.titleFormatter))
|
||||
{
|
||||
if (tooltip.titleFormatter.Equals("{i}", StringComparison.CurrentCultureIgnoreCase))
|
||||
if (IsIgnoreFormatter(tooltip.titleFormatter))
|
||||
{
|
||||
tooltip.context.data.title = string.Empty;
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace XCharts.Runtime
|
||||
for (int i = tooltip.context.data.param.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var param = tooltip.context.data.param[i];
|
||||
if (TooltipHelper.IsIgnoreItemFormatter(param.itemFormatter))
|
||||
if (IsIgnoreFormatter(param.itemFormatter))
|
||||
{
|
||||
tooltip.context.data.param.RemoveAt(i);
|
||||
}
|
||||
@@ -42,7 +42,8 @@ namespace XCharts.Runtime
|
||||
param.serieName,
|
||||
param.category,
|
||||
param.serieData.name,
|
||||
param.color);
|
||||
param.color,
|
||||
param.serieData);
|
||||
foreach (var item in content.Split('|'))
|
||||
{
|
||||
param.columns.Add(item);
|
||||
@@ -51,9 +52,9 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsIgnoreItemFormatter(string itemFormatter)
|
||||
public static bool IsIgnoreFormatter(string itemFormatter)
|
||||
{
|
||||
return "-".Equals(itemFormatter);
|
||||
return "-".Equals(itemFormatter) ||"{i}".Equals(itemFormatter, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public static void LimitInRect(Tooltip tooltip, Rect chartRect)
|
||||
@@ -64,13 +65,18 @@ namespace XCharts.Runtime
|
||||
var pos = tooltip.view.GetTargetPos();
|
||||
if (pos.x + tooltip.context.width > chartRect.x + chartRect.width)
|
||||
{
|
||||
//pos.x = chartRect.x + chartRect.width - tooltip.context.width;
|
||||
pos.x = pos.x - tooltip.context.width - tooltip.offset.x;
|
||||
pos.x = tooltip.context.pointer.x - tooltip.context.width - tooltip.offset.x;
|
||||
}
|
||||
else if (pos.x < chartRect.x)
|
||||
{
|
||||
pos.x = tooltip.context.pointer.x - tooltip.context.width + Mathf.Abs(tooltip.offset.x);
|
||||
}
|
||||
if (pos.y - tooltip.context.height < chartRect.y)
|
||||
{
|
||||
pos.y = chartRect.y + tooltip.context.height;
|
||||
}
|
||||
if (pos.y > chartRect.y + chartRect.height)
|
||||
pos.y = chartRect.y + chartRect.height;
|
||||
tooltip.UpdateContentPos(pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,11 @@ namespace XCharts.Runtime
|
||||
{
|
||||
m_Active = flag && tooltip.showContent;
|
||||
ChartHelper.SetActive(gameObject, m_Active);
|
||||
if (!flag)
|
||||
{
|
||||
foreach (var item in m_Items)
|
||||
item.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace XCharts.Runtime
|
||||
DrawCoord(vh, component);
|
||||
}
|
||||
}
|
||||
public override void DrawTop(VertexHelper vh)
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
if (SeriesHelper.IsAnyClipSerie(chart.series))
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace XCharts.Runtime
|
||||
DrawCoord(vh);
|
||||
}
|
||||
}
|
||||
public override void DrawTop(VertexHelper vh)
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
if (SeriesHelper.IsAnyClipSerie(chart.series))
|
||||
{
|
||||
@@ -165,7 +165,7 @@ namespace XCharts.Runtime
|
||||
axis.context.offset = 0;
|
||||
axis.context.lastCheckInverse = axis.inverse;
|
||||
|
||||
AxisHandler<ParallelAxis>.UpdateAxisTickValueList(axis);
|
||||
(axis.handler as ParallelAxisHander).UpdateAxisTickValueList(axis);
|
||||
(axis.handler as ParallelAxisHander).UpdateAxisLabelText(axis);
|
||||
chart.RefreshChart();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace XCharts.Runtime
|
||||
private static Regex s_RegexNewLine = new Regex(@"[\\|/]+n|</br>|<br>|<br/>", RegexOptions.IgnoreCase);
|
||||
private static Regex s_RegexForAxisLabel = new Regex(@"{value(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
||||
private static Regex s_RegexSubForAxisLabel = new Regex(@"(value)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
||||
private static Regex s_RegexForSerieLabel = new Regex(@"{[a-g|\.](:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
||||
private static Regex s_RegexSubForSerieLabel = new Regex(@"(\.)|([a-g])|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
||||
private static Regex s_RegexForSerieLabel = new Regex(@"{[a-g|\.]\d*(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
||||
private static Regex s_RegexSubForSerieLabel = new Regex(@"(\.)|([a-g]\d*)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
||||
|
||||
public static bool NeedFormat(string content)
|
||||
{
|
||||
@@ -167,7 +167,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public static void ReplaceSerieLabelContent(ref string content, string numericFormatter, int dataCount, double value, double total,
|
||||
string serieName, string category, string dataName, Color color)
|
||||
string serieName, string category, string dataName, Color color, SerieData serieData)
|
||||
{
|
||||
var mc = s_RegexForSerieLabel.Matches(content);
|
||||
foreach (var m in mc)
|
||||
@@ -176,7 +176,13 @@ namespace XCharts.Runtime
|
||||
var args = s_RegexSubForSerieLabel.Matches(old);
|
||||
var argsCount = args.Count;
|
||||
if (argsCount <= 0) continue;
|
||||
var p = args[0].ToString().ElementAt(0);
|
||||
var pstr = args[0].ToString();
|
||||
var p = pstr.ElementAt(0);
|
||||
var pIndex = -1;
|
||||
if (pstr.Length > 1)
|
||||
{
|
||||
int.TryParse(pstr.Substring(1, pstr.Length - 1), out pIndex);
|
||||
}
|
||||
if (argsCount >= 2)
|
||||
{
|
||||
numericFormatter = args[1].ToString();
|
||||
@@ -204,7 +210,10 @@ namespace XCharts.Runtime
|
||||
}
|
||||
else if (p == 'c' || p == 'C')
|
||||
{
|
||||
content = content.Replace(old, ChartCached.NumberToStr(value, numericFormatter));
|
||||
if (pIndex >= 0 && serieData != null)
|
||||
content = content.Replace(old, ChartCached.NumberToStr(serieData.GetData(pIndex), numericFormatter));
|
||||
else
|
||||
content = content.Replace(old, ChartCached.NumberToStr(value, numericFormatter));
|
||||
}
|
||||
else if (p == 'f' || p == 'f')
|
||||
{
|
||||
|
||||
15
Runtime/Internal/Attributes/SinceAttribute.cs
Normal file
15
Runtime/Internal/Attributes/SinceAttribute.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
|
||||
public class Since : Attribute
|
||||
{
|
||||
public readonly string version;
|
||||
|
||||
public Since(string version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Internal/Attributes/SinceAttribute.cs.meta
Normal file
11
Runtime/Internal/Attributes/SinceAttribute.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04c4c3fba4de2404d9c715eeff4a707c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -84,7 +84,11 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public Action<VertexHelper, Serie> onDrawAfterSerie { set { m_OnDrawSerieAfter = value; } }
|
||||
/// <summary>
|
||||
/// 自定义Top绘制回调。在绘制Tooltip前调用。
|
||||
/// 自定义Upper层绘制回调。在绘制Tooltip前调用。
|
||||
/// </summary>
|
||||
public Action<VertexHelper> onDrawUpper { set { m_OnDrawUpper = value; } }
|
||||
/// <summary>
|
||||
/// 自定义Top层绘制回调。在绘制Tooltip前调用。
|
||||
/// </summary>
|
||||
public Action<VertexHelper> onDrawTop { set { m_OnDrawTop = value; } }
|
||||
/// <summary>
|
||||
@@ -143,6 +147,7 @@ namespace XCharts.Runtime
|
||||
m_RefreshChart = true;
|
||||
if (m_Painter) m_Painter.Refresh();
|
||||
foreach (var painter in m_PainterList) painter.Refresh();
|
||||
if (m_PainterUpper) m_PainterUpper.Refresh();
|
||||
if (m_PainterTop) m_PainterTop.Refresh();
|
||||
}
|
||||
|
||||
@@ -507,6 +512,19 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置Upper Painter的材质球
|
||||
/// </summary>
|
||||
/// <param name="material"></param>
|
||||
public void SetUpperPainterMaterial(Material material)
|
||||
{
|
||||
settings.upperPainterMaterial = material;
|
||||
if (m_PainterUpper != null)
|
||||
{
|
||||
m_PainterUpper.material = material;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置Top Painter的材质球
|
||||
/// </summary>
|
||||
|
||||
@@ -423,5 +423,22 @@ namespace XCharts.Runtime
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal bool GetSerieGridCoordAxis(Serie serie, out Axis axis, out Axis relativedAxis)
|
||||
{
|
||||
var yAxis = GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
var isY = yAxis.IsCategory();
|
||||
if (isY)
|
||||
{
|
||||
axis = yAxis;
|
||||
relativedAxis = GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
relativedAxis = yAxis;
|
||||
}
|
||||
return isY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,14 @@ namespace XCharts.Runtime
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.serieName.Equals(serieName)) return serie;
|
||||
if (string.IsNullOrEmpty(serie.serieName))
|
||||
{
|
||||
if (string.IsNullOrEmpty(serieName)) return serie;
|
||||
}
|
||||
else if (serie.serieName.Equals(serieName))
|
||||
{
|
||||
return serie;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace XCharts.Runtime
|
||||
protected Action m_OnInit;
|
||||
protected Action m_OnUpdate;
|
||||
protected Action<VertexHelper> m_OnDrawBase;
|
||||
protected Action<VertexHelper> m_OnDrawUpper;
|
||||
protected Action<VertexHelper> m_OnDrawTop;
|
||||
protected Action<VertexHelper, Serie> m_OnDrawSerieBefore;
|
||||
protected Action<VertexHelper, Serie> m_OnDrawSerieAfter;
|
||||
@@ -96,8 +97,10 @@ namespace XCharts.Runtime
|
||||
internal bool m_CheckAnimation = false;
|
||||
internal protected List<string> m_LegendRealShowName = new List<string>();
|
||||
protected List<Painter> m_PainterList = new List<Painter>();
|
||||
internal Painter m_PainterUpper;
|
||||
internal Painter m_PainterTop;
|
||||
internal int m_BasePainterVertCount;
|
||||
internal int m_UpperPainterVertCount;
|
||||
internal int m_TopPainterVertCount;
|
||||
|
||||
private ThemeType m_CheckTheme = 0;
|
||||
@@ -201,6 +204,11 @@ namespace XCharts.Runtime
|
||||
m_PainterTop.Refresh();
|
||||
}
|
||||
|
||||
public void RefreshUpperPainter()
|
||||
{
|
||||
m_PainterUpper.Refresh();
|
||||
}
|
||||
|
||||
public void RefreshPainter(int index)
|
||||
{
|
||||
var painter = GetPainter(index);
|
||||
@@ -218,7 +226,7 @@ namespace XCharts.Runtime
|
||||
base.RefreshPainter(painter);
|
||||
if (painter != null && painter.type == Painter.Type.Serie)
|
||||
{
|
||||
m_PainterTop.Refresh();
|
||||
m_PainterUpper.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,9 +275,12 @@ namespace XCharts.Runtime
|
||||
if (component == null) return;
|
||||
if (component.anyDirty)
|
||||
{
|
||||
if (component.componentDirty && component.refreshComponent != null)
|
||||
if (component.componentDirty)
|
||||
{
|
||||
component.refreshComponent.Invoke();
|
||||
if (component.refreshComponent != null)
|
||||
component.refreshComponent.Invoke();
|
||||
else
|
||||
component.handler.InitComponent();
|
||||
}
|
||||
if (component.vertsDirty)
|
||||
{
|
||||
@@ -306,6 +317,10 @@ namespace XCharts.Runtime
|
||||
serie.index = i;
|
||||
SetPainterActive(i, true);
|
||||
}
|
||||
if (transform.childCount - 3 != m_PainterTop.transform.GetSiblingIndex())
|
||||
{
|
||||
m_PainterTop.transform.SetSiblingIndex(transform.childCount - 3);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InitPainter()
|
||||
@@ -328,6 +343,14 @@ namespace XCharts.Runtime
|
||||
painter.transform.SetSiblingIndex(index + 1);
|
||||
m_PainterList.Add(painter);
|
||||
}
|
||||
m_PainterUpper = ChartHelper.AddPainterObject("painter_u", transform, m_GraphMinAnchor,
|
||||
m_GraphMaxAnchor, m_GraphPivot, sizeDelta, chartHideFlags, 2 + settings.maxPainter);
|
||||
m_PainterUpper.type = Painter.Type.Top;
|
||||
m_PainterUpper.onPopulateMesh = OnDrawPainterUpper;
|
||||
m_PainterUpper.SetActive(true, m_DebugInfo.showAllChartObject);
|
||||
m_PainterUpper.material = settings.topPainterMaterial;
|
||||
m_PainterUpper.transform.SetSiblingIndex(settings.maxPainter + 1);
|
||||
|
||||
m_PainterTop = ChartHelper.AddPainterObject("painter_t", transform, m_GraphMinAnchor,
|
||||
m_GraphMaxAnchor, m_GraphPivot, sizeDelta, chartHideFlags, 2 + settings.maxPainter);
|
||||
m_PainterTop.type = Painter.Type.Top;
|
||||
@@ -372,6 +395,7 @@ namespace XCharts.Runtime
|
||||
if (m_Painter == null) return;
|
||||
m_Painter.CheckRefresh();
|
||||
foreach (var painter in m_PainterList) painter.CheckRefresh();
|
||||
if (m_PainterUpper != null) m_PainterUpper.CheckRefresh();
|
||||
if (m_PainterTop != null) m_PainterTop.CheckRefresh();
|
||||
}
|
||||
|
||||
@@ -543,6 +567,7 @@ namespace XCharts.Runtime
|
||||
var maxPainter = settings.maxPainter;
|
||||
var maxSeries = m_Series.Count;
|
||||
var rate = Mathf.CeilToInt(maxSeries * 1.0f / maxPainter);
|
||||
m_PainterUpper.Refresh();
|
||||
m_PainterTop.Refresh();
|
||||
m_DebugInfo.refreshCount++;
|
||||
for (int i = painter.index * rate; i < (painter.index + 1) * rate && i < maxSeries; i++)
|
||||
@@ -574,6 +599,18 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnDrawPainterUpper(VertexHelper vh, Painter painter)
|
||||
{
|
||||
vh.Clear();
|
||||
DrawPainterUpper(vh);
|
||||
foreach (var draw in m_ComponentHandlers) draw.DrawUpper(vh);
|
||||
if (m_OnDrawUpper != null)
|
||||
{
|
||||
m_OnDrawUpper(vh);
|
||||
}
|
||||
m_UpperPainterVertCount = vh.currentVertCount;
|
||||
}
|
||||
|
||||
protected virtual void OnDrawPainterTop(VertexHelper vh, Painter painter)
|
||||
{
|
||||
vh.Clear();
|
||||
@@ -588,6 +625,12 @@ namespace XCharts.Runtime
|
||||
|
||||
protected virtual void DrawPainterSerie(VertexHelper vh, Serie serie) { }
|
||||
|
||||
protected virtual void DrawPainterUpper(VertexHelper vh)
|
||||
{
|
||||
foreach (var handler in m_SerieHandlers)
|
||||
handler.DrawUpper(vh);
|
||||
}
|
||||
|
||||
protected virtual void DrawPainterTop(VertexHelper vh)
|
||||
{
|
||||
foreach (var handler in m_SerieHandlers)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace XCharts.Runtime
|
||||
[System.Serializable]
|
||||
public class MainComponent : IComparable
|
||||
{
|
||||
public int instanceId { get; internal set; }
|
||||
public int instanceId { get { return index; } }
|
||||
public int index { get; internal set; }
|
||||
protected bool m_VertsDirty;
|
||||
protected bool m_ComponentDirty;
|
||||
@@ -96,6 +96,7 @@ namespace XCharts.Runtime
|
||||
public virtual void CheckComponent(StringBuilder sb) { }
|
||||
public virtual void Update() { }
|
||||
public virtual void DrawBase(VertexHelper vh) { }
|
||||
public virtual void DrawUpper(VertexHelper vh) { }
|
||||
public virtual void DrawTop(VertexHelper vh) { }
|
||||
public virtual void OnSerieDataUpdate(int serieIndex) { }
|
||||
public virtual void OnPointerClick(PointerEventData eventData) { }
|
||||
|
||||
@@ -9,8 +9,10 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
/// <param name="dataIndex">数据索引</param>
|
||||
/// <param name="value">数值</param>
|
||||
/// <param name="category">类目</param>
|
||||
/// <param name="content">当前内容</param>
|
||||
/// <returns>最终显示的文本内容</returns>
|
||||
public delegate string LabelFormatterFunction(int dataIndex, double value, string category);
|
||||
public delegate string LabelFormatterFunction(int dataIndex, double value, string category, string content);
|
||||
public delegate float AnimationDelayFunction(int dataIndex);
|
||||
public delegate float AnimationDurationFunction(int dataIndex);
|
||||
/// <summary>
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace XCharts.Runtime
|
||||
private Button m_Button;
|
||||
private Image m_Icon;
|
||||
private ChartText m_Text;
|
||||
private Image m_Background;
|
||||
private Image m_TextBackground;
|
||||
private RectTransform m_Rect;
|
||||
private RectTransform m_IconRect;
|
||||
@@ -53,7 +54,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return m_Text.GetPreferredHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +65,7 @@ namespace XCharts.Runtime
|
||||
m_Button = obj.GetComponent<Button>();
|
||||
m_Rect = obj.GetComponent<RectTransform>();
|
||||
m_Icon = obj.transform.Find("icon").gameObject.GetComponent<Image>();
|
||||
m_Background = obj.GetComponent<Image>();
|
||||
m_TextBackground = obj.transform.Find("content").gameObject.GetComponent<Image>();
|
||||
m_Text = new ChartText(obj);
|
||||
m_IconRect = m_Icon.gameObject.GetComponent<RectTransform>();
|
||||
@@ -172,7 +174,8 @@ namespace XCharts.Runtime
|
||||
|
||||
public bool SetContent(string content)
|
||||
{
|
||||
if (m_Text != null && !m_Text.GetText().Equals(content))
|
||||
if (m_Text == null) return false;
|
||||
if (!m_Text.GetText().Equals(content))
|
||||
{
|
||||
m_Text.SetText(content);
|
||||
if (m_LabelAutoSize)
|
||||
@@ -186,11 +189,13 @@ namespace XCharts.Runtime
|
||||
m_TextRect.anchoredPosition3D = new Vector3(m_LabelPaddingLeftRight, 0);
|
||||
m_TextBackgroundRect.sizeDelta = new Vector2(m_Text.GetPreferredWidth() + m_LabelPaddingLeftRight * 2,
|
||||
m_Text.GetPreferredHeight() + m_LabelPaddingTopBottom * 2 - 4);
|
||||
m_Rect.sizeDelta = new Vector3(width, height);
|
||||
|
||||
}
|
||||
m_Rect.sizeDelta = new Vector3(width, height);
|
||||
return sizeChange;
|
||||
}
|
||||
}
|
||||
m_Rect.sizeDelta = new Vector3(width, height);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -209,5 +214,10 @@ namespace XCharts.Runtime
|
||||
m_GameObject.SetActive(active);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBackground(ImageStyle imageStyle)
|
||||
{
|
||||
ChartHelper.SetBackground(m_Background, imageStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,6 +314,22 @@ namespace XCharts.Runtime
|
||||
return img;
|
||||
}
|
||||
|
||||
public static void SetBackground(Image background, ImageStyle imageStyle)
|
||||
{
|
||||
if (background == null) return;
|
||||
if (imageStyle.show)
|
||||
{
|
||||
background.sprite = imageStyle.sprite;
|
||||
background.color = imageStyle.color;
|
||||
background.type = imageStyle.type;
|
||||
}
|
||||
else
|
||||
{
|
||||
background.sprite = null;
|
||||
background.color = Color.clear;
|
||||
}
|
||||
}
|
||||
|
||||
public static ChartLabel AddAxisLabelObject(int total, int index, string name, Transform parent,
|
||||
Vector2 sizeDelta, Axis axis, ComponentTheme theme,
|
||||
string content, Color autoColor, TextAnchor autoAlignment = TextAnchor.MiddleCenter)
|
||||
@@ -340,20 +356,6 @@ namespace XCharts.Runtime
|
||||
var alignment = textStyle.GetAlignment(autoAlignment);
|
||||
UpdateAnchorAndPivotByTextAlignment(alignment, out anchorMin, out anchorMax, out pivot);
|
||||
var labelObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
||||
// TODO: 为了兼容旧版本,这里后面版本可以去掉
|
||||
#region temp code
|
||||
var oldText = labelObj.GetComponent<Text>();
|
||||
if (oldText != null)
|
||||
{
|
||||
GameObject.DestroyImmediate(oldText);
|
||||
}
|
||||
var oldImage = labelObj.GetComponent<Image>();
|
||||
if (oldImage != null)
|
||||
{
|
||||
GameObject.DestroyImmediate(oldImage);
|
||||
}
|
||||
#endregion
|
||||
|
||||
var label = GetOrAddComponent<ChartLabel>(labelObj);
|
||||
label.text = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot,
|
||||
sizeDelta, textStyle, theme, autoColor, autoAlignment, label.text);
|
||||
@@ -608,7 +610,7 @@ namespace XCharts.Runtime
|
||||
return (Color32) color;
|
||||
}
|
||||
|
||||
public static double GetMaxDivisibleValue(double max, int ceilRate)
|
||||
public static double GetMaxDivisibleValue(double max, double ceilRate)
|
||||
{
|
||||
if (max == 0) return 0;
|
||||
if (max > -1 && max < 1)
|
||||
@@ -650,7 +652,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetMinDivisibleValue(double min, int ceilRate)
|
||||
public static double GetMinDivisibleValue(double min, double ceilRate)
|
||||
{
|
||||
if (min == 0) return 0;
|
||||
if (min > -1 && min < 1)
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace XCharts.Runtime
|
||||
[ExecuteInEditMode]
|
||||
public static class XChartsMgr
|
||||
{
|
||||
public static readonly string version = "3.0.1";
|
||||
public static readonly int versionDate = 20220616;
|
||||
public static readonly string version = "3.1.0";
|
||||
public static readonly int versionDate = 20220712;
|
||||
public static string fullVersion { get { return version + "-" + versionDate; } }
|
||||
|
||||
internal static List<BaseChart> chartList = new List<BaseChart>();
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace XCharts.Runtime
|
||||
if (m_SerieGrid == null)
|
||||
return;
|
||||
|
||||
var needCheck = (chart.isPointerInChart && m_SerieGrid.IsPointerEnter()) || m_LegendEnter;
|
||||
var needCheck = (chart.isPointerInChart && m_SerieGrid.IsPointerEnter() && !serie.placeHolder) || m_LegendEnter;
|
||||
var needInteract = false;
|
||||
if (!needCheck)
|
||||
{
|
||||
@@ -128,21 +128,9 @@ namespace XCharts.Runtime
|
||||
if (!serie.show || serie.animation.HasFadeOut())
|
||||
return;
|
||||
|
||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
||||
|
||||
Axis axis;
|
||||
Axis relativedAxis;
|
||||
|
||||
if (isY)
|
||||
{
|
||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
}
|
||||
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
|
||||
if (axis == null)
|
||||
|
||||
@@ -104,21 +104,9 @@ namespace XCharts.Runtime
|
||||
if (!serie.show || serie.animation.HasFadeOut())
|
||||
return;
|
||||
|
||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
||||
|
||||
Axis axis;
|
||||
Axis relativedAxis;
|
||||
|
||||
if (isY)
|
||||
{
|
||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
}
|
||||
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
|
||||
if (axis == null)
|
||||
|
||||
@@ -145,21 +145,11 @@ namespace XCharts.Runtime
|
||||
var lineArrow = serie.lineArrow;
|
||||
var visualMap = chart.GetVisualMapOfSerie(serie);
|
||||
var isVisualMapGradient = VisualMapHelper.IsNeedLineGradient(visualMap);
|
||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
||||
|
||||
Axis axis;
|
||||
Axis relativedAxis;
|
||||
chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||
|
||||
if (isY)
|
||||
{
|
||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var serieData = serie.GetSerieData(i);
|
||||
@@ -270,21 +260,9 @@ namespace XCharts.Runtime
|
||||
if (serie.animation.HasFadeOut())
|
||||
return;
|
||||
|
||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
||||
|
||||
Axis axis;
|
||||
Axis relativedAxis;
|
||||
|
||||
if (isY)
|
||||
{
|
||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
}
|
||||
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||
|
||||
if (axis == null)
|
||||
return;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawTop(VertexHelper vh)
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
if (serie.IsUseCoord<GridCoord>())
|
||||
{
|
||||
|
||||
@@ -271,7 +271,6 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var cdata = datas[i];
|
||||
var isIgnore = cdata.isIgnoreBreak;
|
||||
|
||||
var cp = cdata.position;
|
||||
var lp = datas[i - 1].position;
|
||||
|
||||
@@ -286,7 +285,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
serie.context.lineEndPostion = cp;
|
||||
serie.context.lineEndValue = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
lastDataIsIgnore = isIgnore;
|
||||
|
||||
var handled = false;
|
||||
if (!smooth)
|
||||
{
|
||||
@@ -315,6 +314,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
if (handled)
|
||||
{
|
||||
lastDataIsIgnore = isIgnore;
|
||||
if (isBreak)
|
||||
break;
|
||||
else
|
||||
@@ -371,7 +371,7 @@ namespace XCharts.Runtime
|
||||
visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
|
||||
}
|
||||
}
|
||||
|
||||
lastDataIsIgnore = isIgnore;
|
||||
if (isBreak)
|
||||
break;
|
||||
}
|
||||
@@ -413,9 +413,13 @@ namespace XCharts.Runtime
|
||||
UGL.AddVertToVertexHelper(vh, tp, bp, lineColor, needTriangle);
|
||||
}
|
||||
if (lastIgnore && !needTriangle)
|
||||
{
|
||||
UGL.AddVertToVertexHelper(vh, tp, bp, ColorUtil.clearColor32, false);
|
||||
}
|
||||
if (ignore && needTriangle)
|
||||
{
|
||||
UGL.AddVertToVertexHelper(vh, tp, bp, ColorUtil.clearColor32, false);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void UpdateSerieDrawPoints(Serie serie, Settings setting, ThemeStyle theme, VisualMap visualMap,
|
||||
@@ -452,6 +456,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var ep = dataPoints[i];
|
||||
var ignore = serie.context.dataIgnores[i];
|
||||
|
||||
var dir = (ep - sp).normalized;
|
||||
var dist = Vector3.Distance(sp, ep);
|
||||
var segment = (int) (dist / setting.lineSegmentDistance);
|
||||
@@ -496,8 +501,7 @@ namespace XCharts.Runtime
|
||||
if (isY)
|
||||
UGLHelper.GetBezierListVertical(ref s_CurvesPosList, sp, ep, smoothness, setting.lineSmoothStyle);
|
||||
else
|
||||
UGLHelper.GetBezierList(ref s_CurvesPosList, sp, ep, lsp, nep, smoothness, setting.lineSmoothStyle);
|
||||
|
||||
UGLHelper.GetBezierList(ref s_CurvesPosList, sp, ep, lsp, nep, smoothness, setting.lineSmoothStyle, true);
|
||||
for (int j = 1; j < s_CurvesPosList.Count; j++)
|
||||
{
|
||||
serie.context.drawPoints.Add(new PointInfo(s_CurvesPosList[j], ignore));
|
||||
|
||||
@@ -149,21 +149,10 @@ namespace XCharts.Runtime
|
||||
if (serie.animation.HasFadeOut())
|
||||
return;
|
||||
|
||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
||||
|
||||
Axis axis;
|
||||
Axis relativedAxis;
|
||||
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||
|
||||
if (isY)
|
||||
{
|
||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
}
|
||||
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
|
||||
if (axis == null)
|
||||
|
||||
@@ -15,11 +15,22 @@ namespace XCharts.Runtime
|
||||
UpdateSerieContext();
|
||||
}
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
UpdateRuntimeData(serie);
|
||||
DrawPieLabelLine(vh, serie, false);
|
||||
}
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
{
|
||||
UpdateRuntimeData(serie);
|
||||
DrawPieLabelLine(vh, serie);
|
||||
DrawPie(vh, serie);
|
||||
chart.RefreshBasePainter();
|
||||
}
|
||||
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
DrawPieLabelLine(vh, serie, true);
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
@@ -390,11 +401,13 @@ namespace XCharts.Runtime
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DrawPieLabelLine(VertexHelper vh, Serie serie)
|
||||
private void DrawPieLabelLine(VertexHelper vh, Serie serie, bool drawHightlight)
|
||||
{
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||
if (drawHightlight && !serieData.context.highlight) continue;
|
||||
if (!drawHightlight && serieData.context.highlight) continue;
|
||||
if (SerieLabelHelper.CanShowLabel(serie, serieData, serieLabel, 1))
|
||||
{
|
||||
int colorIndex = chart.m_LegendRealShowName.IndexOf(serieData.name);
|
||||
@@ -426,17 +439,12 @@ namespace XCharts.Runtime
|
||||
float currCos = Mathf.Cos(currAngle * Mathf.Deg2Rad);
|
||||
var radius1 = labelLine.lineType == LabelLine.LineType.HorizontalLine ?
|
||||
serie.context.outsideRadius : outSideRadius;
|
||||
var radius2 = serie.context.outsideRadius + labelLine.lineLength1;
|
||||
var radius3 = insideRadius + (outSideRadius - insideRadius) / 2;
|
||||
if (radius1 < serie.context.insideRadius) radius1 = serie.context.insideRadius;
|
||||
radius1 -= 0.1f;
|
||||
var pos0 = new Vector3(center.x + radius3 * currSin, center.y + radius3 * currCos);
|
||||
var pos1 = new Vector3(center.x + radius1 * currSin, center.y + radius1 * currCos);
|
||||
var pos2 = serieData.context.labelPosition;
|
||||
if (pos2.x == 0)
|
||||
{
|
||||
pos2 = new Vector3(center.x + radius2 * currSin, center.y + radius2 * currCos);
|
||||
}
|
||||
Vector3 pos4, pos6;
|
||||
var horizontalLineCircleRadius = labelLine.lineWidth * 4f;
|
||||
var lineCircleDiff = horizontalLineCircleRadius - 0.3f;
|
||||
@@ -476,19 +484,27 @@ namespace XCharts.Runtime
|
||||
var pos5X = (currAngle - startAngle) % 360 > 180 ?
|
||||
pos2.x - labelLine.lineLength2 : pos2.x + labelLine.lineLength2;
|
||||
var pos5 = new Vector3(pos5X, pos2.y);
|
||||
switch (labelLine.lineType)
|
||||
var angle = Vector3.Angle(pos1 - center, pos2 - pos1);
|
||||
if (angle > 15)
|
||||
{
|
||||
case LabelLine.LineType.BrokenLine:
|
||||
UGL.DrawLine(vh, pos1, pos2, pos5, labelLine.lineWidth, color);
|
||||
break;
|
||||
case LabelLine.LineType.Curves:
|
||||
UGL.DrawCurves(vh, pos1, pos5, pos1, pos2, labelLine.lineWidth, color,
|
||||
chart.settings.lineSmoothness);
|
||||
break;
|
||||
case LabelLine.LineType.HorizontalLine:
|
||||
UGL.DrawCricle(vh, pos0, horizontalLineCircleRadius, color);
|
||||
UGL.DrawLine(vh, pos6, pos4, labelLine.lineWidth, color);
|
||||
break;
|
||||
UGL.DrawLine(vh, pos1, pos5, labelLine.lineWidth, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (labelLine.lineType)
|
||||
{
|
||||
case LabelLine.LineType.BrokenLine:
|
||||
UGL.DrawLine(vh, pos1, pos2, pos5, labelLine.lineWidth, color);
|
||||
break;
|
||||
case LabelLine.LineType.Curves:
|
||||
UGL.DrawCurves(vh, pos1, pos5, pos1, pos2, labelLine.lineWidth, color,
|
||||
chart.settings.lineSmoothness);
|
||||
break;
|
||||
case LabelLine.LineType.HorizontalLine:
|
||||
UGL.DrawCricle(vh, pos0, horizontalLineCircleRadius, color);
|
||||
UGL.DrawLine(vh, pos6, pos4, labelLine.lineWidth, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private float[] m_Center = new float[2] { 0.5f, 0.48f };
|
||||
[SerializeField] private float[] m_Radius = new float[2] { 0, 0.28f };
|
||||
|
||||
[SerializeField][Range(1, 10)] private int m_ShowDataDimension;
|
||||
[SerializeField][Range(2, 10)] private int m_ShowDataDimension;
|
||||
[SerializeField] private bool m_ShowDataName;
|
||||
[SerializeField] private bool m_Clip = false;
|
||||
[SerializeField] private bool m_Ignore = false;
|
||||
@@ -686,7 +686,7 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// 数据项里的数据维数。
|
||||
/// </summary>
|
||||
public int showDataDimension { get { return m_ShowDataDimension; } set { m_ShowDataDimension = value; } }
|
||||
public int showDataDimension { get { return m_ShowDataDimension; } set { m_ShowDataDimension = Mathf.Clamp(2, 10, value); } }
|
||||
/// <summary>
|
||||
/// 在Editor的inpsector上是否显示name参数
|
||||
/// </summary>
|
||||
@@ -852,8 +852,11 @@ namespace XCharts.Runtime
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
foreach (var serieData in m_Data)
|
||||
serieData.ClearVerticesDirty();
|
||||
if (!IsPerformanceMode())
|
||||
{
|
||||
foreach (var serieData in m_Data)
|
||||
serieData.ClearVerticesDirty();
|
||||
}
|
||||
symbol.ClearVerticesDirty();
|
||||
lineStyle.ClearVerticesDirty();
|
||||
itemStyle.ClearVerticesDirty();
|
||||
@@ -872,8 +875,11 @@ namespace XCharts.Runtime
|
||||
public override void ClearComponentDirty()
|
||||
{
|
||||
base.ClearComponentDirty();
|
||||
foreach (var serieData in m_Data)
|
||||
serieData.ClearComponentDirty();
|
||||
if (!IsPerformanceMode())
|
||||
{
|
||||
foreach (var serieData in m_Data)
|
||||
serieData.ClearComponentDirty();
|
||||
}
|
||||
symbol.ClearComponentDirty();
|
||||
lineStyle.ClearComponentDirty();
|
||||
itemStyle.ClearComponentDirty();
|
||||
@@ -900,6 +906,8 @@ namespace XCharts.Runtime
|
||||
|
||||
private bool AnySerieDataVerticesDirty()
|
||||
{
|
||||
if (IsPerformanceMode())
|
||||
return false;
|
||||
if (this is ISimplifiedSerie)
|
||||
return false;
|
||||
foreach (var serieData in m_Data)
|
||||
@@ -909,6 +917,8 @@ namespace XCharts.Runtime
|
||||
|
||||
private bool AnySerieDataComponentDirty()
|
||||
{
|
||||
if (IsPerformanceMode())
|
||||
return false;
|
||||
if (this is ISimplifiedSerie)
|
||||
return false;
|
||||
foreach (var serieData in m_Data)
|
||||
@@ -1132,7 +1142,7 @@ namespace XCharts.Runtime
|
||||
serieData.index = xValue;
|
||||
serieData.id = dataId;
|
||||
AddSerieData(serieData);
|
||||
m_ShowDataDimension = 1;
|
||||
m_ShowDataDimension = 2;
|
||||
SetVerticesDirty();
|
||||
CheckDataName(dataName);
|
||||
labelDirty = true;
|
||||
@@ -1650,7 +1660,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public bool IsPerformanceMode()
|
||||
{
|
||||
return m_Large && m_Data.Count > m_LargeThreshold;
|
||||
return m_Large && m_Data.Count >= m_LargeThreshold;
|
||||
}
|
||||
|
||||
public bool IsLegendName(string legendName)
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public List<int> pointerAxisDataIndexs = new List<int>();
|
||||
public bool isTriggerByAxis = false;
|
||||
public int dataZoomStartIndex = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 中心点
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Runtime
|
||||
public virtual void Update() { }
|
||||
public virtual void DrawBase(VertexHelper vh) { }
|
||||
public virtual void DrawSerie(VertexHelper vh) { }
|
||||
public virtual void DrawUpper(VertexHelper vh) { }
|
||||
public virtual void DrawTop(VertexHelper vh) { }
|
||||
public virtual void OnPointerClick(PointerEventData eventData) { }
|
||||
public virtual void OnPointerDown(PointerEventData eventData) { }
|
||||
@@ -509,7 +510,7 @@ namespace XCharts.Runtime
|
||||
return;
|
||||
|
||||
itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
if (TooltipHelper.IsIgnoreItemFormatter(itemFormatter))
|
||||
if (serie.placeHolder || TooltipHelper.IsIgnoreFormatter(itemFormatter))
|
||||
return;
|
||||
|
||||
var param = serie.context.param;
|
||||
@@ -549,7 +550,7 @@ namespace XCharts.Runtime
|
||||
return;
|
||||
|
||||
itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
if (TooltipHelper.IsIgnoreItemFormatter(itemFormatter))
|
||||
if (serie.placeHolder || TooltipHelper.IsIgnoreFormatter(itemFormatter))
|
||||
return;
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.name);
|
||||
|
||||
@@ -573,7 +573,7 @@ namespace XCharts.Runtime
|
||||
/// <param name="dimension"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public static void UpdateMinMaxData(Serie serie, int dimension, int ceilRate = 0, DataZoom dataZoom = null)
|
||||
public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)
|
||||
{
|
||||
double min = 0, max = 0;
|
||||
GetMinMaxData(serie, dimension, out min, out max, dataZoom);
|
||||
@@ -589,7 +589,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetAllMinMaxData(Serie serie, int ceilRate = 0, DataZoom dataZoom = null)
|
||||
public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)
|
||||
{
|
||||
double min = 0, max = 0;
|
||||
GetMinMaxData(serie, out min, out max, dataZoom);
|
||||
@@ -707,17 +707,25 @@ namespace XCharts.Runtime
|
||||
if (range > data.Count - start - 1)
|
||||
start = data.Count - range - 1;
|
||||
if (start >= 0)
|
||||
{
|
||||
serie.context.dataZoomStartIndex = start;
|
||||
serie.m_FilterData = data.GetRange(start, range);
|
||||
}
|
||||
else
|
||||
{
|
||||
serie.context.dataZoomStartIndex = 0;
|
||||
serie.m_FilterData = data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
serie.context.dataZoomStartIndex = 0;
|
||||
serie.m_FilterData = data;
|
||||
}
|
||||
}
|
||||
else if (end == 0)
|
||||
{
|
||||
serie.context.dataZoomStartIndex = 0;
|
||||
serie.m_FilterData = emptyFilter;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c031417514104eebb5bbd60dd1f90fd
|
||||
guid: 73512c276f5c34fb4a28cf61b2a0c4f1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -138,15 +138,6 @@ namespace XCharts.Runtime
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Serie GetSerieByVesselIndex(List<Serie> series, int vesselIndex)
|
||||
{
|
||||
foreach (var serie in series)
|
||||
{
|
||||
if (serie.vesselIndex == vesselIndex) return serie;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static HashSet<string> _setForStack = new HashSet<string>();
|
||||
/// <summary>
|
||||
/// 是否由数据堆叠
|
||||
@@ -434,8 +425,8 @@ namespace XCharts.Runtime
|
||||
}
|
||||
else
|
||||
{
|
||||
minVaule = min > 1 ? Math.Floor(min) : min;
|
||||
maxValue = max > 1 ? Math.Ceiling(max) : max;
|
||||
minVaule = min;
|
||||
maxValue = max;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96a06a5949772464da15c44ae2ad400d
|
||||
guid: 0a1c1086d9f88497d9e0ac89d719ff48
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -122,7 +122,10 @@ namespace XCharts.Runtime
|
||||
get { return m_TickColor; }
|
||||
set { if (PropertyUtil.SetColor(ref m_TickColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the colors of split area.
|
||||
/// |坐标轴分隔区域的颜色。
|
||||
/// </summary>
|
||||
public List<Color32> splitAreaColors
|
||||
{
|
||||
get { return m_SplitAreaColors; }
|
||||
|
||||
@@ -27,18 +27,38 @@ namespace XCharts.Runtime
|
||||
get { return m_LineWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the symbol size of line serie.
|
||||
/// |折线图的Symbol大小。
|
||||
/// </summary>
|
||||
public float lineSymbolSize
|
||||
{
|
||||
get { return m_LineSymbolSize; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineSymbolSize, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the selected symbol size of line serie.
|
||||
/// |折线图Symbol在被选中状态时的大小。
|
||||
/// </summary>
|
||||
public float lineSymbolSelectedSize { get { return lineSymbolSize * selectedRate; } }
|
||||
/// <summary>
|
||||
/// the symbol size of scatter serie.
|
||||
/// |散点图的Symbol大小。
|
||||
/// </summary>
|
||||
public float scatterSymbolSize
|
||||
{
|
||||
get { return m_ScatterSymbolSize; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ScatterSymbolSize, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the selected symbol size of scatter serie.
|
||||
/// |散点图的Symbol在被选中状态时的大小。
|
||||
/// </summary>
|
||||
public float scatterSymbolSelectedSize { get { return scatterSymbolSize * selectedRate; } }
|
||||
/// <summary>
|
||||
/// the rate of symbol size of line or scatter serie.
|
||||
/// |折线图或散点图在被选中时的放大倍数。
|
||||
/// </summary>
|
||||
public float selectedRate
|
||||
{
|
||||
get { return m_SelectedRate; }
|
||||
@@ -46,7 +66,8 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 饼图鼠标移到高亮时的额外半径
|
||||
/// the extra radius of pie when actived by tooltip.
|
||||
/// |饼图鼠标移到高亮时的额外半径
|
||||
/// </summary>
|
||||
public float pieTooltipExtraRadius
|
||||
{
|
||||
@@ -54,7 +75,8 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_PieTooltipExtraRadius, value < 0 ? 0f : value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 饼图选中时的中心点偏移
|
||||
/// the center offset of pie if selected.
|
||||
/// |饼图选中时的中心点偏移。
|
||||
/// </summary>
|
||||
public float pieSelectedOffset
|
||||
{
|
||||
|
||||
@@ -58,17 +58,23 @@ namespace XCharts.Runtime
|
||||
{
|
||||
get { return sharedTheme.themeType; }
|
||||
}
|
||||
/// <summary>
|
||||
/// theme name.
|
||||
/// |主题名字。
|
||||
/// </summary>
|
||||
public string themeName
|
||||
{
|
||||
get { return sharedTheme.themeName; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the asset of theme.
|
||||
/// |主题配置。
|
||||
/// </summary>
|
||||
public Theme sharedTheme
|
||||
{
|
||||
get { return m_SharedTheme; }
|
||||
set { m_SharedTheme = value; SetAllDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the contrast color of chart.
|
||||
/// |对比色。
|
||||
@@ -91,7 +97,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether the background color is transparent. When true, the background color is not drawn.
|
||||
/// |是否透明背景颜色。当设置为true时,不绘制背景颜色。
|
||||
/// |是否透明背景颜色。当设置为true时,不绘制背景颜色。
|
||||
/// </summary>
|
||||
public bool transparentBackground
|
||||
{
|
||||
|
||||
@@ -59,8 +59,7 @@ namespace XUGL
|
||||
|
||||
for (int i = 0; i < list1.Count; i++)
|
||||
{
|
||||
if (list1[i] == null && list2[i] == null)
|
||||
{ }
|
||||
if (list1[i] == null && list2[i] == null) { }
|
||||
else
|
||||
{
|
||||
if (list1[i] != null)
|
||||
@@ -109,7 +108,7 @@ namespace XUGL
|
||||
}
|
||||
|
||||
public static void GetBezierList(ref List<Vector3> posList, Vector3 sp, Vector3 ep,
|
||||
Vector3 lsp, Vector3 nep, float smoothness = 2f, float k = 2.0f)
|
||||
Vector3 lsp, Vector3 nep, float smoothness = 2f, float k = 2.0f, bool limit = false)
|
||||
{
|
||||
float dist = Mathf.Abs(sp.x - ep.x);
|
||||
Vector3 cp1, cp2;
|
||||
@@ -124,9 +123,20 @@ namespace XUGL
|
||||
else
|
||||
{
|
||||
cp1 = sp + (ep - lsp).normalized * diff;
|
||||
if (limit)
|
||||
cp1.y = sp.y;
|
||||
|
||||
}
|
||||
if (nep == ep)
|
||||
{
|
||||
cp2 = ep;
|
||||
}
|
||||
else
|
||||
{
|
||||
cp2 = ep - (nep - sp).normalized * diff;
|
||||
if (limit)
|
||||
cp2.y = ep.y;
|
||||
}
|
||||
if (nep == ep) cp2 = ep;
|
||||
else cp2 = ep - (nep - sp).normalized * diff;
|
||||
dist = Vector3.Distance(sp, ep);
|
||||
int segment = (int) (dist / (smoothness <= 0 ? 2f : smoothness));
|
||||
if (segment < 1) segment = (int) (dist / 0.5f);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "com.monitor1394.xcharts",
|
||||
"displayName": "XCharts",
|
||||
"version": "3.0.1",
|
||||
"date": "20220616",
|
||||
"checkdate": "20220616",
|
||||
"version": "3.1.0",
|
||||
"date": "20220712",
|
||||
"checkdate": "20220712",
|
||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||
"unity": "2018.3",
|
||||
"description": "A charting and data visualization library for Unity.",
|
||||
@@ -11,6 +11,7 @@
|
||||
"chart",
|
||||
"charts",
|
||||
"graph",
|
||||
"unity-chart",
|
||||
"data-visualization"
|
||||
],
|
||||
"category": "chart",
|
||||
|
||||
Reference in New Issue
Block a user