mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 11:40:13 +00:00
Compare commits
46 Commits
v3.0.0-pre
...
v3.0.0-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d77e1c3d91 | ||
|
|
d4b3f5eaa8 | ||
|
|
8a78867961 | ||
|
|
d9266b3c9c | ||
|
|
0801069f72 | ||
|
|
e92afac0de | ||
|
|
d1fd4dcf44 | ||
|
|
43c31405b8 | ||
|
|
4e4d0bc85d | ||
|
|
96b0ec45d2 | ||
|
|
8c02ce14ac | ||
|
|
419c704b23 | ||
|
|
9dedc1db68 | ||
|
|
f11ee84517 | ||
|
|
dfa978afe0 | ||
|
|
4e6658ad70 | ||
|
|
ef5988a851 | ||
|
|
5d6c5b5f79 | ||
|
|
80e4475f65 | ||
|
|
84cf39df4d | ||
|
|
d44bf55a87 | ||
|
|
ad273cf1b1 | ||
|
|
a3d2d3f1d5 | ||
|
|
7ca4ddcb88 | ||
|
|
9a3461084c | ||
|
|
09df6fa73d | ||
|
|
be4ed41ca6 | ||
|
|
e2b0c935e0 | ||
|
|
e4fac71987 | ||
|
|
20825c148f | ||
|
|
5476fa8d09 | ||
|
|
80c77fc69a | ||
|
|
621bc3dcfd | ||
|
|
1ed0ff377a | ||
|
|
426d437e6d | ||
|
|
6c0dcbbcbb | ||
|
|
4ade064266 | ||
|
|
1ad87920d0 | ||
|
|
b784900fda | ||
|
|
acba2f5c1e | ||
|
|
3bccbd0ab2 | ||
|
|
327661bfdd | ||
|
|
ed393ea560 | ||
|
|
3fbf5bc906 | ||
|
|
b7efcf87cf | ||
|
|
1aea9f3cfe |
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: ['https://www.paypal.com/paypalme/monitor1394','https://github.com/XCharts-Team/XCharts/blob/master/Documentation/res/alipay.png']
|
||||
74
CHANGELOG.md
74
CHANGELOG.md
@@ -1,11 +1,20 @@
|
||||
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[master](#master)
|
||||
[v3.0.0-preivew9](#v3.0.0-preivew9)
|
||||
[v3.0.0-preivew8](#v3.0.0-preivew8)
|
||||
[v3.0.0-preivew7](#v3.0.0-preivew7)
|
||||
[v3.0.0-preivew6](#v3.0.0-preivew6)
|
||||
[v3.0.0-preivew5](#v3.0.0-preivew5)
|
||||
[v3.0.0-preivew4](#v3.0.0-preivew4)
|
||||
[v3.0.0-preivew3](#v3.0.0-preivew3)
|
||||
[v3.0.0-preivew2](#v3.0.0-preivew2)
|
||||
[v3.0.0-preivew1](#v3.0.0-preivew1)
|
||||
[v2.7.0](#v2.7.0)
|
||||
[v2.6.0](#v2.6.0)
|
||||
[v2.5.0](#v2.5.0)
|
||||
[v2.4.0](#v2.4.0)
|
||||
[v2.4.0](#v2.4.0)
|
||||
[v2.3.0](#v2.3.0)
|
||||
[v2.2.3](#v2.2.3)
|
||||
[v2.2.2](#v2.2.2)
|
||||
@@ -43,6 +52,65 @@
|
||||
|
||||
## master
|
||||
|
||||
## v3.0.0-preivew9
|
||||
|
||||
* (2022.05.06) 发布`v3.0.0-preivew9`版本
|
||||
* (2022.05.05) 优化`ItemStyle`设置`color`时的一致性
|
||||
* (2022.05.05) 增加`Line`对`Dash`,`Dot`等的支持 (#197)
|
||||
* (2022.05.04) 增加`Legend`的委托回调
|
||||
* (2022.05.04) 优化`Symbol`和`Label`
|
||||
* (2022.05.01) 增加`Bar`对`clip`的支持 (#196)
|
||||
* (2022.05.01) 修复`RingChart`的`Label`不刷新的问题 (#195)
|
||||
* (2022.04.29) 增加`Tooltip`支持自定义背景图
|
||||
* (2022.04.27) 修复`ItemStyle`代码修改`color`不刷新的问题
|
||||
|
||||
## v3.0.0-preivew8
|
||||
|
||||
* (2022.04.26) 发布`v3.0.0-preivew8`版本
|
||||
* (2022.04.23) 移除`Serie`的`IconStyle`组件
|
||||
* (2022.04.23) 强化`LabelStyle`,所有组件的`TextStyle`都升级为`LabelStyle`
|
||||
* (2022.04.19) 增加`Label`的`rotate`支持设置旋转
|
||||
* (2022.04.17) 修复`Bar`在数值为负数时动画无效的问题
|
||||
* (2022.04.17) 增加`ItemStyle`的`BorderGap`支持设置边框间距
|
||||
* (2022.04.16) 优化`Bar`的`Border`和`Capsule`胶囊柱图
|
||||
* (2022.04.15) 增加`Liquid`对`Round Rect`圆角矩形水位图的支持
|
||||
* (2022.04.14) 增加`Line`对`EndLabel`的支持
|
||||
* (2022.04.13) 增加`VisualMap`的`workOnLine`和`workOnArea`支持折线和区域映射功能 (#191)
|
||||
* (2022.04.12) 优化`Radar`支持`Area`区域触发`Tooltip`
|
||||
* (2022.04.09) 优化`VisualMap`
|
||||
* (2022.04.09) 优化`Tooltip`
|
||||
|
||||
## v3.0.0-preivew7
|
||||
|
||||
* (2022.04.07) 发布`v3.0.0-preivew7`版本
|
||||
* (2022.04.07) 修复`Pie`颜色不刷新的问题
|
||||
* (2022.03.31) 修复`Add Main Component`添加组件异常的问题
|
||||
* (2022.03.30) 修复`Axis`无法自定义`Label`颜色的问题
|
||||
|
||||
## v3.0.0-preivew6
|
||||
|
||||
* (2022.03.30) 发布`v3.0.0-preivew6`版本
|
||||
|
||||
## v3.0.0-preivew5
|
||||
|
||||
* (2022.03.26) 发布`v3.0.0-preivew5`版本
|
||||
|
||||
## v3.0.0-preivew4
|
||||
|
||||
* (2022.03.21) 发布`v3.0.0-preivew4`版本
|
||||
|
||||
## v3.0.0-preivew3
|
||||
|
||||
* (2022.03.09) 发布`v3.0.0-preivew3`版本
|
||||
|
||||
## v3.0.0-preivew2
|
||||
|
||||
* (2022.01.08) 发布`v3.0.0-preivew2`版本
|
||||
|
||||
## v3.0.0-preivew1
|
||||
|
||||
* (2022.01.07) 发布`v3.0.0-preivew1`版本
|
||||
|
||||
## v2.7.0
|
||||
|
||||
* (2022.03.20) 发布`v2.7.0`版本
|
||||
@@ -269,7 +337,7 @@
|
||||
## v1.6.0
|
||||
|
||||
* (2020.08.24) 发布`v1.6.0`版本
|
||||
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFQA-ZH.md)进行升级)
|
||||
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md)进行升级)
|
||||
* (2020.08.15) 优化`PieChart`绘制表现效果#85
|
||||
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
|
||||
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
|
||||
## master
|
||||
|
||||
* (2022.04.23) Remove `Serie` `IconStyle` component
|
||||
* (2022.04.23) Enhance `LabelStyle`, all components `TextStyle` will be upgraded to `LabelStyle`
|
||||
* (2022.04.19) Added `Label` `rotate` to support setting rotation
|
||||
* (2022.04.17) Fixed animation invalidation of `Bar` when the value is negative
|
||||
* (2022.04.17) Added `BorderGap` support for `ItemStyle` to set border spacing
|
||||
* (2022.04.16) Optimize the `Border` and `Capsule` histogram of `Bar`
|
||||
* (2021.08.15) Fixed the problem of displaying exceptions after adding data again when `DataZoom` is enable (#163)
|
||||
* (2021.08.15) Improved `Axis`'s `AxisLabel` text rotate setting to avoid inconsistency offset in `DataZoom` (#163)
|
||||
* (2021.08.14) Added `Legend`'s `textAutoColor` to set the text color match with `Serie` color (#163)
|
||||
@@ -215,7 +221,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
|
||||
## v1.6.0
|
||||
|
||||
* (2020.08.24) Release `v1.6.0` version
|
||||
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFQA-ZH.md) to upgrade)
|
||||
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [FAQ 29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md) to upgrade)
|
||||
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
|
||||
* (2020.08.11) Added `LiquidChart` data change animation#83
|
||||
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85
|
||||
|
||||
@@ -4,34 +4,34 @@
|
||||
|
||||
## 订阅服务
|
||||
|
||||
| |免费用户|个人`1`年`VIP`|个人`2`年`VIP` | 个人长期`VIP` |
|
||||
| ----- |--|--|--|--|
|
||||
| 订阅费用 | -- | `298`¥ | `498`¥ | `888`¥ |
|
||||
| 席位时长 | -- | `1`个席位<br>`1`年 | `1`个席位<br>`2`年 | `1`个席位<br>`长期` |
|
||||
||
|
||||
| |免费用户|付费咨询|个人`1`年`VIP`|个人`2`年`VIP` | 个人长期`VIP` |
|
||||
| ----- |--|--|--|--|--|
|
||||
| 订阅费用 | -- | `98`¥ | `298`¥ | `498`¥ | `888`¥ |
|
||||
| 席位时长 | -- | `1`个席位<br>`7`天,`7`小时* | `1`个席位<br>`1`年 | `1`个席位<br>`2`年 | `1`个席位<br>`长期` |
|
||||
| <b>`服务方式:`</b>|
|
||||
| 官方QQ群交流 | √ | √ | √ | √ |
|
||||
| 专属VIP群交流 | | √ | √ | √ |
|
||||
| 即时一对一交流 | | √ | √ | √ |
|
||||
||
|
||||
| 官方QQ群交流 | √ | √ | √ | √ | √ |
|
||||
| 即时一对一交流 | | √ | √ | √ | √ |
|
||||
| 专属VIP群交流 | | | √ | √ | √ |
|
||||
| <b>`服务内容:`</b>|
|
||||
| 可商用 | √ | √ | √ | √ |
|
||||
| 可二次开发 | √ | √ | √ | √ |
|
||||
| 有问必答 | | √ | √ | √ |
|
||||
| 新手指导 | | √ | √ | √ |
|
||||
| 开发指导 | | √ | √ | √ |
|
||||
| 优化指导 | | √ | √ | √ |
|
||||
| 其他技术支持 | | √ | √ | √ |
|
||||
| 问题及时处理 | | √ | √ | √ |
|
||||
| 需求优先考虑 | | √ | √ | √ |
|
||||
| 可另付费定制 | | √ | √ | √ |
|
||||
| 可另付费加急 | | √ | √ | √ |
|
||||
| 付费模块85折 | | | | √ |
|
||||
| 可商用 | √ | √ | √ | √ | √ |
|
||||
| 可二次开发 | √ | √ | √ | √ | √ |
|
||||
| 有问必答 | | √ | √ | √ | √ |
|
||||
| 即时回应 | | √ | √ | √ | √ |
|
||||
| 新手指导 | | √ | √ | √ | √ |
|
||||
| 开发指导 | | √ | √ | √ | √ |
|
||||
| 优化指导 | | √ | √ | √ | √ |
|
||||
| 其他技术支持 | | | √ | √ | √ |
|
||||
| 问题及时处理 | | | √ | √ | √ |
|
||||
| 需求优先考虑 | | | √ | √ | √ |
|
||||
| 可另付费定制 | | | √ | √ | √ |
|
||||
| 可另付费加急 | | | √ | √ | √ |
|
||||
| 付费图表优惠 | | | 95折 | 95折 | 85折 |
|
||||
|
||||
## 备注说明
|
||||
|
||||
1. __`付费定制`__ 是指用户可根据自己的需求定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
|
||||
2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并指定`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。
|
||||
2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并可要求在`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。
|
||||
3. __`付费咨询`__ 付费咨询有效期`7`天,且总咨询时长不超过`7`个小时。
|
||||
|
||||
## 捐助支持
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts API](XChartsAPI-EN.md)</br>
|
||||
[XCharts Q&A](XChartsFQA-EN.md)
|
||||
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||
|
||||
## Serie
|
||||
|
||||
@@ -22,6 +22,25 @@
|
||||
- [SimplifiedCandlestick](#SimplifiedCandlestick)
|
||||
- [SimplifiedLine](#SimplifiedLine)
|
||||
|
||||
## Theme
|
||||
|
||||
- [AngleAxisTheme](#AngleAxisTheme)
|
||||
- [AxisTheme](#AxisTheme)
|
||||
- [BaseAxisTheme](#BaseAxisTheme)
|
||||
- [ComponentTheme](#ComponentTheme)
|
||||
- [DataZoomTheme](#DataZoomTheme)
|
||||
- [LegendTheme](#LegendTheme)
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [Theme](#Theme)
|
||||
- [ThemeStyle](#ThemeStyle)
|
||||
- [TitleTheme](#TitleTheme)
|
||||
- [TooltipTheme](#TooltipTheme)
|
||||
- [VisualMapTheme](#VisualMapTheme)
|
||||
|
||||
## MainComponent
|
||||
|
||||
- [AngleAxis](#AngleAxis)
|
||||
@@ -68,6 +87,7 @@
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EndLabelStyle](#EndLabelStyle)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [ItemStyle](#ItemStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
@@ -76,17 +96,21 @@
|
||||
- [LevelStyle](#LevelStyle)
|
||||
- [LineArrow](#LineArrow)
|
||||
- [LineStyle](#LineStyle)
|
||||
- [Location](#Location)
|
||||
- [MarkAreaData](#MarkAreaData)
|
||||
- [MarkLineData](#MarkLineData)
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SerieData](#SerieData)
|
||||
- [SerieDataBaseInfo](#SerieDataBaseInfo)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [StageColor](#StageColor)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [SymbolStyle](#SymbolStyle)
|
||||
- [TextLimit](#TextLimit)
|
||||
- [TextPadding](#TextPadding)
|
||||
- [TextStyle](#TextStyle)
|
||||
- [ThemeStyle](#ThemeStyle)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
@@ -99,7 +123,7 @@
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineArrow](#LineArrow)
|
||||
@@ -109,12 +133,13 @@
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [ItemStyle](#ItemStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineStyle](#LineStyle)
|
||||
- [SymbolStyle](#SymbolStyle)
|
||||
- [SerieDataBaseInfo](#SerieDataBaseInfo)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
|
||||
## Other
|
||||
@@ -125,9 +150,9 @@
|
||||
- [DebugInfo](#DebugInfo)
|
||||
- [Indicator](#Indicator)
|
||||
- [Lang](#Lang)
|
||||
- [LangCandlestick](#LangCandlestick)
|
||||
- [LangTime](#LangTime)
|
||||
- [MainComponent](#MainComponent)
|
||||
- [Theme](#Theme)
|
||||
- [XCResourcesImporter](#XCResourcesImporter)
|
||||
- [XCSettings](#XCSettings)
|
||||
|
||||
@@ -223,7 +248,6 @@ The axis in rectangular coordinate.
|
||||
| `inverse` |false | Whether the axis are reversed or not. Invalid in `Category` axis. |
|
||||
| `clockwise` |true | Whether the positive position of axis is in clockwise. True for clockwise by default. |
|
||||
| `insertDataToHead` | | Whether to add new data at the head or at the end of the list. |
|
||||
| `iconStyle` | | 图标样式。 [IconStyle](IconStyle)|
|
||||
| `icons` | | 类目数据对应的图标。 |
|
||||
| `data` | | Category data, available in type: 'Category' axis. |
|
||||
| `axisLine` | | [AxisLine](AxisLine)|
|
||||
@@ -235,26 +259,19 @@ The axis in rectangular coordinate.
|
||||
|
||||
## `AxisLabel`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
Inherits or Implemented: [LabelStyle](#LabelStyle)
|
||||
|
||||
Settings related to axis label.
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Set this to false to prevent the axis label from appearing. |
|
||||
| `formatter` | | |
|
||||
| `interval` |0 | The display interval of the axis label. |
|
||||
| `inside` |false | Set this to true so the axis labels face the inside direction. |
|
||||
| `distance` | | The distance between the axis label and the axis line. |
|
||||
| `numericFormatter` | | Standard numeric format strings. |
|
||||
| `showAsPositiveNumber` |false | Show negative number as positive number. |
|
||||
| `onZero` |false | 刻度标签显示在0刻度上。 |
|
||||
| `width` |0f | 文本的宽。为0时会自动匹配。 |
|
||||
| `height` |0f | 文本的高。为0时会自动匹配。 |
|
||||
| `showStartLabel` |true | Whether to display the first label. |
|
||||
| `showEndLabel` |true | Whether to display the last label. |
|
||||
| `textLimit` | | 文本限制。 [TextLimit](TextLimit)|
|
||||
| `textStyle` | | The text style of axis name. [TextStyle](TextStyle)|
|
||||
|
||||
## `AxisLine`
|
||||
|
||||
@@ -278,9 +295,7 @@ the name of axis.
|
||||
|--|--|--|
|
||||
| `show` | | Whether to show axis name. |
|
||||
| `name` | | the name of axis. |
|
||||
| `formatter` | | The formatter of indicator's name. |
|
||||
| `location` | | Location of axis name.</br>`AxisName.Location`:</br>- `Start`: the location of axis name.</br>- `Middle`: the location of axis name.</br>- `End`: the location of axis name.</br>- `align`: 对齐方式。</br>- `left`: Distance between component and the left side of the container.</br>- `right`: Distance between component and the left side of the container.</br>- `top`: Distance between component and the left side of the container.</br>- `bottom`: Distance between component and the left side of the container.</br>|
|
||||
| `textStyle` | | The text style of axis name. [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | The text style of axis name. [LabelStyle](LabelStyle)|
|
||||
|
||||
## `AxisSplitArea`
|
||||
|
||||
@@ -430,7 +445,7 @@ DataZoom component is used for zooming a specific area, which enables user to in
|
||||
| `filterMode` | | The mode of data filter.</br>`DataZoom.FilterMode`:</br>- `Filter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered if one of the relevant dimensions is out of the window.</br>- `WeakFilter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered only if all of the relevant dimensions are out of the same side of the window.</br>- `Empty`: data that outside the window will be set to NaN, which will not lead to changes of windows of other axes.</br>- `None`: Do not filter data.</br>|
|
||||
| `xAxisIndexs` | | Specify which xAxis is controlled by the dataZoom. |
|
||||
| `yAxisIndexs` | | Specify which yAxis is controlled by the dataZoom. |
|
||||
| `supportInside` | | Whether built-in support is supported. |
|
||||
| `supportInside` | | Whether built-in support is supported. Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging, mouse wheel, finger swiping (on the touch screen). |
|
||||
| `supportInsideScroll` |true | 是否支持坐标系内滚动 |
|
||||
| `supportInsideDrag` |true | 是否支持坐标系内拖拽 |
|
||||
| `supportSlider` | | Whether a slider is supported. There are separate sliders on which the user zooms or roams. |
|
||||
@@ -449,13 +464,13 @@ DataZoom component is used for zooming a specific area, which enables user to in
|
||||
| `bottom` | | Distance between dataZoom component and the bottom side of the container. bottom value is a instant pixel value like 10 or float value [0-1]. |
|
||||
| `rangeMode` | | Use absolute value or percent value in DataZoom.start and DataZoom.end.</br>`DataZoom.RangeMode`:</br>- `//Value`: The value type of start and end.取值类型</br>- `Percent`: percent value.</br>|
|
||||
| `start` | | The start percentage of the window out of the data extent, in the range of 0 ~ 100. |
|
||||
| `end` | | The end percentage of the window out of the data extent, in the range of 0 ~ 100. 数据窗口范围的结束百分比。范围是:0 ~ 100。 |
|
||||
| `end` | | The end percentage of the window out of the data extent, in the range of 0 ~ 100. |
|
||||
| `startValue` | | |
|
||||
| `endValue` | | |
|
||||
| `minShowNum` |1 | Minimum number of display data. Minimum number of data displayed when DataZoom is enlarged to maximum. |
|
||||
| `scrollSensitivity` |1.1f | The sensitivity of dataZoom scroll. The larger the number, the more sensitive it is. |
|
||||
| `orient` | | Specify whether the layout of dataZoom component is horizontal or vertical. What's more, it indicates whether the horizontal axis or vertical axis is controlled by default in catesian coordinate system.</br>`Orient`:</br>- `Horizonal`: 水平</br>- `Vertical`: 垂直</br>|
|
||||
| `textStyle` | | font style. [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | label style. [LabelStyle](LabelStyle)|
|
||||
| `lineStyle` | | 阴影线条样式。 [LineStyle](LineStyle)|
|
||||
| `areaStyle` | | 阴影填充样式。 [AreaStyle](AreaStyle)|
|
||||
|
||||
@@ -481,7 +496,7 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
| `showDebugInfo` |false | |
|
||||
| `showAllChartObject` |false | |
|
||||
| `foldSeries` |false | |
|
||||
| `debugInfoTextStyle` | | [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | [LabelStyle](LabelStyle)|
|
||||
|
||||
## `EffectScatter`
|
||||
|
||||
@@ -531,20 +546,35 @@ Inherits or Implemented: [Serie](#Serie),[INeedSerieContainer](#INeedSerieContai
|
||||
|
||||
## `IconStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |false | Whether the data icon is show. |
|
||||
| `layer` | | 显示在上层还是在下层。</br>`IconStyle.Layer`:</br>- `UnderLabel`: </br>- `AboveLabel`: </br>|
|
||||
| `layer` | | 显示在上层还是在下层。</br>`IconStyle.Layer`:</br>- `UnderText`: The icon is display under the label text. 图标在标签文字下</br>- `AboveText`: The icon is display above the label text. 图标在标签文字上</br>|
|
||||
| `align` | | 水平方向对齐方式。</br>`Align`:</br>- `Center`: 对齐方式</br>- `Left`: 对齐方式</br>- `Right`: 对齐方式</br>|
|
||||
| `sprite` | | The image of icon. |
|
||||
| `type` | | How to display the icon. |
|
||||
| `color` | | 图标颜色。 |
|
||||
| `width` |20 | 图标宽。 |
|
||||
| `height` |20 | 图标高。 |
|
||||
| `offset` | | 图标偏移。 |
|
||||
| `autoHideWhenLabelEmpty` |false | 当label内容为空时是否自动隐藏图标 |
|
||||
|
||||
## `ImageStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Whether the data icon is show. |
|
||||
| `sprite` | | The image of icon. |
|
||||
| `type` | | How to display the image. |
|
||||
| `autoColor` | | 是否自动颜色。 |
|
||||
| `color` | | 图标颜色。 |
|
||||
| `width` |0 | 图标宽。 |
|
||||
| `height` |0 | 图标高。 |
|
||||
|
||||
## `Indicator`
|
||||
|
||||
Indicator of radar chart, which is used to assign multiple variables(dimensions) in radar chart.
|
||||
@@ -592,6 +622,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent]
|
||||
| `centerColor` | | 中心区域颜色。 |
|
||||
| `centerGap` | | 中心区域间隙。 |
|
||||
| `borderWidth` |0 | 边框宽。 |
|
||||
| `borderGap` |0 | 边框间隙。 |
|
||||
| `borderColor` | | 边框的颜色。 |
|
||||
| `borderColor0` | | 边框的颜色。 |
|
||||
| `borderToColor` | | 边框的渐变色。 |
|
||||
@@ -605,15 +636,20 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent]
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
标签的引导线
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Whether the label line is showed. |
|
||||
| `lineType` | | the type of visual guide line.</br>`LineType`:</br>- `Normal`: the normal line chart, 普通折线图。</br>- `Smooth`: the smooth line chart, 平滑曲线。</br>- `StepStart`: step line.</br>- `StepMiddle`: step line.</br>- `StepEnd`: step line.</br>|
|
||||
| `lineColor` |ChartConst.clearColor32 | the color of visual guild line. |
|
||||
| `lineAngle` |0 | the angle of visual guild line. |
|
||||
| `lineWidth` |1.0f | the width of visual guild line. |
|
||||
| `lineGap` |1.0f | the gap of container and guild line. |
|
||||
| `lineLength1` |25f | The length of the first segment of visual guide line. |
|
||||
| `lineLength2` |15f | The length of the second segment of visual guide line. |
|
||||
| `startSymbol` | | The symbol of the start point of labelline. [SymbolStyle](SymbolStyle)|
|
||||
| `endSymbol` | | The symbol of the end point of labelline. [SymbolStyle](SymbolStyle)|
|
||||
|
||||
## `LabelStyle`
|
||||
|
||||
@@ -625,16 +661,17 @@ Text label of chart, to explain some data information about graphic item like va
|
||||
|--|--|--|
|
||||
| `show` |true | Whether the label is showed. |
|
||||
| `Position` | | |
|
||||
| `autoOffset` |false | 是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |
|
||||
| `offset` | | offset to the host graphic element. |
|
||||
| `rotate` | | Rotation of label. |
|
||||
| `distance` | | 距离轴线的距离。 |
|
||||
| `formatter` | | |
|
||||
| `paddingLeftRight` |2f | the text padding of left and right. defaut:2. |
|
||||
| `paddingTopBottom` |2f | the text padding of top and bottom. defaut:2. |
|
||||
| `backgroundWidth` |0 | the width of background. If set as default value 0, it means than the background width auto set as the text width. |
|
||||
| `backgroundHeight` |0 | the height of background. If set as default value 0, it means than the background height auto set as the text height. |
|
||||
| `numericFormatter` | | Standard numeric format strings. |
|
||||
| `autoOffset` |false | 是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会根据已支持的serie自动设置颜色。 |
|
||||
| `width` |0 | the width of label. If set as default value 0, it means than the label width auto set as the text width. |
|
||||
| `height` |0 | the height of label. If set as default value 0, it means than the label height auto set as the text height. |
|
||||
| `icon` | | the sytle of icon. [IconStyle](IconStyle)|
|
||||
| `background` | | the sytle of background. [ImageStyle](ImageStyle)|
|
||||
| `textPadding` | | the text padding of label. [TextPadding](TextPadding)|
|
||||
| `textStyle` | | the sytle of text. [TextStyle](TextStyle)|
|
||||
|
||||
## `Lang`
|
||||
@@ -644,6 +681,9 @@ Inherits or Implemented: [ScriptableObject](#ScriptableObject)
|
||||
Language.
|
||||
|
||||
|
||||
## `LangCandlestick`
|
||||
|
||||
|
||||
## `LangTime`
|
||||
|
||||
|
||||
@@ -659,14 +699,14 @@ Legend component.The legend component shows different sets of tags, colors, and
|
||||
| `iconType` | | Type of legend.</br>`Painter.Type`:</br>- `Base`: </br>- `Serie`: </br>- `Top`: </br>|
|
||||
| `selectedMode` | | Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.</br>`VisualMap.SelectedMode`:</br>- `Multiple`: 多选。</br>- `Single`: 单选。</br>|
|
||||
| `orient` | | Specify whether the layout of legend component is horizontal or vertical.</br>`Orient`:</br>- `Horizonal`: 水平</br>- `Vertical`: 垂直</br>|
|
||||
| `location` | | The location of legend.</br>`AxisName.Location`:</br>- `Start`: the location of axis name.</br>- `Middle`: the location of axis name.</br>- `End`: the location of axis name.</br>- `align`: 对齐方式。</br>- `left`: Distance between component and the left side of the container.</br>- `right`: Distance between component and the left side of the container.</br>- `top`: Distance between component and the left side of the container.</br>- `bottom`: Distance between component and the left side of the container.</br>|
|
||||
| `location` | | The location of legend. [Location](Location)|
|
||||
| `itemWidth` |25.0f | Image width of legend symbol. |
|
||||
| `itemHeight` |12.0f | Image height of legend symbol. |
|
||||
| `itemGap` |10f | The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout. |
|
||||
| `itemAutoColor` |true | Whether the legend symbol matches the color automatically. |
|
||||
| `textAutoColor` |false | Whether the legend text matches the color automatically. |
|
||||
| `formatter` | | |
|
||||
| `textStyle` | | the style of text. [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | the style of text. [LabelStyle](LabelStyle)|
|
||||
| `data` | | Data array of legend. An array item is usually a name representing string. (If it is a pie chart, it could also be the name of a single data in the pie chart) of a series. |
|
||||
| `icons` | | 自定义的图例标记图形。 |
|
||||
|
||||
@@ -709,7 +749,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` | | Whether to show the arrow. |
|
||||
| `Position` | | |
|
||||
| `position` | | The position of arrow.</br>`LineArrow.Position`:</br>- `End`: 末端箭头</br>- `Start`: 头端箭头</br>|
|
||||
| `arrow` | | the arrow of line. [ArrowStyle](ArrowStyle)|
|
||||
|
||||
## `LineStyle`
|
||||
@@ -729,6 +769,20 @@ The style of line.
|
||||
| `length` |0 | |
|
||||
| `opacity` |1 | Opacity of the line. Supports value from 0 to 1, and the line will not be drawn when set to 0. |
|
||||
|
||||
## `Location`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[IPropertyChanged](#IPropertyChanged)
|
||||
|
||||
Location type. Quick to set the general location.
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `align` | | 对齐方式。</br>`Align`:</br>- `Center`: 对齐方式</br>- `Left`: 对齐方式</br>- `Right`: 对齐方式</br>|
|
||||
| `left` | | Distance between component and the left side of the container. |
|
||||
| `right` | | Distance between component and the left side of the container. |
|
||||
| `top` | | Distance between component and the left side of the container. |
|
||||
| `bottom` | | Distance between component and the left side of the container. |
|
||||
|
||||
## `MainComponent`
|
||||
|
||||
Inherits or Implemented: [IComparable](#IComparable)
|
||||
@@ -843,9 +897,9 @@ Polar coordinate can be used in scatter and line chart. Every polar coordinate h
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Whether to show the polor component. |
|
||||
| `center` | | [default:[0.5f,0.45f]]The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate. |
|
||||
| `radius` |0.35f | [default:0.35f]the radius of polar. |
|
||||
| `backgroundColor` | | [default:Color.clear]Background color of polar, which is transparent by default. |
|
||||
| `center` | | The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate. When value between 0 and 1 represents a percentage relative to the chart. |
|
||||
| `radius` |0.35f | the radius of polar. |
|
||||
| `backgroundColor` | | Background color of polar, which is transparent by default. |
|
||||
|
||||
## `Radar`
|
||||
|
||||
@@ -899,7 +953,6 @@ Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
| `endLabels` | | |
|
||||
| `lineArrows` | | |
|
||||
| `areaStyles` | | |
|
||||
| `iconStyles` | | |
|
||||
| `titleStyles` | | |
|
||||
| `emphases` | | |
|
||||
| `index` | | The index of serie. |
|
||||
@@ -965,7 +1018,7 @@ Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
| `bottom` | | Distance between component and the bottom side of the container. |
|
||||
| `insertDataToHead` | | Whether to add new data at the head or at the end of the list. |
|
||||
| `lineStyle` | | The style of line. [LineStyle](LineStyle)|
|
||||
| `symbol` | | the symbol of serie data item. [SymbolStyle](SymbolStyle)|
|
||||
| `symbol` | | the symbol of serie data item. [SerieSymbol](SerieSymbol)|
|
||||
| `animation` | | The start animation. [AnimationStyle](AnimationStyle)|
|
||||
| `itemStyle` | | The style of data item. [ItemStyle](ItemStyle)|
|
||||
| `data` | | 系列中的数据内容数组。SerieData可以设置1到n维数据。 |
|
||||
@@ -982,17 +1035,49 @@ A data item of serie.
|
||||
| `name` | | the name of data item. |
|
||||
| `id` | | 数据项的唯一id。唯一id不是必须设置的。 |
|
||||
| `parentId` | | |
|
||||
| `baseInfos` | | |
|
||||
| `itemStyles` | | |
|
||||
| `labels` | | |
|
||||
| `labelLines` | | |
|
||||
| `emphases` | | |
|
||||
| `symbols` | | |
|
||||
| `iconStyles` | | |
|
||||
| `lineStyles` | | |
|
||||
| `areaStyles` | | |
|
||||
| `titleStyles` | | |
|
||||
| `data` | | An arbitrary dimension data list of data item. |
|
||||
|
||||
## `SerieDataBaseInfo`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
数据项的其他基础数据。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `ignore` |false | 是否忽略数据。当为 true 时,数据不进行绘制。 |
|
||||
| `selected` | | Whether the data item is selected. |
|
||||
| `radius` | | 自定义半径。可用在饼图中自定义某个数据项的半径。 |
|
||||
|
||||
## `SerieSymbol`
|
||||
|
||||
Inherits or Implemented: [SymbolStyle](#SymbolStyle),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
系列数据项的标记的图形
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `sizeType` | | the type of symbol size.</br>`SymbolSizeType`:</br>- `Custom`: Specify constant for symbol size.</br>- `FromData`: Specify the dataIndex and dataScale to calculate symbol size.</br>- `Function`: Specify function for symbol size.</br>|
|
||||
| `selectedSize` |0f | the size of selected symbol. |
|
||||
| `dataIndex` |1 | whitch data index is when the sizeType assined as FromData. |
|
||||
| `dataScale` |1 | the scale of data when sizeType assined as FromData. |
|
||||
| `selectedDataScale` |1.5f | the scale of selected data when sizeType assined as FromData. |
|
||||
| `sizeFunction` | | the function of size when sizeType assined as Function. |
|
||||
| `selectedSizeFunction` | | the function of size when sizeType assined as Function. |
|
||||
| `startIndex` | | the index start to show symbol. |
|
||||
| `interval` | | the interval of show symbol. |
|
||||
| `forceShowLast` |false | whether to show the last symbol. |
|
||||
| `repeat` |false | 图形是否重复。 |
|
||||
|
||||
## `SerieTheme`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
@@ -1084,7 +1169,7 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
|
||||
## `SymbolStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
系列数据项的标记的图形
|
||||
|
||||
@@ -1092,24 +1177,14 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent]
|
||||
|--|--|--|
|
||||
| `show` |true | Whether the symbol is showed. |
|
||||
| `type` | | the type of symbol.</br>`SymbolType`:</br>- `None`: 不显示标记。</br>- `Custom`: 自定义标记。</br>- `Circle`: 圆形。</br>- `EmptyCircle`: 空心圆。</br>- `Rect`: 正方形。可通过设置`itemStyle`的`cornerRadius`变成圆角矩形。</br>- `EmptyRect`: 空心正方形。</br>- `Triangle`: 三角形。</br>- `EmptyTriangle`: 空心三角形。</br>- `Diamond`: 菱形。</br>- `EmptyDiamond`: 空心菱形。</br>- `Arrow`: 箭头。</br>- `EmptyArrow`: 空心箭头。</br>|
|
||||
| `sizeType` | | the type of symbol size.</br>`SymbolSizeType`:</br>- `Custom`: Specify constant for symbol size.</br>- `FromData`: Specify the dataIndex and dataScale to calculate symbol size.</br>- `Function`: Specify function for symbol size.</br>|
|
||||
| `size` |0f | the size of symbol. |
|
||||
| `selectedSize` |0f | the size of selected symbol. |
|
||||
| `dataIndex` |1 | whitch data index is when the sizeType assined as FromData. |
|
||||
| `dataScale` |1 | the scale of data when sizeType assined as FromData. |
|
||||
| `selectedDataScale` |1.5f | the scale of selected data when sizeType assined as FromData. |
|
||||
| `sizeFunction` | | the function of size when sizeType assined as Function. |
|
||||
| `selectedSizeFunction` | | the function of size when sizeType assined as Function. |
|
||||
| `startIndex` | | the index start to show symbol. |
|
||||
| `interval` | | the interval of show symbol. |
|
||||
| `forceShowLast` |false | whether to show the last symbol. |
|
||||
| `gap` |0 | the gap of symbol and line segment. |
|
||||
| `width` |0f | 图形的宽。 |
|
||||
| `height` |0f | 图形的高。 |
|
||||
| `repeat` |false | 图形是否重复。 |
|
||||
| `offset` |Vector2.zero | 图形的偏移。 |
|
||||
| `image` | | 自定义的标记图形。 |
|
||||
| `imageType` | | |
|
||||
| `color` | | 图形的颜色。 |
|
||||
|
||||
## `TextLimit`
|
||||
|
||||
@@ -1124,6 +1199,20 @@ Text character limitation and adaptation component. When the length of the text
|
||||
| `gap` |1 | White pixel distance at both ends. |
|
||||
| `suffix` | | Suffixes when the length exceeds. |
|
||||
|
||||
## `TextPadding`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
Settings related to text.
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | |
|
||||
| `top` |2 | |
|
||||
| `right` |4 | |
|
||||
| `left` |4 | |
|
||||
| `bottom` |2 | |
|
||||
|
||||
## `TextStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
@@ -1132,15 +1221,13 @@ Settings related to text.
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Settings related to text. |
|
||||
| `font` | | the font of text. When `null`, the theme's font is used by default. |
|
||||
| `autoWrap` |false | 是否自动换行。 |
|
||||
| `autoAlign` |true | 文本是否让系统自动选对齐方式。为false时才会用alignment。 |
|
||||
| `rotate` |0 | Rotation of text. |
|
||||
| `extraWidth` |0 | Extra width of text preferred width. |
|
||||
| `offset` |Vector2.zero | the offset of position. |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会自动设置颜色。 |
|
||||
| `color` | | the color of text. |
|
||||
| `autoBackgroundColor` |false | |
|
||||
| `backgroundColor` | | the color of text. |
|
||||
| `fontSize` |0 | font size. |
|
||||
| `fontStyle` | | font style. |
|
||||
| `lineSpacing` |1f | text line spacing. |
|
||||
@@ -1184,7 +1271,8 @@ Theme.
|
||||
|--|--|--|
|
||||
| `show` |true | |
|
||||
| `sharedTheme` | | [Theme](Theme)|
|
||||
| `enableCustomTheme` | | |
|
||||
| `transparentBackground` |false | Whether the background color is transparent. When true, the background color is not drawn. |是否透明背景颜色。当设置为true时,不绘制背景颜色。 |
|
||||
| `enableCustomTheme` |false | Whether to customize theme colors. When set to true, you can use 'sync color to custom' to synchronize the theme color to the custom color. It can also be set manually. |
|
||||
| `customFont` | | |
|
||||
| `customBackgroundColor` | | the custom background color of chart. |
|
||||
| `customColorPalette` | | |
|
||||
@@ -1199,23 +1287,18 @@ Title component, including main title and subtitle.
|
||||
|--|--|--|
|
||||
| `show` |true | [default:true] Set this to false to prevent the title from showing. |
|
||||
| `text` | | The main title text, supporting \n for newlines. |
|
||||
| `textStyle` | | The text style of main title. [TextStyle](TextStyle)|
|
||||
| `subText` | | Subtitle text, supporting for \n for newlines. |
|
||||
| `subTextStyle` | | The text style of sub title. [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | The text style of main title. [LabelStyle](LabelStyle)|
|
||||
| `subLabelStyle` | | The text style of sub title. [LabelStyle](LabelStyle)|
|
||||
| `itemGap` |0 | [default:8] The gap between the main title and subtitle. |
|
||||
| `location` | | The location of title component.</br>`AxisName.Location`:</br>- `Start`: the location of axis name.</br>- `Middle`: the location of axis name.</br>- `End`: the location of axis name.</br>- `align`: 对齐方式。</br>- `left`: Distance between component and the left side of the container.</br>- `right`: Distance between component and the left side of the container.</br>- `top`: Distance between component and the left side of the container.</br>- `bottom`: Distance between component and the left side of the container.</br>|
|
||||
| `location` | | The location of title component. [Location](Location)|
|
||||
|
||||
## `TitleStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent](#ISerieDataComponent),[ISerieExtraComponent](#ISerieExtraComponent)
|
||||
Inherits or Implemented: [LabelStyle](#LabelStyle),[ISerieDataComponent](#ISerieDataComponent),[ISerieExtraComponent](#ISerieExtraComponent)
|
||||
|
||||
the title of serie.
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Whether to show title. |
|
||||
| `offsetCenter` |Vector2(0, -0.2f) | The offset position relative to the center. |
|
||||
| `textStyle` | | the color of text. [TextStyle](TextStyle)|
|
||||
|
||||
## `TitleTheme`
|
||||
|
||||
@@ -1249,6 +1332,7 @@ Tooltip component.
|
||||
| `alwayShowContent` |false | Whether to trigger after always display. |
|
||||
| `offset` |Vector2(18f, -25f) | The position offset of tooltip relative to the mouse position. |
|
||||
| `backgroundImage` | | The background image of tooltip. |
|
||||
| `backgroundType` | | The background type of tooltip. |
|
||||
| `backgroundColor` | | The background color of tooltip. |
|
||||
| `borderWidth` |2f | the width of tooltip border. |
|
||||
| `fixedXEnable` |false | |
|
||||
@@ -1259,9 +1343,9 @@ Tooltip component.
|
||||
| `itemHeight` |25f | |
|
||||
| `borderColor` |Color32(230, 230, 230, 255) | the color of tooltip border. |
|
||||
| `lineStyle` | | the line style of indicator line. [LineStyle](LineStyle)|
|
||||
| `labelTextStyle` | | the text style of content. [TextStyle](TextStyle)|
|
||||
| `titleTextStyle` | | 标题的文本样式。 [TextStyle](TextStyle)|
|
||||
| `columnsTextStyle` | | |
|
||||
| `indicatorLabelStyle` | | the label style of tooltip axis indicator label. [LabelStyle](LabelStyle)|
|
||||
| `titleLabelStyle` | | 标题的文本样式。 [LabelStyle](LabelStyle)|
|
||||
| `contentLabelStyles` | | |
|
||||
|
||||
## `TooltipTheme`
|
||||
|
||||
@@ -1284,7 +1368,8 @@ VisualMap component. Mapping data to visual elements such as colors.
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Whether to display components. If set to false, it will not show up, but the data mapping function still exists. |
|
||||
| `show` |true | Whether to enable components. |
|
||||
| `showUI` |false | Whether to display components. If set to false, it will not show up, but the data mapping function still exists. |
|
||||
| `type` | | the type of visualmap component.</br>`Painter.Type`:</br>- `Base`: </br>- `Serie`: </br>- `Top`: </br>|
|
||||
| `selectedMode` | | the selected mode for Piecewise visualMap.</br>`VisualMap.SelectedMode`:</br>- `Multiple`: 多选。</br>- `Single`: 单选。</br>|
|
||||
| `serieIndex` |0 | the serie index of visualMap. |
|
||||
@@ -1304,7 +1389,9 @@ VisualMap component. Mapping data to visual elements such as colors.
|
||||
| `hoverLink` |true | When the hoverLink function is turned on, when the mouse hovers over the visualMap component, the corresponding value of the mouse position is highlighted in the corresponding graphic element in the diagram. |
|
||||
| `autoMinMax` |true | Automatically set min, Max value 自动设置min,max的值 |
|
||||
| `orient` | | Specify whether the layout of component is horizontal or vertical.</br>`Orient`:</br>- `Horizonal`: 水平</br>- `Vertical`: 垂直</br>|
|
||||
| `location` | | The location of component.</br>`AxisName.Location`:</br>- `Start`: the location of axis name.</br>- `Middle`: the location of axis name.</br>- `End`: the location of axis name.</br>- `align`: 对齐方式。</br>- `left`: Distance between component and the left side of the container.</br>- `right`: Distance between component and the left side of the container.</br>- `top`: Distance between component and the left side of the container.</br>- `bottom`: Distance between component and the left side of the container.</br>|
|
||||
| `location` | | The location of component. [Location](Location)|
|
||||
| `workOnLine` |true | Whether the visualmap is work on linestyle of linechart. |
|
||||
| `workOnArea` |false | Whether the visualmap is work on areaStyle of linechart. |
|
||||
| `inRange` | | Defines the visual color in the selected range. |
|
||||
| `outOfRange` | | Defines a visual color outside of the selected range. |
|
||||
| `pieces` | | 分段式每一段的相关配置。 |
|
||||
@@ -1394,4 +1481,4 @@ The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts API](XChartsAPI-EN.md)</br>
|
||||
[XCharts Q&A](XChartsFQA-EN.md)
|
||||
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)
|
||||
[XCharts问答](XChartsFAQ-ZH.md)
|
||||
|
||||
## Serie 系列
|
||||
|
||||
@@ -22,6 +22,25 @@
|
||||
- [SimplifiedCandlestick](#SimplifiedCandlestick)
|
||||
- [SimplifiedLine](#SimplifiedLine)
|
||||
|
||||
## Theme 主题
|
||||
|
||||
- [AngleAxisTheme](#AngleAxisTheme)
|
||||
- [AxisTheme](#AxisTheme)
|
||||
- [BaseAxisTheme](#BaseAxisTheme)
|
||||
- [ComponentTheme](#ComponentTheme)
|
||||
- [DataZoomTheme](#DataZoomTheme)
|
||||
- [LegendTheme](#LegendTheme)
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [Theme](#Theme)
|
||||
- [ThemeStyle](#ThemeStyle)
|
||||
- [TitleTheme](#TitleTheme)
|
||||
- [TooltipTheme](#TooltipTheme)
|
||||
- [VisualMapTheme](#VisualMapTheme)
|
||||
|
||||
## MainComponent 主组件
|
||||
|
||||
- [AngleAxis](#AngleAxis)
|
||||
@@ -68,6 +87,7 @@
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EndLabelStyle](#EndLabelStyle)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [ItemStyle](#ItemStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
@@ -76,17 +96,21 @@
|
||||
- [LevelStyle](#LevelStyle)
|
||||
- [LineArrow](#LineArrow)
|
||||
- [LineStyle](#LineStyle)
|
||||
- [Location](#Location)
|
||||
- [MarkAreaData](#MarkAreaData)
|
||||
- [MarkLineData](#MarkLineData)
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SerieData](#SerieData)
|
||||
- [SerieDataBaseInfo](#SerieDataBaseInfo)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [StageColor](#StageColor)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [SymbolStyle](#SymbolStyle)
|
||||
- [TextLimit](#TextLimit)
|
||||
- [TextPadding](#TextPadding)
|
||||
- [TextStyle](#TextStyle)
|
||||
- [ThemeStyle](#ThemeStyle)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
@@ -99,7 +123,7 @@
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineArrow](#LineArrow)
|
||||
@@ -109,12 +133,13 @@
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [ItemStyle](#ItemStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineStyle](#LineStyle)
|
||||
- [SymbolStyle](#SymbolStyle)
|
||||
- [SerieDataBaseInfo](#SerieDataBaseInfo)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
|
||||
## Other 其他
|
||||
@@ -125,9 +150,9 @@
|
||||
- [DebugInfo](#DebugInfo)
|
||||
- [Indicator](#Indicator)
|
||||
- [Lang](#Lang)
|
||||
- [LangCandlestick](#LangCandlestick)
|
||||
- [LangTime](#LangTime)
|
||||
- [MainComponent](#MainComponent)
|
||||
- [Theme](#Theme)
|
||||
- [XCResourcesImporter](#XCResourcesImporter)
|
||||
- [XCSettings](#XCSettings)
|
||||
|
||||
@@ -223,7 +248,6 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
| `inverse` |false | 是否反向坐标轴。在类目轴中无效。 |
|
||||
| `clockwise` |true | 刻度增长是否按顺时针,默认顺时针。 |
|
||||
| `insertDataToHead` | | 添加新数据时是在列表的头部还是尾部加入。 |
|
||||
| `iconStyle` | | 图标样式。 [IconStyle](IconStyle)|
|
||||
| `icons` | | 类目数据对应的图标。 |
|
||||
| `data` | | 类目数据,在类目轴(type: 'category')中有效。 |
|
||||
| `axisLine` | | [AxisLine](AxisLine)|
|
||||
@@ -235,26 +259,19 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
|
||||
## `AxisLabel`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
Inherits or Implemented: [LabelStyle](#LabelStyle)
|
||||
|
||||
坐标轴刻度标签的相关设置。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示刻度标签。 |
|
||||
| `formatter` | | |
|
||||
| `interval` |0 | 坐标轴刻度标签的显示间隔,在类目轴中有效。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。 |
|
||||
| `inside` |false | 刻度标签是否朝内,默认朝外。 |
|
||||
| `distance` | | 刻度标签与轴线之间的距离。 |
|
||||
| `numericFormatter` | | 标准数字格式字符串。用于将数值格式化显示为字符串。 使用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 |
|
||||
| `showAsPositiveNumber` |false | 将负数数值显示为正数。一般和`Serie`的`showAsPositiveNumber`配合使用。 |
|
||||
| `onZero` |false | 刻度标签显示在0刻度上。 |
|
||||
| `width` |0f | 文本的宽。为0时会自动匹配。 |
|
||||
| `height` |0f | 文本的高。为0时会自动匹配。 |
|
||||
| `showStartLabel` |true | 是否显示第一个文本。 |
|
||||
| `showEndLabel` |true | 是否显示最后一个文本。 |
|
||||
| `textLimit` | | 文本限制。 [TextLimit](TextLimit)|
|
||||
| `textStyle` | | 文本样式。 [TextStyle](TextStyle)|
|
||||
|
||||
## `AxisLine`
|
||||
|
||||
@@ -278,9 +295,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|--|--|--|
|
||||
| `show` | | 是否显示坐标名称。 |
|
||||
| `name` | | 坐标轴名称。 |
|
||||
| `formatter` | | 指示器名称显示的格式器。可用在雷达图。 |
|
||||
| `location` | | 坐标轴名称显示位置。</br>`AxisName.Location`:</br>- `Start`: 坐标轴名称显示位置。</br>- `Middle`: 坐标轴名称显示位置。</br>- `End`: 坐标轴名称显示位置。</br>- `align`: 对齐方式。</br>- `left`: 离容器左侧的距离。</br>- `right`: 离容器右侧的距离。</br>- `top`: 离容器上侧的距离。</br>- `bottom`: 离容器下侧的距离。</br>|
|
||||
| `textStyle` | | 文本样式。 [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | 文本样式。 [LabelStyle](LabelStyle)|
|
||||
|
||||
## `AxisSplitArea`
|
||||
|
||||
@@ -422,7 +437,7 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
|
||||
Inherits or Implemented: [MainComponent](#MainComponent),[IUpdateRuntimeData](#IUpdateRuntimeData)
|
||||
|
||||
<para>DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。</para>
|
||||
DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
@@ -430,7 +445,7 @@ Inherits or Implemented: [MainComponent](#MainComponent),[IUpdateRuntimeData](#I
|
||||
| `filterMode` | | 数据过滤类型。</br>`DataZoom.FilterMode`:</br>- `Filter`: 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只要有一个维度在数据窗口外,整个数据项就会被过滤掉。</br>- `WeakFilter`: 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只有当全部维度都在数据窗口同侧外部,整个数据项才会被过滤掉。</br>- `Empty`: 当前数据窗口外的数据,被 设置为空。即 不会 影响其他轴的数据范围。</br>- `None`: 不过滤数据,只改变数轴范围。</br>|
|
||||
| `xAxisIndexs` | | 控制的 x 轴索引列表。 |
|
||||
| `yAxisIndexs` | | 控制的 y 轴索引列表。 |
|
||||
| `supportInside` | | Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging, mouse wheel, finger swiping (on the touch screen). |
|
||||
| `supportInside` | | 是否支持内置。内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。 |
|
||||
| `supportInsideScroll` |true | 是否支持坐标系内滚动 |
|
||||
| `supportInsideDrag` |true | 是否支持坐标系内拖拽 |
|
||||
| `supportSlider` | | 是否支持滑动条。有单独的滑动条,用户在滑动条上进行缩放或漫游。 |
|
||||
@@ -449,13 +464,13 @@ Inherits or Implemented: [MainComponent](#MainComponent),[IUpdateRuntimeData](#I
|
||||
| `bottom` | | 组件离容器下侧的距离。 |
|
||||
| `rangeMode` | | 取绝对值还是百分比。</br>`DataZoom.RangeMode`:</br>- `//Value`: The value type of start and end.取值类型</br>- `Percent`: 百分比。</br>|
|
||||
| `start` | | 数据窗口范围的起始百分比。范围是:0 ~ 100。 |
|
||||
| `end` | | The end percentage of the window out of the data extent, in the range of 0 ~ 100. 数据窗口范围的结束百分比。范围是:0 ~ 100。 |
|
||||
| `end` | | 数据窗口范围的结束百分比。范围是:0 ~ 100。 |
|
||||
| `startValue` | | |
|
||||
| `endValue` | | |
|
||||
| `minShowNum` |1 | 最小显示数据个数。当DataZoom放大到最大时,最小显示的数据个数。 |
|
||||
| `scrollSensitivity` |1.1f | 缩放区域组件的敏感度。值越高每次缩放所代表的数据越多。 |
|
||||
| `orient` | | 布局方式是横还是竖。不仅是布局方式,对于直角坐标系而言,也决定了,缺省情况控制横向数轴还是纵向数轴。</br>`Orient`:</br>- `Horizonal`: 水平</br>- `Vertical`: 垂直</br>|
|
||||
| `textStyle` | | 文字格式。 [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | 文本标签格式。 [LabelStyle](LabelStyle)|
|
||||
| `lineStyle` | | 阴影线条样式。 [LineStyle](LineStyle)|
|
||||
| `areaStyle` | | 阴影填充样式。 [AreaStyle](AreaStyle)|
|
||||
|
||||
@@ -481,7 +496,7 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
| `showDebugInfo` |false | |
|
||||
| `showAllChartObject` |false | |
|
||||
| `foldSeries` |false | |
|
||||
| `debugInfoTextStyle` | | [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | [LabelStyle](LabelStyle)|
|
||||
|
||||
## `EffectScatter`
|
||||
|
||||
@@ -531,20 +546,35 @@ Inherits or Implemented: [Serie](#Serie),[INeedSerieContainer](#INeedSerieContai
|
||||
|
||||
## `IconStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |false | 是否显示图标。 |
|
||||
| `layer` | | 显示在上层还是在下层。</br>`IconStyle.Layer`:</br>- `UnderLabel`: </br>- `AboveLabel`: </br>|
|
||||
| `layer` | | 显示在上层还是在下层。</br>`IconStyle.Layer`:</br>- `UnderText`: The icon is display under the label text. 图标在标签文字下</br>- `AboveText`: The icon is display above the label text. 图标在标签文字上</br>|
|
||||
| `align` | | 水平方向对齐方式。</br>`Align`:</br>- `Center`: 对齐方式</br>- `Left`: 对齐方式</br>- `Right`: 对齐方式</br>|
|
||||
| `sprite` | | 图标的图片。 |
|
||||
| `type` | | 图片的显示类型。 |
|
||||
| `color` | | 图标颜色。 |
|
||||
| `width` |20 | 图标宽。 |
|
||||
| `height` |20 | 图标高。 |
|
||||
| `offset` | | 图标偏移。 |
|
||||
| `autoHideWhenLabelEmpty` |false | 当label内容为空时是否自动隐藏图标 |
|
||||
|
||||
## `ImageStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示图标。 |
|
||||
| `sprite` | | 图标的图片。 |
|
||||
| `type` | | 图片的显示类型。 |
|
||||
| `autoColor` | | 是否自动颜色。 |
|
||||
| `color` | | 图标颜色。 |
|
||||
| `width` |0 | 图标宽。 |
|
||||
| `height` |0 | 图标高。 |
|
||||
|
||||
## `Indicator`
|
||||
|
||||
雷达图的指示器,用来指定雷达图中的多个变量(维度)。
|
||||
@@ -592,6 +622,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent]
|
||||
| `centerColor` | | 中心区域颜色。 |
|
||||
| `centerGap` | | 中心区域间隙。 |
|
||||
| `borderWidth` |0 | 边框宽。 |
|
||||
| `borderGap` |0 | 边框间隙。 |
|
||||
| `borderColor` | | 边框的颜色。 |
|
||||
| `borderColor0` | | 边框的颜色。 |
|
||||
| `borderToColor` | | 边框的渐变色。 |
|
||||
@@ -605,15 +636,20 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent]
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
标签的引导线
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示视觉引导线。 |
|
||||
| `lineType` | | 视觉引导线类型。</br>`LineType`:</br>- `Normal`: the normal line chart, 普通折线图。</br>- `Smooth`: the smooth line chart, 平滑曲线。</br>- `StepStart`: 阶梯线图:当前点。</br>- `StepMiddle`: 阶梯线图:当前点和下一个点的中间。</br>- `StepEnd`: 阶梯线图:下一个拐点。</br>|
|
||||
| `lineColor` |ChartConst.clearColor32 | 视觉引导线颜色。默认和serie一致取自调色板。 |
|
||||
| `lineAngle` |0 | 视觉引导线的固定角度。对折线和曲线有效。 |
|
||||
| `lineWidth` |1.0f | 视觉引导线的宽度。 |
|
||||
| `lineGap` |1.0f | 视觉引导线和容器的间距。 |
|
||||
| `lineLength1` |25f | 视觉引导线第一段的长度。 |
|
||||
| `lineLength2` |15f | 视觉引导线第二段的长度。 |
|
||||
| `startSymbol` | | 起始点的图形标记。 [SymbolStyle](SymbolStyle)|
|
||||
| `endSymbol` | | 结束点的图形标记。 [SymbolStyle](SymbolStyle)|
|
||||
|
||||
## `LabelStyle`
|
||||
|
||||
@@ -625,16 +661,17 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示文本标签。 |
|
||||
| `Position` | | |
|
||||
| `autoOffset` |false | 是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |
|
||||
| `offset` | | 距离图形元素的偏移 |
|
||||
| `rotate` | | 文本的旋转。 |
|
||||
| `distance` | | 距离轴线的距离。 |
|
||||
| `formatter` | | |
|
||||
| `paddingLeftRight` |2f | 左右边距。 |
|
||||
| `paddingTopBottom` |2f | 上下边距。 |
|
||||
| `backgroundWidth` |0 | 标签的背景宽度。一般不用指定,不指定时则自动是文字的宽度。 |
|
||||
| `backgroundHeight` |0 | 标签的背景高度。一般不用指定,不指定时则自动是文字的高度。 |
|
||||
| `numericFormatter` | | 标准数字格式字符串。用于将数值格式化显示为字符串。 使用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 |
|
||||
| `autoOffset` |false | 是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会根据已支持的serie自动设置颜色。 |
|
||||
| `width` |0 | 标签的宽度。一般不用指定,不指定时则自动是文字的宽度。 |
|
||||
| `height` |0 | 标签的高度。一般不用指定,不指定时则自动是文字的高度。 |
|
||||
| `icon` | | 图标样式。 [IconStyle](IconStyle)|
|
||||
| `background` | | 背景图样式。 [ImageStyle](ImageStyle)|
|
||||
| `textPadding` | | 文本的边距。 [TextPadding](TextPadding)|
|
||||
| `textStyle` | | 文本样式。 [TextStyle](TextStyle)|
|
||||
|
||||
## `Lang`
|
||||
@@ -644,6 +681,9 @@ Inherits or Implemented: [ScriptableObject](#ScriptableObject)
|
||||
国际化语言表。
|
||||
|
||||
|
||||
## `LangCandlestick`
|
||||
|
||||
|
||||
## `LangTime`
|
||||
|
||||
|
||||
@@ -659,14 +699,14 @@ Inherits or Implemented: [MainComponent](#MainComponent),[IPropertyChanged](#IPr
|
||||
| `iconType` | | 图例类型。 [default:Type.Auto]</br>`Painter.Type`:</br>- `Base`: </br>- `Serie`: </br>- `Top`: </br>|
|
||||
| `selectedMode` | | 选择模式。控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。 [default:SelectedMode.Multiple]</br>`VisualMap.SelectedMode`:</br>- `Multiple`: 多选。</br>- `Single`: 单选。</br>|
|
||||
| `orient` | | 布局方式是横还是竖。 [default:Orient.Horizonal]</br>`Orient`:</br>- `Horizonal`: 水平</br>- `Vertical`: 垂直</br>|
|
||||
| `location` | | 图例显示的位置。 [default:Location.defaultTop]</br>`AxisName.Location`:</br>- `Start`: 坐标轴名称显示位置。</br>- `Middle`: 坐标轴名称显示位置。</br>- `End`: 坐标轴名称显示位置。</br>- `align`: 对齐方式。</br>- `left`: 离容器左侧的距离。</br>- `right`: 离容器右侧的距离。</br>- `top`: 离容器上侧的距离。</br>- `bottom`: 离容器下侧的距离。</br>|
|
||||
| `location` | | 图例显示的位置。 [default:Location.defaultTop] [Location](Location)|
|
||||
| `itemWidth` |25.0f | 图例标记的图形宽度。 [default:24f] |
|
||||
| `itemHeight` |12.0f | 图例标记的图形高度。 [default:12f] |
|
||||
| `itemGap` |10f | 图例每项之间的间隔。横向布局时为水平间隔,纵向布局时为纵向间隔。 [default:10f] |
|
||||
| `itemAutoColor` |true | 图例标记的图形是否自动匹配颜色。 [default:true] |
|
||||
| `textAutoColor` |false | 图例标记的文本是否自动匹配颜色。 [default:false] |
|
||||
| `formatter` | | |
|
||||
| `textStyle` | | 文本样式。 [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | 文本样式。 [LabelStyle](LabelStyle)|
|
||||
| `data` | | If data is not specified, it will be auto collected from series. |
|
||||
| `icons` | | 自定义的图例标记图形。 |
|
||||
|
||||
@@ -709,7 +749,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` | | 是否显示箭头。 |
|
||||
| `Position` | | |
|
||||
| `position` | | 箭头位置。</br>`LineArrow.Position`:</br>- `End`: 末端箭头</br>- `Start`: 头端箭头</br>|
|
||||
| `arrow` | | 箭头。 [ArrowStyle](ArrowStyle)|
|
||||
|
||||
## `LineStyle`
|
||||
@@ -729,6 +769,20 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent]
|
||||
| `length` |0 | |
|
||||
| `opacity` |1 | 线的透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。 |
|
||||
|
||||
## `Location`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[IPropertyChanged](#IPropertyChanged)
|
||||
|
||||
位置类型。通过Align快速设置大体位置,再通过left,right,top,bottom微调具体位置。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `align` | | 对齐方式。</br>`Align`:</br>- `Center`: 对齐方式</br>- `Left`: 对齐方式</br>- `Right`: 对齐方式</br>|
|
||||
| `left` | | 离容器左侧的距离。 |
|
||||
| `right` | | 离容器右侧的距离。 |
|
||||
| `top` | | 离容器上侧的距离。 |
|
||||
| `bottom` | | 离容器下侧的距离。 |
|
||||
|
||||
## `MainComponent`
|
||||
|
||||
Inherits or Implemented: [IComparable](#IComparable)
|
||||
@@ -843,7 +897,7 @@ Inherits or Implemented: [CoordSystem](#CoordSystem),[ISerieContainer](#ISerieCo
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示极坐标。 |
|
||||
| `center` | | When value between 0 and 1 represents a percentage relative to the chart. |
|
||||
| `center` | | 极坐标的中心点。数组的第一项是横坐标,第二项是纵坐标。 当值为0-1之间时表示百分比,设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度。 |
|
||||
| `radius` |0.35f | 极坐标的半径。 |
|
||||
| `backgroundColor` | | 极坐标的背景色,默认透明。 |
|
||||
|
||||
@@ -899,7 +953,6 @@ Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
| `endLabels` | | |
|
||||
| `lineArrows` | | |
|
||||
| `areaStyles` | | |
|
||||
| `iconStyles` | | |
|
||||
| `titleStyles` | | |
|
||||
| `emphases` | | |
|
||||
| `index` | | 系列索引。 |
|
||||
@@ -965,7 +1018,7 @@ Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
| `bottom` | | 组件离容器下侧的距离。 |
|
||||
| `insertDataToHead` | | 添加新数据时是在列表的头部还是尾部加入。 |
|
||||
| `lineStyle` | | 线条样式。 [LineStyle](LineStyle)|
|
||||
| `symbol` | | 标记的图形。 [SymbolStyle](SymbolStyle)|
|
||||
| `symbol` | | 标记的图形。 [SerieSymbol](SerieSymbol)|
|
||||
| `animation` | | 起始动画。 [AnimationStyle](AnimationStyle)|
|
||||
| `itemStyle` | | 图形样式。 [ItemStyle](ItemStyle)|
|
||||
| `data` | | 系列中的数据内容数组。SerieData可以设置1到n维数据。 |
|
||||
@@ -982,17 +1035,49 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
| `name` | | 数据项名称。 |
|
||||
| `id` | | 数据项的唯一id。唯一id不是必须设置的。 |
|
||||
| `parentId` | | |
|
||||
| `baseInfos` | | |
|
||||
| `itemStyles` | | |
|
||||
| `labels` | | |
|
||||
| `labelLines` | | |
|
||||
| `emphases` | | |
|
||||
| `symbols` | | |
|
||||
| `iconStyles` | | |
|
||||
| `lineStyles` | | |
|
||||
| `areaStyles` | | |
|
||||
| `titleStyles` | | |
|
||||
| `data` | | 可指定任意维数的数值列表。 |
|
||||
|
||||
## `SerieDataBaseInfo`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
数据项的其他基础数据。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `ignore` |false | 是否忽略数据。当为 true 时,数据不进行绘制。 |
|
||||
| `selected` | | 该数据项是否被选中。 |
|
||||
| `radius` | | 自定义半径。可用在饼图中自定义某个数据项的半径。 |
|
||||
|
||||
## `SerieSymbol`
|
||||
|
||||
Inherits or Implemented: [SymbolStyle](#SymbolStyle),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
系列数据项的标记的图形
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `sizeType` | | 标记图形的大小获取方式。</br>`SymbolSizeType`:</br>- `Custom`: 自定义大小。</br>- `FromData`: 通过 dataIndex 从数据中获取,再乘以一个比例系数 dataScale 。</br>- `Function`: 通过委托函数获取。</br>|
|
||||
| `selectedSize` |0f | 被选中的标记的大小。 |
|
||||
| `dataIndex` |1 | 当sizeType指定为FromData时,指定的数据源索引。 |
|
||||
| `dataScale` |1 | 当sizeType指定为FromData时,指定的倍数系数。 |
|
||||
| `selectedDataScale` |1.5f | 当sizeType指定为FromData时,指定的高亮倍数系数。 |
|
||||
| `sizeFunction` | | 当sizeType指定为Function时,指定的委托函数。 |
|
||||
| `selectedSizeFunction` | | 当sizeType指定为Function时,指定的高亮委托函数。 |
|
||||
| `startIndex` | | 开始显示图形标记的索引。 |
|
||||
| `interval` | | 显示图形标记的间隔。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。 |
|
||||
| `forceShowLast` |false | 是否强制显示最后一个图形标记。 |
|
||||
| `repeat` |false | 图形是否重复。 |
|
||||
|
||||
## `SerieTheme`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
@@ -1084,7 +1169,7 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
|
||||
## `SymbolStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
系列数据项的标记的图形
|
||||
|
||||
@@ -1092,24 +1177,14 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent]
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示标记。 |
|
||||
| `type` | | 标记类型。</br>`SymbolType`:</br>- `None`: 不显示标记。</br>- `Custom`: 自定义标记。</br>- `Circle`: 圆形。</br>- `EmptyCircle`: 空心圆。</br>- `Rect`: 正方形。可通过设置`itemStyle`的`cornerRadius`变成圆角矩形。</br>- `EmptyRect`: 空心正方形。</br>- `Triangle`: 三角形。</br>- `EmptyTriangle`: 空心三角形。</br>- `Diamond`: 菱形。</br>- `EmptyDiamond`: 空心菱形。</br>- `Arrow`: 箭头。</br>- `EmptyArrow`: 空心箭头。</br>|
|
||||
| `sizeType` | | 标记图形的大小获取方式。</br>`SymbolSizeType`:</br>- `Custom`: 自定义大小。</br>- `FromData`: 通过 dataIndex 从数据中获取,再乘以一个比例系数 dataScale 。</br>- `Function`: 通过委托函数获取。</br>|
|
||||
| `size` |0f | 标记的大小。 |
|
||||
| `selectedSize` |0f | 被选中的标记的大小。 |
|
||||
| `dataIndex` |1 | 当sizeType指定为FromData时,指定的数据源索引。 |
|
||||
| `dataScale` |1 | 当sizeType指定为FromData时,指定的倍数系数。 |
|
||||
| `selectedDataScale` |1.5f | 当sizeType指定为FromData时,指定的高亮倍数系数。 |
|
||||
| `sizeFunction` | | 当sizeType指定为Function时,指定的委托函数。 |
|
||||
| `selectedSizeFunction` | | 当sizeType指定为Function时,指定的高亮委托函数。 |
|
||||
| `startIndex` | | 开始显示图形标记的索引。 |
|
||||
| `interval` | | 显示图形标记的间隔。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。 |
|
||||
| `forceShowLast` |false | 是否强制显示最后一个图形标记。 |
|
||||
| `gap` |0 | 图形标记和线条的间隙距离。 |
|
||||
| `width` |0f | 图形的宽。 |
|
||||
| `height` |0f | 图形的高。 |
|
||||
| `repeat` |false | 图形是否重复。 |
|
||||
| `offset` |Vector2.zero | 图形的偏移。 |
|
||||
| `image` | | 自定义的标记图形。 |
|
||||
| `imageType` | | |
|
||||
| `color` | | 图形的颜色。 |
|
||||
|
||||
## `TextLimit`
|
||||
|
||||
@@ -1124,6 +1199,20 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
| `gap` |1 | 两边留白像素距离。 [default:10f] |
|
||||
| `suffix` | | 长度超出时的后缀。 [default: "..."] |
|
||||
|
||||
## `TextPadding`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
文本的内边距设置。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | |
|
||||
| `top` |2 | |
|
||||
| `right` |4 | |
|
||||
| `left` |4 | |
|
||||
| `bottom` |2 | |
|
||||
|
||||
## `TextStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
@@ -1132,15 +1221,13 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 文本的相关设置。 |
|
||||
| `font` | | 文本字体。 [default: null] |
|
||||
| `autoWrap` |false | 是否自动换行。 |
|
||||
| `autoAlign` |true | 文本是否让系统自动选对齐方式。为false时才会用alignment。 |
|
||||
| `rotate` |0 | 文本的旋转。 [default: `0f`] |
|
||||
| `extraWidth` |0 | 额外的宽度 |
|
||||
| `offset` |Vector2.zero | 坐标偏移。 [Default: `Vector2.zero`] |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会自动设置颜色。 |
|
||||
| `color` | | 文本的颜色。 [default: `Color.clear`] |
|
||||
| `autoBackgroundColor` |false | |
|
||||
| `backgroundColor` | | 文本的背景颜色。 [default: `Color.clear`] |
|
||||
| `fontSize` |0 | 文本字体大小。 [default: 18] |
|
||||
| `fontStyle` | | 文本字体的风格。 [default: FontStyle.Normal] |
|
||||
| `lineSpacing` |1f | 行间距。 [default: 1f] |
|
||||
@@ -1184,7 +1271,8 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|--|--|--|
|
||||
| `show` |true | |
|
||||
| `sharedTheme` | | [Theme](Theme)|
|
||||
| `enableCustomTheme` | | |
|
||||
| `transparentBackground` |false | Whether the background color is transparent. When true, the background color is not drawn. |是否透明背景颜色。当设置为true时,不绘制背景颜色。 |
|
||||
| `enableCustomTheme` |false | 是否自定义主题颜色。当设置为true时,可以用‘sync color to custom’同步主题的颜色到自定义颜色。也可以手动设置。 |
|
||||
| `customFont` | | |
|
||||
| `customBackgroundColor` | | 自定义的背景颜色。 |
|
||||
| `customColorPalette` | | |
|
||||
@@ -1199,23 +1287,18 @@ Inherits or Implemented: [MainComponent](#MainComponent),[IPropertyChanged](#IPr
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示标题组件。 |
|
||||
| `text` | | 主标题文本,支持使用 \n 换行。 |
|
||||
| `textStyle` | | 主标题文本样式。 [TextStyle](TextStyle)|
|
||||
| `subText` | | 副标题文本,支持使用 \n 换行。 |
|
||||
| `subTextStyle` | | 副标题文本样式。 [TextStyle](TextStyle)|
|
||||
| `labelStyle` | | 主标题文本样式。 [LabelStyle](LabelStyle)|
|
||||
| `subLabelStyle` | | 副标题文本样式。 [LabelStyle](LabelStyle)|
|
||||
| `itemGap` |0 | 主副标题之间的间距。 |
|
||||
| `location` | | 标题显示位置。</br>`AxisName.Location`:</br>- `Start`: 坐标轴名称显示位置。</br>- `Middle`: 坐标轴名称显示位置。</br>- `End`: 坐标轴名称显示位置。</br>- `align`: 对齐方式。</br>- `left`: 离容器左侧的距离。</br>- `right`: 离容器右侧的距离。</br>- `top`: 离容器上侧的距离。</br>- `bottom`: 离容器下侧的距离。</br>|
|
||||
| `location` | | 标题显示位置。 [Location](Location)|
|
||||
|
||||
## `TitleStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieDataComponent](#ISerieDataComponent),[ISerieExtraComponent](#ISerieExtraComponent)
|
||||
Inherits or Implemented: [LabelStyle](#LabelStyle),[ISerieDataComponent](#ISerieDataComponent),[ISerieExtraComponent](#ISerieExtraComponent)
|
||||
|
||||
标题相关设置。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示标题。 |
|
||||
| `offsetCenter` |Vector2(0, -0.2f) | 相对于中心的偏移位置。 |
|
||||
| `textStyle` | | 文本的颜色。 [TextStyle](TextStyle)|
|
||||
|
||||
## `TitleTheme`
|
||||
|
||||
@@ -1249,6 +1332,7 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
| `alwayShowContent` |false | 是否触发后一直显示提示框浮层。 |
|
||||
| `offset` |Vector2(18f, -25f) | 提示框相对于鼠标位置的偏移。 |
|
||||
| `backgroundImage` | | 提示框的背景图片。 |
|
||||
| `backgroundType` | | 提示框的背景图片显示类型。 |
|
||||
| `backgroundColor` | | 提示框的背景颜色。 |
|
||||
| `borderWidth` |2f | 边框线宽。 |
|
||||
| `fixedXEnable` |false | |
|
||||
@@ -1259,9 +1343,9 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
| `itemHeight` |25f | |
|
||||
| `borderColor` |Color32(230, 230, 230, 255) | 边框颜色。 |
|
||||
| `lineStyle` | | 指示线样式。 [LineStyle](LineStyle)|
|
||||
| `labelTextStyle` | | 提示框标签的文本样式。 [TextStyle](TextStyle)|
|
||||
| `titleTextStyle` | | 标题的文本样式。 [TextStyle](TextStyle)|
|
||||
| `columnsTextStyle` | | |
|
||||
| `indicatorLabelStyle` | | 提示框的坐标轴指示器文本的样式。 [LabelStyle](LabelStyle)|
|
||||
| `titleLabelStyle` | | 标题的文本样式。 [LabelStyle](LabelStyle)|
|
||||
| `contentLabelStyles` | | |
|
||||
|
||||
## `TooltipTheme`
|
||||
|
||||
@@ -1284,7 +1368,8 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示组件。如果设置为 false,不会显示,但是数据映射的功能还存在。 [default: true] |
|
||||
| `show` |true | 组件是否生效。 |
|
||||
| `showUI` |false | 是否显示组件。如果设置为 false,不会显示,但是数据映射的功能还存在。 |
|
||||
| `type` | | 组件类型。</br>`Painter.Type`:</br>- `Base`: </br>- `Serie`: </br>- `Top`: </br>|
|
||||
| `selectedMode` | | 选择模式。</br>`VisualMap.SelectedMode`:</br>- `Multiple`: 多选。</br>- `Single`: 单选。</br>|
|
||||
| `serieIndex` |0 | 影响的serie索引。 |
|
||||
@@ -1304,7 +1389,9 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
| `hoverLink` |true | Conversely, when the mouse hovers over a graphic element in a diagram, the corresponding value of the visualMap component is triangulated in the corresponding position. |
|
||||
| `autoMinMax` |true | Automatically set min, Max value 自动设置min,max的值 |
|
||||
| `orient` | | 布局方式是横还是竖。</br>`Orient`:</br>- `Horizonal`: 水平</br>- `Vertical`: 垂直</br>|
|
||||
| `location` | | 组件显示的位置。</br>`AxisName.Location`:</br>- `Start`: 坐标轴名称显示位置。</br>- `Middle`: 坐标轴名称显示位置。</br>- `End`: 坐标轴名称显示位置。</br>- `align`: 对齐方式。</br>- `left`: 离容器左侧的距离。</br>- `right`: 离容器右侧的距离。</br>- `top`: 离容器上侧的距离。</br>- `bottom`: 离容器下侧的距离。</br>|
|
||||
| `location` | | 组件显示的位置。 [Location](Location)|
|
||||
| `workOnLine` |true | 组件是否对LineChart的LineStyle有效。 |
|
||||
| `workOnArea` |false | 组件是否对LineChart的AreaStyle有效。 |
|
||||
| `inRange` | | 定义 在选中范围中 的视觉颜色。 |
|
||||
| `outOfRange` | | 定义 在选中范围外 的视觉颜色。 |
|
||||
| `pieces` | | 分段式每一段的相关配置。 |
|
||||
@@ -1394,4 +1481,4 @@ Inherits or Implemented: [Axis](#Axis)
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)
|
||||
[XCharts问答](XChartsFAQ-ZH.md)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# XCharts Q&A
|
||||
# XCharts FAQ
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts API](XChartsAPI-EN.md)</br>
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2929481916a9540ed9ecc270be6a3b0e
|
||||
guid: e803ae0ae73794ec6891fed7551fe01d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2d61cadf902a4e20a2690f3c7d2ceea
|
||||
guid: 4df833a2a1e6c4a7da37a08379dd2e18
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -1,7 +1,7 @@
|
||||
# 教程:5分钟上手 XCharts 3.0
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -226,6 +226,6 @@ itemStyle.color = Color.blue;
|
||||
```
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 教程:5分钟上手 XCharts 3.0
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -226,6 +226,6 @@ itemStyle.color = Color.blue;
|
||||
```
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -11,6 +11,15 @@ namespace XCharts.Editor
|
||||
[CustomEditor(typeof(BaseChart), true)]
|
||||
public class BaseChartEditor : UnityEditor.Editor
|
||||
{
|
||||
class Styles
|
||||
{
|
||||
public static readonly GUIContent btnAddSerie = new GUIContent("Add Serie", "");
|
||||
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
|
||||
public static readonly GUIContent btnCovertXYAxis = new GUIContent("Covert XY Axis", "");
|
||||
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Chart Object", "");
|
||||
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
|
||||
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
|
||||
}
|
||||
protected BaseChart m_Chart;
|
||||
protected SerializedProperty m_Script;
|
||||
protected SerializedProperty m_EnableTextMeshPro;
|
||||
@@ -28,6 +37,7 @@ namespace XCharts.Editor
|
||||
private bool m_CheckWarning = false;
|
||||
private int m_LastComponentCount = 0;
|
||||
private int m_LastSerieCount = 0;
|
||||
private string m_VersionString = "";
|
||||
private StringBuilder sb = new StringBuilder();
|
||||
MainComponentListEditor m_ComponentList;
|
||||
SerieListEditor m_SerieList;
|
||||
@@ -51,6 +61,10 @@ namespace XCharts.Editor
|
||||
RefreshSeries();
|
||||
m_SerieList = new SerieListEditor(this);
|
||||
m_SerieList.Init(m_Chart, serializedObject, m_Series);
|
||||
|
||||
m_VersionString = "v" + XChartsMgr.fullVersion;
|
||||
if (m_EnableTextMeshPro.boolValue)
|
||||
m_VersionString += "-tmp";
|
||||
}
|
||||
|
||||
public List<SerializedProperty> RefreshComponent()
|
||||
@@ -97,8 +111,6 @@ namespace XCharts.Editor
|
||||
m_SerieList.UpdateSeriesProperty(m_Series);
|
||||
}
|
||||
OnStartInspectorGUI();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
OnDebugInspectorGUI();
|
||||
EditorGUILayout.Space();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
@@ -113,18 +125,23 @@ namespace XCharts.Editor
|
||||
EditorGUILayout.PropertyField(m_Script);
|
||||
EditorGUILayout.PropertyField(m_ChartName);
|
||||
EditorGUILayout.PropertyField(m_RaycastTarget);
|
||||
if (XChartsMgr.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox("chart name is repeated: " + m_ChartName.stringValue, MessageType.Error);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.PropertyField(m_Theme);
|
||||
EditorGUILayout.PropertyField(m_Settings);
|
||||
|
||||
m_ComponentList.OnGUI();
|
||||
|
||||
m_SerieList.OnGUI();
|
||||
}
|
||||
|
||||
protected virtual void OnDebugInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_DebugInfo, true);
|
||||
EditorGUILayout.Space();
|
||||
AddSerie();
|
||||
AddComponent();
|
||||
CheckWarning();
|
||||
@@ -165,16 +182,12 @@ namespace XCharts.Editor
|
||||
|
||||
private void ShowVersion()
|
||||
{
|
||||
sb.Length = 0;
|
||||
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
|
||||
if(m_EnableTextMeshPro.boolValue)
|
||||
sb.Append("-tmp");
|
||||
EditorGUILayout.HelpBox(sb.ToString(), MessageType.None);
|
||||
EditorGUILayout.HelpBox(m_VersionString, MessageType.None);
|
||||
}
|
||||
|
||||
private void AddComponent()
|
||||
{
|
||||
if (GUILayout.Button("Add Component"))
|
||||
if (GUILayout.Button(Styles.btnAddComponent))
|
||||
{
|
||||
var menu = new GenericMenu();
|
||||
foreach (var type in GetMainComponentTypeNames())
|
||||
@@ -197,7 +210,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
private void AddSerie()
|
||||
{
|
||||
if (GUILayout.Button("Add Serie"))
|
||||
if (GUILayout.Button(Styles.btnAddSerie))
|
||||
{
|
||||
var menu = new GenericMenu();
|
||||
foreach (var type in GetSerieTypeNames())
|
||||
@@ -260,22 +273,22 @@ namespace XCharts.Editor
|
||||
{
|
||||
if (m_Chart.HasChartComponent<XAxis>() && m_Chart.HasChartComponent<YAxis>())
|
||||
{
|
||||
if (GUILayout.Button("Covert XY Axis"))
|
||||
if (GUILayout.Button(Styles.btnCovertXYAxis))
|
||||
m_Chart.CovertXYAxis(0);
|
||||
}
|
||||
if (GUILayout.Button("Rebuild Chart Object"))
|
||||
if (GUILayout.Button(Styles.btnRebuildChartObject))
|
||||
{
|
||||
m_Chart.RebuildChartObject();
|
||||
}
|
||||
if (m_CheckWarning)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Check Warning"))
|
||||
if (GUILayout.Button(Styles.btnCheckWarning))
|
||||
{
|
||||
m_CheckWarning = true;
|
||||
m_Chart.CheckWarning();
|
||||
}
|
||||
if (GUILayout.Button("Hide Warning"))
|
||||
if (GUILayout.Button(Styles.btnHideWarning))
|
||||
{
|
||||
m_CheckWarning = false;
|
||||
}
|
||||
@@ -296,7 +309,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button("Check warning"))
|
||||
if (GUILayout.Button(Styles.btnCheckWarning))
|
||||
{
|
||||
m_CheckWarning = true;
|
||||
m_Chart.CheckWarning();
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_FoldSeries");
|
||||
PropertyField(prop, "m_ShowDebugInfo");
|
||||
PropertyField(prop, "m_ShowAllChartObject");
|
||||
PropertyField(prop, "m_DebugInfoTextStyle");
|
||||
PropertyField(prop, "m_LabelStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Layer");
|
||||
PropertyField(prop, "m_Align");
|
||||
PropertyField(prop, "m_Sprite");
|
||||
PropertyField(prop, "m_Type");
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Height");
|
||||
|
||||
28
Editor/ChildComponents/ImageStyleDrawer.cs
Normal file
28
Editor/ChildComponents/ImageStyleDrawer.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ImageStyle), true)]
|
||||
public class ImageStyleDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "ImageStyle"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Sprite");
|
||||
PropertyField(prop, "m_Type");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Height");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e994b64b93384ae4bfa9a7a85ba8914
|
||||
guid: 4649856b17dfd4f628eb975040fb791c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -24,6 +24,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_CenterColor");
|
||||
PropertyField(prop, "m_CenterGap");
|
||||
PropertyField(prop, "m_BorderWidth");
|
||||
PropertyField(prop, "m_BorderGap");
|
||||
PropertyField(prop, "m_BorderColor");
|
||||
PropertyField(prop, "m_BorderColor0");
|
||||
PropertyField(prop, "m_BorderToColor");
|
||||
|
||||
@@ -17,10 +17,13 @@ namespace XCharts.Editor
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_LineType");
|
||||
PropertyField(prop, "m_LineColor");
|
||||
PropertyField(prop, "m_LineAngle");
|
||||
PropertyField(prop, "m_LineWidth");
|
||||
PropertyField(prop, "m_LineGap");
|
||||
PropertyField(prop, "m_LineLength1");
|
||||
PropertyField(prop, "m_LineLength2");
|
||||
PropertyField(prop, "m_StartSymbol");
|
||||
PropertyField(prop, "m_EndSymbol");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,19 +16,26 @@ namespace XCharts.Editor
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Position");
|
||||
PropertyField(prop, "m_Offset");
|
||||
PropertyField(prop, "m_AutoOffset");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_Formatter");
|
||||
PropertyField(prop, "m_NumericFormatter");
|
||||
PropertyField(prop, "m_BackgroundWidth");
|
||||
PropertyField(prop, "m_BackgroundHeight");
|
||||
PropertyField(prop, "m_PaddingLeftRight");
|
||||
PropertyField(prop, "m_PaddingTopBottom");
|
||||
PropertyField(prop, "m_AutoOffset");
|
||||
PropertyField(prop, "m_Offset");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_Rotate");
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Height");
|
||||
PropertyField(prop, "m_Icon");
|
||||
PropertyField(prop, "m_Background");
|
||||
PropertyField(prop, "m_TextStyle");
|
||||
PropertyField(prop, "m_TextPadding");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EndLabelStyle), true)]
|
||||
public class EndLabelStyleDrawer : LabelStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "End Label"; } }
|
||||
}
|
||||
}
|
||||
25
Editor/ChildComponents/SerieDataBaseInfoDrawer.cs
Normal file
25
Editor/ChildComponents/SerieDataBaseInfoDrawer.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieDataBaseInfo), true)]
|
||||
public class SerieDataBaseInfoDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "BaseInfo"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", false))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Ignore");
|
||||
PropertyField(prop, "m_Selected");
|
||||
PropertyField(prop, "m_Radius");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/ChildComponents/SerieDataBaseInfoDrawer.cs.meta
Normal file
11
Editor/ChildComponents/SerieDataBaseInfoDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 418b81a68e59a4572ab57787b5362d5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
53
Editor/ChildComponents/SerieSymbolDrawer.cs
Normal file
53
Editor/ChildComponents/SerieSymbolDrawer.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
|
||||
public class SerieSymbolDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Symbol"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
PropertyField(prop, "m_Type");
|
||||
if (type == SymbolType.Custom)
|
||||
{
|
||||
PropertyField(prop, "m_Image");
|
||||
PropertyField(prop, "m_ImageType");
|
||||
PropertyField(prop, "m_Width");
|
||||
// PropertyField(prop, "m_Height");
|
||||
// PropertyField(prop, "m_Offset");
|
||||
}
|
||||
PropertyField(prop, "m_Gap");
|
||||
PropertyField(prop, "m_SizeType");
|
||||
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
PropertyField(prop, "m_Size");
|
||||
PropertyField(prop, "m_SelectedSize");
|
||||
break;
|
||||
case SymbolSizeType.FromData:
|
||||
PropertyField(prop, "m_DataIndex");
|
||||
PropertyField(prop, "m_DataScale");
|
||||
PropertyField(prop, "m_SelectedDataScale");
|
||||
break;
|
||||
case SymbolSizeType.Function:
|
||||
break;
|
||||
}
|
||||
PropertyField(prop, "m_StartIndex");
|
||||
PropertyField(prop, "m_Interval");
|
||||
PropertyField(prop, "m_ForceShowLast");
|
||||
PropertyField(prop, "m_Repeat");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/ChildComponents/SerieSymbolDrawer.cs.meta
Normal file
11
Editor/ChildComponents/SerieSymbolDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a164822bc0fd4e5291f00c5a4ee86f6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -23,29 +23,12 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Image");
|
||||
PropertyField(prop, "m_ImageType");
|
||||
PropertyField(prop, "m_Width");
|
||||
// PropertyField(prop, "m_Height");
|
||||
PropertyField(prop, "m_Height");
|
||||
// PropertyField(prop, "m_Offset");
|
||||
}
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_Size");
|
||||
PropertyField(prop, "m_Gap");
|
||||
PropertyField(prop, "m_SizeType");
|
||||
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
PropertyField(prop, "m_Size");
|
||||
PropertyField(prop, "m_SelectedSize");
|
||||
break;
|
||||
case SymbolSizeType.FromData:
|
||||
PropertyField(prop, "m_DataIndex");
|
||||
PropertyField(prop, "m_DataScale");
|
||||
PropertyField(prop, "m_SelectedDataScale");
|
||||
break;
|
||||
case SymbolSizeType.Function:
|
||||
break;
|
||||
}
|
||||
PropertyField(prop, "m_StartIndex");
|
||||
PropertyField(prop, "m_Interval");
|
||||
PropertyField(prop, "m_ForceShowLast");
|
||||
PropertyField(prop, "m_Repeat");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
26
Editor/ChildComponents/TextPaddingDrawer.cs
Normal file
26
Editor/ChildComponents/TextPaddingDrawer.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(TextPadding), true)]
|
||||
public class TextPaddingDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Padding"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Top");
|
||||
PropertyField(prop, "m_Right");
|
||||
PropertyField(prop, "m_Bottom");
|
||||
PropertyField(prop, "m_Left");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/ChildComponents/TextPaddingDrawer.cs.meta
Normal file
11
Editor/ChildComponents/TextPaddingDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46cc25f4c9fc846938a06cf3b8fc75bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,7 +15,7 @@ namespace XCharts.Editor
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "", true))
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
#if dUI_TextMeshPro
|
||||
@@ -24,11 +24,8 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Font");
|
||||
#endif
|
||||
PropertyField(prop, "m_Rotate");
|
||||
PropertyField(prop, "m_Offset");
|
||||
PropertyField(prop, "m_ExtraWidth");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_AutoBackgroundColor");
|
||||
PropertyField(prop, "m_BackgroundColor");
|
||||
PropertyField(prop, "m_FontSize");
|
||||
PropertyField(prop, "m_LineSpacing");
|
||||
#if dUI_TextMeshPro
|
||||
@@ -37,8 +34,8 @@ namespace XCharts.Editor
|
||||
#else
|
||||
PropertyField(prop, "m_FontStyle");
|
||||
PropertyField(prop, "m_Alignment");
|
||||
PropertyField(prop, "m_AutoWrap");
|
||||
PropertyField(prop, "m_AutoAlign");
|
||||
PropertyField(prop, "m_AutoWrap");
|
||||
#endif
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace XCharts.Editor
|
||||
XCThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
|
||||
}
|
||||
PropertyField(prop, "m_SharedTheme");
|
||||
PropertyField(prop, "m_TransparentBackground");
|
||||
PropertyField(prop, "m_EnableCustomTheme");
|
||||
using (new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
|
||||
{
|
||||
|
||||
@@ -5,19 +5,8 @@ using XCharts.Runtime;
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(TitleStyle), true)]
|
||||
public class TitleStyleDrawer : BasePropertyDrawer
|
||||
public class TitleStyleDrawer : LabelStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "TitleStyle"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_OffsetCenter");
|
||||
PropertyField(prop, "m_TextStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,6 @@ namespace XCharts.Editor
|
||||
PropertyField("m_AxisLabel");
|
||||
PropertyField("m_SplitLine");
|
||||
PropertyField("m_SplitArea");
|
||||
PropertyField("m_IconStyle");
|
||||
PropertyListField("m_Icons", true);
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
@@ -153,17 +152,22 @@ namespace XCharts.Editor
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Inside");
|
||||
PropertyField(prop, "m_Interval");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Height");
|
||||
PropertyField(prop, "m_Formatter");
|
||||
PropertyField(prop, "m_NumericFormatter");
|
||||
|
||||
PropertyField(prop, "m_ShowAsPositiveNumber");
|
||||
PropertyField(prop, "m_OnZero");
|
||||
PropertyField(prop, "m_ShowStartLabel");
|
||||
PropertyField(prop, "m_ShowEndLabel");
|
||||
PropertyField(prop, "m_TextLimit");
|
||||
|
||||
PropertyField(prop, "m_Rotate");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_Formatter");
|
||||
PropertyField(prop, "m_NumericFormatter");
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Height");
|
||||
PropertyField(prop, "m_Icon");
|
||||
PropertyField(prop, "m_Background");
|
||||
PropertyField(prop, "m_TextStyle");
|
||||
PropertyField(prop, "m_TextPadding");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
@@ -180,9 +184,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Name");
|
||||
PropertyField(prop, "m_Formatter");
|
||||
PropertyField(prop, "m_Location");
|
||||
PropertyField(prop, "m_TextStyle");
|
||||
PropertyField(prop, "m_LabelStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Bottom");
|
||||
PropertyField("m_LineStyle");
|
||||
PropertyField("m_AreaStyle");
|
||||
PropertyField("m_LabelStyle");
|
||||
PropertyListField("m_XAxisIndexs", true);
|
||||
PropertyListField("m_YAxisIndexs", true);
|
||||
PropertyField("m_TextStyle");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Orient");
|
||||
PropertyField("m_Formatter");
|
||||
PropertyField("m_Location");
|
||||
PropertyField("m_TextStyle");
|
||||
PropertyField("m_LabelStyle");
|
||||
PropertyListField("m_Icons");
|
||||
PropertyListField("m_Data");
|
||||
--EditorGUI.indentLevel;
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_SubText");
|
||||
PropertyField("m_ItemGap");
|
||||
PropertyField("m_Location");
|
||||
PropertyField("m_TextStyle");
|
||||
PropertyField("m_SubTextStyle");
|
||||
PropertyField("m_LabelStyle");
|
||||
PropertyField("m_SubLabelStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,17 @@ namespace XCharts.Editor
|
||||
PropertyField("m_TitleFormatter");
|
||||
PropertyField("m_ItemFormatter");
|
||||
PropertyField("m_NumericFormatter");
|
||||
PropertyField("m_TitleHeight");
|
||||
PropertyField("m_ItemHeight");
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
PropertyField("m_TitleHeight");
|
||||
PropertyField("m_ItemHeight");
|
||||
PropertyField("m_Marker");
|
||||
PropertyField("m_BorderWidth");
|
||||
PropertyField("m_BorderColor");
|
||||
PropertyField("m_PaddingLeftRight");
|
||||
PropertyField("m_PaddingTopBottom");
|
||||
PropertyField("m_BackgroundImage");
|
||||
PropertyField("m_BackgroundType");
|
||||
PropertyField("m_BackgroundColor");
|
||||
PropertyField("m_FixedWidth");
|
||||
PropertyField("m_FixedHeight");
|
||||
@@ -40,9 +41,9 @@ namespace XCharts.Editor
|
||||
PropertyField("m_FixedY");
|
||||
});
|
||||
PropertyField("m_LineStyle");
|
||||
PropertyField("m_LabelTextStyle");
|
||||
PropertyField("m_TitleTextStyle");
|
||||
PropertyListField("m_ColumnsTextStyle");
|
||||
PropertyField("m_IndicatorLabelStyle");
|
||||
PropertyField("m_TitleLabelStyle");
|
||||
PropertyListField("m_ContentLabelStyles");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,10 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Max");
|
||||
PropertyField("m_SplitNumber");
|
||||
PropertyField("m_Dimension");
|
||||
PropertyField("m_Show");
|
||||
if (baseProperty.FindPropertyRelative("m_Show").boolValue)
|
||||
PropertyField("m_WorkOnLine");
|
||||
PropertyField("m_WorkOnArea");
|
||||
PropertyField("m_ShowUI");
|
||||
if (baseProperty.FindPropertyRelative("m_ShowUI").boolValue)
|
||||
{
|
||||
PropertyField("m_SelectedMode");
|
||||
PropertyTwoFiled("m_Range");
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_BarZebraWidth");
|
||||
PropertyField("m_BarZebraGap");
|
||||
}
|
||||
|
||||
PropertyField("m_Clip");
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
PropertyFieldLimitMin("m_MinShow", 0);
|
||||
@@ -38,7 +38,6 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ShowAsPositiveNumber");
|
||||
PropertyField("m_Large");
|
||||
PropertyField("m_LargeThreshold");
|
||||
PropertyField("m_Clip");
|
||||
PropertyField("m_PlaceHolder");
|
||||
});
|
||||
PropertyField("m_ItemStyle");
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_YAxisIndex");
|
||||
}
|
||||
PropertyField("m_LineType");
|
||||
//PropertyField("m_Clip");
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
PropertyFieldLimitMin("m_MinShow", 0);
|
||||
@@ -32,7 +33,6 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ShowAsPositiveNumber");
|
||||
PropertyField("m_Large");
|
||||
PropertyField("m_LargeThreshold");
|
||||
PropertyField("m_Clip");
|
||||
});
|
||||
PropertyField("m_Symbol");
|
||||
PropertyField("m_LineStyle");
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Gap");
|
||||
PropertyTwoFiled("m_Center");
|
||||
PropertyTwoFiled("m_Radius");
|
||||
//PropertyField("m_StartAngle");
|
||||
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace XCharts.Editor
|
||||
var m_Id = serieData.FindPropertyRelative("m_Id");
|
||||
var m_ParentId = serieData.FindPropertyRelative("m_ParentId");
|
||||
|
||||
var m_IconStyle = serieData.FindPropertyRelative("m_IconStyles");
|
||||
var m_BaseInfo = serieData.FindPropertyRelative("m_BaseInfos");
|
||||
var m_Label = serieData.FindPropertyRelative("m_Labels");
|
||||
var m_ItemStyle = serieData.FindPropertyRelative("m_ItemStyles");
|
||||
var m_Emphasis = serieData.FindPropertyRelative("m_Emphases");
|
||||
@@ -208,19 +208,19 @@ namespace XCharts.Editor
|
||||
PropertyField(m_Id);
|
||||
PropertyField(m_ParentId);
|
||||
|
||||
var componentNum = m_IconStyle.arraySize + m_Label.arraySize + m_ItemStyle.arraySize + m_Emphasis.arraySize
|
||||
var componentNum = m_BaseInfo.arraySize + m_Label.arraySize + m_ItemStyle.arraySize + m_Emphasis.arraySize
|
||||
+ m_Symbol.arraySize + m_LineStyle.arraySize + m_AreaStyle.arraySize;
|
||||
var title = "Component";
|
||||
if (componentNum == 0) title += " (None)";
|
||||
m_DataComponentFoldout = ChartEditorHelper.DrawHeader(title, m_DataComponentFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Add BaseInfo", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<SerieDataBaseInfo>();
|
||||
}, m_BaseInfo.arraySize == 0),
|
||||
new HeaderMenuInfo("Add ItemStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<ItemStyle>();
|
||||
}, m_ItemStyle.arraySize == 0),
|
||||
new HeaderMenuInfo("Add IconStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<IconStyle>();
|
||||
}, m_IconStyle.arraySize == 0),
|
||||
new HeaderMenuInfo("Add Label", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<LabelStyle>();
|
||||
@@ -231,7 +231,7 @@ namespace XCharts.Editor
|
||||
}, m_Emphasis.arraySize == 0),
|
||||
new HeaderMenuInfo("Add Symbol", () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<SymbolStyle>();
|
||||
serie.GetSerieData(index).GetOrAddComponent<SerieSymbol>();
|
||||
}, m_Symbol.arraySize == 0),
|
||||
new HeaderMenuInfo("Add LineStyle", () =>
|
||||
{
|
||||
@@ -245,14 +245,14 @@ namespace XCharts.Editor
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent<TitleStyle>();
|
||||
}, m_TitleStyle.arraySize == 0),
|
||||
new HeaderMenuInfo("Remove BaseInfo", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<SerieDataBaseInfo>();
|
||||
}, m_BaseInfo.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove ItemStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<ItemStyle>();
|
||||
}, m_ItemStyle.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove IconStyle", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<IconStyle>();
|
||||
}, m_IconStyle.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove Label", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<LabelStyle>();
|
||||
@@ -263,7 +263,7 @@ namespace XCharts.Editor
|
||||
}, m_Emphasis.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove Symbol", () =>
|
||||
{
|
||||
serie.GetSerieData(index).RemoveComponent<SymbolStyle>();
|
||||
serie.GetSerieData(index).RemoveComponent<SerieSymbol>();
|
||||
}, m_Symbol.arraySize > 0),
|
||||
new HeaderMenuInfo("Remove LineStyle", () =>
|
||||
{
|
||||
@@ -283,8 +283,8 @@ namespace XCharts.Editor
|
||||
}, componentNum > 0));
|
||||
if (m_DataComponentFoldout)
|
||||
{
|
||||
if (m_IconStyle.arraySize > 0)
|
||||
PropertyField(m_IconStyle.GetArrayElementAtIndex(0));
|
||||
if (m_BaseInfo.arraySize > 0)
|
||||
PropertyField(m_BaseInfo.GetArrayElementAtIndex(0));
|
||||
if (m_Label.arraySize > 0)
|
||||
PropertyField(m_Label.GetArrayElementAtIndex(0));
|
||||
if (m_ItemStyle.arraySize > 0)
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_YAxisIndex");
|
||||
PropertyField("m_BarWidth");
|
||||
PropertyField("m_BarGap");
|
||||
PropertyField("m_Clip");
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_XAxisIndex");
|
||||
PropertyField("m_YAxisIndex");
|
||||
PropertyField("m_LineType");
|
||||
//PropertyField("m_Clip");
|
||||
PropertyField("m_LineStyle");
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace XCharts.Editor
|
||||
public static void CheckDeletedAsset(string assetPath)
|
||||
{
|
||||
if (!IsThemeAsset(assetPath)) return;
|
||||
if (XCSettings.Instance == null) return;
|
||||
var themes = XCSettings.customThemes;
|
||||
var changed = false;
|
||||
|
||||
|
||||
@@ -194,7 +194,8 @@ namespace XCharts.Editor
|
||||
else if (a.StartsWith("selected:"))
|
||||
{
|
||||
string selected = a.Substring(9, a.Length - 9);
|
||||
serieData.selected = bool.Parse(selected);
|
||||
var baseInfo = serieData.GetOrAddComponent<SerieDataBaseInfo>();
|
||||
baseInfo.selected = bool.Parse(selected);
|
||||
}
|
||||
}
|
||||
serie.AddSerieData(serieData);
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace XCharts.Editor
|
||||
static SettingsProvider[] CreateXCSettingsProvider()
|
||||
{
|
||||
var providers = new System.Collections.Generic.List<SettingsProvider> { new XCResourceImporterProvider() };
|
||||
|
||||
if (GetSettings() != null)
|
||||
{
|
||||
var provider = new AssetSettingsProvider("Project/XCharts/Settings", GetSettings);
|
||||
|
||||
@@ -193,20 +193,5 @@ namespace XCharts.Editor
|
||||
XChartsMgr.ModifyTMPRefence(true);
|
||||
XChartsMgr.DisableTextMeshPro();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/Theme/Export Default Theme")]
|
||||
public static void ExportDefaultTheme()
|
||||
{
|
||||
var profile = ScriptableObject.CreateInstance<Theme>();
|
||||
profile.name = "Default";
|
||||
profile.themeName = "Default";
|
||||
profile.themeType = ThemeType.Default;
|
||||
|
||||
var themeName = XCSettings.THEME_ASSET_NAME_PREFIX + profile.themeName;
|
||||
var path = XCSettings.THEME_ASSET_FOLDER + "/" + themeName + ".asset";
|
||||
AssetDatabase.CreateAsset(profile, path);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,6 +270,7 @@ namespace XCharts.Example
|
||||
|
||||
var visualMap = chart.GetOrAddChartComponent<VisualMap>();
|
||||
visualMap.show = true;
|
||||
visualMap.showUI = true;
|
||||
visualMap.orient = Orient.Vertical;
|
||||
visualMap.calculable = true;
|
||||
visualMap.min = 0;
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace XCharts.Example
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
serie.label.textStyle.color = Color.white;
|
||||
serie.label.textStyle.backgroundColor = Color.grey;
|
||||
serie.label.background.color = Color.grey;
|
||||
serie.labelDirty = true;
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
@@ -8,7 +8,16 @@ namespace XCharts.Example
|
||||
[ExecuteInEditMode]
|
||||
public class Example13_LineSimple : MonoBehaviour
|
||||
{
|
||||
void Awake()
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
AddData();
|
||||
//OnTestBtn();
|
||||
}
|
||||
}
|
||||
|
||||
void AddData()
|
||||
{
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace XCharts.Example
|
||||
legend.orient = Orient.Vertical;
|
||||
|
||||
chart.RemoveData();
|
||||
serie = chart.AddSerie<Bar>( "访问来源");
|
||||
serie = chart.AddSerie<Bar>("访问来源");
|
||||
serie.radius[0] = 0;
|
||||
serie.radius[1] = 110;
|
||||
serie.center[0] = 0.5f;
|
||||
@@ -118,12 +118,12 @@ namespace XCharts.Example
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
serie.data[0].selected = true;
|
||||
serie.data[0].GetOrAddComponent<SerieDataBaseInfo>().selected = true;
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
serie.gap = 0f;
|
||||
serie.data[0].selected = false;
|
||||
serie.data[0].GetOrAddComponent<SerieDataBaseInfo>().selected = false;
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(1);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ namespace XCharts.Example
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "多图组合";
|
||||
|
||||
serie1 = chart.AddSerie<Pie>( "访问来源2");
|
||||
serie1 = chart.AddSerie<Pie>("访问来源2");
|
||||
chart.AddData(1, 335, "直达");
|
||||
chart.AddData(1, 679, "营销广告");
|
||||
chart.AddData(1, 1548, "搜索引擎");
|
||||
|
||||
@@ -29,7 +29,8 @@ namespace XCharts.Example
|
||||
|
||||
var serieData = chart.AddData(0, 20);
|
||||
//var serieData = serie1.GetSerieData(0);
|
||||
serieData.radius = 10;
|
||||
var baseInfo = serieData.GetOrAddComponent<SerieDataBaseInfo>();
|
||||
baseInfo.radius = 10;
|
||||
var itemStyle = serieData.GetOrAddComponent<ItemStyle>();
|
||||
itemStyle.color = Color.blue;
|
||||
}
|
||||
|
||||
92
README.md
92
README.md
@@ -47,60 +47,78 @@
|
||||
|
||||
[XCharts3.0 教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
[XCharts3.0 API](Documentation/XChartsAPI-ZH.md)
|
||||
[XCharts3.0 问答](Documentation/XChartsFQA-ZH.md)
|
||||
[XCharts3.0 问答](Documentation/XChartsFAQ-ZH.md)
|
||||
[XCharts3.0 配置项手册](Documentation/XChartsConfiguration-ZH.md)
|
||||
[XCharts3.0 更新日志](CHANGELOG.md)
|
||||
|
||||
## 特性
|
||||
|
||||
* 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
||||
* 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
||||
* 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||
* 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
||||
* 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
||||
* 支持环形图、玫瑰图等饼图。
|
||||
* 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
|
||||
* 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
||||
* 支持主题定制、导入和导出,内置两种默认主题。
|
||||
* 支持自定义图表内容绘制,提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
|
||||
* 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
|
||||
* 支持万级大数据绘制。
|
||||
* 支持`TexMeshPro`。
|
||||
|
||||
## XCharts3.0 比 2.0 的改进
|
||||
|
||||
* 更健壮的底层框架。
|
||||
* 更小的序列化文件。
|
||||
* 更强大的性能。
|
||||
* 更好的交互体验。
|
||||
* 更多的组件支持。
|
||||
* 更合理的组件调整。
|
||||
* 更灵活的组件插拔。
|
||||
* 更方便的二次开发。
|
||||
* 更丰富的Demo示例。
|
||||
- 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
||||
- 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
||||
- 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||
- 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
||||
- 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
||||
- 支持环形图、玫瑰图等饼图。
|
||||
- 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
|
||||
- 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
||||
- 支持主题定制、导入和导出,内置两种默认主题。
|
||||
- 支持自定义图表内容绘制,提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
|
||||
- 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
|
||||
- 支持万级大数据绘制。
|
||||
- 支持`TexMeshPro`。
|
||||
|
||||
## XCharts3.0 新功能
|
||||
|
||||
* 增加Time时间轴。
|
||||
* 增加SingleAxis单轴。
|
||||
* 增加多种坐标系:Grid、Polar、Radar、SingleAxis。
|
||||
* 增加多种动画方式。
|
||||
* 增加多种图表交互。
|
||||
* 增加国际化支持。
|
||||
* 增加Widgets小组件。
|
||||
* 增加多种扩展图表。
|
||||
- 增加Time时间轴。
|
||||
- 增加SingleAxis单轴。
|
||||
- 增加多种坐标系:Grid、Polar、Radar、SingleAxis。
|
||||
- 增加多种动画方式。
|
||||
- 增加多种图表交互。
|
||||
- 增加国际化支持。
|
||||
- 增加Widgets小组件。
|
||||
- 增加多种扩展图表。
|
||||
|
||||
## XCharts3.0 相比 XCharts2.0 的改进
|
||||
|
||||
- 更健壮的底层框架。
|
||||
- 更强大的性能。
|
||||
- 更小的序列化文件。
|
||||
- 更好的交互体验。
|
||||
- 更多的组件支持。
|
||||
- 更合理的组件调整。
|
||||
- 更灵活的组件插拔。
|
||||
- 更方便的二次开发。
|
||||
- 更丰富的Demo示例。
|
||||
|
||||
## XCharts3.0 和 2.0 数据对比
|
||||
|
||||
| Case | XCharts2.0 | XCharts3.0 | Note |
|
||||
| -- | -- | -- | -- |
|
||||
| 2000数据折线图的帧频 | 20 | 83 | 性能提升 3 倍 |
|
||||
| 2000数据折线图的顶点数 | 36.5k | 6.7k | 顶点数减少 4 倍 |
|
||||
| 2000数据折线图的Prefab大小 | 11.1MB | 802KB | 序列化文件大小减少 10 倍 |
|
||||
| 单条折线图数据最大容量 | 4.1k | 19k | 单Serie数据容量提升 4 倍 |
|
||||
| 支持的图表 | 11种 |23种 | 支持的图表多 1 倍 |
|
||||
|
||||
## 注意
|
||||
|
||||
- XCharts3.0 不兼容 XCharts2.0 版本,建议旧项目还是继续使用XCharts2.0,新项目使用XCharts3.0。
|
||||
- XCharts2.0 进入维护阶段,后续只修复严重bug理论上不再加新功能。
|
||||
- XCharts 理论上支持Unity 5.6及以上版本,但由于版本测试有限难免疏漏,发现版本兼容问题可提Issue。
|
||||
- XCharts 内置图表都为常见的图表,可以免费使用;扩展图表大部分为不常使用的图表,有需要的可付费获取,感谢对XCharts的支持。
|
||||
- 本仓库只包含XCharts源码,不包含Demo示例部分。需要查看Demo示例请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)
|
||||
|
||||
## 截图
|
||||
|
||||
[XCharts Demo 项目](https://github.com/XCharts-Team/XCharts-Demo)
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
更多示例请看 [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo),也可以到 [在线Demo](https://xcharts-team.github.io/demo/) 查看WebGL下的运行效果。
|
||||
|
||||
## 使用
|
||||
|
||||
[XCharts教程:5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
[XCharts教程:5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
|
||||
## 日志
|
||||
|
||||
|
||||
@@ -48,10 +48,5 @@ MonoBehaviour:
|
||||
m_PieTooltipExtraRadius: 8
|
||||
m_PieSelectedOffset: 8
|
||||
m_CustomThemes:
|
||||
- {fileID: 0}
|
||||
- {fileID: 11400000, guid: 289d2fc7f4ce24f73b9ed8ec52639f72, type: 2}
|
||||
- {fileID: 11400000, guid: e1dc23a10de1e4c5dbfbaf74c4dfd218, type: 2}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 11400000, guid: 0a4f01779f9b24f48846f968fe013a57, type: 2}
|
||||
- {fileID: 11400000, guid: 4d093c897dc514d12aca94b6b17cb4fa, type: 2}
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace XCharts.Runtime
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
AddChartComponentWhenNoExist<PolarCoord>();
|
||||
AddChartComponentWhenNoExist<AngleAxis>();
|
||||
AddChartComponentWhenNoExist<RadiusAxis>();
|
||||
|
||||
var tooltip = GetChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.Corss;
|
||||
|
||||
@@ -532,18 +532,21 @@ namespace XCharts.Runtime
|
||||
isEnd = true;
|
||||
}
|
||||
}
|
||||
else if (currHig - destProgress > 0)
|
||||
else
|
||||
{
|
||||
currHig = destProgress;
|
||||
isEnd = true;
|
||||
if ((destProgress - startProgress > 0 && currHig > destProgress)
|
||||
|| (destProgress - startProgress < 0 && currHig < destProgress))
|
||||
{
|
||||
currHig = destProgress;
|
||||
isEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
SetDataCurrProgress(dataIndex, currHig);
|
||||
return currHig;
|
||||
}
|
||||
}
|
||||
|
||||
internal void CheckSymbol(float dest)
|
||||
public void CheckSymbol(float dest)
|
||||
{
|
||||
if (!enable || m_IsEnd || m_IsPause || !m_IsInit)
|
||||
return;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace XCharts.Runtime
|
||||
return destProgress;
|
||||
}
|
||||
var isDataAnimationEnd = true;
|
||||
float currHig = serie.animation.CheckItemProgress(dataIndex, destProgress, ref isDataAnimationEnd, startPorgress);
|
||||
var currHig = serie.animation.CheckItemProgress(dataIndex, destProgress, ref isDataAnimationEnd, startPorgress);
|
||||
if (!isDataAnimationEnd)
|
||||
{
|
||||
serie.animation.context.isAllItemAnimationEnd = false;
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace XCharts.Runtime
|
||||
/// |极坐标系的角度轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(PolarCoord))]
|
||||
[ComponentHandler(typeof(AngleAxisHandler), true)]
|
||||
public class AngleAxis : Axis
|
||||
{
|
||||
|
||||
@@ -86,14 +86,14 @@ namespace XCharts.Runtime
|
||||
bool inside = axis.axisLabel.inside;
|
||||
var labelName = AxisHelper.GetLabelName(axis, total, i, axis.context.minValue, axis.context.maxValue,
|
||||
null, isPercentStack);
|
||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(scaleAngle, txtHig), axis,
|
||||
chart.theme.axis, labelName);
|
||||
label.label.SetAlignment(axis.axisLabel.textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform,
|
||||
new Vector2(scaleAngle, txtHig), axis,
|
||||
chart.theme.axis, labelName, Color.clear);
|
||||
label.text.SetAlignment(axis.axisLabel.textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
var pos = ChartHelper.GetPos(cenPos, radius + margin,
|
||||
isCategory ? (totalAngle + scaleAngle / 2) : totalAngle, true);
|
||||
AxisHelper.AdjustCircleLabelPos(label, pos, cenPos, txtHig, Vector3.zero);
|
||||
if (i == 0) axis.axisLabel.SetRelatedText(label.label, scaleAngle);
|
||||
if (i == 0) axis.axisLabel.SetRelatedText(label.text, scaleAngle);
|
||||
axis.context.labelObjectList.Add(label);
|
||||
|
||||
totalAngle += scaleAngle;
|
||||
|
||||
@@ -94,7 +94,6 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected bool m_Inverse = false;
|
||||
[SerializeField] private bool m_Clockwise = true;
|
||||
[SerializeField] private bool m_InsertDataToHead;
|
||||
[SerializeField] private IconStyle m_IconStyle = new IconStyle();
|
||||
[SerializeField] protected List<Sprite> m_Icons = new List<Sprite>();
|
||||
[SerializeField] protected List<string> m_Data = new List<string>();
|
||||
[SerializeField] protected AxisLine m_AxisLine = AxisLine.defaultAxisLine;
|
||||
@@ -362,14 +361,6 @@ namespace XCharts.Runtime
|
||||
get { return m_InsertDataToHead; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_InsertDataToHead, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图标样式。
|
||||
/// </summary>
|
||||
public IconStyle iconStyle
|
||||
{
|
||||
get { return m_IconStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_IconStyle, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
public override bool vertsDirty
|
||||
{
|
||||
@@ -432,7 +423,6 @@ namespace XCharts.Runtime
|
||||
axis.logBaseE = logBaseE;
|
||||
axis.ceilRate = ceilRate;
|
||||
axis.insertDataToHead = insertDataToHead;
|
||||
axis.iconStyle = iconStyle.Clone();
|
||||
axis.axisLine = axisLine.Clone();
|
||||
axis.axisName = axisName.Clone();
|
||||
axis.axisTick = axisTick.Clone();
|
||||
@@ -461,7 +451,6 @@ namespace XCharts.Runtime
|
||||
logBaseE = axis.logBaseE;
|
||||
ceilRate = axis.ceilRate;
|
||||
insertDataToHead = axis.insertDataToHead;
|
||||
iconStyle.Copy(axis.iconStyle);
|
||||
axisLine.Copy(axis.axisLine);
|
||||
axisName.Copy(axis.axisName);
|
||||
axisTick.Copy(axis.axisTick);
|
||||
|
||||
@@ -7,43 +7,45 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public class AxisContext : MainComponentContext
|
||||
{
|
||||
internal Orient orient { get; set; }
|
||||
public float x { get; internal set; }
|
||||
public float y { get; internal set; }
|
||||
public float width { get; internal set; }
|
||||
public float height { get; internal set; }
|
||||
public Vector3 position { get; internal set; }
|
||||
public float left { get; internal set; }
|
||||
public float right { get; internal set; }
|
||||
public float bottom { get; internal set; }
|
||||
public float top { get; internal set; }
|
||||
public Orient orient;
|
||||
public float x;
|
||||
public float y;
|
||||
public float zeroX;
|
||||
public float zeroY;
|
||||
public float width;
|
||||
public float height;
|
||||
public Vector3 position;
|
||||
public float left;
|
||||
public float right;
|
||||
public float bottom;
|
||||
public float top;
|
||||
/// <summary>
|
||||
/// the current minimun value.
|
||||
/// |当前最小值。
|
||||
/// </summary>
|
||||
public double minValue { get; internal set; }
|
||||
public double minValue;
|
||||
/// <summary>
|
||||
/// the current maximum value.
|
||||
/// |当前最大值。
|
||||
/// </summary>
|
||||
public double maxValue { get; internal set; }
|
||||
public double maxValue;
|
||||
/// <summary>
|
||||
/// the offset of zero position.
|
||||
/// |坐标轴原点在坐标轴的偏移。
|
||||
/// </summary>
|
||||
public float offset { get; internal set; }
|
||||
public double minMaxRange { get; internal set; }
|
||||
public float scaleWidth { get; internal set; }
|
||||
public float startAngle { get; set; }
|
||||
public double pointerValue { get; internal set; }
|
||||
public Vector3 pointerLabelPosition { get; internal set; }
|
||||
public double axisTooltipValue { get; internal set; }
|
||||
public float offset;
|
||||
public double minMaxRange;
|
||||
public float scaleWidth;
|
||||
public float startAngle;
|
||||
public double pointerValue;
|
||||
public Vector3 pointerLabelPosition;
|
||||
public double axisTooltipValue;
|
||||
public List<string> runtimeData { get { return m_RuntimeData; } }
|
||||
public List<double> labelValueList { get { return m_LabelValueList; } }
|
||||
public List<ChartLabel> labelObjectList { get { return m_AxisLabelList; } }
|
||||
|
||||
internal List<string> filterData;
|
||||
internal bool lastCheckInverse { get; set; }
|
||||
internal bool lastCheckInverse;
|
||||
internal bool isNeedUpdateFilterData;
|
||||
|
||||
private int filterStart;
|
||||
@@ -104,7 +106,12 @@ namespace XCharts.Runtime
|
||||
else
|
||||
range = dataZoom.minShowNum;
|
||||
}
|
||||
filterData = data.GetRange(start, range);
|
||||
if (range > data.Count - start - 1)
|
||||
start = data.Count - range - 1;
|
||||
if (start >= 0)
|
||||
filterData = data.GetRange(start, range);
|
||||
else
|
||||
filterData = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace XCharts
|
||||
return;
|
||||
if (!grid.context.isPointerEnter)
|
||||
{
|
||||
axis.context.pointerValue = 0;
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -166,6 +166,10 @@ namespace XCharts
|
||||
: (float)(Math.Abs(axis.context.minValue) * (grid.context.width
|
||||
/ (Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
|
||||
);
|
||||
axis.context.x = grid.context.x;
|
||||
axis.context.y = grid.context.y;
|
||||
axis.context.zeroY = grid.context.y;
|
||||
axis.context.zeroX = grid.context.x - (float)(axis.context.minValue * grid.context.width / axis.context.minMaxRange);
|
||||
}
|
||||
if (grid != null && axis is YAxis && axis.IsValue())
|
||||
{
|
||||
@@ -176,6 +180,10 @@ namespace XCharts
|
||||
: (float)(Math.Abs(axis.context.minValue) * (grid.context.height
|
||||
/ (Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
|
||||
);
|
||||
axis.context.x = grid.context.x;
|
||||
axis.context.y = grid.context.y;
|
||||
axis.context.zeroX = grid.context.x;
|
||||
axis.context.zeroY = grid.context.y - (float)(axis.context.minValue * grid.context.height / axis.context.minMaxRange);
|
||||
}
|
||||
}
|
||||
var dataZoom = chart.GetDataZoomOfAxis(axis);
|
||||
@@ -296,12 +304,12 @@ namespace XCharts
|
||||
if (i == 0)
|
||||
{
|
||||
var dist = GetLabelPosition(0, 1).x - pos.x;
|
||||
label.SetLabelActive(dist > label.label.GetPreferredWidth());
|
||||
label.SetTextActive(dist > label.text.GetPreferredWidth());
|
||||
}
|
||||
else if (i == axis.context.labelValueList.Count - 1)
|
||||
{
|
||||
var dist = pos.x - GetLabelPosition(0, i - 1).x;
|
||||
label.SetLabelActive(dist > label.label.GetPreferredWidth());
|
||||
label.SetTextActive(dist > label.text.GetPreferredWidth());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -309,12 +317,12 @@ namespace XCharts
|
||||
if (i == 0)
|
||||
{
|
||||
var dist = GetLabelPosition(0, 1).y - pos.y;
|
||||
label.SetLabelActive(dist > label.label.GetPreferredHeight());
|
||||
label.SetTextActive(dist > label.text.GetPreferredHeight());
|
||||
}
|
||||
else if (i == axis.context.labelValueList.Count - 1)
|
||||
{
|
||||
var dist = pos.y - GetLabelPosition(0, i - 1).y;
|
||||
label.SetLabelActive(dist > label.label.GetPreferredHeight());
|
||||
label.SetTextActive(dist > label.text.GetPreferredHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -361,82 +369,36 @@ namespace XCharts
|
||||
? axis.axisLabel.height
|
||||
: 20f;
|
||||
|
||||
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
|
||||
var inside = axis.axisLabel.inside;
|
||||
var defaultAlignment = orient == Orient.Horizonal ? TextAnchor.MiddleCenter :
|
||||
((inside && axis.IsLeft()) || (!inside && axis.IsRight())
|
||||
? TextAnchor.MiddleLeft
|
||||
: TextAnchor.MiddleRight);
|
||||
|
||||
if (axis.IsCategory() && axis.boundaryGap)
|
||||
{
|
||||
splitNumber -= 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < splitNumber; i++)
|
||||
{
|
||||
ChartLabel label;
|
||||
|
||||
var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
|
||||
var inside = axis.axisLabel.inside;
|
||||
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
|
||||
|
||||
var labelName = AxisHelper.GetLabelName(axis, axisLength, i,
|
||||
axis.context.minValue,
|
||||
axis.context.maxValue,
|
||||
dataZoom, isPercentStack);
|
||||
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
label = ChartHelper.AddAxisLabelObject(splitNumber, i,
|
||||
ChartCached.GetAxisLabelName(i),
|
||||
axisObj.transform,
|
||||
new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f),
|
||||
new Vector2(textWidth, textHeight),
|
||||
axis, chart.theme.axis, labelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((inside && axis.IsLeft()) || (!inside && axis.IsRight()))
|
||||
{
|
||||
label = ChartHelper.AddAxisLabelObject(splitNumber, i,
|
||||
ChartCached.GetAxisLabelName(i),
|
||||
axisObj.transform,
|
||||
Vector2.zero,
|
||||
Vector2.zero,
|
||||
new Vector2(0, 0.5f),
|
||||
new Vector2(textWidth, textHeight),
|
||||
axis, chart.theme.axis, labelName);
|
||||
|
||||
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleLeft));
|
||||
}
|
||||
else
|
||||
{
|
||||
label = ChartHelper.AddAxisLabelObject(splitNumber, i,
|
||||
ChartCached.GetAxisLabelName(i),
|
||||
axisObj.transform,
|
||||
Vector2.zero,
|
||||
Vector2.zero,
|
||||
new Vector2(1, 0.5f),
|
||||
new Vector2(textWidth, textHeight),
|
||||
axis, chart.theme.axis, labelName);
|
||||
|
||||
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleRight));
|
||||
}
|
||||
}
|
||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i,
|
||||
ChartCached.GetAxisLabelName(i),
|
||||
axisObj.transform,
|
||||
new Vector2(textWidth, textHeight),
|
||||
axis, chart.theme.axis, labelName,
|
||||
Color.clear,
|
||||
defaultAlignment);
|
||||
|
||||
if (i == 0)
|
||||
axis.axisLabel.SetRelatedText(label.label, labelWidth);
|
||||
axis.axisLabel.SetRelatedText(label.text, labelWidth);
|
||||
|
||||
var pos = handler.GetLabelPosition(totalWidth + gapWidth, i);
|
||||
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (axis.IsRight())
|
||||
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleLeft));
|
||||
else
|
||||
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleRight));
|
||||
}
|
||||
|
||||
label.SetPosition(pos);
|
||||
handler.CheckValueLabelActive(axis, i, label, pos);
|
||||
|
||||
@@ -446,59 +408,41 @@ namespace XCharts
|
||||
}
|
||||
if (axis.axisName.show)
|
||||
{
|
||||
ChartText axisName = null;
|
||||
|
||||
var axisNameTextStyle = axis.axisName.textStyle;
|
||||
var offset = axisNameTextStyle.offset;
|
||||
|
||||
ChartLabel label = null;
|
||||
var relativedDist = (relativedAxis == null ? 0 : relativedAxis.context.offset);
|
||||
var zeroPos = new Vector3(axisStartX, axisStartY + relativedDist);
|
||||
|
||||
var offset = axis.axisName.labelStyle.offset;
|
||||
var autoColor = axis.axisLine.GetColor(chart.theme.axis.lineColor);
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
switch (axis.axisName.location)
|
||||
switch (axis.axisName.labelStyle.position)
|
||||
{
|
||||
case AxisName.Location.Start:
|
||||
case LabelStyle.Position.Start:
|
||||
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform,
|
||||
new Vector2(1, 0.5f),
|
||||
new Vector2(1, 0.5f),
|
||||
new Vector2(1, 0.5f),
|
||||
new Vector2(100, 20),
|
||||
axisNameTextStyle, chart.theme.axis);
|
||||
|
||||
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleRight));
|
||||
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Top
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleRight);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.position == Axis.AxisPosition.Top
|
||||
? new Vector2(zeroPos.x - offset.x, axisStartY + relativedLength + offset.y + axis.offset)
|
||||
: new Vector2(zeroPos.x - offset.x, zeroPos.y + offset.y + axis.offset));
|
||||
break;
|
||||
|
||||
case AxisName.Location.Middle:
|
||||
case LabelStyle.Position.Middle:
|
||||
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform,
|
||||
new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f),
|
||||
new Vector2(100, 20),
|
||||
axisNameTextStyle, chart.theme.axis);
|
||||
|
||||
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Top
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.position == Axis.AxisPosition.Top
|
||||
? new Vector2(axisStartX + axisLength / 2 + offset.x, axisStartY + relativedLength - offset.y + axis.offset)
|
||||
: new Vector2(axisStartX + axisLength / 2 + offset.x, axisStartY - offset.y + axis.offset));
|
||||
break;
|
||||
|
||||
case AxisName.Location.End:
|
||||
default:
|
||||
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform,
|
||||
new Vector2(0, 0.5f),
|
||||
new Vector2(0, 0.5f),
|
||||
new Vector2(0, 0.5f),
|
||||
new Vector2(100, 20),
|
||||
axisNameTextStyle, chart.theme.axis);
|
||||
|
||||
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleLeft));
|
||||
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Top
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleLeft);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.position == Axis.AxisPosition.Top
|
||||
? new Vector2(axisStartX + axisLength + offset.x, axisStartY + relativedLength + offset.y + axis.offset)
|
||||
: new Vector2(axisStartX + axisLength + offset.x, zeroPos.y + offset.y + axis.offset));
|
||||
break;
|
||||
@@ -506,43 +450,39 @@ namespace XCharts
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (axis.axisName.location)
|
||||
switch (axis.axisName.labelStyle.position)
|
||||
{
|
||||
case AxisName.Location.Start:
|
||||
case LabelStyle.Position.Start:
|
||||
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), axisNameTextStyle,
|
||||
chart.theme.axis);
|
||||
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Right ?
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.position == Axis.AxisPosition.Right ?
|
||||
new Vector2(axisStartX + relativedLength + offset.x + axis.offset, axisStartY - offset.y) :
|
||||
new Vector2(zeroPos.x + offset.x + axis.offset, axisStartY - offset.y));
|
||||
break;
|
||||
|
||||
case AxisName.Location.Middle:
|
||||
case LabelStyle.Position.Middle:
|
||||
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(1, 0.5f),
|
||||
new Vector2(1, 0.5f), new Vector2(1, 0.5f), new Vector2(100, 20), axisNameTextStyle,
|
||||
chart.theme.axis);
|
||||
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleRight));
|
||||
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Right ?
|
||||
new Vector2(axisStartX + relativedLength - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y) :
|
||||
new Vector2(axisStartX - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y));
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.position == Axis.AxisPosition.Right ?
|
||||
new Vector2(axisStartX + relativedLength - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y) :
|
||||
new Vector2(axisStartX - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y));
|
||||
break;
|
||||
|
||||
case AxisName.Location.End:
|
||||
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisName, axisObj.transform, new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), axisNameTextStyle,
|
||||
chart.theme.axis);
|
||||
axisName.SetAlignment(axisNameTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
axisName.SetLocalPosition(axis.position == Axis.AxisPosition.Right ?
|
||||
default:
|
||||
//LabelStyle.Position
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.position == Axis.AxisPosition.Right ?
|
||||
new Vector2(axisStartX + relativedLength + offset.x + axis.offset, axisStartY + axisLength + offset.y) :
|
||||
new Vector2(zeroPos.x + offset.x + axis.offset, axisStartY + axisLength + offset.y));
|
||||
break;
|
||||
}
|
||||
}
|
||||
axisName.SetText(axis.axisName.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +513,7 @@ namespace XCharts
|
||||
else
|
||||
current += axisStartY - axis.axisLabel.distance - fontSize / 2;
|
||||
|
||||
return new Vector3(axisStartX + scaleWid, current) + axis.axisLabel.textStyle.offsetv3;
|
||||
return new Vector3(axisStartX + scaleWid, current);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -588,7 +528,7 @@ namespace XCharts
|
||||
else
|
||||
current += axisStartX - axis.axisLabel.distance;
|
||||
|
||||
return new Vector3(current, axisStartY + scaleWid) + axis.axisLabel.textStyle.offsetv3;
|
||||
return new Vector3(current, axisStartY + scaleWid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -403,33 +403,11 @@ namespace XCharts.Runtime
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void AdjustCircleLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
||||
{
|
||||
var txtWidth = txt.GetPreferredWidth();
|
||||
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
|
||||
txt.SetSizeDelta(sizeDelta);
|
||||
var diff = pos.x - cenPos.x;
|
||||
if (diff < -1f) //left
|
||||
{
|
||||
pos = new Vector3(pos.x - txtWidth / 2, pos.y);
|
||||
}
|
||||
else if (diff > 1f) //right
|
||||
{
|
||||
pos = new Vector3(pos.x + txtWidth / 2, pos.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
float y = pos.y > cenPos.y ? pos.y + txtHig / 2 : pos.y - txtHig / 2;
|
||||
pos = new Vector3(pos.x, y);
|
||||
}
|
||||
txt.SetLocalPosition(pos + offset);
|
||||
}
|
||||
|
||||
public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
||||
{
|
||||
var txtWidth = txt.label.GetPreferredWidth();
|
||||
var sizeDelta = new Vector2(txtWidth, txt.label.GetPreferredHeight());
|
||||
txt.label.SetSizeDelta(sizeDelta);
|
||||
var txtWidth = txt.text.GetPreferredWidth();
|
||||
var sizeDelta = new Vector2(txtWidth, txt.text.GetPreferredHeight());
|
||||
txt.text.SetSizeDelta(sizeDelta);
|
||||
var diff = pos.x - cenPos.x;
|
||||
if (diff < -1f) //left
|
||||
{
|
||||
@@ -447,11 +425,11 @@ namespace XCharts.Runtime
|
||||
txt.SetPosition(pos + offset);
|
||||
}
|
||||
|
||||
public static void AdjustRadiusAxisLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
||||
public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
||||
{
|
||||
var txtWidth = txt.GetPreferredWidth();
|
||||
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
|
||||
txt.SetSizeDelta(sizeDelta);
|
||||
var txtWidth = txt.text.GetPreferredWidth();
|
||||
var sizeDelta = new Vector2(txtWidth, txt.text.GetPreferredHeight());
|
||||
txt.text.SetSizeDelta(sizeDelta);
|
||||
var diff = pos.y - cenPos.y;
|
||||
if (diff > 20f) //left
|
||||
{
|
||||
@@ -466,7 +444,7 @@ namespace XCharts.Runtime
|
||||
float y = pos.y > cenPos.y ? pos.y + txtHig / 2 : pos.y - txtHig / 2;
|
||||
pos = new Vector3(pos.x, y);
|
||||
}
|
||||
txt.SetLocalPosition(pos);
|
||||
txt.SetPosition(pos);
|
||||
}
|
||||
|
||||
public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)
|
||||
@@ -490,6 +468,22 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetAxisPositionValue(GridCoord grid, Axis axis, Vector3 pos)
|
||||
{
|
||||
if (axis is YAxis)
|
||||
return GetAxisPositionValue(pos.y, grid.context.height, axis.context.minMaxRange, grid.context.y, axis.context.offset);
|
||||
else if (axis is XAxis)
|
||||
return GetAxisPositionValue(pos.x, grid.context.width, axis.context.minMaxRange, grid.context.x, axis.context.offset);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static double GetAxisPositionValue(float xy, float axisLength, double axisRange, float axisStart, float axisOffset)
|
||||
{
|
||||
var yRate = axisRange / axisLength;
|
||||
return yRate * (xy - axisStart - axisOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得数值value在坐标轴上的坐标位置
|
||||
/// </summary>
|
||||
@@ -517,7 +511,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得数值value在坐标轴上对于的长度
|
||||
/// 获得数值value在坐标轴上对应的长度
|
||||
/// </summary>
|
||||
/// <param name="grid"></param>
|
||||
/// <param name="axis"></param>
|
||||
@@ -555,10 +549,10 @@ namespace XCharts.Runtime
|
||||
var yDataHig = 0f;
|
||||
if (axis.context.minMaxRange != 0)
|
||||
{
|
||||
if (!realLength || (realLength && axis.context.minValue > 0))
|
||||
yDataHig = (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight);
|
||||
if (realLength)
|
||||
yDataHig = (float)(value * gridHeight / axis.context.minMaxRange);
|
||||
else
|
||||
yDataHig = (float)(value / axis.context.minMaxRange * gridHeight);
|
||||
yDataHig = (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight);
|
||||
}
|
||||
return includeGridXY
|
||||
? gridXY + yDataHig
|
||||
|
||||
@@ -10,33 +10,16 @@ namespace XCharts.Runtime
|
||||
/// |坐标轴刻度标签的相关设置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisLabel : ChildComponent
|
||||
public class AxisLabel : LabelStyle
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private string m_Formatter;
|
||||
[SerializeField] private int m_Interval = 0;
|
||||
[SerializeField] private bool m_Inside = false;
|
||||
[SerializeField] private float m_Distance;
|
||||
[SerializeField] private string m_NumericFormatter = "";
|
||||
[SerializeField] private bool m_ShowAsPositiveNumber = false;
|
||||
[SerializeField] private bool m_OnZero = false;
|
||||
[SerializeField] private float m_Width = 0f;
|
||||
[SerializeField] private float m_Height = 0f;
|
||||
[SerializeField] private bool m_ShowStartLabel = true;
|
||||
[SerializeField] private bool m_ShowEndLabel = true;
|
||||
[SerializeField] private TextLimit m_TextLimit = new TextLimit();
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||
private AxisLabelFormatterFunction m_FormatterFunction;
|
||||
|
||||
/// <summary>
|
||||
/// Set this to false to prevent the axis label from appearing.
|
||||
/// |是否显示刻度标签。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The display interval of the axis label.
|
||||
/// |坐标轴刻度标签的显示间隔,在类目轴中有效。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。
|
||||
@@ -55,38 +38,6 @@ namespace XCharts.Runtime
|
||||
get { return m_Inside; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Inside, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The distance between the axis label and the axis line.
|
||||
/// |刻度标签与轴线之间的距离。
|
||||
/// </summary>
|
||||
public float distance
|
||||
{
|
||||
get { return m_Distance; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Distance, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图例内容字符串模版格式器。支持用 \n 换行。
|
||||
/// 模板变量为图例名称 {value}。
|
||||
/// </summary>
|
||||
public string formatter
|
||||
{
|
||||
get { return m_Formatter; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Standard numeric format strings.
|
||||
/// |标准数字格式字符串。用于将数值格式化显示为字符串。
|
||||
/// 使用Axx的形式:A是格式说明符的单字符,支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明,从0-99。
|
||||
/// 参考:https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string numericFormatter
|
||||
{
|
||||
get { return m_NumericFormatter; }
|
||||
set { if (PropertyUtil.SetClass(ref m_NumericFormatter, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show negative number as positive number.
|
||||
/// |将负数数值显示为正数。一般和`Serie`的`showAsPositiveNumber`配合使用。
|
||||
@@ -106,22 +57,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_OnZero, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 文本的宽。为0时会自动匹配。
|
||||
/// </summary>
|
||||
public float width
|
||||
{
|
||||
get { return m_Width; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 文本的高。为0时会自动匹配。
|
||||
/// </summary>
|
||||
public float height
|
||||
{
|
||||
get { return m_Height; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to display the first label.
|
||||
/// |是否显示第一个文本。
|
||||
/// </summary>
|
||||
@@ -148,21 +83,6 @@ namespace XCharts.Runtime
|
||||
set { if (value != null) { m_TextLimit = value; SetComponentDirty(); } }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text style of axis name.
|
||||
/// |文本样式。
|
||||
/// </summary>
|
||||
public TextStyle textStyle
|
||||
{
|
||||
get { return m_TextStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
public AxisLabelFormatterFunction formatterFunction
|
||||
{
|
||||
set { m_FormatterFunction = value; }
|
||||
}
|
||||
|
||||
public override bool componentDirty { get { return m_ComponentDirty || m_TextLimit.componentDirty; } }
|
||||
public override void ClearComponentDirty()
|
||||
{
|
||||
@@ -185,7 +105,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public AxisLabel Clone()
|
||||
public new AxisLabel Clone()
|
||||
{
|
||||
var axisLabel = new AxisLabel();
|
||||
axisLabel.show = show;
|
||||
|
||||
@@ -11,21 +11,9 @@ namespace XCharts.Runtime
|
||||
[Serializable]
|
||||
public class AxisName : ChildComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// the location of axis name.
|
||||
/// |坐标轴名称显示位置。
|
||||
/// </summary>
|
||||
public enum Location
|
||||
{
|
||||
Start,
|
||||
Middle,
|
||||
End
|
||||
}
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private string m_Formatter;
|
||||
[SerializeField] private Location m_Location;
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show axis name.
|
||||
@@ -45,46 +33,28 @@ namespace XCharts.Runtime
|
||||
get { return m_Name; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Name, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The formatter of indicator's name.
|
||||
/// |指示器名称显示的格式器。可用在雷达图。
|
||||
/// </summary>
|
||||
public string formatter
|
||||
{
|
||||
get { return m_Formatter; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Location of axis name.
|
||||
/// |坐标轴名称显示位置。
|
||||
/// </summary>
|
||||
public Location location
|
||||
{
|
||||
get { return m_Location; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Location, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text style of axis name.
|
||||
/// |文本样式。
|
||||
/// </summary>
|
||||
public TextStyle textStyle
|
||||
public LabelStyle labelStyle
|
||||
{
|
||||
get { return m_TextStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetComponentDirty(); }
|
||||
get { return m_LabelStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
public static AxisName defaultAxisName
|
||||
{
|
||||
get
|
||||
{
|
||||
return new AxisName()
|
||||
var axisName = new AxisName()
|
||||
{
|
||||
m_Show = false,
|
||||
m_Name = "axisName",
|
||||
m_Location = Location.End,
|
||||
m_TextStyle = new TextStyle(),
|
||||
m_LabelStyle = new LabelStyle()
|
||||
};
|
||||
axisName.labelStyle.position = LabelStyle.Position.End;
|
||||
return axisName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,8 +63,7 @@ namespace XCharts.Runtime
|
||||
var axisName = new AxisName();
|
||||
axisName.show = show;
|
||||
axisName.name = name;
|
||||
axisName.location = location;
|
||||
axisName.textStyle.Copy(textStyle);
|
||||
axisName.m_LabelStyle.Copy(m_LabelStyle);
|
||||
return axisName;
|
||||
}
|
||||
|
||||
@@ -102,8 +71,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
show = axisName.show;
|
||||
name = axisName.name;
|
||||
location = axisName.location;
|
||||
textStyle.Copy(axisName.textStyle);
|
||||
m_LabelStyle.Copy(axisName.labelStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ namespace XCharts.Runtime
|
||||
splitLine.show = false;
|
||||
splitLine.lineStyle.type = LineStyle.Type.None;
|
||||
axisLabel.textLimit.enable = true;
|
||||
iconStyle.show = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace XCharts.Runtime
|
||||
/// |极坐标系的径向轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(PolarCoord))]
|
||||
[ComponentHandler(typeof(RadiusAxisHandler), true)]
|
||||
public class RadiusAxis : Axis
|
||||
{
|
||||
|
||||
@@ -36,12 +36,11 @@ namespace XCharts.Runtime
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
return;
|
||||
}
|
||||
|
||||
var angleAxis = ComponentHelper.GetAngleAxis(chart.components, polar.index);
|
||||
if (angleAxis == null)
|
||||
return;
|
||||
|
||||
var startAngle = angleAxis.context.startAngle;
|
||||
|
||||
var dist = Vector3.Distance(chart.pointerPos, polar.context.center);
|
||||
axis.context.pointerValue = axis.context.minValue + (dist / polar.context.radius) * axis.context.minMaxRange;
|
||||
axis.context.pointerLabelPosition = GetLabelPosition(polar, axis, angleAxis.context.startAngle, dist);
|
||||
@@ -110,18 +109,17 @@ namespace XCharts.Runtime
|
||||
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
|
||||
var labelName = AxisHelper.GetLabelName(axis, radius, i, axis.context.minValue, axis.context.maxValue,
|
||||
null, isPercentStack);
|
||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(labelWidth, txtHig), axis, chart.theme.axis,
|
||||
labelName);
|
||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i, objName + i, axisObj.transform,
|
||||
new Vector2(labelWidth, txtHig), axis, chart.theme.axis, labelName, Color.clear);
|
||||
|
||||
if (i == 0)
|
||||
axis.axisLabel.SetRelatedText(label.label, labelWidth);
|
||||
axis.axisLabel.SetRelatedText(label.text, labelWidth);
|
||||
|
||||
label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
label.text.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||
label.SetText(labelName);
|
||||
label.SetPosition(GetLabelPosition(polar, axis, angleAxis.context.startAngle, totalWidth));
|
||||
label.SetActive(true);
|
||||
label.SetLabelActive(true);
|
||||
label.SetTextActive(true);
|
||||
|
||||
axis.context.labelObjectList.Add(label);
|
||||
|
||||
|
||||
@@ -140,7 +140,6 @@ namespace XCharts.Runtime
|
||||
axisLabel.textLimit.enable = true;
|
||||
axisTick.showStartTick = true;
|
||||
axisTick.showEndTick = true;
|
||||
iconStyle.show = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ namespace XCharts.Runtime
|
||||
splitLine.show = false;
|
||||
splitLine.lineStyle.type = LineStyle.Type.None;
|
||||
axisLabel.textLimit.enable = true;
|
||||
iconStyle.show = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ namespace XCharts.Runtime
|
||||
splitLine.lineStyle.type = LineStyle.Type.None;
|
||||
axisLabel.textLimit.enable = false;
|
||||
axisTick.showStartTick = true;
|
||||
iconStyle.show = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void SetDefaultValue()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Show = true;
|
||||
m_Image = null;
|
||||
m_ImageType = Image.Type.Sliced;
|
||||
m_ImageColor = Color.white;
|
||||
|
||||
@@ -33,32 +33,6 @@ namespace XCharts.Runtime
|
||||
component.refreshComponent();
|
||||
}
|
||||
|
||||
//protected void DrawBackground(VertexHelper vh)
|
||||
//{
|
||||
//TODO: CooridateChart
|
||||
// if (SeriesHelper.IsAnyClipSerie(m_Series))
|
||||
// {
|
||||
// var xLineDiff = xAxis0.axisLine.GetWidth(m_Theme.axis.lineWidth);
|
||||
// var yLineDiff = yAxis0.axisLine.GetWidth(m_Theme.axis.lineWidth);
|
||||
// var xSplitDiff = xAxis0.splitLine.GetWidth(m_Theme.axis.splitLineWidth);
|
||||
// var ySplitDiff = yAxis0.splitLine.GetWidth(m_Theme.axis.splitLineWidth);
|
||||
// foreach (var grid in m_Grids)
|
||||
// {
|
||||
// var cpty = grid.context.runtimeY + grid.context.runtimeHeight + ySplitDiff;
|
||||
// var cp1 = new Vector3(grid.context.runtimeX - yLineDiff, grid.context.runtimeY - xLineDiff);
|
||||
// var cp2 = new Vector3(grid.context.runtimeX - yLineDiff, cpty);
|
||||
// var cp3 = new Vector3(grid.context.runtimeX + grid.context.runtimeWidth + xSplitDiff, cpty);
|
||||
// var cp4 = new Vector3(grid.context.runtimeX + grid.context.runtimeWidth + xSplitDiff, grid.context.runtimeY - xLineDiff);
|
||||
// var backgroundColor = ThemeHelper.GetBackgroundColor(m_Theme, m_Background);
|
||||
// UGL.DrawQuadrilateral(vh, cp1, cp2, cp3, cp4, backgroundColor);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// base.DrawBackground(vh);
|
||||
// }
|
||||
// }
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
if (!component.show)
|
||||
|
||||
@@ -7,5 +7,12 @@ namespace XCharts.Runtime
|
||||
[System.Serializable]
|
||||
public class EndLabelStyle : LabelStyle
|
||||
{
|
||||
public EndLabelStyle()
|
||||
{
|
||||
m_Offset = new Vector3(5, 0, 0);
|
||||
m_TextStyle.alignment = TextAnchor.MiddleLeft;
|
||||
m_NumericFormatter = "f0";
|
||||
m_Formatter = "{a}:{c}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,26 @@ using UnityEngine.UI;
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
public class IconStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
public class IconStyle : ChildComponent
|
||||
{
|
||||
public enum Layer
|
||||
{
|
||||
UnderLabel,
|
||||
AboveLabel
|
||||
/// <summary>
|
||||
/// The icon is display under the label text.
|
||||
/// 图标在标签文字下
|
||||
/// </summary>
|
||||
UnderText,
|
||||
/// <summary>
|
||||
/// The icon is display above the label text.
|
||||
/// 图标在标签文字上
|
||||
/// </summary>
|
||||
AboveText
|
||||
}
|
||||
[SerializeField] private bool m_Show = false;
|
||||
[SerializeField] private Layer m_Layer;
|
||||
[SerializeField] private Align m_Align = Align.Left;
|
||||
[SerializeField] private Sprite m_Sprite;
|
||||
[SerializeField] private Image.Type m_Type;
|
||||
[SerializeField] private Color m_Color = Color.white;
|
||||
[SerializeField] private float m_Width = 20;
|
||||
[SerializeField] private float m_Height = 20;
|
||||
@@ -25,7 +34,7 @@ namespace XCharts.Runtime
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Layer = Layer.UnderLabel;
|
||||
m_Layer = Layer.UnderText;
|
||||
m_Sprite = null;
|
||||
m_Color = Color.white;
|
||||
m_Width = 20;
|
||||
@@ -48,6 +57,11 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
|
||||
/// <summary>
|
||||
/// How to display the icon.
|
||||
/// |图片的显示类型。
|
||||
/// </summary>
|
||||
public Image.Type type { get { return m_Type; } set { m_Type = value; } }
|
||||
/// <summary>
|
||||
/// 图标颜色。
|
||||
/// </summary>
|
||||
public Color color { get { return m_Color; } set { m_Color = value; } }
|
||||
@@ -77,6 +91,7 @@ namespace XCharts.Runtime
|
||||
iconStyle.show = show;
|
||||
iconStyle.layer = layer;
|
||||
iconStyle.sprite = sprite;
|
||||
iconStyle.type = type;
|
||||
iconStyle.color = color;
|
||||
iconStyle.width = width;
|
||||
iconStyle.height = height;
|
||||
@@ -91,6 +106,7 @@ namespace XCharts.Runtime
|
||||
show = iconStyle.show;
|
||||
layer = iconStyle.layer;
|
||||
sprite = iconStyle.sprite;
|
||||
type = iconStyle.type;
|
||||
color = iconStyle.color;
|
||||
width = iconStyle.width;
|
||||
height = iconStyle.height;
|
||||
|
||||
82
Runtime/Component/Child/ImageStyle.cs
Normal file
82
Runtime/Component/Child/ImageStyle.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
public class ImageStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Sprite m_Sprite;
|
||||
[SerializeField] private Image.Type m_Type;
|
||||
[SerializeField] private bool m_AutoColor;
|
||||
[SerializeField] private Color m_Color = Color.clear;
|
||||
[SerializeField] private float m_Width = 0;
|
||||
[SerializeField] private float m_Height = 0;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Type = Image.Type.Simple;
|
||||
m_Sprite = null;
|
||||
m_AutoColor = false;
|
||||
m_Color = Color.white;
|
||||
m_Width = 0;
|
||||
m_Height = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the data icon is show.
|
||||
/// |是否显示图标。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// The image of icon.
|
||||
/// |图标的图片。
|
||||
/// </summary>
|
||||
public Sprite sprite { get { return m_Sprite; } set { m_Sprite = value; } }
|
||||
/// <summary>
|
||||
/// How to display the image.
|
||||
/// |图片的显示类型。
|
||||
/// </summary>
|
||||
public Image.Type type { get { return m_Type; } set { m_Type = value; } }
|
||||
/// <summary>
|
||||
/// 是否自动颜色。
|
||||
/// </summary>
|
||||
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
|
||||
/// <summary>
|
||||
/// 图标颜色。
|
||||
/// </summary>
|
||||
public Color color { get { return m_Color; } set { m_Color = value; } }
|
||||
/// <summary>
|
||||
/// 图标宽。
|
||||
/// </summary>
|
||||
public float width { get { return m_Width; } set { m_Width = value; } }
|
||||
/// <summary>
|
||||
/// 图标高。
|
||||
/// </summary>
|
||||
public float height { get { return m_Height; } set { m_Height = value; } }
|
||||
public ImageStyle Clone()
|
||||
{
|
||||
var imageStyle = new ImageStyle();
|
||||
imageStyle.type = type;
|
||||
imageStyle.sprite = sprite;
|
||||
imageStyle.autoColor = autoColor;
|
||||
imageStyle.color = color;
|
||||
imageStyle.width = width;
|
||||
imageStyle.height = height;
|
||||
return imageStyle;
|
||||
}
|
||||
|
||||
public void Copy(ImageStyle imageStyle)
|
||||
{
|
||||
type = imageStyle.type;
|
||||
sprite = imageStyle.sprite;
|
||||
autoColor = imageStyle.autoColor;
|
||||
color = imageStyle.color;
|
||||
width = imageStyle.width;
|
||||
height = imageStyle.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Child/ImageStyle.cs.meta
Normal file
11
Runtime/Component/Child/ImageStyle.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a76d1129783c4f55b0773da2eda9b67
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private Color32 m_CenterColor;
|
||||
[SerializeField] private float m_CenterGap;
|
||||
[SerializeField] private float m_BorderWidth = 0;
|
||||
[SerializeField] private float m_BorderGap = 0;
|
||||
[SerializeField] private Color32 m_BorderColor;
|
||||
[SerializeField] private Color32 m_BorderColor0;
|
||||
[SerializeField] private Color32 m_BorderToColor;
|
||||
@@ -39,6 +40,7 @@ namespace XCharts.Runtime
|
||||
m_CenterColor = Color.clear;
|
||||
m_CenterGap = 0;
|
||||
m_BorderWidth = 0;
|
||||
m_BorderGap = 0;
|
||||
m_BorderColor = Color.clear;
|
||||
m_BorderColor0 = Color.clear;
|
||||
m_BorderToColor = Color.clear;
|
||||
@@ -108,6 +110,14 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据项背景宽度。
|
||||
/// </summary>
|
||||
public float backgroundWidth
|
||||
{
|
||||
get { return m_BackgroundWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 中心区域颜色。
|
||||
/// </summary>
|
||||
public Color32 centerColor
|
||||
@@ -124,14 +134,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_CenterGap, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据项背景宽度。
|
||||
/// </summary>
|
||||
public float backgroundWidth
|
||||
{
|
||||
get { return m_BackgroundWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 边框的颜色。
|
||||
/// </summary>
|
||||
public Color32 borderColor
|
||||
@@ -164,6 +166,14 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_BorderWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 边框间隙。
|
||||
/// </summary>
|
||||
public float borderGap
|
||||
{
|
||||
get { return m_BorderGap; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BorderGap, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|
||||
/// </summary>
|
||||
public float opacity
|
||||
@@ -231,6 +241,16 @@ namespace XCharts.Runtime
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color32 GetToColor()
|
||||
{
|
||||
if (m_Opacity == 1 || m_ToColor.a == 0)
|
||||
return m_ToColor;
|
||||
|
||||
var color = m_ToColor;
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color32 GetColor0()
|
||||
{
|
||||
if (m_Opacity == 1 || m_Color0.a == 0)
|
||||
@@ -316,14 +336,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemStyleHelper
|
||||
{
|
||||
public static bool IsNeedCorner(ItemStyle itemStyle)
|
||||
public bool IsNeedCorner()
|
||||
{
|
||||
if (itemStyle.cornerRadius == null) return false;
|
||||
foreach (var value in itemStyle.cornerRadius)
|
||||
if (m_CornerRadius == null) return false;
|
||||
foreach (var value in m_CornerRadius)
|
||||
{
|
||||
if (value != 0) return true;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签的引导线
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class LabelLine : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
@@ -29,16 +32,20 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private LineType m_LineType = LineType.BrokenLine;
|
||||
[SerializeField] private Color32 m_LineColor = ChartConst.clearColor32;
|
||||
[SerializeField] private float m_LineAngle = 0;
|
||||
[SerializeField] private float m_LineWidth = 1.0f;
|
||||
[SerializeField] private float m_LineGap = 1.0f;
|
||||
[SerializeField] private float m_LineLength1 = 25f;
|
||||
[SerializeField] private float m_LineLength2 = 15f;
|
||||
[SerializeField] private SymbolStyle m_StartSymbol = new SymbolStyle() { type = SymbolType.Circle, size = 3 };
|
||||
[SerializeField] private SymbolStyle m_EndSymbol = new SymbolStyle() { type = SymbolType.Circle, size = 3 };
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_LineType = LineType.BrokenLine;
|
||||
m_LineColor = Color.clear;
|
||||
m_LineAngle = 0;
|
||||
m_LineWidth = 1.0f;
|
||||
m_LineGap = 1.0f;
|
||||
m_LineLength1 = 25f;
|
||||
@@ -73,6 +80,15 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the angle of visual guild line.
|
||||
/// |视觉引导线的固定角度。对折线和曲线有效。
|
||||
/// </summary>
|
||||
public float lineAngle
|
||||
{
|
||||
get { return m_LineAngle; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineAngle, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the width of visual guild line.
|
||||
/// |视觉引导线的宽度。
|
||||
/// </summary>
|
||||
@@ -108,5 +124,23 @@ namespace XCharts.Runtime
|
||||
get { return m_LineLength2; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineLength2, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The symbol of the start point of labelline.
|
||||
/// |起始点的图形标记。
|
||||
/// </summary>
|
||||
public SymbolStyle startSymbol
|
||||
{
|
||||
get { return m_StartSymbol; }
|
||||
set { if (PropertyUtil.SetClass(ref m_StartSymbol, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The symbol of the end point of labelline.
|
||||
/// |结束点的图形标记。
|
||||
/// </summary>
|
||||
public SymbolStyle endSymbol
|
||||
{
|
||||
get { return m_EndSymbol; }
|
||||
set { if (PropertyUtil.SetClass(ref m_EndSymbol, value)) SetVerticesDirty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
@@ -17,6 +15,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public enum Position
|
||||
{
|
||||
Default,
|
||||
/// <summary>
|
||||
/// Outside of sectors of pie chart, which relates to corresponding sector through visual guide line.
|
||||
/// |饼图扇区外侧,通过视觉引导线连到相应的扇区。
|
||||
@@ -69,35 +68,34 @@ namespace XCharts.Runtime
|
||||
End
|
||||
}
|
||||
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] Position m_Position = Position.Default;
|
||||
[SerializeField] protected bool m_AutoOffset = false;
|
||||
[SerializeField] protected Vector3 m_Offset;
|
||||
[SerializeField] protected float m_Rotate;
|
||||
[SerializeField] protected float m_Distance;
|
||||
[SerializeField] protected string m_Formatter;
|
||||
[SerializeField] protected string m_NumericFormatter = "";
|
||||
[SerializeField] protected float m_Width = 0;
|
||||
[SerializeField] protected float m_Height = 0;
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] Position m_Position = Position.Outside;
|
||||
[SerializeField] private Vector3 m_Offset;
|
||||
[SerializeField] private float m_Distance;
|
||||
[SerializeField] private string m_Formatter;
|
||||
[SerializeField] private float m_PaddingLeftRight = 2f;
|
||||
[SerializeField] private float m_PaddingTopBottom = 2f;
|
||||
[SerializeField] private float m_BackgroundWidth = 0;
|
||||
[SerializeField] private float m_BackgroundHeight = 0;
|
||||
[SerializeField] private string m_NumericFormatter = "";
|
||||
[SerializeField] private bool m_AutoOffset = false;
|
||||
[SerializeField] private bool m_AutoColor = false;
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||
private SerieLabelFormatterFunction m_FormatterFunction;
|
||||
[SerializeField] protected IconStyle m_Icon = new IconStyle();
|
||||
[SerializeField] protected ImageStyle m_Background = new ImageStyle();
|
||||
[SerializeField] protected TextPadding m_TextPadding = new TextPadding();
|
||||
[SerializeField] protected TextStyle m_TextStyle = new TextStyle();
|
||||
protected LabelFormatterFunction m_FormatterFunction;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Position = Position.Outside;
|
||||
m_Position = Position.Default;
|
||||
m_Offset = Vector3.zero;
|
||||
m_Distance = 0;
|
||||
m_PaddingLeftRight = 2f;
|
||||
m_PaddingTopBottom = 2f;
|
||||
m_BackgroundWidth = 0;
|
||||
m_BackgroundHeight = 0;
|
||||
m_Rotate = 0;
|
||||
m_Width = 0;
|
||||
m_Height = 0;
|
||||
m_NumericFormatter = "";
|
||||
m_AutoOffset = false;
|
||||
m_AutoColor = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -146,6 +144,15 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Rotation of label.
|
||||
/// |文本的旋转。
|
||||
/// </summary>
|
||||
public float rotate
|
||||
{
|
||||
get { return m_Rotate; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Rotate, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 距离轴线的距离。
|
||||
/// </summary>
|
||||
public float distance
|
||||
@@ -154,42 +161,33 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Distance, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the width of background. If set as default value 0, it means than the background width auto set as the text width.
|
||||
/// |标签的背景宽度。一般不用指定,不指定时则自动是文字的宽度。
|
||||
/// the width of label. If set as default value 0, it means than the label width auto set as the text width.
|
||||
/// |标签的宽度。一般不用指定,不指定时则自动是文字的宽度。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float backgroundWidth
|
||||
public float width
|
||||
{
|
||||
get { return m_BackgroundWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetComponentDirty(); }
|
||||
get { return m_Width; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the height of background. If set as default value 0, it means than the background height auto set as the text height.
|
||||
/// |标签的背景高度。一般不用指定,不指定时则自动是文字的高度。
|
||||
/// the height of label. If set as default value 0, it means than the label height auto set as the text height.
|
||||
/// |标签的高度。一般不用指定,不指定时则自动是文字的高度。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float backgroundHeight
|
||||
public float height
|
||||
{
|
||||
get { return m_BackgroundHeight; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundHeight, value)) SetComponentDirty(); }
|
||||
get { return m_Height; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the text padding of left and right. defaut:2.
|
||||
/// |左右边距。
|
||||
/// the text padding of label.
|
||||
/// |文本的边距。
|
||||
/// </summary>
|
||||
public float paddingLeftRight
|
||||
public TextPadding textPadding
|
||||
{
|
||||
get { return m_PaddingLeftRight; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_PaddingLeftRight, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the text padding of top and bottom. defaut:2.
|
||||
/// |上下边距。
|
||||
/// </summary>
|
||||
public float paddingTopBottom
|
||||
{
|
||||
get { return m_PaddingTopBottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_PaddingTopBottom, value)) SetComponentDirty(); }
|
||||
get { return m_TextPadding; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextPadding, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Standard numeric format strings.
|
||||
@@ -212,14 +210,23 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoOffset, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否开启自动颜色。当开启时,会根据已支持的serie自动设置颜色。
|
||||
/// the sytle of background.
|
||||
/// |背景图样式。
|
||||
/// </summary>
|
||||
public bool autoColor
|
||||
public ImageStyle background
|
||||
{
|
||||
get { return m_AutoColor; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoColor, value)) SetAllDirty(); }
|
||||
get { return m_Background; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Background, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sytle of icon.
|
||||
/// |图标样式。
|
||||
/// </summary>
|
||||
public IconStyle icon
|
||||
{
|
||||
get { return m_Icon; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Icon, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the sytle of text.
|
||||
/// |文本样式。
|
||||
@@ -229,8 +236,7 @@ namespace XCharts.Runtime
|
||||
get { return m_TextStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
public SerieLabelFormatterFunction formatterFunction
|
||||
public LabelFormatterFunction formatterFunction
|
||||
{
|
||||
get { return m_FormatterFunction; }
|
||||
set { m_FormatterFunction = value; }
|
||||
@@ -238,7 +244,17 @@ namespace XCharts.Runtime
|
||||
|
||||
public bool IsInside()
|
||||
{
|
||||
return position == Position.Inside || position == Position.Center;
|
||||
return m_Position == Position.Inside || m_Position == Position.Center;
|
||||
}
|
||||
|
||||
public bool IsDefaultPosition(Position position)
|
||||
{
|
||||
return m_Position == Position.Default || m_Position == position;
|
||||
}
|
||||
|
||||
public bool IsAutoSize()
|
||||
{
|
||||
return width == 0 && height == 0;
|
||||
}
|
||||
|
||||
public Vector3 GetOffset(float radius)
|
||||
@@ -261,29 +277,42 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public TextAnchor GetAutoAlignment()
|
||||
public virtual LabelStyle Clone()
|
||||
{
|
||||
if (textStyle.autoAlign) return textStyle.alignment;
|
||||
else
|
||||
{
|
||||
switch (position)
|
||||
{
|
||||
case LabelStyle.Position.Inside:
|
||||
case LabelStyle.Position.Center:
|
||||
case LabelStyle.Position.Top:
|
||||
case LabelStyle.Position.Bottom:
|
||||
return TextAnchor.MiddleCenter;
|
||||
case LabelStyle.Position.Outside:
|
||||
case LabelStyle.Position.Right:
|
||||
return TextAnchor.MiddleLeft;
|
||||
case LabelStyle.Position.Left:
|
||||
return TextAnchor.MiddleRight;
|
||||
default:
|
||||
return TextAnchor.MiddleCenter;
|
||||
}
|
||||
}
|
||||
var label = new LabelStyle();
|
||||
label.m_Show = m_Show;
|
||||
label.m_Position = m_Position;
|
||||
label.m_Offset = m_Offset;
|
||||
label.m_Rotate = m_Rotate;
|
||||
label.m_Distance = m_Distance;
|
||||
label.m_Formatter = m_Formatter;
|
||||
label.m_Width = m_Width;
|
||||
label.m_Height = m_Height;
|
||||
label.m_NumericFormatter = m_NumericFormatter;
|
||||
label.m_AutoOffset = m_AutoOffset;
|
||||
label.m_Icon.Copy(m_Icon);
|
||||
label.m_Background.Copy(m_Background);
|
||||
label.m_TextPadding = m_TextPadding;
|
||||
label.m_TextStyle.Copy(m_TextStyle);
|
||||
return label;
|
||||
}
|
||||
|
||||
public virtual void Copy(LabelStyle label)
|
||||
{
|
||||
m_Show = label.m_Show;
|
||||
m_Position = label.m_Position;
|
||||
m_Offset = label.m_Offset;
|
||||
m_Rotate = label.m_Rotate;
|
||||
m_Distance = label.m_Distance;
|
||||
m_Formatter = label.m_Formatter;
|
||||
m_Width = label.m_Width;
|
||||
m_Height = label.m_Height;
|
||||
m_NumericFormatter = label.m_NumericFormatter;
|
||||
m_AutoOffset = label.m_AutoOffset;
|
||||
m_Icon.Copy(label.m_Icon);
|
||||
m_Background.Copy(label.m_Background);
|
||||
m_TextPadding = label.m_TextPadding;
|
||||
m_TextStyle.Copy(label.m_TextStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace XCharts.Runtime
|
||||
Start
|
||||
}
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] Position m_Position;
|
||||
[SerializeField] private Position m_Position;
|
||||
[SerializeField]
|
||||
private ArrowStyle m_Arrow = new ArrowStyle()
|
||||
{
|
||||
|
||||
33
Runtime/Component/Child/SerieDataBaseInfo.cs
Normal file
33
Runtime/Component/Child/SerieDataBaseInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据项的其他基础数据。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class SerieDataBaseInfo : ChildComponent, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private bool m_Ignore = false;
|
||||
[SerializeField] private bool m_Selected;
|
||||
[SerializeField] private float m_Radius;
|
||||
|
||||
/// <summary>
|
||||
/// 是否忽略数据。当为 true 时,数据不进行绘制。
|
||||
/// </summary>
|
||||
public bool ignore
|
||||
{
|
||||
get { return m_Ignore; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Ignore, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 自定义半径。可用在饼图中自定义某个数据项的半径。
|
||||
/// </summary>
|
||||
public float radius { get { return m_Radius; } set { m_Radius = value; } }
|
||||
/// <summary>
|
||||
/// Whether the data item is selected.
|
||||
/// |该数据项是否被选中。
|
||||
/// </summary>
|
||||
public bool selected { get { return m_Selected; } set { m_Selected = value; } }
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Child/SerieDataBaseInfo.cs.meta
Normal file
11
Runtime/Component/Child/SerieDataBaseInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6d8757fbd847419aaed450e020e827c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
242
Runtime/Component/Child/SerieSymbl.cs
Normal file
242
Runtime/Component/Child/SerieSymbl.cs
Normal file
@@ -0,0 +1,242 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The way to get serie symbol size.
|
||||
/// |获取标记图形大小的方式。
|
||||
/// </summary>
|
||||
public enum SymbolSizeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Specify constant for symbol size.
|
||||
/// |自定义大小。
|
||||
/// </summary>
|
||||
Custom,
|
||||
/// <summary>
|
||||
/// Specify the dataIndex and dataScale to calculate symbol size.
|
||||
/// |通过 dataIndex 从数据中获取,再乘以一个比例系数 dataScale 。
|
||||
/// </summary>
|
||||
FromData,
|
||||
/// <summary>
|
||||
/// Specify function for symbol size.
|
||||
/// |通过委托函数获取。
|
||||
/// </summary>
|
||||
Function,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系列数据项的标记的图形
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class SerieSymbol : SymbolStyle, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private SymbolSizeType m_SizeType = SymbolSizeType.Custom;
|
||||
[SerializeField] private float m_SelectedSize = 0f;
|
||||
[SerializeField] private int m_DataIndex = 1;
|
||||
[SerializeField] private float m_DataScale = 1;
|
||||
[SerializeField] private float m_SelectedDataScale = 1.5f;
|
||||
[SerializeField] private SymbolSizeFunction m_SizeFunction;
|
||||
[SerializeField] private SymbolSizeFunction m_SelectedSizeFunction;
|
||||
[SerializeField] private int m_StartIndex;
|
||||
[SerializeField] private int m_Interval;
|
||||
[SerializeField] private bool m_ForceShowLast = false;
|
||||
[SerializeField] private bool m_Repeat = false;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
m_SizeType = SymbolSizeType.Custom;
|
||||
m_SelectedSize = 0f;
|
||||
m_DataIndex = 1;
|
||||
m_DataScale = 1;
|
||||
m_SelectedDataScale = 1.5f;
|
||||
m_SizeFunction = null;
|
||||
m_SelectedSizeFunction = null;
|
||||
m_StartIndex = 0;
|
||||
m_Interval = 0;
|
||||
m_ForceShowLast = false;
|
||||
m_Repeat = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the type of symbol size.
|
||||
/// |标记图形的大小获取方式。
|
||||
/// </summary>
|
||||
public SymbolSizeType sizeType
|
||||
{
|
||||
get { return m_SizeType; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SizeType, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the size of selected symbol.
|
||||
/// |被选中的标记的大小。
|
||||
/// </summary>
|
||||
public float selectedSize
|
||||
{
|
||||
get { return m_SelectedSize; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SelectedSize, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// whitch data index is when the sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的数据源索引。
|
||||
/// </summary>
|
||||
public int dataIndex
|
||||
{
|
||||
get { return m_DataIndex; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_DataIndex, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the scale of data when sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的倍数系数。
|
||||
/// </summary>
|
||||
public float dataScale
|
||||
{
|
||||
get { return m_DataScale; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_DataScale, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the scale of selected data when sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的高亮倍数系数。
|
||||
/// </summary>
|
||||
public float selectedDataScale
|
||||
{
|
||||
get { return m_SelectedDataScale; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SelectedDataScale, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the function of size when sizeType assined as Function.
|
||||
/// |当sizeType指定为Function时,指定的委托函数。
|
||||
/// </summary>
|
||||
public SymbolSizeFunction sizeFunction
|
||||
{
|
||||
get { return m_SizeFunction; }
|
||||
set { if (PropertyUtil.SetClass(ref m_SizeFunction, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the function of size when sizeType assined as Function.
|
||||
/// |当sizeType指定为Function时,指定的高亮委托函数。
|
||||
/// </summary>
|
||||
public SymbolSizeFunction selectedSizeFunction
|
||||
{
|
||||
get { return m_SelectedSizeFunction; }
|
||||
set { if (PropertyUtil.SetClass(ref m_SelectedSizeFunction, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the index start to show symbol.
|
||||
/// |开始显示图形标记的索引。
|
||||
/// </summary>
|
||||
public int startIndex
|
||||
{
|
||||
get { return m_StartIndex; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_StartIndex, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the interval of show symbol.
|
||||
/// |显示图形标记的间隔。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。
|
||||
/// </summary>
|
||||
public int interval
|
||||
{
|
||||
get { return m_Interval; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// whether to show the last symbol.
|
||||
/// |是否强制显示最后一个图形标记。
|
||||
/// </summary>
|
||||
public bool forceShowLast
|
||||
{
|
||||
get { return m_ForceShowLast; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ForceShowLast, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形是否重复。
|
||||
/// </summary>
|
||||
public bool repeat
|
||||
{
|
||||
get { return m_Repeat; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Repeat, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据指定的sizeType获得标记的大小
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSize(List<double> data, float themeSize)
|
||||
{
|
||||
switch (m_SizeType)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
return size == 0 ? themeSize : size;
|
||||
case SymbolSizeType.FromData:
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return (float)data[dataIndex] * m_DataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
return size == 0 ? themeSize : size;
|
||||
}
|
||||
case SymbolSizeType.Function:
|
||||
if (data != null && sizeFunction != null) return sizeFunction(data);
|
||||
else return size == 0 ? themeSize : size;
|
||||
default: return size == 0 ? themeSize : size;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据sizeType获得高亮时的标记大小
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSelectedSize(List<double> data, float themeSelectedSize)
|
||||
{
|
||||
switch (m_SizeType)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
|
||||
case SymbolSizeType.FromData:
|
||||
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return (float)data[dataIndex] * m_SelectedDataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
}
|
||||
|
||||
case SymbolSizeType.Function:
|
||||
|
||||
if (data != null && selectedSizeFunction != null)
|
||||
return selectedSizeFunction(data);
|
||||
else
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
|
||||
default: return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSymbol(int dataIndex, int dataCount)
|
||||
{
|
||||
if (!show)
|
||||
return false;
|
||||
|
||||
if (dataIndex < startIndex)
|
||||
return false;
|
||||
|
||||
if (m_Interval <= 0)
|
||||
return true;
|
||||
|
||||
if (m_ForceShowLast && dataIndex == dataCount - 1)
|
||||
return true;
|
||||
|
||||
return (dataIndex - startIndex) % (m_Interval + 1) == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Child/SerieSymbl.cs.meta
Normal file
11
Runtime/Component/Child/SerieSymbl.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd2852f4c46ae4dbd8c105e62dcce9a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -61,75 +61,31 @@ namespace XCharts.Runtime
|
||||
EmptyArrow
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The way to get serie symbol size.
|
||||
/// |获取标记图形大小的方式。
|
||||
/// </summary>
|
||||
public enum SymbolSizeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Specify constant for symbol size.
|
||||
/// |自定义大小。
|
||||
/// </summary>
|
||||
Custom,
|
||||
/// <summary>
|
||||
/// Specify the dataIndex and dataScale to calculate symbol size.
|
||||
/// |通过 dataIndex 从数据中获取,再乘以一个比例系数 dataScale 。
|
||||
/// </summary>
|
||||
FromData,
|
||||
/// <summary>
|
||||
/// Specify function for symbol size.
|
||||
/// |通过委托函数获取。
|
||||
/// </summary>
|
||||
Function,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系列数据项的标记的图形
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class SymbolStyle : ChildComponent, ISerieDataComponent
|
||||
public class SymbolStyle : ChildComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private SymbolType m_Type = SymbolType.EmptyCircle;
|
||||
[SerializeField] private SymbolSizeType m_SizeType = SymbolSizeType.Custom;
|
||||
[SerializeField] private float m_Size = 0f;
|
||||
[SerializeField] private float m_SelectedSize = 0f;
|
||||
[SerializeField] private int m_DataIndex = 1;
|
||||
[SerializeField] private float m_DataScale = 1;
|
||||
[SerializeField] private float m_SelectedDataScale = 1.5f;
|
||||
[SerializeField] private SymbolSizeFunction m_SizeFunction;
|
||||
[SerializeField] private SymbolSizeFunction m_SelectedSizeFunction;
|
||||
[SerializeField] private int m_StartIndex;
|
||||
[SerializeField] private int m_Interval;
|
||||
[SerializeField] private bool m_ForceShowLast = false;
|
||||
[SerializeField] private float m_Gap = 0;
|
||||
[SerializeField] private float m_Width = 0f;
|
||||
[SerializeField] private float m_Height = 0f;
|
||||
[SerializeField] private bool m_Repeat = false;
|
||||
[SerializeField] private Vector2 m_Offset = Vector2.zero;
|
||||
[SerializeField] private Sprite m_Image;
|
||||
[SerializeField] private Image.Type m_ImageType;
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] protected SymbolType m_Type = SymbolType.EmptyCircle;
|
||||
[SerializeField] protected float m_Size = 0f;
|
||||
[SerializeField] protected float m_Gap = 0;
|
||||
[SerializeField] protected float m_Width = 0f;
|
||||
[SerializeField] protected float m_Height = 0f;
|
||||
[SerializeField] protected Vector2 m_Offset = Vector2.zero;
|
||||
[SerializeField] protected Sprite m_Image;
|
||||
[SerializeField] protected Image.Type m_ImageType;
|
||||
[SerializeField] protected Color32 m_Color;
|
||||
|
||||
public void Reset()
|
||||
public virtual void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Type = SymbolType.EmptyCircle;
|
||||
m_SizeType = SymbolSizeType.Custom;
|
||||
m_Size = 0f;
|
||||
m_SelectedSize = 0f;
|
||||
m_DataIndex = 1;
|
||||
m_DataScale = 1;
|
||||
m_SelectedDataScale = 1.5f;
|
||||
m_SizeFunction = null;
|
||||
m_SelectedSizeFunction = null;
|
||||
m_StartIndex = 0;
|
||||
m_Interval = 0;
|
||||
m_ForceShowLast = false;
|
||||
m_Gap = 0;
|
||||
m_Width = 0f;
|
||||
m_Height = 0f;
|
||||
m_Repeat = false;
|
||||
m_Offset = Vector2.zero;
|
||||
m_Image = null;
|
||||
m_ImageType = Image.Type.Simple;
|
||||
@@ -154,15 +110,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Type, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the type of symbol size.
|
||||
/// |标记图形的大小获取方式。
|
||||
/// </summary>
|
||||
public SymbolSizeType sizeType
|
||||
{
|
||||
get { return m_SizeType; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SizeType, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the size of symbol.
|
||||
/// |标记的大小。
|
||||
/// </summary>
|
||||
@@ -172,87 +119,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Size, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the size of selected symbol.
|
||||
/// |被选中的标记的大小。
|
||||
/// </summary>
|
||||
public float selectedSize
|
||||
{
|
||||
get { return m_SelectedSize; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SelectedSize, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// whitch data index is when the sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的数据源索引。
|
||||
/// </summary>
|
||||
public int dataIndex
|
||||
{
|
||||
get { return m_DataIndex; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_DataIndex, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the scale of data when sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的倍数系数。
|
||||
/// </summary>
|
||||
public float dataScale
|
||||
{
|
||||
get { return m_DataScale; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_DataScale, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the scale of selected data when sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的高亮倍数系数。
|
||||
/// </summary>
|
||||
public float selectedDataScale
|
||||
{
|
||||
get { return m_SelectedDataScale; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SelectedDataScale, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the function of size when sizeType assined as Function.
|
||||
/// |当sizeType指定为Function时,指定的委托函数。
|
||||
/// </summary>
|
||||
public SymbolSizeFunction sizeFunction
|
||||
{
|
||||
get { return m_SizeFunction; }
|
||||
set { if (PropertyUtil.SetClass(ref m_SizeFunction, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the function of size when sizeType assined as Function.
|
||||
/// |当sizeType指定为Function时,指定的高亮委托函数。
|
||||
/// </summary>
|
||||
public SymbolSizeFunction selectedSizeFunction
|
||||
{
|
||||
get { return m_SelectedSizeFunction; }
|
||||
set { if (PropertyUtil.SetClass(ref m_SelectedSizeFunction, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the index start to show symbol.
|
||||
/// |开始显示图形标记的索引。
|
||||
/// </summary>
|
||||
public int startIndex
|
||||
{
|
||||
get { return m_StartIndex; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_StartIndex, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the interval of show symbol.
|
||||
/// |显示图形标记的间隔。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。
|
||||
/// </summary>
|
||||
public int interval
|
||||
{
|
||||
get { return m_Interval; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// whether to show the last symbol.
|
||||
/// |是否强制显示最后一个图形标记。
|
||||
/// </summary>
|
||||
public bool forceShowLast
|
||||
{
|
||||
get { return m_ForceShowLast; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ForceShowLast, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the gap of symbol and line segment.
|
||||
/// |图形标记和线条的间隙距离。
|
||||
/// </summary>
|
||||
@@ -278,14 +144,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形是否重复。
|
||||
/// </summary>
|
||||
public bool repeat
|
||||
{
|
||||
get { return m_Repeat; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Repeat, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 自定义的标记图形。
|
||||
/// </summary>
|
||||
public Sprite image
|
||||
@@ -306,6 +164,14 @@ namespace XCharts.Runtime
|
||||
get { return m_Offset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形的颜色。
|
||||
/// </summary>
|
||||
public Color32 color
|
||||
{
|
||||
get { return m_Color; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Color, value)) SetAllDirty(); }
|
||||
}
|
||||
public Vector3 offset3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
|
||||
private List<float> m_AnimationSize = new List<float>() { 0, 5, 10 };
|
||||
/// <summary>
|
||||
@@ -313,84 +179,11 @@ namespace XCharts.Runtime
|
||||
/// |带有涟漪特效动画的散点图的动画参数。
|
||||
/// </summary>
|
||||
public List<float> animationSize { get { return m_AnimationSize; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据指定的sizeType获得标记的大小
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSize(List<double> data, float themeSize)
|
||||
public Color32 GetColor(Color32 defaultColor)
|
||||
{
|
||||
switch (m_SizeType)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
return size == 0 ? themeSize : size;
|
||||
case SymbolSizeType.FromData:
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return (float)data[dataIndex] * m_DataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
return size == 0 ? themeSize : size;
|
||||
}
|
||||
case SymbolSizeType.Function:
|
||||
if (data != null && sizeFunction != null) return sizeFunction(data);
|
||||
else return size == 0 ? themeSize : size;
|
||||
default: return size == 0 ? themeSize : size;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据sizeType获得高亮时的标记大小
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSelectedSize(List<double> data, float themeSelectedSize)
|
||||
{
|
||||
switch (m_SizeType)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
|
||||
case SymbolSizeType.FromData:
|
||||
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return (float)data[dataIndex] * m_SelectedDataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
}
|
||||
|
||||
case SymbolSizeType.Function:
|
||||
|
||||
if (data != null && selectedSizeFunction != null)
|
||||
return selectedSizeFunction(data);
|
||||
else
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
|
||||
default: return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSymbol(int dataIndex, int dataCount)
|
||||
{
|
||||
if (!show)
|
||||
return false;
|
||||
|
||||
if (dataIndex < startIndex)
|
||||
return false;
|
||||
|
||||
if (m_Interval <= 0)
|
||||
return true;
|
||||
|
||||
if (m_ForceShowLast && dataIndex == dataCount - 1)
|
||||
return true;
|
||||
|
||||
return (dataIndex - startIndex) % (m_Interval + 1) == 0;
|
||||
return ChartHelper.IsClearColor(m_Color) ? defaultColor : m_Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
61
Runtime/Component/Child/TextPadding.cs
Normal file
61
Runtime/Component/Child/TextPadding.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to text.
|
||||
/// |文本的内边距设置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TextPadding : ChildComponent
|
||||
{
|
||||
[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;
|
||||
}
|
||||
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float top
|
||||
{
|
||||
get { return m_Top; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float right
|
||||
{
|
||||
get { return m_Right; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float bottom
|
||||
{
|
||||
get { return m_Bottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetComponentDirty(); }
|
||||
}
|
||||
public float left
|
||||
{
|
||||
get { return m_Left; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetComponentDirty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Child/TextPadding.cs.meta
Normal file
11
Runtime/Component/Child/TextPadding.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 407bba126a0854199a4686b44cc9407e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -14,15 +14,13 @@ namespace XCharts.Runtime
|
||||
[Serializable]
|
||||
public class TextStyle : ChildComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Font m_Font;
|
||||
[SerializeField] private bool m_AutoWrap = false;
|
||||
[SerializeField] private bool m_AutoAlign = true;
|
||||
[SerializeField] private float m_Rotate = 0;
|
||||
[SerializeField] private float m_ExtraWidth = 0;
|
||||
[SerializeField] private Vector2 m_Offset = Vector2.zero;
|
||||
[SerializeField] private bool m_AutoColor = false;
|
||||
[SerializeField] private Color m_Color = Color.clear;
|
||||
[SerializeField] private bool m_AutoBackgroundColor = false;
|
||||
[SerializeField] private Color m_BackgroundColor = Color.clear;
|
||||
[SerializeField] private int m_FontSize = 0;
|
||||
[SerializeField] private FontStyle m_FontStyle = FontStyle.Normal;
|
||||
[SerializeField] private float m_LineSpacing = 1f;
|
||||
@@ -32,6 +30,11 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private FontStyles m_TMPFontStyle = FontStyles.Normal;
|
||||
[SerializeField] private TextAlignmentOptions m_TMPAlignment = TextAlignmentOptions.Left;
|
||||
#endif
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Rotation of text.
|
||||
/// |文本的旋转。
|
||||
@@ -43,27 +46,13 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Rotate, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Extra width of text preferred width.
|
||||
/// |额外的宽度
|
||||
/// 是否开启自动颜色。当开启时,会自动设置颜色。
|
||||
/// </summary>
|
||||
public float extraWidth
|
||||
public bool autoColor
|
||||
{
|
||||
get { return m_ExtraWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ExtraWidth, value)) SetComponentDirty(); }
|
||||
get { return m_AutoColor; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoColor, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the offset of position.
|
||||
/// |坐标偏移。
|
||||
/// [Default: `Vector2.zero`]
|
||||
/// </summary>
|
||||
public Vector2 offset
|
||||
{
|
||||
get { return m_Offset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
public Vector3 offsetv3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
|
||||
|
||||
/// <summary>
|
||||
/// the color of text.
|
||||
/// |文本的颜色。
|
||||
@@ -74,21 +63,6 @@ namespace XCharts.Runtime
|
||||
get { return m_Color; }
|
||||
set { if (PropertyUtil.SetColor(ref m_Color, value)) SetComponentDirty(); }
|
||||
}
|
||||
public bool autoBackgroundColor
|
||||
{
|
||||
get { return m_AutoBackgroundColor; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoBackgroundColor, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of text.
|
||||
/// |文本的背景颜色。
|
||||
/// [default: `Color.clear`]
|
||||
/// </summary>
|
||||
public Color backgroundColor
|
||||
{
|
||||
get { return m_BackgroundColor; }
|
||||
set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the font of text. When `null`, the theme's font is used by default.
|
||||
/// |文本字体。
|
||||
@@ -165,11 +139,6 @@ namespace XCharts.Runtime
|
||||
get { return m_TMPFontStyle; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_TMPFontStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
public TextAlignmentOptions tmpAlignment
|
||||
{
|
||||
get { return m_TMPAlignment; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_TMPAlignment, value)) SetComponentDirty(); }
|
||||
}
|
||||
#endif
|
||||
|
||||
public TextStyle()
|
||||
@@ -206,9 +175,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
font = textStyle.font;
|
||||
rotate = textStyle.rotate;
|
||||
offset = textStyle.offset;
|
||||
color = textStyle.color;
|
||||
backgroundColor = textStyle.backgroundColor;
|
||||
fontSize = textStyle.fontSize;
|
||||
fontStyle = textStyle.fontStyle;
|
||||
lineSpacing = textStyle.lineSpacing;
|
||||
@@ -217,7 +184,6 @@ namespace XCharts.Runtime
|
||||
autoAlign = textStyle.autoAlign;
|
||||
#if dUI_TextMeshPro
|
||||
m_TMPFont = textStyle.tmpFont;
|
||||
m_TMPAlignment = textStyle.tmpAlignment;
|
||||
m_TMPFontStyle = textStyle.tmpFontStyle;
|
||||
#endif
|
||||
}
|
||||
@@ -247,9 +213,9 @@ namespace XCharts.Runtime
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
public TextAnchor GetAlignment(TextAnchor systemAlignment)
|
||||
public TextAnchor GetAlignment(TextAnchor defaultAlignment)
|
||||
{
|
||||
return m_AutoAlign ? systemAlignment : alignment;
|
||||
return m_AutoAlign ? defaultAlignment : alignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ namespace XCharts.Runtime
|
||||
/// DataZoom component is used for zooming a specific area,
|
||||
/// which enables user to investigate data in detail,
|
||||
/// or get an overview of the data, or get rid of outlier points.
|
||||
/// |
|
||||
/// <para>DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。</para>
|
||||
/// |DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[ComponentHandler(typeof(DataZoomHandler), true)]
|
||||
@@ -88,7 +87,7 @@ namespace XCharts.Runtime
|
||||
[Range(1f, 20f)]
|
||||
[SerializeField] private float m_ScrollSensitivity = 1.1f;
|
||||
[SerializeField] private Orient m_Orient = Orient.Horizonal;
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle();
|
||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.Solid);
|
||||
[SerializeField] private AreaStyle m_AreaStyle = new AreaStyle();
|
||||
|
||||
@@ -132,7 +131,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether built-in support is supported.
|
||||
/// |Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging,
|
||||
/// Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging,
|
||||
/// mouse wheel, finger swiping (on the touch screen).
|
||||
/// |是否支持内置。内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。
|
||||
/// </summary>
|
||||
@@ -303,7 +302,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The end percentage of the window out of the data extent, in the range of 0 ~ 100.
|
||||
/// 数据窗口范围的结束百分比。范围是:0 ~ 100。
|
||||
/// |数据窗口范围的结束百分比。范围是:0 ~ 100。
|
||||
/// </summary>
|
||||
public float end
|
||||
{
|
||||
@@ -340,13 +339,13 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Orient, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// font style.
|
||||
/// |文字格式。
|
||||
/// label style.
|
||||
/// |文本标签格式。
|
||||
/// </summary>
|
||||
public TextStyle textStyle
|
||||
public LabelStyle labelStyle
|
||||
{
|
||||
get { return m_TextStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetComponentDirty(); }
|
||||
get { return m_LabelStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 阴影线条样式。
|
||||
@@ -377,12 +376,12 @@ namespace XCharts.Runtime
|
||||
/// The start label.
|
||||
/// |组件的开始信息文本。
|
||||
/// </summary>
|
||||
private ChartText m_StartLabel { get; set; }
|
||||
private ChartLabel m_StartLabel { get; set; }
|
||||
/// <summary>
|
||||
/// The end label.
|
||||
/// |组件的结束信息文本。
|
||||
/// </summary>
|
||||
private ChartText m_EndLabel { get; set; }
|
||||
private ChartLabel m_EndLabel { get; set; }
|
||||
|
||||
public override void SetDefaultValue()
|
||||
{
|
||||
@@ -403,7 +402,7 @@ namespace XCharts.Runtime
|
||||
end = 70;
|
||||
m_Orient = Orient.Horizonal;
|
||||
m_ScrollSensitivity = 10;
|
||||
m_TextStyle = new TextStyle();
|
||||
m_LabelStyle = new LabelStyle();
|
||||
m_LineStyle = new LineStyle(LineStyle.Type.Solid)
|
||||
{
|
||||
opacity = 0.3f
|
||||
@@ -563,14 +562,8 @@ namespace XCharts.Runtime
|
||||
/// <param name="flag"></param>
|
||||
internal void SetLabelActive(bool flag)
|
||||
{
|
||||
if (m_StartLabel != null && m_StartLabel.gameObject.activeInHierarchy != flag)
|
||||
{
|
||||
m_StartLabel.gameObject.SetActive(flag);
|
||||
}
|
||||
if (m_EndLabel != null && m_EndLabel.gameObject.activeInHierarchy != flag)
|
||||
{
|
||||
m_EndLabel.gameObject.SetActive(flag);
|
||||
}
|
||||
m_StartLabel.SetActive(flag);
|
||||
m_EndLabel.SetActive(flag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -591,24 +584,24 @@ namespace XCharts.Runtime
|
||||
if (m_EndLabel != null) m_EndLabel.SetText(text);
|
||||
}
|
||||
|
||||
internal void SetStartLabel(ChartText startLabel)
|
||||
internal void SetStartLabel(ChartLabel startLabel)
|
||||
{
|
||||
m_StartLabel = startLabel;
|
||||
}
|
||||
|
||||
internal void SetEndLabel(ChartText endLabel)
|
||||
internal void SetEndLabel(ChartLabel endLabel)
|
||||
{
|
||||
m_EndLabel = endLabel;
|
||||
}
|
||||
|
||||
internal void UpdateStartLabelPosition(Vector3 pos)
|
||||
{
|
||||
m_StartLabel.SetLocalPosition(pos);
|
||||
m_StartLabel.SetPosition(pos);
|
||||
}
|
||||
|
||||
internal void UpdateEndLabelPosition(Vector3 pos)
|
||||
{
|
||||
m_EndLabel.SetLocalPosition(pos);
|
||||
m_EndLabel.SetPosition(pos);
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight)
|
||||
|
||||
@@ -29,15 +29,13 @@ namespace XCharts.Runtime
|
||||
dataZoomObject.hideFlags = chart.chartHideFlags;
|
||||
ChartHelper.HideAllObject(dataZoomObject);
|
||||
|
||||
var startLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "start", dataZoomObject.transform,
|
||||
Vector2.zero, Vector2.zero, new Vector2(1, 0.5f), new Vector2(200, 20), dataZoom.textStyle,
|
||||
chart.theme.dataZoom);
|
||||
startLabel.SetAlignment(TextAnchor.MiddleRight);
|
||||
var startLabel = ChartHelper.AddChartLabel(s_DefaultDataZoom + "start", dataZoomObject.transform,
|
||||
dataZoom.labelStyle, chart.theme.dataZoom, "", Color.clear, TextAnchor.MiddleRight);
|
||||
startLabel.gameObject.SetActive(true);
|
||||
|
||||
var endLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "end", dataZoomObject.transform,
|
||||
Vector2.zero, Vector2.zero, new Vector2(0, 0.5f), new Vector2(200, 20), dataZoom.textStyle,
|
||||
chart.theme.dataZoom);
|
||||
endLabel.SetAlignment(TextAnchor.MiddleLeft);
|
||||
var endLabel = ChartHelper.AddChartLabel(s_DefaultDataZoom + "end", dataZoomObject.transform,
|
||||
dataZoom.labelStyle, chart.theme.dataZoom, "", Color.clear, TextAnchor.MiddleLeft);
|
||||
endLabel.gameObject.SetActive(true);
|
||||
|
||||
dataZoom.SetStartLabel(startLabel);
|
||||
dataZoom.SetEndLabel(endLabel);
|
||||
|
||||
@@ -9,18 +9,24 @@ namespace XCharts.Runtime
|
||||
[Serializable]
|
||||
public class DebugInfo
|
||||
{
|
||||
#pragma warning disable 0414
|
||||
#pragma warning disable 0414
|
||||
[SerializeField] private bool m_Show = true;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning restore 0414
|
||||
[SerializeField] private bool m_ShowDebugInfo = false;
|
||||
[SerializeField] protected bool m_ShowAllChartObject = false;
|
||||
[SerializeField] protected bool m_FoldSeries = false;
|
||||
[SerializeField]
|
||||
private TextStyle m_DebugInfoTextStyle = new TextStyle()
|
||||
private LabelStyle m_LabelStyle = new LabelStyle()
|
||||
{
|
||||
fontSize = 18,
|
||||
backgroundColor = new Color32(32, 32, 32, 170),
|
||||
color = Color.white
|
||||
background = new ImageStyle()
|
||||
{
|
||||
color = new Color32(32, 32, 32, 170)
|
||||
},
|
||||
textStyle = new TextStyle()
|
||||
{
|
||||
fontSize = 18,
|
||||
color = Color.white
|
||||
}
|
||||
};
|
||||
|
||||
private static StringBuilder s_Sb = new StringBuilder();
|
||||
@@ -35,7 +41,7 @@ namespace XCharts.Runtime
|
||||
private ChartLabel m_Label;
|
||||
private List<float> m_FpsList = new List<float>();
|
||||
|
||||
public bool showAllChartObject { get { return m_ShowAllChartObject; } }
|
||||
public bool showAllChartObject { get { return m_ShowAllChartObject; } set { m_ShowAllChartObject = value; } }
|
||||
public bool foldSeries { get { return m_FoldSeries; } set { m_FoldSeries = value; } }
|
||||
public float fps { get; private set; }
|
||||
public float avgFps { get; private set; }
|
||||
@@ -45,7 +51,7 @@ namespace XCharts.Runtime
|
||||
public void Init(BaseChart chart)
|
||||
{
|
||||
m_Chart = chart;
|
||||
m_Label = AddDebugInfoObject("debug", chart.transform, m_DebugInfoTextStyle, chart.theme);
|
||||
m_Label = AddDebugInfoObject("debug", chart.transform, m_LabelStyle, chart.theme);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
@@ -124,7 +130,7 @@ namespace XCharts.Runtime
|
||||
return total / list.Count;
|
||||
}
|
||||
|
||||
private ChartLabel AddDebugInfoObject(string name, Transform parent, TextStyle textStyle,
|
||||
private ChartLabel AddDebugInfoObject(string name, Transform parent, LabelStyle labelStyle,
|
||||
ThemeStyle theme)
|
||||
{
|
||||
var anchorMax = new Vector2(0, 1);
|
||||
@@ -137,16 +143,9 @@ namespace XCharts.Runtime
|
||||
labelGameObject.hideFlags = m_Chart.chartHideFlags;
|
||||
ChartHelper.SetActive(labelGameObject, m_ShowDebugInfo);
|
||||
|
||||
var label = ChartHelper.GetOrAddComponent<ChartLabel>(labelGameObject);
|
||||
label.labelBackground = label;
|
||||
label.labelBackground.color = textStyle.backgroundColor;
|
||||
label.labelBackground.raycastTarget = false;
|
||||
label.label = ChartHelper.AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme.common);
|
||||
label.SetAutoSize(true);
|
||||
label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.UpperLeft));
|
||||
label.label.SetLocalPosition(new Vector2(3, -3));
|
||||
label.SetText("30");
|
||||
label.SetTextColor(textStyle.color);
|
||||
var label = ChartHelper.AddChartLabel("info", labelGameObject.transform, labelStyle, theme.common,
|
||||
"", Color.clear, TextAnchor.UpperLeft);
|
||||
label.SetActive(labelStyle.show);
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private bool m_ItemAutoColor = true;
|
||||
[SerializeField] private bool m_TextAutoColor = false;
|
||||
[SerializeField] private string m_Formatter;
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle() { offset = new Vector2(2f, 0), fontSize = 0 };
|
||||
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle();
|
||||
[SerializeField] private List<string> m_Data = new List<string>();
|
||||
[SerializeField] private List<Sprite> m_Icons = new List<Sprite>();
|
||||
|
||||
@@ -195,10 +195,10 @@ namespace XCharts.Runtime
|
||||
/// the style of text.
|
||||
/// |文本样式。
|
||||
/// </summary>
|
||||
public TextStyle textStyle
|
||||
public LabelStyle labelStyle
|
||||
{
|
||||
get { return m_TextStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetComponentDirty(); }
|
||||
get { return m_LabelStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Data array of legend. An array item is usually a name representing string. (If it is a pie chart,
|
||||
@@ -229,14 +229,14 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public override bool componentDirty
|
||||
{
|
||||
get { return m_ComponentDirty || location.componentDirty || textStyle.componentDirty; }
|
||||
get { return m_ComponentDirty || location.componentDirty || labelStyle.componentDirty; }
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
{
|
||||
base.ClearComponentDirty();
|
||||
location.ClearComponentDirty();
|
||||
textStyle.ClearComponentDirty();
|
||||
labelStyle.ClearComponentDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace XCharts.Runtime
|
||||
public override void CheckComponent(System.Text.StringBuilder sb)
|
||||
{
|
||||
var legend = component;
|
||||
if (ChartHelper.IsColorAlphaZero(legend.textStyle.color))
|
||||
if (ChartHelper.IsColorAlphaZero(legend.labelStyle.textStyle.color))
|
||||
sb.AppendFormat("warning:legend{0}->textStyle->color alpha is 0\n", legend.index);
|
||||
var serieNameList = SeriesHelper.GetLegalSerieNameList(chart.series);
|
||||
if (serieNameList.Count == 0)
|
||||
@@ -93,14 +93,14 @@ namespace XCharts.Runtime
|
||||
int clickedIndex = int.Parse(temp[0]);
|
||||
if (legend.selectedMode == Legend.SelectedMode.Multiple)
|
||||
{
|
||||
chart.OnLegendButtonClick(clickedIndex, selectedName, !chart.IsActiveByLegend(selectedName));
|
||||
OnLegendButtonClick(legend, clickedIndex, selectedName, !chart.IsActiveByLegend(selectedName));
|
||||
}
|
||||
else
|
||||
{
|
||||
var btnList = legend.context.buttonList.Values.ToArray();
|
||||
if (btnList.Length == 1)
|
||||
{
|
||||
chart.OnLegendButtonClick(0, selectedName, !chart.IsActiveByLegend(selectedName));
|
||||
OnLegendButtonClick(legend, 0, selectedName, !chart.IsActiveByLegend(selectedName));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -109,7 +109,7 @@ namespace XCharts.Runtime
|
||||
temp = btnList[n].name.Split('_');
|
||||
selectedName = btnList[n].legendName;
|
||||
var index = btnList[n].index;
|
||||
chart.OnLegendButtonClick(n, selectedName, index == clickedIndex ? true : false);
|
||||
OnLegendButtonClick(legend, n, selectedName, index == clickedIndex ? true : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace XCharts.Runtime
|
||||
var temp = item.button.name.Split('_');
|
||||
string selectedName = temp[1];
|
||||
int index = int.Parse(temp[0]);
|
||||
chart.OnLegendButtonEnter(index, selectedName);
|
||||
OnLegendButtonEnter(legend, index, selectedName);
|
||||
});
|
||||
ChartHelper.AddEventListener(item.button.gameObject, EventTriggerType.PointerExit, (data) =>
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace XCharts.Runtime
|
||||
var temp = item.button.name.Split('_');
|
||||
string selectedName = temp[1];
|
||||
int index = int.Parse(temp[0]);
|
||||
chart.OnLegendButtonExit(index, selectedName);
|
||||
OnLegendButtonExit(legend, index, selectedName);
|
||||
});
|
||||
}
|
||||
LegendHelper.ResetItemPosition(legend, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
@@ -136,6 +136,27 @@ namespace XCharts.Runtime
|
||||
legend.refreshComponent();
|
||||
}
|
||||
|
||||
private void OnLegendButtonClick(Legend legend, int index, string legendName, bool show)
|
||||
{
|
||||
chart.OnLegendButtonClick(index, legendName, show);
|
||||
if (chart.onLegendClick != null)
|
||||
chart.onLegendClick(legend, index, legendName, show);
|
||||
}
|
||||
|
||||
private void OnLegendButtonEnter(Legend legend, int index, string legendName)
|
||||
{
|
||||
chart.OnLegendButtonEnter(index, legendName);
|
||||
if (chart.onLegendEnter != null)
|
||||
chart.onLegendEnter(legend, index, legendName);
|
||||
}
|
||||
|
||||
private void OnLegendButtonExit(Legend legend, int index, string legendName)
|
||||
{
|
||||
chart.OnLegendButtonExit(index, legendName);
|
||||
if (chart.onLegendExit != null)
|
||||
chart.onLegendExit(legend, index, legendName);
|
||||
}
|
||||
|
||||
private void DrawLegend(VertexHelper vh)
|
||||
{
|
||||
if (chart.series.Count == 0) return;
|
||||
@@ -198,7 +219,7 @@ namespace XCharts.Runtime
|
||||
UGL.DrawDiamond(vh, rect.center, radius, color);
|
||||
break;
|
||||
case Legend.Type.EmptyCircle:
|
||||
var backgroundColor = chart.theme.GetBackgroundColor(chart.GetChartComponent<Background>());
|
||||
var backgroundColor = chart.GetChartBackgroundColor();
|
||||
UGL.DrawEmptyCricle(vh, rect.center, radius, 2 * chart.settings.legendIconLineWidth,
|
||||
color, color, backgroundColor, 1f);
|
||||
break;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public static Color GetContentColor(int legendIndex, Legend legend, ThemeStyle theme, bool active)
|
||||
{
|
||||
var textStyle = legend.textStyle;
|
||||
var textStyle = legend.labelStyle.textStyle;
|
||||
if (active)
|
||||
{
|
||||
if (legend.textAutoColor) return theme.GetColor(legendIndex);
|
||||
@@ -40,7 +40,7 @@ namespace XCharts.Runtime
|
||||
var pivot = new Vector2(0, 0.5f);
|
||||
var sizeDelta = new Vector2(100, 30);
|
||||
var iconSizeDelta = new Vector2(legend.itemWidth, legend.itemHeight);
|
||||
var textStyle = legend.textStyle;
|
||||
var textStyle = legend.labelStyle.textStyle;
|
||||
var contentColor = GetContentColor(legendIndex, legend, theme, active);
|
||||
|
||||
var objAnchorMin = new Vector2(0, 1);
|
||||
@@ -48,16 +48,15 @@ namespace XCharts.Runtime
|
||||
var objPivot = new Vector2(0, 1);
|
||||
var btnObj = ChartHelper.AddObject(objName, parent, objAnchorMin, objAnchorMax, objPivot, sizeDelta, i);
|
||||
var iconObj = ChartHelper.AddObject("icon", btnObj.transform, anchorMin, anchorMax, pivot, iconSizeDelta);
|
||||
var contentObj = ChartHelper.AddObject("content", btnObj.transform, anchorMin, anchorMax, pivot, sizeDelta);
|
||||
var img = ChartHelper.GetOrAddComponent<Image>(btnObj);
|
||||
img.color = Color.clear;
|
||||
ChartHelper.GetOrAddComponent<Button>(btnObj);
|
||||
ChartHelper.GetOrAddComponent<Image>(iconObj);
|
||||
ChartHelper.GetOrAddComponent<Image>(contentObj);
|
||||
var txt = ChartHelper.AddTextObject("Text", contentObj.transform, anchorMin, anchorMax, pivot, sizeDelta,
|
||||
textStyle, theme.legend);
|
||||
txt.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleLeft));
|
||||
txt.SetColor(contentColor);
|
||||
|
||||
var label = ChartHelper.AddChartLabel("content", btnObj.transform, legend.labelStyle, theme.legend,
|
||||
content, contentColor, TextAnchor.MiddleLeft);
|
||||
label.SetActive(true);
|
||||
|
||||
var item = new LegendItem();
|
||||
item.index = i;
|
||||
item.name = objName;
|
||||
@@ -66,9 +65,8 @@ namespace XCharts.Runtime
|
||||
item.SetIconSize(legend.itemWidth, legend.itemHeight);
|
||||
item.SetIconColor(itemColor);
|
||||
item.SetIconImage(legend.GetIcon(i));
|
||||
item.SetContentPosition(textStyle.offsetv3);
|
||||
item.SetContentPosition(legend.labelStyle.offset);
|
||||
item.SetContent(content);
|
||||
item.SetContentBackgroundColor(textStyle.backgroundColor);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace XCharts.Runtime
|
||||
internal sealed class MarkAreaHandler : MainComponentHandler<MarkArea>
|
||||
{
|
||||
private GameObject m_MarkLineLabelRoot;
|
||||
private bool m_LabelShow;
|
||||
private bool m_NeedUpdateLabelPosition;
|
||||
|
||||
public override void InitComponent()
|
||||
@@ -41,23 +40,16 @@ namespace XCharts.Runtime
|
||||
|
||||
private void InitMarkArea(MarkArea markArea)
|
||||
{
|
||||
m_LabelShow = markArea.label.show && !string.IsNullOrEmpty(component.text);
|
||||
markArea.painter = chart.m_PainterTop;
|
||||
markArea.refreshComponent = delegate ()
|
||||
{
|
||||
var label = markArea.label;
|
||||
var color = !ChartHelper.IsClearColor(label.textStyle.color) ? label.textStyle.color : chart.theme.axis.textColor;
|
||||
var element = ChartHelper.AddSerieLabel("label", m_MarkLineLabelRoot.transform, label.backgroundWidth,
|
||||
label.backgroundHeight, color, label.textStyle, chart.theme);
|
||||
var isAutoSize = label.backgroundWidth == 0 || label.backgroundHeight == 0;
|
||||
var item = ChartHelper.GetOrAddComponent<ChartLabel>(element);
|
||||
var label = ChartHelper.AddChartLabel("label", m_MarkLineLabelRoot.transform, markArea.label, chart.theme.axis,
|
||||
component.text, Color.clear, TextAnchor.MiddleCenter);
|
||||
UpdateRuntimeData(component);
|
||||
item.SetLabel(element, isAutoSize, label.paddingLeftRight, label.paddingTopBottom);
|
||||
item.SetIconActive(false);
|
||||
item.SetActive(m_LabelShow);
|
||||
item.SetPosition(component.runtimeLabelPosition);
|
||||
item.SetText(component.text);
|
||||
markArea.runtimeLabel = item;
|
||||
label.SetActive(markArea.label.show);
|
||||
label.SetPosition(component.runtimeLabelPosition);
|
||||
label.SetText(component.text);
|
||||
markArea.runtimeLabel = label;
|
||||
};
|
||||
markArea.refreshComponent();
|
||||
}
|
||||
@@ -70,7 +62,7 @@ namespace XCharts.Runtime
|
||||
|
||||
UpdateRuntimeData(markArea);
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.serieName);
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
var serieColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, false);
|
||||
var areaColor = markArea.itemStyle.GetColor(serieColor);
|
||||
UGL.DrawRectangle(vh, markArea.runtimeRect, areaColor, areaColor);
|
||||
@@ -96,7 +88,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void UpdateLabelPosition(MarkArea markArea)
|
||||
{
|
||||
if (!m_LabelShow) return;
|
||||
if (!markArea.label.show) return;
|
||||
m_NeedUpdateLabelPosition = true;
|
||||
var rect = markArea.runtimeRect;
|
||||
switch (markArea.label.position)
|
||||
@@ -120,7 +112,7 @@ namespace XCharts.Runtime
|
||||
markArea.runtimeLabelPosition = rect.center + new Vector2(0, rect.height / 2);
|
||||
break;
|
||||
}
|
||||
markArea.runtimeLabelPosition += markArea.label.offset + markArea.label.textStyle.offsetv3;
|
||||
markArea.runtimeLabelPosition += markArea.label.offset;
|
||||
}
|
||||
|
||||
private Vector3 GetPosition(MarkAreaData data, Serie serie, DataZoom dataZoom, XAxis xAxis, YAxis yAxis,
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace XCharts.Runtime
|
||||
var serie = chart.GetSerie(markLine.serieIndex);
|
||||
if (!serie.show || !markLine.show) return;
|
||||
ResetTempMarkLineGroupData(markLine);
|
||||
var serieColor = (Color)chart.theme.GetColor(chart.GetLegendRealShowNameIndex(serie.serieName));
|
||||
var serieColor = (Color) chart.GetItemColor(serie);
|
||||
if (m_TempGroupData.Count > 0)
|
||||
{
|
||||
foreach (var kv in m_TempGroupData)
|
||||
@@ -72,19 +72,16 @@ namespace XCharts.Runtime
|
||||
data.painter = chart.m_PainterTop;
|
||||
data.refreshComponent = delegate ()
|
||||
{
|
||||
var label = data.label;
|
||||
var textName = string.Format("markLine_{0}_{1}", serie.index, data.index);
|
||||
var color = !ChartHelper.IsClearColor(label.textStyle.color) ? label.textStyle.color : chart.theme.axis.textColor;
|
||||
var element = ChartHelper.AddSerieLabel(textName, m_MarkLineLabelRoot.transform, label.backgroundWidth,
|
||||
label.backgroundHeight, color, label.textStyle, chart.theme);
|
||||
var isAutoSize = label.backgroundWidth == 0 || label.backgroundHeight == 0;
|
||||
var item = ChartHelper.GetOrAddComponent<ChartLabel>(element);
|
||||
item.SetLabel(element, isAutoSize, label.paddingLeftRight, label.paddingTopBottom);
|
||||
item.SetIconActive(false);
|
||||
item.SetActive(data.label.show);
|
||||
item.SetPosition(MarkLineHelper.GetLabelPosition(data));
|
||||
item.SetText(MarkLineHelper.GetFormatterContent(serie, data));
|
||||
data.runtimeLabel = item;
|
||||
var content = MarkLineHelper.GetFormatterContent(serie, data);
|
||||
var label = ChartHelper.AddChartLabel(textName, m_MarkLineLabelRoot.transform, data.label, chart.theme.axis,
|
||||
content, Color.clear, TextAnchor.MiddleCenter);
|
||||
label.SetActive(data.label.show);
|
||||
|
||||
label.SetIconActive(false);
|
||||
label.SetActive(data.label.show);
|
||||
label.SetPosition(MarkLineHelper.GetLabelPosition(data));
|
||||
data.runtimeLabel = label;
|
||||
};
|
||||
data.refreshComponent();
|
||||
}
|
||||
@@ -245,11 +242,10 @@ namespace XCharts.Runtime
|
||||
private void DrawMarkLineSymbol(VertexHelper vh, SymbolStyle symbol, Serie serie, GridCoord grid, ThemeStyle theme,
|
||||
Vector3 pos, Vector3 startPos, Color32 lineColor)
|
||||
{
|
||||
var symbolSize = symbol.GetSize(null, theme.serie.lineSymbolSize);
|
||||
var tickness = SerieHelper.GetSymbolBorder(serie, null, theme, false);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, null, theme, false);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, null, false);
|
||||
chart.DrawClipSymbol(vh, symbol.type, symbolSize, tickness, pos, lineColor, lineColor,
|
||||
chart.DrawClipSymbol(vh, symbol.type, symbol.size, tickness, pos, lineColor, lineColor,
|
||||
ColorUtil.clearColor32, borderColor, symbol.gap, true, cornerRadius, grid, startPos);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace XCharts.Runtime
|
||||
var numericFormatter = serieLabel.numericFormatter;
|
||||
if (serieLabel.formatterFunction != null)
|
||||
{
|
||||
return serieLabel.formatterFunction(data.index, data.runtimeValue);
|
||||
return serieLabel.formatterFunction(data.index, data.runtimeValue, null);
|
||||
}
|
||||
if (string.IsNullOrEmpty(serieLabel.formatter))
|
||||
return ChartCached.NumberToStr(data.runtimeValue, numericFormatter);
|
||||
@@ -29,8 +29,8 @@ namespace XCharts.Runtime
|
||||
if (!data.label.show) return Vector3.zero;
|
||||
var dir = (data.runtimeEndPosition - data.runtimeStartPosition).normalized;
|
||||
var horizontal = Mathf.Abs(Vector3.Dot(dir, Vector3.right)) == 1;
|
||||
var labelWidth = data.runtimeLabel == null ? 50 : data.runtimeLabel.GetLabelWidth();
|
||||
var labelHeight = data.runtimeLabel == null ? 20 : data.runtimeLabel.GetLabelHeight();
|
||||
var labelWidth = data.runtimeLabel == null ? 50 : data.runtimeLabel.GetTextWidth();
|
||||
var labelHeight = data.runtimeLabel == null ? 20 : data.runtimeLabel.GetTextHeight();
|
||||
switch (data.label.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
|
||||
@@ -431,13 +431,13 @@ namespace XCharts.Runtime
|
||||
if (string.IsNullOrEmpty(indicatorName))
|
||||
return indicatorName;
|
||||
|
||||
if (string.IsNullOrEmpty(m_AxisName.formatter))
|
||||
if (string.IsNullOrEmpty(m_AxisName.labelStyle.formatter))
|
||||
{
|
||||
return indicatorName;
|
||||
}
|
||||
else
|
||||
{
|
||||
var content = m_AxisName.formatter;
|
||||
var content = m_AxisName.labelStyle.formatter;
|
||||
FormatterHelper.ReplaceAxisLabelContent(ref content, indicatorName);
|
||||
return content;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user