mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-06-11 04:53:45 +00:00
Compare commits
344 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad3a8f9ad8 | ||
|
|
8c1dc44e1e | ||
|
|
25a06afb50 | ||
|
|
df4223421f | ||
|
|
f9b1eadd40 | ||
|
|
c61ad794a7 | ||
|
|
3b6ce91c65 | ||
|
|
c2a19ee47b | ||
|
|
768cf8d404 | ||
|
|
9a98d6a5df | ||
|
|
e40e19c197 | ||
|
|
59cd12d0eb | ||
|
|
e7978cbc30 | ||
|
|
10a36e0295 | ||
|
|
5853376a44 | ||
|
|
1bb9b455b4 | ||
|
|
de4f650e4f | ||
|
|
feb5e7fc32 | ||
|
|
378fccf8b4 | ||
|
|
9e1dd027e9 | ||
|
|
71ecebb466 | ||
|
|
4903ac53f0 | ||
|
|
35e8f3e902 | ||
|
|
d5fbd33534 | ||
|
|
c458846990 | ||
|
|
e3098e6e16 | ||
|
|
b22288eac4 | ||
|
|
99d824e3a0 | ||
|
|
6d41daa678 | ||
|
|
cdac6acd8c | ||
|
|
94d1398bd3 | ||
|
|
e2c7779493 | ||
|
|
9e95b8daa7 | ||
|
|
6d16a9c16a | ||
|
|
3b7e8184b0 | ||
|
|
33b7e5c1a4 | ||
|
|
24270e5c69 | ||
|
|
e3fb5685bf | ||
|
|
89e7a09e64 | ||
|
|
ee5efa9f8d | ||
|
|
2fe9a40f42 | ||
|
|
ddbd82bebf | ||
|
|
549ee43a37 | ||
|
|
3b9af0f8ec | ||
|
|
caee79630b | ||
|
|
a12c98b1a5 | ||
|
|
8617475808 | ||
|
|
922901380e | ||
|
|
96cb7ffc74 | ||
|
|
74cf4fe4ce | ||
|
|
eb948f03d5 | ||
|
|
6a6ab72ed8 | ||
|
|
df66f5c7ee | ||
|
|
042f9d3c01 | ||
|
|
1e6140a138 | ||
|
|
86125c597e | ||
|
|
fc346d30fb | ||
|
|
3e8bf7caee | ||
|
|
4e3182edfc | ||
|
|
b86cae6717 | ||
|
|
0c92d08f0d | ||
|
|
b1522a27d4 | ||
|
|
120c6d5408 | ||
|
|
e2120b3da6 | ||
|
|
58e6108bb2 | ||
|
|
3ef2e7c23c | ||
|
|
a361e191da | ||
|
|
f5a41b5119 | ||
|
|
42079848dc | ||
|
|
4b8374b1ae | ||
|
|
0990b11c1c | ||
|
|
99b1624b54 | ||
|
|
113c3887ae | ||
|
|
9f5040435f | ||
|
|
f21e9c6a32 | ||
|
|
a071956675 | ||
|
|
eab4f9530b | ||
|
|
ce8b03b692 | ||
|
|
2505a48ac2 | ||
|
|
74e75e93af | ||
|
|
4f8390b515 | ||
|
|
d91ebeee3a | ||
|
|
b9c5623687 | ||
|
|
34b4096482 | ||
|
|
bc75865a5e | ||
|
|
c987cb1ef7 | ||
|
|
d93f7830de | ||
|
|
61a2da10ba | ||
|
|
9e39150009 | ||
|
|
653b81cc48 | ||
|
|
e68e41a939 | ||
|
|
d0448a5b11 | ||
|
|
daec83c4a5 | ||
|
|
6aa11249c5 | ||
|
|
9a56985b3a | ||
|
|
fff04347fa | ||
|
|
5a5ad1e108 | ||
|
|
3c233d1cb1 | ||
|
|
c44583772c | ||
|
|
29e9593179 | ||
|
|
318bdcb1f2 | ||
|
|
c3489fbc1e | ||
|
|
91db00a173 | ||
|
|
a3533dbc02 | ||
|
|
f1c504e81a | ||
|
|
178215d980 | ||
|
|
cbd527316e | ||
|
|
3580df9117 | ||
|
|
11bdbba286 | ||
|
|
4ed22190d6 | ||
|
|
06ef86a9d6 | ||
|
|
3d73578063 | ||
|
|
07caa54631 | ||
|
|
023eeb9ea8 | ||
|
|
2431a001b1 | ||
|
|
e83eeabf9c | ||
|
|
9c5b83dc22 | ||
|
|
9d2b14afef | ||
|
|
63173cdce6 | ||
|
|
922a944881 | ||
|
|
53c7ddf9d4 | ||
|
|
a50bda5344 | ||
|
|
e8c8ab87aa | ||
|
|
1c6904f074 | ||
|
|
225fc69e70 | ||
|
|
546077459f | ||
|
|
bdc6c3b289 | ||
|
|
bbf1dc862c | ||
|
|
c841ac4a93 | ||
|
|
bece2eb564 | ||
|
|
735e36d6e5 | ||
|
|
0a19b2a6cc | ||
|
|
7ea260b986 | ||
|
|
cdc182191b | ||
|
|
45be0748aa | ||
|
|
1f970cbb36 | ||
|
|
4aee1b0a92 | ||
|
|
079d1030ae | ||
|
|
ddf44a8c1d | ||
|
|
f94f678661 | ||
|
|
9816c34701 | ||
|
|
b959b15c71 | ||
|
|
c9ac0daed9 | ||
|
|
65684f2952 | ||
|
|
509bd97741 | ||
|
|
83db4dd951 | ||
|
|
a730404935 | ||
|
|
f51e5f1859 | ||
|
|
e8204fc41e | ||
|
|
304726debf | ||
|
|
d8ecb94dd9 | ||
|
|
573f9efcaf | ||
|
|
985f70c3c9 | ||
|
|
68d5bc36d6 | ||
|
|
6b931497ab | ||
|
|
4bbedc8ef6 | ||
|
|
7f2de53af9 | ||
|
|
48a4fb470a | ||
|
|
c67d3a3a80 | ||
|
|
6a5026e907 | ||
|
|
38716facba | ||
|
|
86f0ae5739 | ||
|
|
fea5ab34c0 | ||
|
|
789ab008f6 | ||
|
|
7f525ebaf0 | ||
|
|
4fd7650726 | ||
|
|
66c01d55b9 | ||
|
|
54bb49dfa7 | ||
|
|
c065245e00 | ||
|
|
51697a54f4 | ||
|
|
00123e0f94 | ||
|
|
8c840404e0 | ||
|
|
c5d7e5369d | ||
|
|
8750bbc22a | ||
|
|
680b9d5c20 | ||
|
|
23dee8bd44 | ||
|
|
6c1b402d2d | ||
|
|
c6e78f9cb9 | ||
|
|
7402925512 | ||
|
|
5d5f32b55e | ||
|
|
c8cb47da63 | ||
|
|
66d666192a | ||
|
|
2a815e54db | ||
|
|
367844a86c | ||
|
|
910b9194ac | ||
|
|
eb196a237f | ||
|
|
71038a9f88 | ||
|
|
a6ba17ee00 | ||
|
|
9deb120446 | ||
|
|
8df1dbe0fb | ||
|
|
e4fbe5670f | ||
|
|
e0f6b8c2dc | ||
|
|
32b2137b87 | ||
|
|
dc46477c15 | ||
|
|
d6f1c82a08 | ||
|
|
267cb7472c | ||
|
|
6d04cac38b | ||
|
|
0331804a85 | ||
|
|
11eccbc39b | ||
|
|
80d596a721 | ||
|
|
637fde799e | ||
|
|
9a198b35b1 | ||
|
|
3476c56eb6 | ||
|
|
d9e1c1211c | ||
|
|
9fab42a9e7 | ||
|
|
d69327e301 | ||
|
|
2566641b5f | ||
|
|
fea083035f | ||
|
|
938ae62905 | ||
|
|
8eec52939c | ||
|
|
151a2ed01f | ||
|
|
3aa6daf97c | ||
|
|
c3c6eb5719 | ||
|
|
4fde95eab7 | ||
|
|
3d4360a10a | ||
|
|
64187fea3f | ||
|
|
0c187b6ff9 | ||
|
|
71c8bc1499 | ||
|
|
d0d5c2a101 | ||
|
|
95dddd9448 | ||
|
|
9ed80d3b59 | ||
|
|
01a49de373 | ||
|
|
2e2ad0a1f2 | ||
|
|
5356e2304c | ||
|
|
0d1d2460a0 | ||
|
|
f88ac6b4c4 | ||
|
|
9d3d8543a5 | ||
|
|
ea819bfa42 | ||
|
|
618fe0fb01 | ||
|
|
43ba7d47c5 | ||
|
|
e3e01587ab | ||
|
|
f36ca34055 | ||
|
|
0ffc6d7efe | ||
|
|
ec89828c67 | ||
|
|
18c0d3218d | ||
|
|
f867ac7efd | ||
|
|
fc7655fd76 | ||
|
|
0c09d40654 | ||
|
|
758d578ad2 | ||
|
|
318b4146a9 | ||
|
|
ea4dac65e1 | ||
|
|
b27f0ec6ec | ||
|
|
f5e8ba4082 | ||
|
|
816e26f517 | ||
|
|
58d6d52747 | ||
|
|
ccd71710ce | ||
|
|
e103c87d10 | ||
|
|
e515908f9b | ||
|
|
eca0c6ea46 | ||
|
|
1229c1bfa2 | ||
|
|
f678477c88 | ||
|
|
0adc9e71e5 | ||
|
|
bc1596f8d3 | ||
|
|
4a754c0021 | ||
|
|
2c382fda00 | ||
|
|
45159b186f | ||
|
|
00274567cf | ||
|
|
42c2c91f03 | ||
|
|
9c26716e7c | ||
|
|
c8a5560a67 | ||
|
|
ad707ec14d | ||
|
|
b6c0962ff3 | ||
|
|
86e66984d4 | ||
|
|
04d646ed8c | ||
|
|
0f83a70b54 | ||
|
|
6b6bf9d9da | ||
|
|
4c1432a535 | ||
|
|
bab788d4cb | ||
|
|
fab683f5e1 | ||
|
|
29c9f59762 | ||
|
|
c29a22c576 | ||
|
|
5568c2fd76 | ||
|
|
5c231514a5 | ||
|
|
93abffaaaa | ||
|
|
a9c801c077 | ||
|
|
2d35f77740 | ||
|
|
529c784ee2 | ||
|
|
fdd686b038 | ||
|
|
36d629b29a | ||
|
|
59335786df | ||
|
|
0af76517e1 | ||
|
|
674d937104 | ||
|
|
a038317c6e | ||
|
|
5fe12dcde7 | ||
|
|
f00eb2147d | ||
|
|
76238d7d7e | ||
|
|
c53be4b5f9 | ||
|
|
8b320e9bc9 | ||
|
|
5757049e74 | ||
|
|
d196551756 | ||
|
|
d7223f6790 | ||
|
|
a50b58d48e | ||
|
|
a0db57bdf2 | ||
|
|
3dfa5487ee | ||
|
|
bddbe600ce | ||
|
|
3073926d73 | ||
|
|
49e9066334 | ||
|
|
372ed1de58 | ||
|
|
dbb867e0ab | ||
|
|
adbd88c411 | ||
|
|
99b3d24366 | ||
|
|
6f69af3945 | ||
|
|
c6e38f2003 | ||
|
|
e0f4ed946d | ||
|
|
465af108aa | ||
|
|
bf152a3a71 | ||
|
|
64c9b97eb9 | ||
|
|
c42ca0f097 | ||
|
|
8c6d013341 | ||
|
|
398fee2d97 | ||
|
|
33246c2a1f | ||
|
|
b102fed9fe | ||
|
|
9c069296ed | ||
|
|
9f94541b9e | ||
|
|
7a367d24ab | ||
|
|
4964bca341 | ||
|
|
22b167981b | ||
|
|
80d9087084 | ||
|
|
d6630ef5bf | ||
|
|
5e3bc3ff15 | ||
|
|
3d09d82abd | ||
|
|
22715dab95 | ||
|
|
ace8537650 | ||
|
|
d7c6bf59ef | ||
|
|
c9cd4ee38a | ||
|
|
633456ada0 | ||
|
|
7fbaf7af70 | ||
|
|
e90d7d61d9 | ||
|
|
bda6fc7978 | ||
|
|
8288e75445 | ||
|
|
6ace71f8db | ||
|
|
a4aabb5bbe | ||
|
|
d90a0d69b2 | ||
|
|
c17d83ae6d | ||
|
|
317ffc4d99 | ||
|
|
bc6c387db3 | ||
|
|
d9053db2e3 | ||
|
|
d7cfda2521 | ||
|
|
a5aa630b74 | ||
|
|
ce1691e1ce | ||
|
|
a3a25fe7c6 | ||
|
|
d4a3886530 | ||
|
|
927644fb10 | ||
|
|
d67a922a74 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -10,4 +10,4 @@ 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.me/monitor1394','https://github.com/XCharts-Team/XCharts/blob/master/Documentation~/img/support_alipay.png','https://github.com/XCharts-Team/XCharts/blob/master/Documentation~/img/support_wechat.png']
|
||||
custom: ['https://github.com/XCharts-Team/XCharts/blob/master/Documentation~/zh/img/support_alipay.png','https://github.com/XCharts-Team/XCharts/blob/master/Documentation~/zh/img/support_wechat.png']
|
||||
|
||||
10263
Documentation~/en/api.md
10263
Documentation~/en/api.md
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,18 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.12.0](#v3120)
|
||||
[v3.11.2](#v3112)
|
||||
[v3.11.1](#v3111)
|
||||
[v3.11.0](#v3110)
|
||||
[v3.10.2](#v3102)
|
||||
[v3.10.1](#v3101)
|
||||
[v3.10.0](#v3100)
|
||||
[v3.9.0](#v390)
|
||||
[v3.8.1](#v381)
|
||||
[v3.8.0](#v380)
|
||||
[v3.7.0](#v370)
|
||||
[v3.6.0](#v360)
|
||||
[v3.5.0](#v350)
|
||||
[v3.4.0](#v340)
|
||||
[v3.3.0](#v330)
|
||||
@@ -60,6 +72,307 @@
|
||||
|
||||
## master
|
||||
|
||||
## v3.12.0
|
||||
|
||||
Version Highlights:
|
||||
|
||||
* Added `radiusGradient` parameter for `Ring` to set the gradient direction
|
||||
* Added support for `date` and `time` in `numericFormatter`
|
||||
* Improved `origin` parameter setting for `AreaStyle` to define the starting position of area filling
|
||||
* Adjusted and perfected the documentation
|
||||
* Other optimizations and fixes
|
||||
|
||||
Log Details:
|
||||
|
||||
* (2024.09.30) Released version `v3.12.0`
|
||||
* (2024.09.27) Improved the `5-minute tutorial`
|
||||
* (2024.09.24) Improved support for multiple Series in `Legend`'s `formatter` (#332)
|
||||
* (2024.09.22) Adjusted the display style of the `Documentation`
|
||||
* (2024.09.09) Added support for `date` and `time` in `numericFormatter`
|
||||
* (2024.09.03) Improved the setting of the `origin` parameter for `AreaStyle` to define the starting position of area filling
|
||||
* (2024.09.01) Added `radiusGradient` parameter for `Ring` to set the gradient direction
|
||||
* (2024.09.01) Optimized the position of the first Label when `Axis` is used as a time axis
|
||||
|
||||
|
||||
## v3.11.2
|
||||
|
||||
* (2024.08.01) Release `v3.11.2`
|
||||
* (2024.07.29) Fixed compatibility issue with `Tooltip` reporting error on wechat mini game platform (#326)
|
||||
* (2024.07.27) Adjust the default position of `AxisName` for `Axis`
|
||||
* (2024.07.22) Improved the behavior of `Pie`'s `Label` when `Tooltip` is triggered
|
||||
* (2024.07.21) Fix to `Tooltip` indicating inaccurate content when opening `DataZoom`
|
||||
* (2024.07.17) Fixed an issue where `Label` of `MarkLine` could flash during initialization
|
||||
* (2024.07.16) Optimized the default effect of `Tooltip` when `Axis` is `Time` timeline
|
||||
* (2024.07.15) Optimized segmentation when Axis is Time
|
||||
* (2024.07.14) Improved movement performance when `Axis` is `Time`
|
||||
* (2024.07.12) Optimized the initial display effect of `Label`
|
||||
* (2024.07.06) Fix to `Chart` background not adaptive when dynamically created (#323)
|
||||
|
||||
## v3.11.1
|
||||
|
||||
* (2024.07.01) Release `v3.11.1`
|
||||
* (2024.07.01) Fixed an issue where `Serie` has multiple abnormal colors
|
||||
* (2024.06.23) Fixed an issue where `labels` would pile up during initialization
|
||||
|
||||
## v3.11.0
|
||||
|
||||
Release Highlights:
|
||||
|
||||
* Added `Line3DChart` for 3D line charts
|
||||
* Added `GraphChart` for relationship graphs
|
||||
* Added support for 3D coordinate systems
|
||||
* Added `triggerOn` setting for `Tooltip` to define trigger conditions
|
||||
* Various bug fixes and optimizations
|
||||
|
||||
Changelog Details:
|
||||
|
||||
* (2024.06.16) Released version `v3.11.0`
|
||||
* (2024.06.15) Added buttons for adding, deleting, and moving data up and down under `Editor`
|
||||
* (2024.06.11) Fixed issue where `Axis`'s `IndicatorLabel` might overlap with `Tooltip`
|
||||
* (2024.06.11) Fixed issue where `Tooltip`'s `Axis` `IndicatorLabel` might not display when in `Cross` mode (#315)
|
||||
* (2024.06.10) Renamed `Tooltip`'s `Corss` to `Cross`
|
||||
* (2024.06.09) Added `minCategorySpacing` setting for `Axis` to define the default minimum category spacing
|
||||
* (2024.06.09) Fixed inaccurate indicator position of `Tooltip`'s `Cross` when `Axis` is a category axis and `DataZoom` is enabled
|
||||
* (2024.06.06) Fixed animation issue when `Serie` is cloned (#320)
|
||||
* (2024.06.04) Fixed issue where `Serie`'s `state` does not refresh when set dynamically via code
|
||||
* (2024.05.29) Adjusted the right-click menu of `XCharts` in the `Hierarchy` view to `UI/XCharts`
|
||||
* (2024.05.29) Added support for 3D coordinate systems to category axes
|
||||
* (2024.05.19) Optimized editing performance in `Editor`
|
||||
* (2024.05.09) Added utility class `JsonUtil`
|
||||
* (2024.05.01) Fixed the issue where `Tooltip` caused garbage collection (GC) on every frame (#311) (by @stefanbursuc)
|
||||
* (2024.04.23) Fixed chart exception issue after multiple calls to `ConvertXYAxis()`
|
||||
* (2024.04.22) Fixed potential incorrect retrieval of `GridCoord` when `DataZoom` controls multiple axes (#317)
|
||||
* (2024.04.22) Added 3D coordinate system
|
||||
* (2024.04.15) Optimized `DateTimeUtil` for timezone issues when converting timestamps to `DateTime`
|
||||
* (2024.04.15) Optimized `GridCoord` to display `Left` `Right` `Top` `Bottom` parameters even when `GridLayout` is enabled (#316)
|
||||
* (2024.04.14) Fixed incorrect label position of `Tooltip`'s `Cross` when `DataZoom` is enabled (#315)
|
||||
* (2024.04.12) Fixed incorrect effect of `Candlesticks` (#313)
|
||||
* (2024.03.20) Added `triggerOn` setting for `Tooltip` to define trigger conditions
|
||||
* (2024.03.19) Fixed color issue when setting `opacity` in `Pie`'s `ItemStyle` (#309)
|
||||
|
||||
## v3.10.2
|
||||
|
||||
* (2024.03.11) Release `v3.10.2`
|
||||
* (2024.03.11) Fix to `Legend`'s `formatter` showing possible mismatches when setting {d} (#304)
|
||||
* (2024.03.11) Fix to `Tooltip` still showing after moving out of coordinate system
|
||||
* (2024.03.08) Fixed an issue where `Tooltip`'s title might not appear after upgrading from an older version
|
||||
|
||||
## v3.10.1
|
||||
|
||||
* (2024.02.21) Release `v3.10.1`
|
||||
* (2024.02.19) Fix to `Tooltip` dot markers not adapting to color
|
||||
|
||||
## v3.10.0
|
||||
|
||||
Highlights:
|
||||
|
||||
* Added bi-category axis support
|
||||
* Added more segmentation shortcut menu to create charts, which can create dozens of charts with one click
|
||||
* Added chart border Settings to support rounded corner charts
|
||||
* Fixed several issues
|
||||
|
||||
Extended features:
|
||||
|
||||
* Added `SankeyChart` Sankey chart
|
||||
* Added `border` Settings for `UITable`
|
||||
|
||||
Log details:
|
||||
|
||||
* (2024.02.01) Release `v3.10.0`
|
||||
* (2024.01.31) Fix to Tooltip not displaying after itemFormatter is set to -
|
||||
* (2024.01.27) Fix to TextLimit not working after TextMeshPro is enabled (#301)
|
||||
* (2024.01.24) Added `Bar` to support both X and Y axes as` Category `axes
|
||||
* (2024.01.23) Added `{y}` wildcard to get the class name of the Y-axis
|
||||
* (2024.01.23) Added `Line` to support both X and Y axes as` Category `axes
|
||||
* (2024.01.18) Fixed dynamic modification of `Animation`s `type` code
|
||||
* (2024.01.13) Added more quick Chart creation menus for Chart
|
||||
* (2024.01.09) added `borderStyle` to `Background` to give the chart rounded corners by default
|
||||
* (2024.01.07) Fix to invalid first ContentLabelStyle setting color for Tooltop
|
||||
* (2024.01.01) Added `BorderStyle` border style
|
||||
* (2023.12.26) Added support for Heatmap's maxCache parameter
|
||||
* (2023.12.25) Optimizes the number of vertices drawn when `Line`` opens clip
|
||||
* (2023.12.22) Fixed an issue where some border data of `Scatter` map was not displayed
|
||||
* (2023.12.21) Fix to `TriggerTooltip()` interface may not fire when 0 or maximum index is specified
|
||||
* (2023.12.19) Fixed an issue where `Legend`'s `LabelStyle` does not take effect after setting its formatter
|
||||
* (2023.12.12) Added TextLimit for Legend to limit the length of the text displayed in the legend
|
||||
* (2023.12.11) Fix to coordinate drawing failure when `Serie` was added with `double-maxvalue`
|
||||
* (2023.12.10) Add `Serie` to `minShowLabel` to hide `labels` that are less than the specified value
|
||||
* (2023.12.09) Add depth to `LevelStyle` to specify the level to which it belongs
|
||||
* (2023.12.09) Added `LevelStyle` `LineStyle` to set line styles
|
||||
* (2023.12.09) Adding `Serie` to `Link` can be used to add node-edge relationships to Sankey diagrams
|
||||
* (2023.12.05) added `ResetChartStatus()` to actively reset chart status
|
||||
|
||||
## v3.9.0
|
||||
|
||||
Highlights:
|
||||
|
||||
* Added `Animation` in `Axis` to improve the animation effect of data changes
|
||||
* Added `minorTick` for `Log` type of `Axis`
|
||||
* Added MarkLine's `onTop` setting to displayed at the top level
|
||||
* Perfect code comments and documentation
|
||||
* Fixed several issues
|
||||
|
||||
Extended features:
|
||||
|
||||
* `UITable` adds the carousel function
|
||||
* `UITable` adds data api and callback functions
|
||||
* `Pie3DChart` optimizes rendering performance
|
||||
|
||||
Log details:
|
||||
|
||||
* (2023.12.01) Release `v3.9.0`
|
||||
* (2023.12.01) Fixed inaccurate display of Tooltip's `titleFormatter` set to `{b}`
|
||||
* (2023.11.30) Added support for `SerieData` to add `Label` separately
|
||||
* (2023.11.28) Fix to `Tooltip` incorrectly indicating the number line
|
||||
* (2023.11.24) fixed inaccurate return values in Chart's `UpdateData()` interface
|
||||
* (2023.11.24) Fix to `Axis` not working smoothly when updating data
|
||||
* (2023.11.23) Added Animation support for Axis
|
||||
* (2023.11.16) Cancel `Legend`'s `formatter` and replace it with `LabelStyle`
|
||||
* (2023.11.14) Improved annotation and documentation for LabelStyle's formatter (#291)
|
||||
* (2023.11.11) Fix to comments Documentation for some comments in `Documentation` (#290)
|
||||
* (2023.11.11) fixed an issue where Legend's formatter didn't refresh automatically when data was changed
|
||||
* (2023.11.05) Fix to SerieEventData's value always being 0 (#287)
|
||||
* (2023.11.03) Fix to abnormal mouse movement when setting `Bar` gradient (#285)
|
||||
* (2023.11.02) Optimizes ignoring of formatter when SerieData is set to ignore
|
||||
* (2023.11.01) Added whether MarkLine's `onTop` setting is displayed at the top level
|
||||
* (2023.10.21) Fix to `Label` location exception when `Pie` has 0 data
|
||||
* (2023.10.21) Added subscale support for `Axis`
|
||||
* (2023.10.19) Fixed abnormal lead line when `Pie` set rose chart
|
||||
* (2023.10.15) Fixed Animation exception when `Line` was set to `AlongPath` (#281)
|
||||
* (2023.10.12) Fixed invalid value axis when `MarkLine` specified `yValue`
|
||||
* (2023.10.11) Fixed invalid setting of `Serie` `showDataDimension`
|
||||
|
||||
## v3.8.1
|
||||
|
||||
* (2023.10.02) Release `v3.8.1` version
|
||||
* (2023.09.29) Fixed issue where `Bar` is set to `Bottom` when horizontal does not take effect
|
||||
* (2023.09.22) Added support for dashed lines in `Line`'s smooth curves
|
||||
* (2023.09.16) Fix to `Tooltip` reporting an exception when there is no data in the category axis (#279)
|
||||
* (2023.09.16) Fix to `Pie` drawing exception with no data (#278)
|
||||
* (2023.09.12) Added `Pie` `radiusGradient` to set the gradient effect in the radius direction
|
||||
* (2023.09.05) Improved the performance of LabelLine`s lineEndX in Pie
|
||||
* (2023.09.05) Fixed `TriggerTooltip()` interface not working for `Ring`
|
||||
* (2023.09.05) Fixed drawing error when `Radar` data is all zeros
|
||||
|
||||
## v3.8.0
|
||||
|
||||
Highlights:
|
||||
|
||||
* Refactoring `Animation` animation system, adding support for `New Animation` and `Interactive animation`
|
||||
* Improved `PieChart` animation interactive representation
|
||||
* Added four new markers for `Symbol` : `EmptyTriangle`, `EmptyDiamond`, `Plus` and `Minus`
|
||||
* Improved `Chart` mouse interaction callback
|
||||
* Added the function of `LabelLine` to fix the horizontal coordinate
|
||||
* Added `GridLayout` grid layout component
|
||||
* Added `Auto` type for `Tooltip`
|
||||
* Optimizes and fixes several other issues
|
||||
|
||||
Log details:
|
||||
|
||||
* (2023.09.03) Release `v3.8.0`
|
||||
* (2023.09.01) Added `Tooltip` Auto to automatically set display type and trigger type
|
||||
* (2023.08.29) Added gridIndex support for `Ring` to set the specified grid
|
||||
* (2023.08.29) Added gridIndex support for Radar to set the specified grid
|
||||
* (2023.08.29) Added gridIndex support for `Pie` to set specified grids
|
||||
* (2023.08.29) Added the GridLayout component for managing multiple GridCoord layouts
|
||||
* (2023.08.25) Fixed display only one Label when there are multiple Marklines
|
||||
* (2023.08.25) Fixed MarkLine drawing outside the coordinate system after opening Clip
|
||||
* (2023.08.24) Optimizes `YAxis` to default 0-1 range when all data is 0
|
||||
* (2023.08.23) Fixed an issue where `Label` of `YAxis` could duplicate
|
||||
* (2023.08.22) Fixed `Bar` display hidden drawing performance exception
|
||||
* (2023.08.22) Improved Zebra histogram rendering performance (#276)
|
||||
* (2023.08.16) Added Daemon daemon to resolve an error after TMP is enabled locally
|
||||
* (2023.08.15) Fixed `Data` displaying axes incorrectly when data is between -1 and 1 (#273) (b y@Ambitroc)
|
||||
* (2023.08.14) Fixed `XCharts` updating error after` TextMeshPro `and` NewInputSystem `are enabled locally (#272)
|
||||
* (2023.08.12) Fixed `Chart` error when deleted at runtime (#269)
|
||||
* (2023.08.11) Fixed an issue where data could not be added when DataZoom was enabled
|
||||
* (2023.08.11) Fixed `itemFormatter` not working when `SerieData` sets ItemStyle separately
|
||||
* (2023.08.10) Improved BarChart`s performance when Tooltip`s Trigger is an Item
|
||||
* (2023.08.09) Added `Axis` to support dynamic icon colors by setting `color` of `IconStyle` to `clear`
|
||||
* (2023.08.08) Added support for `Pie` for `LabelLine`s` lineEndX `
|
||||
* (2023.08.05) Clean up the code for `Examples` and remove unnecessary use cases
|
||||
* (2023.08.04) Added support for `LabelLine`'s `lineEndX` to set the boot line to fixed X position
|
||||
* (2023.08.04) Added support for Ring`s avoidLabelOverlap to avoid text stacking (#247)
|
||||
* (2023.08.03) Improved Chart`s onSerieEnter, onSerieExit, and onSerieClick callbacks
|
||||
* (2023.08.02) Fixed invalid `onSerieEnter` and `onSerieExit` callbacks for `BarChart`
|
||||
* (2023.08.02) Added support for Symbol's `Plus` and `Minus` signs
|
||||
* (2023.07.31) Added support for Symbol's `EmptyTriangle` and `EmptyDiamond`, improved `Symbol` performance
|
||||
* (2023.07.31) Improved the default configuration effect of `Line`
|
||||
* (2023.07.27) Add `Serie` to `minRadius` to set minimum radius
|
||||
* (2023.07.26) Added `MLValue` multiple values
|
||||
* (2023.07.25) Added `XLog` log system
|
||||
* (2023.07.18) Improved the interactive animation effect of `Pie` pie chart
|
||||
* (2023.07.14) Added support for `Animation` `Interaction` interactive animation configuration
|
||||
* (2023.07.11) Added `Animation` `Addition` new animation configuration support
|
||||
* (2023.07.11) Reconstructs `Animation` animation system to improve animation experience
|
||||
* (2023.06.30) Added support for PolarCood`s indicatorLabelOffset setting indicating text offsets
|
||||
* (2023.06.30) Fixed an issue where the background color of Axis `IndicatorLabel` could be abnormal
|
||||
* (2023.06.30) Added support for Axis `IndicatorLabel` customizable `color`
|
||||
* (2023.06.12) Fixed an issue where AxisLabel's formatterFunction had the wrong value on the value axis
|
||||
|
||||
## v3.7.0
|
||||
|
||||
Highlights:
|
||||
|
||||
* Added `HelpDoc` official website help document redirection
|
||||
* Added support for `Clip` for `Line`
|
||||
* Optimize the range Settings of `Axis`
|
||||
* Other optimizations and fixes
|
||||
|
||||
Log details:
|
||||
|
||||
* (2022.06.08) Release v3.7.0
|
||||
* (2023.06.04) Added `HelpDoc` help document skip
|
||||
* (2023.05.30) Fixed Serie name with `_` line causing `Legend` to not fire (#252) (by @svr2kos2)
|
||||
* (2023.05.10) Added `MinMaxAuto` range type for `Axis`
|
||||
* (2023.05.10) Added support for `Clip` for `Line`
|
||||
* (2023.05.04) Fixed `Axis` setting` CeilRate `not taking effect in range -1 to 1
|
||||
* (2023.05.04) Optimizes MinMax type range calculations for Axis
|
||||
* (2023.05.04) Fixed AxisLabel displaying `Label` formatting incorrectly when the data is all floating point numbers less than 1
|
||||
* (2023.05.04) Fixed `Theme` being reset after modifying default theme parameters
|
||||
* (2023.05.04) Added `Warning` when `Symbol` selects `Custom` type
|
||||
* (2023.04.15) Fixed `DataZoom` may be abnormal in multiple charts (#252)
|
||||
* (2023.04.14) Fixed `Tooltip` may be abnormal when there is only one data
|
||||
* (2023.04.14) Added `BaseChart`s `TriggerTooltip()` interface to try to trigger `ToolTip`
|
||||
* (2023.04.12) Optimizes` RadarCood `setting` startAngle `with text following the adjustment position
|
||||
* (2023.04.12) Added `Radar` support for wildcard `{b}`
|
||||
* (2023.04.11) Fixed an issue where Inspector could be abnormal when dynamically adding components
|
||||
|
||||
## v3.6.0
|
||||
|
||||
* (2023.04.01) Release `v3.6.0` version
|
||||
* (2023.03.14) Fix for Tooltip's `titleFormater` setting `{b}` may not take effect
|
||||
* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by @Ambitroc)
|
||||
* (2023.03.12) Added `LabelStyle` `autoRotate` to set automatic rotation of angled vertical text
|
||||
* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by @Ambitroc)
|
||||
* (2023.03.09) Adds callbacks to Chart's `onSerieClick`, `onSerieDown`, `onSerieEnter` and `onSerieExit`
|
||||
* (2023.03.09) Fixed click-check offset for `Pie` not taking effect
|
||||
* (2023.03.04) Added Positions for Legend to customize legend positions
|
||||
* (2023.03.03) Fixed `Animation` changing animation that might not work
|
||||
* (2023.02.28) Fixed issue with Serie's Label not refreshing when `Legend` is clicked
|
||||
* (2023.02.26) Adds DataZoom's `startEndFunction` delegate
|
||||
* (2023.02.12) Refactor the Component code and adjust the API
|
||||
* (2023.02.10) Fix `Axis` with incorrect minimum in `Log` axis in some cases
|
||||
* (2023.02.10) Optimizes the default display format of Axis's value Label
|
||||
* (2023.02.08) Added startLock and endLock for DataZoom
|
||||
* (2023.02.02) Fixed bug where datazoom xaxis label could be displayed off-chart when datazoom is turned on
|
||||
* (2023.02.02) Optimizes the `ignore` setting of `SerieData` to ignore data
|
||||
* (2023.02.01) Fix `XChartsMgr.ContainsChart()` interface exception
|
||||
* (2023.01.31) Added support for `InputSystem` (#242) (by @Bian-Sh)
|
||||
* (2023.01.11) Fixed chart not refreshing after removing Component from Inspector (#241)
|
||||
* (2023.01.06) Fixed bug with `Pie` displaying abnormal Label when the last few values are 0 (#240)
|
||||
* (2023.01.03) deletes serie `MarkColor` and adds ItemStyle `MarkColor`
|
||||
* (2022.12.29) Added `+` to list editor
|
||||
* (2022.12.29) Fixed `UpdateXYData()` interface affecting data accuracy (#238)
|
||||
* (2022.12.28) Fixed abnormal display when setting `border` when `Pie` has only one data (#237)
|
||||
* (2022.12.22) Adjust `Covert` rename to `Convert`, involving interfaces such as: `ConvertXYAxis()`, `CovertSerie()`, etc
|
||||
* (2022.12.22) Fixed abnormal display of `Label` after `Convert XY Axis`
|
||||
* (2022.12.12) Fixed an issue where the `Value` Axis of `axis` calculated the value range incorrectly in some cases
|
||||
* (2022.12.12) Optimized legend's formatter to support `{h}` wildcards
|
||||
* (2022.12.12) Fixed abnormal display of Legend's formatter when set to a fixed value
|
||||
* (2022.12.08) Added `AreaStyle` `toTop` parameter to set whether the line graph gradient goes to the top or to the actual position
|
||||
* (2022.12.07) Adds text wildcard `{h}` for `Formatter` to support setting current color values
|
||||
|
||||
## v3.5.0
|
||||
|
||||
Highlights:
|
||||
@@ -88,7 +401,7 @@ Log details:
|
||||
* (2022.11.26) Fixed an exception when selecting `DataZoom` from right to left
|
||||
* (2022.11.20) Rename `UdpateXAxisIcon()` interface to `UpdateXAxisIcon()` (#235)
|
||||
* (2022.11.12) Added `Pie` `LabelLine` support `Symbol`
|
||||
* (2022.11.12) added `DataZoom` `MarqueeStyle` support box selection area
|
||||
* (2022.11.12) Added `DataZoom` `MarqueeStyle` support box selection area
|
||||
* (2022.11.10) Optimized area color fill effect for `Radar` when type is` Single `
|
||||
* (2022.11.04) Fixed exception after itemFormatter `Tooltip` set wildcard `{d}`
|
||||
|
||||
@@ -152,7 +465,7 @@ Details:
|
||||
* (2022.09.06) Added support for `SerieSymbol` `minSize` and `maxSize` parameters to set maximum and minimum sizes
|
||||
* (2022.09.06) Added support for `showStartLine` and `showEndLine` parameters for `AxisSplitLine` to set whether to display the first splitter
|
||||
* (2022.09.06) Added `Heatmap` support for different patterns via `symbol`
|
||||
* (2022.09.05) added `Heatmap` `heatmapType` support for setting `Data` and `Count` two different mapping methods of Heatmap
|
||||
* (2022.09.05) Added `Heatmap` `heatmapType` support for setting `Data` and `Count` two different mapping methods of Heatmap
|
||||
* (2022.09.05) Optimizes `Tooltip` when indicating numerical axis in thermograph
|
||||
* (2022.09.02) Added `onPointerEnterPie` callback support
|
||||
* (2022.09.02) Optimize the HeatmapChart `
|
||||
@@ -162,7 +475,7 @@ Details:
|
||||
* (2022.08.29) optimizes `YAxis` Max/min calculations when `DataZoom` is enabled
|
||||
* (2022.08.29) optimized `CandlestickChart` massive data rendering
|
||||
* (2022.08.28) fixed an issue where `LineChart` does not appear properly in the case of stacking and custom Y-axis range
|
||||
* (2022.08.26) added `Legend` new icon type `Candlestick`
|
||||
* (2022.08.26) Added `Legend` new icon type `Candlestick`
|
||||
* (2022.08.26) optimizes` CandlestickChart `performance and adjusts related` AddData() `interface parameters
|
||||
* (2022.08.26) Added support for setting different display positions in Tooltip's `position` parameter
|
||||
* (2022.08.26) Delete the `fixedXEnable` and `fixedYEnable` arguments of Tooltip
|
||||
@@ -194,7 +507,7 @@ Details:
|
||||
* (2022.08.10) Optimized font synchronization for Theme
|
||||
* (2022.08.10) optimizes the default `layer` of Chart to `UI`
|
||||
* (2022.08.09) optimizes the `Time` timeline of `Axis`
|
||||
* (2022.08.09) added AreaStyle `innerFill` parameter to support filling convex polygons
|
||||
* (2022.08.09) Added AreaStyle `innerFill` parameter to support filling convex polygons
|
||||
* (2022.08.08) Optimized the maintenance of data item indexes in `Serie`, added detection and repair functions, and fixed related problems
|
||||
* (2022.07.29) Fixed `Unity` version compatibility: Chart creation exception after some versions import
|
||||
* (2022.07.29) Add `Axis` to` Time `timeline, support sub-scale and sub-divider
|
||||
@@ -208,10 +521,10 @@ Details:
|
||||
* (2022.07.22) Omit the `Emphasis`,` EmphasisItemStyle `, `EmphasisLabelStyle`, `EmphasisLabelLine` component
|
||||
* (2022.07.20) Added `Since` feature support for classes
|
||||
* (2022.07.20) fixed the `showStartLabel` and `showEndLabel` parameter Settings for `AxisLabel` not taking effect when `Axis` is on the` Value `Axis
|
||||
* (2022.07.19) added `Axis` to` MinorSplitLine `to set the Axis degree divider
|
||||
* (2022.07.19) added `Axis` `MinorTick` to set the Axis sub-scale
|
||||
* (2022.07.19) Added `Axis` to` MinorSplitLine `to set the Axis degree divider
|
||||
* (2022.07.19) Added `Axis` `MinorTick` to set the Axis sub-scale
|
||||
* (2022.07.17) Add the `smooth` parameter for Radar to set the smooth curve
|
||||
* (2022.07.15) added DataZoom support for the `Time` timeline
|
||||
* (2022.07.15) Added DataZoom support for the `Time` timeline
|
||||
|
||||
## v3.1.0
|
||||
|
||||
@@ -222,7 +535,7 @@ Details:
|
||||
* (2022.07.04) Added the axisMaxSplitNumber parameter of `Settings` to set the maximum number of partitions for `Axis`
|
||||
* (2022.07.04) Fixed Axis` Tick `drawing position after setting `offset`(#209)
|
||||
* (2022.07.03) Optimize the `AxisLabel` formatterFunction custom delegate
|
||||
* (2022.07.03) added the `onZero` parameter of `AxisName` to support setting the coordinate AxisName and position to match the Y-axis 0 scale (#207)
|
||||
* (2022.07.03) Added the `onZero` parameter of `AxisName` to support setting the coordinate AxisName and position to match the Y-axis 0 scale (#207)
|
||||
* (2022.07.02) Fixed bug where `Legend` was not working when `PieChart` was being created dynamically with code (#206)
|
||||
* (2022.07.02) Fixed `YAxis` AxisLabel setting `onZero` not working
|
||||
* (2022.07.02) Fixed `AxisLabel` code refreshing after setting `distance` property
|
||||
@@ -610,7 +923,7 @@ Details:
|
||||
* (2020.04.19) 优化`LineChart`折线图的区域填充渐变效果
|
||||
* (2020.04.19) 增加`AxisLabel`的`onZero`参数可将`Label`显示在`0`刻度上
|
||||
* (2020.04.19) 增加`Serie`和`AxisLabel`的`showAsPositiveNumber`参数将负数数值显示为正数
|
||||
* (2020.04.18) 增加`Covert XY Axis`互换XY轴配置
|
||||
* (2020.04.18) 增加`Convert XY Axis`互换XY轴配置
|
||||
* (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转
|
||||
* (2020.04.16) 修复`Check warning`在`Unity2019.3`上的显示问题
|
||||
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,150 +1,168 @@
|
||||
# XCharts FAQ
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)<br/>
|
||||
[XCharts API](XChartsAPI-EN.md)<br/>
|
||||
[XCharts Configuration](XChartsConfiguration-EN.md)
|
||||
[FAQ 1: How to adjust the margin between the axis and the background?](#how-to-adjust-the-margin-between-the-axis-and-the-background)
|
||||
[FAQ 2: How to play agian the fadeIn animation?](#how-to-play-agian-the-fadein-animation)
|
||||
[FAQ 3: How to customize the color of data item in line chart and pie chart?](#how-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
|
||||
[FAQ 4: How to formatter the text of axis label, such as add a units text?](#how-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
|
||||
[FAQ 5: How to stack the bar of bar chart](#how-to-stack-the-bar-of-bar-chart)
|
||||
[FAQ 6: How to make the bar serie in the same bar but not stack?](#how-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
|
||||
[FAQ 7: How to adjust the bar width and gap of barchart?](#how-to-adjust-the-bar-width-and-gap-of-barchart)
|
||||
[FAQ 8: How to adjust the color of bar?](#how-to-adjust-the-color-of-bar)
|
||||
[FAQ 9: Can I adjust the anchor of chart?](#can-i-adjust-the-anchor-of-chart)
|
||||
[FAQ 10: Can display more than 1000 data?](#can-display-more-than-1000-data)
|
||||
[FAQ 11: Can line chart drawing be dash, dot and dash-dot?](#can-line-chart-drawing-be-dash-dot-and-dash-dot)
|
||||
[FAQ 12: How to limit the value range of the Y-axis?](#how-to-limit-the-value-range-of-the-y-axis)
|
||||
[FAQ 13: How to customize the tick value range of value axis?](#how-to-customize-the-tick-value-range-of-value-axis)
|
||||
[FAQ 14: How to display text at the top of data items?](#how-to-display-text-at-the-top-of-data-items)
|
||||
[FAQ 15: How do I customize icons for data items?](#how-do-i-customize-icons-for-data-items)
|
||||
[FAQ 16: How to anti-aliasing and make the chart smoother?](#how-to-anti-aliasing-and-make-the-chart-smoother)
|
||||
[FAQ 17: Why does mouse over chart Tooltip not show?](#why-does-mouse-over-chart-tooltip-not-show)
|
||||
[FAQ 18: How not to display the bar line of Tooltip?](#how-not-to-display-the-bar-line-of-tooltip)
|
||||
[FAQ 19: How do I customize the display of Tooltip?](#how-do-i-customize-the-display-of-tooltip)
|
||||
[FAQ 20: How do I get the Y-axis to display multiple decimal places?](#how-do-i-get-the-y-axis-to-display-multiple-decimal-places)
|
||||
[FAQ 21: How do I dynamically update data with code?](#how-do-i-dynamically-update-data-with-code)
|
||||
[FAQ 22: How to display legend? Why are legends sometimes not displayed?](#how-to-display-legend-why-are-legends-sometimes-not-displayed)
|
||||
[FAQ 23: How to make chart as prefab?](#how-to-make-chart-as-prefab)
|
||||
[FAQ 24: How do I draw custom graphic in chart,such as line or dot?](#how-do-i-draw-custom-content-in-chart-such-as-line-or-dot)
|
||||
[FAQ 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#how-to-achieve-similar-data-movement-effect-of-electro-cardiogram)
|
||||
[FAQ 26: How do I use the background component? What are the conditions?](#how-do-i-use-the-background-component-what-are-the-conditions)
|
||||
[FAQ 27: Mesh can not have more than 65000 vertices?](#mesh-cannot-have-more-than-65000-vertices)
|
||||
[FAQ 28: Why are the parameters set in Serie reset after they run?](#why-are-the-parameters-set-in-serie-reset-after-they-run)
|
||||
[FAQ 29: How to change the color of serie symbol?](#how-to-change-the-color-of-serie-symbol)
|
||||
[FAQ 30: How to deal with TMP errors when importing or updating XCharts?](#what-if-tmp-errors-occur-when-importing-or-updating-xcharts)
|
||||
[FAQ 31: Support empty data? How to achieve the effect of line chart disconnection?](#support-empty-data-how-to-achieve-the-effect-of-line-chart-disconnection)
|
||||
[FAQ 32: 2.x What are the common problems when upgrading version 3.x?](#what-are-the-common-problems-when-upgrading-xcharts2-to-xcharts3)
|
||||
|
||||
[QA 1: How to adjust the margin between the axis and the background?](#How-to-adjust-the-margin-between-the-axis-and-the=-background)
|
||||
[QA 2: How to play agian the fadeIn animation?](#How-to-play-agian-the-fadeIn-animation)
|
||||
[QA 3: How to customize the color of data item in line chart and pie chart?](#How-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
|
||||
[QA 4: How to formatter the text of axis label, such as add a units text?](#How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
|
||||
[QA 5: How to stack the bar of bar chart](#How-to-stack-the-bar-of-bar-chart)
|
||||
[QA 6: How to make the bar serie in the same bar but not stack?](#How-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
|
||||
[QA 7: How to adjust the bar width and gap of barchart?](#How-to-adjust-the-bar-width-and-gap-of-barchart)
|
||||
[QA 8: How to adjust the color of bar?](#How-to-adjust-the-color-of-bar)
|
||||
[QA 9: Can I adjust the anchor of chart?](#Can-I-adjust-the-anchor-of-chart)
|
||||
[QA 10: Can display more than 1000 data?](#Can-display-more-than-1000-data)
|
||||
[QA 11: Can line chart drawing be dash, dot and dash-dot?](#Can-line-chart-drawing-be-dash-dot-and-dash-dot)
|
||||
[QA 12: How to limit the value range of the Y-axis?](#How-to-limit-the-value-range-of-the-Y-axis)
|
||||
[QA 13: How to customize the tick value range of value axis?](#How-to-customize-the-tick-value-range-of-value-axis)
|
||||
[QA 14: How to display text at the top of data items?](#How-to-display-text-at-the-top-of-data-items)
|
||||
[QA 15: How do I customize icons for data items?](#How-do-I-customize-icons-for-data-items)
|
||||
[QA 16: How to anti-aliasing and make the chart smoother?](#How-to-anti-aliasing-and-make-the-chart-smoother)
|
||||
[QA 17: Why does mouse over chart Tooltip not show?](#Why-does-mouse-over-chart-Tooltip-not-show)
|
||||
[QA 18: How not to display the bar line of Tooltip?](#How-not-to-display-the-bar-line-of-Tooltip)
|
||||
[QA 19: How do I customize the display of Tooltip?](#How-do-I-customize-the-display-of-Tooltip)
|
||||
[QA 20: How do I get the Y-axis to display multiple decimal places?](#How-do-I-get-the-Y-axis-to-display-multiple-decimal-places)
|
||||
[QA 21: How do I dynamically update data with code?](#How-do-I-dynamically-update-data-with-code)
|
||||
[QA 22: How to display legend? Why are legends sometimes not displayed?](#How-to-display-legend?Why-are-legends-sometimes-not-displayed)
|
||||
[QA 23: How to make chart as prefab?](#How-to-make-chart-as-prefab)
|
||||
[QA 24: How do I draw custom graphic in chart,such as line or dot?](#How-do-I-draw-custom-content-in-chart-such-as-line-or-dot)
|
||||
[QA 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram)
|
||||
[QA 26: How do I use the background component? What are the conditions?](#How-do-I-use-the-background-component-What-are-the-conditions)
|
||||
[QA 27: Mesh can not have more than 65000 vertices?](#Mesh-cannot-have-more-than-65000-vertices)
|
||||
[QA 28: Why are the parameters set in Serie reset after they run?](#Why-are-the-parameters-set-in-Serie-reset-after-they-run)
|
||||
## how-to-adjust-the-margin-between-the-axis-and-the-background
|
||||
|
||||
## How-to-adjust-the-margin-between-the-axis-and-the=-background
|
||||
`Grid` conponent,which can adjust the left, right, up, down margins of chart.
|
||||
|
||||
A: `Grid` conponent,which can adjust the left, right, up, down margins of chart.
|
||||
## how-to-play-agian-the-fadein-animation
|
||||
|
||||
## How-to-play-agian-the-fadeIn-animation
|
||||
call the `chart.AnimationReset()` API.
|
||||
|
||||
A: call the `chart.AnimationReset()` API.
|
||||
## how-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
|
||||
|
||||
## How-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
|
||||
`Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
|
||||
|
||||
A: `Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
|
||||
## how-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
|
||||
|
||||
## How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
|
||||
Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
|
||||
|
||||
A: Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
|
||||
## how-to-stack-the-bar-of-bar-chart
|
||||
|
||||
## How-to-stack-the-bar-of-bar-chart
|
||||
Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
|
||||
|
||||
A: Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
|
||||
## how-to-make-the-bar-serie-in-the-same-bar-but-not-stack
|
||||
|
||||
## How-to-make-the-bar-serie-in-the-same-bar-but-not-stack
|
||||
Set the `barGap` of `Serie` to `-1`,`stack` to null.
|
||||
|
||||
A: Set the `barGap` of `Serie` to `-1`,`stack` to null.
|
||||
## how-to-adjust-the-bar-width-and-gap-of-barchart
|
||||
|
||||
## How-to-adjust-the-bar-width-and-gap-of-barchart
|
||||
Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
|
||||
|
||||
A: Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
|
||||
## how-to-adjust-the-color-of-bar
|
||||
|
||||
## How-to-adjust-the-color-of-bar
|
||||
Adjust the `ItemStyle` of `Data` in `inspector`.
|
||||
|
||||
A: Adjust the `ItemStyle` of `Data` in `inspector`.
|
||||
## can-i-adjust-the-anchor-of-chart
|
||||
|
||||
## Can-I-adjust-the-anchor-of-chart
|
||||
Yes, you can set any one of 16 anchors but the value use default.
|
||||
|
||||
A: Yes, you can set any one of 16 anchors but the value use default.
|
||||
## can-display-more-than-1000-data
|
||||
|
||||
## Can-display-more-than-1000-data
|
||||
Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
|
||||
|
||||
A: Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
|
||||
## can-line-chart-drawing-be-dash-dot-and-dash-dot
|
||||
|
||||
## Can-line-chart-drawing-be-dash-dot-and-dash-dot
|
||||
Yes. Adjust the `lineType` of `Serie`.
|
||||
|
||||
A: Yes. Adjust the `lineType` of `Serie`.
|
||||
## how-to-limit-the-value-range-of-the-y-axis
|
||||
|
||||
## How-to-limit-the-value-range-of-the-Y-axis
|
||||
Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
|
||||
|
||||
A: Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
|
||||
## how-to-customize-the-tick-value-range-of-value-axis
|
||||
|
||||
## How-to-customize-the-tick-value-range-of-value-axis
|
||||
By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
|
||||
|
||||
A: By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
|
||||
## how-to-display-text-at-the-top-of-data-items
|
||||
|
||||
## How-to-display-text-at-the-top-of-data-items
|
||||
Adjust the `Label` of `Serie`.
|
||||
|
||||
A: Adjust the `Label` of `Serie`.
|
||||
## how-do-i-customize-icons-for-data-items
|
||||
|
||||
## How-do-I-customize-icons-for-data-items
|
||||
Set the `Icon` of `Data` in `Serie`.
|
||||
|
||||
A: Set the `Icon` of `Data` in `Serie`.
|
||||
## how-to-anti-aliasing-and-make-the-chart-smoother
|
||||
|
||||
## How-to-anti-aliasing-and-make-the-chart-smoother
|
||||
Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
|
||||
|
||||
A: Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
|
||||
## why-does-mouse-over-chart-tooltip-not-show
|
||||
|
||||
## Why-does-mouse-over-chart-Tooltip-not-show
|
||||
Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
|
||||
|
||||
A: Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
|
||||
## how-not-to-display-the-bar-line-of-tooltip
|
||||
|
||||
## How-not-to-display-the-bar-line-of-Tooltip
|
||||
Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
|
||||
|
||||
A: Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
|
||||
## how-do-i-customize-the-display-of-tooltip
|
||||
|
||||
## How-do-I-customize-the-display-of-Tooltip
|
||||
See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
|
||||
|
||||
A: See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
|
||||
## how-do-i-get-the-y-axis-to-display-multiple-decimal-places
|
||||
|
||||
## How-do-I-get-the-Y-axis-to-display-multiple-decimal-places
|
||||
Set the `numericFormatter` parameter of `AxisLabel`.
|
||||
|
||||
A: Set the `numericFormatter` parameter of `AxisLabel`.
|
||||
## how-do-i-dynamically-update-data-with-code
|
||||
|
||||
## How-do-I-dynamically-update-data-with-code
|
||||
See example: `Example01_UpdateData.cs`
|
||||
|
||||
A: See example: `Example01_UpdateData.cs`
|
||||
## how-to-display-legend-why-are-legends-sometimes-not-displayed
|
||||
|
||||
## How-to-display-legend?Why-are-legends-sometimes-not-displayed
|
||||
First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
|
||||
|
||||
A: First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
|
||||
## how-to-make-chart-as-prefab
|
||||
|
||||
## How-to-make-chart-as-prefab
|
||||
Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
|
||||
|
||||
A: Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
|
||||
## how-do-i-draw-custom-content-in-chart-such-as-line-or-dot
|
||||
|
||||
## How-do-I-draw-custom-content-in-chart-such-as-line-or-dot
|
||||
Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
|
||||
|
||||
A: Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
|
||||
## how-to-achieve-similar-data-movement-effect-of-electro-cardiogram
|
||||
|
||||
## How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram
|
||||
See `Example_Dynamic.cs`.
|
||||
|
||||
A: See `Example_Dynamic.cs`.
|
||||
## how-do-i-use-the-background-component-what-are-the-conditions
|
||||
|
||||
## How-do-I-use-the-background-component-What-are-the-conditions
|
||||
Setting `show` to `true` for the `background` component.
|
||||
|
||||
A: Setting `show` to `true` for the `background` component.
|
||||
## mesh-cannot-have-more-than-65000-vertices
|
||||
|
||||
## Mesh-cannot-have-more-than-65000-vertices
|
||||
This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [FAQ 10: Can display more than 1000 data](#can-display-more-than-1000-data)
|
||||
|
||||
A: This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [QA 10: Can display more than 1000 data](#Can-display-more-than-1000-data)
|
||||
## why-are-the-parameters-set-in-serie-reset-after-they-run
|
||||
|
||||
## Why-are-the-parameters-set-in-Serie-reset-after-they-run
|
||||
Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
|
||||
|
||||
A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
|
||||
## how-to-change-the-color-of-serie-symbol
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)<br/>
|
||||
[XCharts API](XChartsAPI-EN.md)<br/>
|
||||
[XCharts Configuration](XChartsConfiguration-EN.md)
|
||||
The color of 'Symbol' is the color of 'ItemStyle' used.
|
||||
|
||||
## what-if-tmp-errors-occur-when-importing-or-updating-xcharts
|
||||
|
||||
XCharts does not enable TMP by default, so there are no references to TMP on asmdef. This issue may occur when updating XCharts after TMP is enabled locally. It can be solved in the following two ways:
|
||||
|
||||
1. Find `XCharts.Runtime.asmdef` and `XCharts.Editor.asmdef` and manually add references to `TextMeshPro`
|
||||
2. Remove the `dUI_TextMeshPro` macro for Scripting Define Symbols in PlayerSetting
|
||||
|
||||
Version ` 3.8.0 ` after adding Daemon [XCharts - Daemon](https://github.com/XCharts-Team/XCharts-Daemon), will be XCharts - Daemon import project, When updating XCharts, the daemon automatically refreshes the asmdef based on the locally enabled TMP to ensure proper compilation.
|
||||
|
||||
## support-empty-data-how-to-achieve-the-effect-of-line-chart-disconnection
|
||||
|
||||
`data` of `Serie` is of type `double`, so it cannot represent empty data. Empty data can be achieved by turning on Serie's ignore and specifying ignoreValue. You can also set the ignore parameter for each SerieData. The ignoreLineBreak parameter can be set to disconnect or connect after ignoring data.
|
||||
|
||||
## what-are-the-common-problems-when-upgrading-xcharts2-to-xcharts3
|
||||
|
||||
1. `XCharts.Runtime.XChartsMgr` is missing the class attribute `ExtensionOfNativeClass`!
|
||||
3.x version does not need to mount XChartsMgr, directly delete the `_xcharts_` node on the scene.
|
||||
|
||||
BIN
Documentation~/en/img/tutorial01_axisdata.png
Normal file
BIN
Documentation~/en/img/tutorial01_axisdata.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
Documentation~/en/img/tutorial01_seriedata.png
Normal file
BIN
Documentation~/en/img/tutorial01_seriedata.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
BIN
Documentation~/en/img/xcharts.png
Normal file
BIN
Documentation~/en/img/xcharts.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
@@ -1,87 +1,145 @@
|
||||
# 教程:5分钟上手 XCharts 3.0
|
||||
---
|
||||
title: Tutorial: Getting Started with XCharts 3.0 in 5 Minutes
|
||||
sidebar_position: 11
|
||||
slug: /tutorial01
|
||||
---
|
||||
|
||||
## 获取和导入 XCharts
|
||||
# Tutorial: Getting Started with XCharts 3.0 in 5 Minutes
|
||||
|
||||
XCharts可通过以下任意一种方式导入到项目:
|
||||
|
||||
- 直接将XCharts源码到项目
|
||||
> Note: This tutorial is only applicable to the XCharts 3.x version. For the 2.x version, please refer to [Tutorial: Mastering XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/Tutorial%3A5-Minute-Start-to-XCharts.md)
|
||||
|
||||
下载好XCharts源码后,直接将XCharts目录拷贝到Unity项目工程的Assets目录或Packages目录下,编译通过后即可使用。
|
||||
## Prerequisites for XCharts
|
||||
|
||||
- 通过`Assets/Import Package`导入XCharts
|
||||
XCharts is a Unity chart plugin, currently only available for use on the Unity platform.
|
||||
|
||||
下载好XCharts的.unitypackage文件后,打开Unity,菜单栏 Assets-->Import Package-->选中.unitypackage导入即可开始使用XCharts。
|
||||
Before using XCharts, you need to:
|
||||
|
||||
- 通过`Package Manager`导入XCharts
|
||||
- Have a basic understanding of how to use Unity.
|
||||
- Understand the basic usage of UGUI for making UI.
|
||||
- Know how to use Unity's MonoBehavior scripts, how to attach scripts, and how to manipulate scripts with code.
|
||||
|
||||
对于Unity 2018.3以上版本,可通过 Package Manager来导入XCharts,打开Package Manager后,通过 `Add package form git URL...`,输入XCharts3.0的GitHub URL: `https://github.com/XCharts-Team/XCharts.git#3.0` 稍等片刻后即可使用XCharts。
|
||||
If you are new to Unity, it is recommended to learn some basic Unity tutorials before using XCharts.
|
||||
|
||||
也可以直接将package加入到`manifest.json`文件:打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
|
||||
## Obtaining and Importing XCharts
|
||||
|
||||
``` json
|
||||
"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git#3.0",
|
||||
```
|
||||
XCharts is primarily maintained and released through Github. You can download the source code and Package from the [Github Homepage](https://github.com/XCharts-Team).
|
||||
|
||||
如需更新`XCharts`,删除`manifest.json`文件(部分Unity版本可能是packages-lock.json文件)的`lock`下的`com.monitor1394.xcharts`相关内容即会重新下载编译。
|
||||
XCharts can be imported into your project in any of the following ways:
|
||||
|
||||
## 添加一个简单图表
|
||||
### Copying the XCharts Source Code Directly into the Project
|
||||
|
||||
在`Hierarchy`视图下右键或菜单栏`GameObject`下拉选择`XCharts->LineChart`,即可快速创建一个默认的折线图出来:
|
||||
After downloading the XCharts source code, simply copy the XCharts directory into the Assets directory of your Unity project. Once compiled, it is ready to use.
|
||||
|
||||
### Importing XCharts through Import Package
|
||||
|
||||
After downloading the .unitypackage file of XCharts, open Unity, go to the menu bar Assets-->Import Package-->select the downloaded .unitypackage to import. After the import is complete and compiled, you can start using XCharts.
|
||||
|
||||
### Importing XCharts through Package Manager
|
||||
|
||||
For Unity versions above 2018.3, you can import XCharts through the Package Manager. Open the Package Manager, then use `Add package from git URL...`, enter the GitHub URL of XCharts: `https://github.com/XCharts-Team/XCharts.git`. After compiling, you can use XCharts.
|
||||
|
||||
For some Unity versions, you can also directly add the package to the `manifest.json` file: Open the `manifest.json` file under the `Packages` directory, and add the following under `dependencies`:
|
||||
|
||||
>"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git",
|
||||
|
||||
If you need to update `XCharts`, delete the relevant content of `com.monitor1394.xcharts` under the `lock` of the `manifest.json` file (some Unity versions may be the packages-lock.json file), and it will re-download and compile.
|
||||
|
||||
### Recommended Import of XCharts Daemon
|
||||
|
||||
The daemon [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon) ensures that the compilation is normal when updating. It is very useful when TextMeshPro or NewInputSystem is turned on locally. After importing XCharts-Daemon into the project, the daemon will automatically refresh XCharts' asmdef according to the local situation of TMP when updating XCharts, ensuring that the compilation is normal without manual intervention, which is convenient for automated processes such as CI/CD.
|
||||
|
||||
The import method of XCharts-Daemon can refer to the previous import method of XCharts. It can be imported into the project through source code or Package. The GitHub URL of XCharts-Daemon: https://github.com/XCharts-Team/XCharts-Daemon.git
|
||||
|
||||
## Basic Usage of XCharts
|
||||
|
||||
After importing XCharts and compiling, the XCharts menu will appear in the Unity editor's menu bar, and you can start using XCharts.
|
||||
|
||||
>Note: The XCharts menu in the Unity menu bar indicates that XCharts is available.
|
||||
|
||||
### Adding a Simple Chart
|
||||
|
||||
In the `Hierarchy` view, right-click `UI->XCharts->LineChart` or select `LineChart` from the menu bar `XCharts` to quickly create a default line chart:
|
||||
|
||||

|
||||
|
||||
## 添加多个Seire
|
||||
If you need to create a chart under a certain node, you can select the node and right-click `UI->XCharts->LineChart` to create a chart under the node.
|
||||
|
||||
在`Inspector`视图,找到`LineChart`的面板,通过`Add Serie`按钮,可以添加第二条`Line`折线:
|
||||
### Modifying Chart Data
|
||||
|
||||
For the newly created chart, its data can be modified on the Inspector panel.
|
||||
|
||||
For X-axis data, you can add, delete, and modify by expanding: `XAxis->Data`:
|
||||
|
||||

|
||||
|
||||
For Serie data, you can add, delete, and modify by expanding: `Serie->Data`:
|
||||
|
||||

|
||||
|
||||
Serie supports multi-dimensional data, and generally, a line chart only uses two-dimensional data: the first dimension represents the ID of the X-axis category data, and the second dimension represents the corresponding value.
|
||||
|
||||
### Adding Multiple Series
|
||||
|
||||
In the `Inspector` view, find the `LineChart` panel, and click the `Add Serie` button to add a second `Line` line:
|
||||
|
||||

|
||||

|
||||
|
||||
## 添加其他组件
|
||||
>Note: Series are added through the `Add Serie` button. Different types of Series can be added. [What kinds of Series does XCharts have?](https://xcharts-team.github.io/docs/configuration#serie-系列)
|
||||
|
||||
默认图表没有`Legend`,需要`Legend`组件可通过`Add Component`按钮添加:
|
||||
### Adding Other Main Components
|
||||
|
||||
By default, the chart does not have a `Legend`. If you need a `Legend` component, you can add it through the `Add Component` button:
|
||||
|
||||

|
||||
|
||||
## 添加Serie组件
|
||||
>Note: Main components are added through the `Add Component` button. [What main components does XCharts have?](https://xcharts-team.github.io/docs/configuration/#maincomponent-主组件)
|
||||
|
||||
Serie只自带了几个常见的组件,其他组件要根据需求额外添加,不同的Serie支持不同的额外组件。比如,需要给折线图区域填充颜色,可单独给`Serie`添加`AreaStyle`组件:
|
||||
### Adding Serie Components
|
||||
|
||||
Serie only comes with a few common components, and other components need to be added when used. For example, if you need to fill the area color for the line chart, you can add an `AreaStyle` component to `Serie` separately:
|
||||
|
||||

|
||||

|
||||
|
||||
## 添加SerieData组件
|
||||
>Note: Serie components are added through the button on the right side of Serie. [What components can be added to Serie in XCharts?](https://xcharts-team.github.io/docs/configuration/#iseriecomponent-可添加到serie的组件)
|
||||
|
||||
如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加`Component`。比如我们给折线图的第二个数据单独显示`Label`:
|
||||
### Adding SerieData Components
|
||||
|
||||
If you need to customize the configuration of each data item individually, you can add components to each `SerieData` separately. For example, we can display `Label` for the second data of the line chart individually:
|
||||
|
||||

|
||||

|
||||
|
||||
## 更多组件和配置参数
|
||||
>Note: SerieData components are added through the button on the right side of SerieData after expanding. [What components can be added to SerieData in XCharts?](https://xcharts-team.github.io/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
|
||||
|
||||
功能越丰富就越需要更多的组件和参数支持。XCharts有多达几十种的主组件和子组件,每个组件有几个至几十个不等的可配置参数,以支持各种灵活而复杂的功能。
|
||||
### More Components and Configuration Parameters
|
||||
|
||||
首次接触XCharts者可在 `Inspector` 视图下可以添加和调整各个组件,`Game` 视图会实时反馈调整的效果,以熟悉各种组件实现的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](configuration.md)。
|
||||
XCharts has been continuously iterated and optimized, and now has dozens of main components and sub-components, each with several to dozens of configurable parameters to support a variety of functions.
|
||||
|
||||
## 如何快速调整参数
|
||||
When using XCharts for the first time, it is recommended to personally test the actual effects of each chart, each component. The `Inspector` view can directly add various charts, components, and adjust various configuration parameters, and the `Game` view will provide real-time feedback on the adjustments. A detailed description of each component's parameters can be found in the [XCharts Configuration Manual](configuration.md).
|
||||
|
||||
`XCharts`是配置参数驱动。想要什么效果,你只需要去调整对应组件下的配置参数就可以,不需要去改`Hierarchy`视图下的节点,因为那些节点是由`XCharts`内部根据配置参数生成的,即使改了也会在刷新时被还原回来。
|
||||
### How to Quickly Adjust Parameters
|
||||
|
||||
快速定位你想要改的效果对应的组件。这就需要对组件有一定的了解。比如我们想要让X轴的轴线末端显示箭头,如何定位?第一步,X轴定位到`XAxis0`;第二步,轴线定位到`AxisLine`;最后,再去看`AxisLine`组件下有没有这样的参数可以实现这个效果。
|
||||
XCharts is driven by data and parameters. To achieve the desired effect, simply adjust the configuration parameters under the corresponding component. Do not modify the nodes under the `Hierarchy` view, as those nodes are generated by XCharts internally based on configuration and data, and will be restored upon refresh.
|
||||
|
||||
`XCharts`提供从全局`Theme`、系列`Serie`、单个数据项`SerieData`全方位的参数配置。优先级从大到小为:`SerieData`->`Serie`->`Theme`。以`ItemStyle`的颜色为例:
|
||||
To quickly locate the component corresponding to the effect you want to change, you need to have a certain understanding of the components. For example, we want to display an arrow at the end of the X-axis line. How to locate it? The first step, the X-axis is located at `XAxis0`; the second step, the axis line is located at `AxisLine`; finally, check if there is such a parameter under the `AxisLine` component to achieve this effect. If you are not sure about the parameters, you can refer to the [XCharts Configuration Manual](configuration.md).
|
||||
|
||||
1. 如果`SerieData`的`ItemStyle`配置有非`0000`颜色值,则优先用这个颜色值。
|
||||
2. 如果`Serie`的`ItemStyle`配置有非`0000`颜色值,则优先用这个颜色值。
|
||||
3. 否则颜色值取自主题`Theme`的`Color Palette`。
|
||||
`XCharts` provides comprehensive parameter configuration from the global `Theme`, series `Serie`, and individual data items `SerieData`. The priority order from high to low is: `SerieData`->`Serie`->`Theme`. Take the color of `ItemStyle` as
|
||||
an example:
|
||||
|
||||
通常配置的颜色值为0000时表示用主题默认颜色;配置参数的值为0或null时表示用主题默认配置。
|
||||
1. If the `ItemStyle` of `SerieData` has a color value other than `0000`, this color value is used first.
|
||||
2. If the `ItemStyle` of `Serie` has a color value other than `0000`, this color value is used.
|
||||
3. Otherwise, the color value is taken from the `Color Palette` of the theme `Theme`.
|
||||
|
||||
## 用代码添加折线图
|
||||
>Note: The color value is usually `0000` when using the default color of the theme; other parameters are `0` or null when using the default configuration of the theme; pay attention to transparency when setting colors.
|
||||
|
||||
给`gameObject`挂上`LineChart`脚本:
|
||||
### Adding a Line Chart with Code
|
||||
|
||||
```C#
|
||||
Attach the `LineChart` script to `gameObject`:
|
||||
|
||||
```csharp
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
@@ -89,53 +147,60 @@ if (chart == null)
|
||||
chart.Init();
|
||||
}
|
||||
```
|
||||
用代码生成的Chart需要调用一次Init()。
|
||||
|
||||
调整大小:
|
||||
Adjust the size:
|
||||
|
||||
```C#
|
||||
chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTransform,或直接在Inspector上改
|
||||
```csharp
|
||||
chart.SetSize(580, 300);//Dynamically set the size with code, or directly operate chart.rectTransform, or directly change it in the Inspector
|
||||
```
|
||||
|
||||
设置标题:
|
||||
Set the title:
|
||||
|
||||
```C#
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple Line";
|
||||
```
|
||||
|
||||
设置提示框和图例是否显示:
|
||||
Set whether to display the tooltip and legend:
|
||||
|
||||
```C#
|
||||
var tooltip = chart.GetOrAddChartComponent<Tooltip>();
|
||||
```csharp
|
||||
var tooltip = chart.EnsureChartComponent<Tooltip>();
|
||||
tooltip.show = true;
|
||||
|
||||
var legend = chart.GetOrAddChartComponent<Legend>();
|
||||
var legend = chart.EnsureChartComponent<Legend>();
|
||||
legend.show = false;
|
||||
```
|
||||
|
||||
设置坐标轴:
|
||||
Set the coordinate axis:
|
||||
|
||||
```C#
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
```csharp
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
```
|
||||
|
||||
清空默认数据,添加`Line`类型的`Serie`用于接收数据:
|
||||
Clear all default data (including Series), add a `Line` type `Serie` to receive data:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>("line");
|
||||
```
|
||||
|
||||
添加10个数据:
|
||||
If the Serie is fixed, it is recommended to only clear the data, not to remove the Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.ClearData();
|
||||
```
|
||||
|
||||
This way, you can set the configuration parameters of Serie in the UI in advance.
|
||||
|
||||
Add 10 data points:
|
||||
|
||||
```csharp
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
@@ -143,73 +208,93 @@ for (int i = 0; i < 10; i++)
|
||||
}
|
||||
```
|
||||
|
||||
这样一个简单的折线图就出来了:
|
||||
Now, a simple line chart is ready:
|
||||
|
||||

|
||||
|
||||
如果一个Chart里面有多个系列时,则Axis的data只需要加一次,不要多个循环加重复了。记住:Axis的数据个数要和Serie的数据个数一致。
|
||||
If there are multiple series in a Chart, the data of Axis only needs to be added once, and should not be repeated in multiple loops.
|
||||
|
||||
完整代码请查阅`Examples`:`Example13_LineSimple.cs`
|
||||
>Remember: The number of Axis data should be consistent with the number of Serie data.
|
||||
|
||||
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](configuration.md)里面的所有参数都是可以通过代码控制的。
|
||||
For the complete code, please refer to `Examples`: `Example13_LineSimple.cs`
|
||||
|
||||
另外,除非定制,建议调用`Chart`下提供的`public`接口,特别是数据相关操作部分。这些接口内部会做一些关联处理,比如刷新图表等。常见的接口有:
|
||||
You can also control more parameters with code. There are more examples in `Examples`. All parameters that can be configured in the `Inspector` can be set with code. All parameters in the [XCharts Configuration Manual](configuration.md) can be controlled by code.
|
||||
|
||||
1. `chart.ClearData()`:清空图表数据(不移除Series)
|
||||
2. `chart.RemoveData()`:清除图表数据(会移除所有Serie)
|
||||
3. `chart.AddSerie()`:添加Serie
|
||||
4. `chart.AddXAxisData()`:添加X轴数据
|
||||
5. `chart.AddData()`:添加Serie数据
|
||||
6. `chart.UpdateData()`:更新Serie数据
|
||||
7. `chart.UpdateXAxisData()`:更新X轴数据
|
||||
8. `chart.UpdateDataName()`:更新Serie数据的名字
|
||||
### Setting the Default Font
|
||||
|
||||
XCharts内部有自动刷新机制,但也是在一定条件下。如果自己调用了内部组件的接口,碰到组件没有刷新,确实找不到原因的话,可以用以下两个接口强制刷新:
|
||||
The default font used by XCharts is Unity's default font `Arial`, which may not display Chinese characters on the WebGL platform. When using XCharts in your project, it is recommended to set the font first:
|
||||
|
||||
1. `chart.RefreshAllComponent()`:刷新图表组件,会重新初始化所有组件,不建议频繁使用。
|
||||
2. `chart.RefreshChart()`:刷新图表绘制,只刷新绘制部分,不会刷新组件文本,位置等部分。
|
||||
- Find the `XCharts/Resources/XCSetting.asset` resource and modify the `Font` inside and save.
|
||||
- Find the `XCharts/Resources/XCTheme-Default.asset` and `XCharts/Resources/XCTheme-Dark.asset` font configurations, and click the `Sync Font from Setting` and `Sync Font to Sub Theme` buttons to synchronize the font to the theme configuration files.
|
||||
|
||||
## 使用TextMeshPro
|
||||
After the font is set, newly created charts will use the newly set font. For old charts, you can click the `Rebuild Chart Object` button to refresh.
|
||||
|
||||
XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换。可通过以下方式开启和关闭:
|
||||
>Note: It is recommended to set the font before using XCharts; when updating XCharts, pay attention to the potential restoration of the set font.
|
||||
|
||||
### Using TextMeshPro
|
||||
|
||||
XCharts supports TextMeshPro, but it is not enabled by default and needs to be switched on manually. It can be turned on and off in the following ways:
|
||||
|
||||

|
||||
|
||||
开启后需要设置好TextMeshPro要用的全局字体,也可以在主题Theme里单独设置:
|
||||
After turning it on, you need to set the global font to be used by TextMeshPro, and it can also be set individually in the Theme:
|
||||
|
||||

|
||||
|
||||
建议在项目初就规划好是否使用TextMeshPro,并设置好字体。在已有很多图表的情况下切换TMP时,可能某些图表无法自动刷新,可以手动点击`Rebuild Chart Object`按钮来重建图表,即可正常初始化。
|
||||
It is recommended to plan whether to use TextMeshPro at the beginning of the project and set the font accordingly. When switching to TMP in a project with many charts, some charts may not refresh automatically, and you can manually click the `Rebuild Chart Object` button to rebuild the chart, which will initialize normally.
|
||||
|
||||
开启了TMP项目在更新XCharts时,可能会碰到丢失了TMP引用而无法编译通过的问题,可通过以下两种方式解决:
|
||||
If you have enabled TMP in your project, you may encounter compilation failures due to lost TMP references when updating XCharts. This can be solved in the following two ways:
|
||||
|
||||
1. 找到`XCharts.Runtime.asmdef`和`XCharts.Editor.asmdef`,手动加上 `TextMeshPro`的引用
|
||||
2. 移除`PlayerSetting`中`Scripting Define Symbols`的`dUI_TextMeshPro`宏
|
||||
1. Find `XCharts.Runtime.asmdef` and `XCharts.Editor.asmdef`, and manually add references to `TextMeshPro`.
|
||||
2. Remove the `dUI_TextMeshPro` macro from the `Scripting Define Symbols` in `PlayerSetting`.
|
||||
|
||||
## 用代码改图表参数
|
||||
After the `3.8.0` version, the [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon) daemon was added. After importing XCharts-Daemon into the project, the daemon will automatically refresh the asmdef based on the local situation of the enabled TMP when updating XCharts, ensuring normal compilation.
|
||||
|
||||
`Inspector`上看到的所有参数都可以用代码来修改,关键是要定位好你要改的参数是在组件上、还是serie上、还是在具体的数据项上改。
|
||||
## XCharts Code Control
|
||||
|
||||
### 改主组件上的参数
|
||||
All parameters seen in the `Inspector` can be modified with code. The key is to locate the parameter you want to change, whether it is on the component, the Serie, or the specific data item SerieData.
|
||||
|
||||
需要先获取组件,再修改里面的参数:
|
||||
In addition, unless customized, it is recommended to call the `public` interfaces provided under `Chart`, especially for data-related and list operations. These interfaces will do some associated processing internally, such as refreshing the chart. Common interfaces include:
|
||||
|
||||
```C#
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
1. `chart.ClearData()`: Clear chart data (does not remove Series)
|
||||
2. `chart.RemoveData()`: Clear chart data (will remove all Series)
|
||||
3. `chart.AddSerie()`: Add Serie
|
||||
4. `chart.AddXAxisData()`: Add X-axis data
|
||||
5. `chart.AddData()`: Add Serie data
|
||||
6. `chart.UpdateData()`: Update Serie data
|
||||
7. `chart.UpdateXAxisData()`: Update X-axis data
|
||||
8. `chart.UpdateDataName()`: Update the name of Serie data
|
||||
|
||||
XCharts has an automatic refresh mechanism, but it is also triggered under certain conditions. If you have called the internal component interfaces and encountered components that have not been refreshed, and you cannot find the reason, you can use the following two interfaces to force a refresh:
|
||||
|
||||
1. `chart.RefreshAllComponent()`: Refresh chart components, which will re-initialize all components. It is not recommended to use it frequently.
|
||||
2. `chart.RefreshChart()`: Refresh chart rendering, which only refreshes the rendering part and will not refresh component text, position, etc.
|
||||
3. Each component can also refresh itself by calling `SetAllDirty()`.
|
||||
|
||||
>Note: Use APIs to manipulate data and various lists, not directly access the list for processing.
|
||||
|
||||
### Changing Parameters on Main Components
|
||||
|
||||
You need to obtain the component first, then modify its parameters:
|
||||
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple LineChart";
|
||||
title.subText = "normal line";
|
||||
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
```
|
||||
|
||||
### 改Serie的参数
|
||||
> Note: In older versions without the `EnsureChartComponent()` interface, use `GetOrAddChartComponent()`
|
||||
|
||||
新添加的Serie:
|
||||
### Changing Serie Parameters
|
||||
|
||||
```C#
|
||||
For newly added Series:
|
||||
|
||||
```csharp
|
||||
var serie = chart.AddSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -219,9 +304,9 @@ serie.animation.dataChangeEnable = true;
|
||||
serie.roundCap = true;
|
||||
```
|
||||
|
||||
已存在的Serie:
|
||||
For existing Series:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serie = chart.GetSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -231,23 +316,23 @@ serie.animation.dataChangeEnable = true;
|
||||
serie.roundCap = true;
|
||||
```
|
||||
|
||||
给Serie添加额外组件:
|
||||
Adding additional components to Serie:
|
||||
|
||||
```C#
|
||||
serie.AddExtraComponent<AreaStyle>();
|
||||
```csharp
|
||||
serie.EnsureComponent<AreaStyle>();
|
||||
|
||||
var label = serie1.AddExtraComponent<LabelStyle>();
|
||||
var label = serie1.EnsureComponent<LabelStyle>();
|
||||
label.offset = new Vector3(0,20,0);
|
||||
```
|
||||
|
||||
### 改数据项SerieData上的参数
|
||||
### Changing Parameters on Data Item SerieData
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serieData = chart.AddData(0, 20);
|
||||
//var serieData = serie.GetSerieData(0); //从已有数据中获取
|
||||
//var serieData = serie.GetSerieData(0); //To get from existing data
|
||||
serieData.radius = 10;
|
||||
|
||||
var itemStyle = serieData.GetOrAddComponent<ItemStyle>(); //给数据项添加ItemStyle组件
|
||||
var itemStyle = serieData.EnsureComponent<ItemStyle>(); //Add ItemStyle component to the data item
|
||||
itemStyle.color = Color.blue;
|
||||
|
||||
```
|
||||
|
||||
10263
Documentation~/zh/api.md
10263
Documentation~/zh/api.md
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,23 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
sidebar_position: 61
|
||||
slug: /changelog
|
||||
---
|
||||
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.12.0](#v3120)
|
||||
[v3.11.2](#v3112)
|
||||
[v3.11.1](#v3111)
|
||||
[v3.11.0](#v3110)
|
||||
[v3.10.2](#v3102)
|
||||
[v3.10.1](#v3101)
|
||||
[v3.10.0](#v3100)
|
||||
[v3.9.0](#v390)
|
||||
[v3.8.1](#v381)
|
||||
[v3.8.0](#v380)
|
||||
[v3.7.0](#v370)
|
||||
[v3.6.0](#v360)
|
||||
[v3.5.0](#v350)
|
||||
[v3.4.0](#v340)
|
||||
[v3.3.0](#v330)
|
||||
@@ -65,6 +77,324 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
## v3.12.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`Ring`的`radiusGradient`参数设置渐变方向
|
||||
* 增加`numericFormatter`对`date`和`time`的支持
|
||||
* 完善`AreaStyle`的`origin`参数设置区域填充起始位置
|
||||
* 调整和完善文档
|
||||
* 其他优化和修复
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2024.09.30) 发布`v3.12.0`版本
|
||||
* (2024.09.27) 完善`5分钟教程`
|
||||
* (2024.09.24) 完善`Legend`的`formatter`对多Serie的支持 (#332)
|
||||
* (2024.09.22) 调整`Documentation`文档显示样式
|
||||
* (2024.09.09) 增加`numericFormatter`对`date`和`time`的支持
|
||||
* (2024.09.03) 完善`AreaStyle`的`origin`参数设置区域填充起始位置
|
||||
* (2024.09.01) 增加`Ring`的`radiusGradient`参数设置渐变方向
|
||||
* (2024.09.01) 优化`Axis`为时间轴时首个Label的位置
|
||||
|
||||
## v3.11.2
|
||||
|
||||
* (2024.08.01) 发布`v3.11.2`版本
|
||||
* (2024.07.29) 修复`Tooltip`在微信小游戏平台上报错的兼容问题 (#326)
|
||||
* (2024.07.27) 调整`Axis`的`AxisName`的默认位置
|
||||
* (2024.07.22) 优化`Pie`的`Label`在`Tooltip`触发时的表现
|
||||
* (2024.07.21) 修复`Tooltip`在开启`DataZoom`时指示内容不准确的问题
|
||||
* (2024.07.17) 修复`MarkLine`的`Label`在初始化时可能会闪烁的问题
|
||||
* (2024.07.16) 优化`Axis`为`Time`时间轴时的`Tooltip`默认效果
|
||||
* (2024.07.15) 优化`Axis`为`Time`时间轴时的分割效果
|
||||
* (2024.07.14) 优化`Axis`为`Time`时间轴时的移动表现
|
||||
* (2024.07.12) 优化`Label`的初始化显示效果
|
||||
* (2024.07.06) 修复`Chart`在动态创建时背景没有自适应的问题 (#323)
|
||||
|
||||
## v3.11.1
|
||||
|
||||
* (2024.07.01) 发布`v3.11.1`版本
|
||||
* (2024.07.01) 修复`Serie`有多个时颜色异常的问题
|
||||
* (2024.06.23) 修复`Label`在初始化时会堆积的问题
|
||||
|
||||
## v3.11.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`Line3DChart`3D折线图
|
||||
* 增加`GraphChart`关系图
|
||||
* 增加`3D`坐标系支持
|
||||
* 增加`Tooltip`的`triggerOn`设置触发条件
|
||||
* 其他问题修复和优化
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2024.06.16) 发布`v3.11.0`版本
|
||||
* (2024.06.15) 增加`Editor`下`Data`的添加、删除、上下移动操作按钮
|
||||
* (2024.06.11) 修复`Axis`的`IndicatorLabel`可能会遮挡住`Tooltip`的问题
|
||||
* (2024.06.11) 修复`Tooltip`在`Cross`时`Axis`的`IndicatorLabel`可能不显示的问题 (#315)
|
||||
* (2024.06.10) 调整`Tooltip`的`Corss`重命名为`Cross`
|
||||
* (2024.06.09) 增加`Axis`的`minCategorySpacing`设置类目轴默认的最小类目间距
|
||||
* (2024.06.09) 修复`Tooltip`的`Cross`在`Axis`是类目轴并且开启`DataZoom`的情况下指示位置不准确的问题
|
||||
* (2024.06.06) 修复`Serie`在`Clone`时动画异常问题 (#320)
|
||||
* (2024.06.04) 修复`Serie`的`state`在代码动态设置时不刷新的问题
|
||||
* (2024.05.29) 调整`XCharts`在`Hierarchy`视图下的右键菜单到`UI/XCharts`下
|
||||
* (2024.05.29) 增加`3D`坐标系对类目轴的支持
|
||||
* (2024.05.19) 优化`Editor`下的编辑性能
|
||||
* (2024.05.09) 增加`JsonUtil`工具类
|
||||
* (2024.05.01) 修复`Tooltip`每帧产生GC的问题 (#311) (by @stefanbursuc)
|
||||
* (2024.04.23) 修复`ConvertXYAxis()`多次调用后图表异常的问题
|
||||
* (2024.04.22) 修复`DataZoom`控制多个轴时的`GridCoord`获取可能不正确的问题 (#317)
|
||||
* (2024.04.22) 增加`3D`坐标系
|
||||
* (2024.04.15) 优化`DateTimeUtil`时间戳转`DateTime`接口时区的问题
|
||||
* (2024.04.15) 优化`GridCoord`在开启`GridLayout`时也显示`Left` `Right` `Top` `Bottom`参数 (#316)
|
||||
* (2024.04.14) 修复`Tooltip`的`Cross`在开启`DataZoom`的情况下`label`位置不正确的问题 (#315)
|
||||
* (2024.04.12) 修复`Candlesticks`效果不对的问题 (#313)
|
||||
* (2024.03.20) 增加`Tooltip`的`triggerOn`设置触发条件
|
||||
* (2024.03.19) 修复`Pie`在设置`ItemStyle`的`opacity`时颜色不对的问题 (#309)
|
||||
|
||||
## v3.10.2
|
||||
|
||||
* (2024.03.11) 发布`v3.10.2`版本
|
||||
* (2024.03.11) 修复`Legend`的`formatter`在设置`{d}`通配符时显示可能不匹配的问题 (#304)
|
||||
* (2024.03.11) 修复`Tooltip`移出坐标系后还显示的问题
|
||||
* (2024.03.08) 修复`Tooltip`的`title`从旧版本升级后可能不显示的问题
|
||||
|
||||
## v3.10.1
|
||||
|
||||
* (2024.02.21) 发布`v3.10.1`版本
|
||||
* (2024.02.19) 修复`Tooltip`的圆点标记不会自适应颜色的问题
|
||||
|
||||
## v3.10.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加双类目轴支持
|
||||
* 增加更多细分快捷菜单创建图表,可一键创建几十种图表
|
||||
* 增加图表边框设置,支持圆角图表
|
||||
* 修复若干问题
|
||||
|
||||
扩展功能:
|
||||
|
||||
* 增加`SankeyChart`桑基图
|
||||
* 增加`UITable`的边框设置
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2024.02.01) 发布`v3.10.0`版本
|
||||
* (2024.01.31) 修复`Tooltip`在设置`itemFormatter`为`-`后整个不显示的问题
|
||||
* (2024.01.27) 修复`TextLimit`在开启`TextMeshPro`后无效的问题 (#301)
|
||||
* (2024.01.24) 增加`Bar`支持X轴和Y轴都为`Category`类目轴
|
||||
* (2024.01.23) 增加`{y}`通配符用于获取Y轴的类目名
|
||||
* (2024.01.23) 增加`Line`支持X轴和Y轴都为`Category`类目轴
|
||||
* (2024.01.18) 修复`Animation`的`type`代码动态修改无效的问题
|
||||
* (2024.01.13) 增加`Chart`的更多快捷创建图表菜单
|
||||
* (2024.01.09) 增加`Background`的`borderStyle`,给图表默认设置圆角
|
||||
* (2024.01.07) 修复`Tooltop`的第一个`ContentLabelStyle`设置`color`无效的问题
|
||||
* (2024.01.01) 增加`BorderStyle`边框样式
|
||||
* (2023.12.26) 增加`Heatmap`的`maxCache`参数支持
|
||||
* (2023.12.25) 优化`Line`开启`clip`时绘制的顶点数
|
||||
* (2023.12.22) 修复`Scatter`散点图部分边界数据不显示的问题
|
||||
* (2023.12.21) 修复`TriggerTooltip()`接口在指定0或最大index时可能无法触发的问题
|
||||
* (2023.12.19) 修复`Legend`的`LabelStyle`设置`formatter`后不生效的问题
|
||||
* (2023.12.12) 增加`Legend`的`TextLimit`可限制图例显示文本的长度
|
||||
* (2023.12.11) 修复`Serie`添加`double.MaxValue`时坐标绘制失败的问题
|
||||
* (2023.12.10) 增加`Serie`的`minShowLabel`可隐藏小于指定值的`label`
|
||||
* (2023.12.09) 增加`LevelStyle`的`depth`指定所属层次
|
||||
* (2023.12.09) 增加`LevelStyle`的`LineStyle`设置线条样式
|
||||
* (2023.12.09) 增加`Serie`的`Link`可用于桑基图添加节点边关系
|
||||
* (2023.12.05) 增加`ResetChartStatus()`可主动重置图表状态
|
||||
|
||||
## v3.9.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`Axis`的`Animation`,完善数据变更动画效果
|
||||
* 增加`Axis`的对数轴子刻度的支持
|
||||
* 增加`MarkLine`的`onTop`设置是否显示在最上层
|
||||
* 完善代码注释和手册文档
|
||||
* 修复若干问题
|
||||
|
||||
扩展功能:
|
||||
|
||||
* `UITable`增加轮播功能
|
||||
* `UITable`增加数据操作接口和回调函数
|
||||
* `Pie3DChart`优化绘制表现
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2023.12.01) 发布`v3.9.0`版本
|
||||
* (2023.12.01) 修复`Tooltip`的`titleFormatter`设置为`{b}`后显示不准确的问题
|
||||
* (2023.11.30) 增加`SerieData`可单独添加`Label`的支持
|
||||
* (2023.11.28) 修复`Tooltip`在对数轴时指示不准确的问题
|
||||
* (2023.11.24) 修复`Chart`的`UpdateData()`接口返回值不准确的问题
|
||||
* (2023.11.24) 修复`Axis`的更新数据时效果不顺畅的问题
|
||||
* (2023.11.23) 增加`Axis`的`Animation`支持动画效果
|
||||
* (2023.11.16) 取消`Legend`的`formatter`,用`LabelStyle`的代替
|
||||
* (2023.11.14) 完善`LabelStyle`的`formatter`的注释和文档(#291)
|
||||
* (2023.11.11) 修复`Documentation`部分注释生成文档不完整的问题 (#290)
|
||||
* (2023.11.11) 修复`Legend`的`formatter`在数据变更时没有自动刷新的问题
|
||||
* (2023.11.05) 修复`SerieEventData`的`value`一直是0的问题 (#287)
|
||||
* (2023.11.03) 修复`Bar`设置渐变色时鼠标移出效果异常的问题 (#285)
|
||||
* (2023.11.02) 优化`SerieData`设置`ignore`时`formatter`的忽略问题
|
||||
* (2023.11.01) 增加`MarkLine`的`onTop`设置是否显示在最上层
|
||||
* (2023.10.21) 修复`Pie`有0数据时`Label`的位置异常的问题
|
||||
* (2023.10.21) 增加`Axis`的对数轴支持子刻度
|
||||
* (2023.10.19) 修复`Pie`设置玫瑰图时引导线异常的问题
|
||||
* (2023.10.15) 修复`Line`设置`Animation`为`AlongPath`时动画异常的问题 (#281)
|
||||
* (2023.10.12) 修复`MarkLine`指定`yValue`时对数值轴无效的问题
|
||||
* (2023.10.11) 修复`Serie`的`showDataDimension`设置无效的问题
|
||||
|
||||
## v3.8.1
|
||||
|
||||
* (2023.10.02) 发布`v3.8.1`版本
|
||||
* (2023.09.29) 修复`Bar`在水平方向时`Label`设置为`Bottom`不生效的问题
|
||||
* (2023.09.22) 增加`Line`的平滑曲线对`Dash`虚线的支持
|
||||
* (2023.09.16) 修复`Tooltip`在类目轴无数据时异常报错的问题 (#279)
|
||||
* (2023.09.16) 修复`Pie`无数据时绘制异常的问题 (#278)
|
||||
* (2023.09.12) 增加`Pie`的`radiusGradient`可设置半径方向的渐变效果
|
||||
* (2023.09.05) 优化`LabelLine`的`lineEndX`在`Pie`中的表现
|
||||
* (2023.09.05) 修复`TriggerTooltip()`接口对`Ring`无效的问题
|
||||
* (2023.09.05) 修复`Radar`数据全为0时绘制报错的问题
|
||||
|
||||
## v3.8.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 重构`Animation`动画系统,增加`新增动画`和`交互动画`的支持
|
||||
* 完善`PieChart`的动画交互表现
|
||||
* 增加`Symbol`的`EmptyTriangle`、`EmptyDiamond`、`Plus`、`Minus`四种新标记
|
||||
* 完善`Chart`的鼠标交互回调
|
||||
* 增加`LabelLine`可固定横坐标的功能
|
||||
* 增加`GridLayout`网格布局组件
|
||||
* 增加`Tooltip`的`Auto`类型
|
||||
* 优化和修复若干其他问题
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2023.09.03) 发布`v3.8.0`版本
|
||||
* (2023.09.01) 增加`Tooltip`的`Auto`自动设置显示类型和触发类型
|
||||
* (2023.08.29) 增加`Ring`的`gridIndex`支持设置指定网格
|
||||
* (2023.08.29) 增加`Radar`的`gridIndex`支持设置指定网格
|
||||
* (2023.08.29) 增加`Pie`的`gridIndex`支持设置指定网格
|
||||
* (2023.08.29) 增加`GridLayout`网格布局组件用于管理多个`GridCoord`的布局
|
||||
* (2023.08.25) 修复`MarkLine`多个时只显示一个`Label`的问题
|
||||
* (2023.08.25) 修复`MarkLine`在开启`Clip`后还绘制在坐标系外的问题
|
||||
* (2023.08.24) 优化`YAxis`在数据全为0时默认设置0-1的范围
|
||||
* (2023.08.23) 修复`YAxis`的`Label`可能会重复的问题
|
||||
* (2023.08.22) 修复`Bar`显示隐藏时绘制表现异常的问题
|
||||
* (2023.08.22) 优化`Zebra`斑马柱图的绘制表现 (#276)
|
||||
* (2023.08.16) 增加`Daemon`守护程序,解决本地开启TMP后更新版本报错问题
|
||||
* (2023.08.15) 修复`Data`数据在-1到1之间时坐标轴显示错误的问题 (#273) (by @Ambitroc)
|
||||
* (2023.08.14) 修复`XCharts`本地开启`TextMeshPro`和 `NewInputSystem`后更新版本会报错的问题 (#272)
|
||||
* (2023.08.12) 修复`Chart`在运行时被删除时会异常报错的问题 (#269)
|
||||
* (2023.08.11) 修复`DataZoom`开启时可能会导致无法添加数据的问题
|
||||
* (2023.08.11) 修复`SerieData`单独设置`ItemStyle`的`itemFormatter`不生效的问题
|
||||
* (2023.08.10) 优化`BarChart`在`Tooltip`的`Trigger`为`Item`时的表现
|
||||
* (2023.08.09) 增加`Axis`可通过设置`IconStyle`的`color`为`clear`来实现动态图标颜色的支持
|
||||
* (2023.08.08) 增加`Pie`对`LabelLine`的`lineEndX`的支持
|
||||
* (2023.08.05) 整理`Examples`的代码,删除不必要的用例
|
||||
* (2023.08.04) 增加`LabelLine`的`lineEndX`可设置引导线固定X位置的支持
|
||||
* (2023.08.04) 增加`Ring`的`avoidLabelOverlap`避免文本堆叠的支持 (#247)
|
||||
* (2023.08.03) 完善`Chart`的`onSerieEnter`,`onSerieExit`和`onSerieClick`回调
|
||||
* (2023.08.02) 修复`BarChart`的`onSerieEnter`和`onSerieExit`回调无效的问题
|
||||
* (2023.08.02) 增加`Symbol`的`Plus`加号和`Minus`减号的支持
|
||||
* (2023.07.31) 增加`Symbol`的`EmptyTriangle`和`EmptyDiamond`的支持,优化`Symbol`表现效果
|
||||
* (2023.07.31) 优化`Line`的默认配置效果
|
||||
* (2023.07.27) 增加`Serie`的`minRadius`可设置最小半径
|
||||
* (2023.07.26) 增加`MLValue`多样式数值
|
||||
* (2023.07.25) 增加`XLog`日志系统
|
||||
* (2023.07.18) 完善`Pie`饼图的交互动画效果
|
||||
* (2023.07.14) 增加`Animation`的`Interaction`交互动画配置支持
|
||||
* (2023.07.11) 增加`Animation`的`Addition`新增动画配置支持
|
||||
* (2023.07.11) 重构`Animation`动画系统,完善动画体验
|
||||
* (2023.06.30) 增加`PolarCood`的`indicatorLabelOffset`设置指示文本偏移的支持
|
||||
* (2023.06.30) 修复`Axis`的`IndicatorLabel`的背景颜色可能不正常的问题
|
||||
* (2023.06.30) 增加`Axis`的`IndicatorLabel`可自定义`color`的支持
|
||||
* (2023.06.12) 修复`AxisLabel`的`formatterFunction`在数值轴时`value`不对的问题
|
||||
|
||||
## v3.7.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`HelpDoc`官网帮助文档跳转
|
||||
* 增加`Line`对`Clip`的支持
|
||||
* 优化`Axis`的范围设置
|
||||
* 其他优化和修复
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2023.06.08) 发布`v3.7.0`版本
|
||||
* (2023.06.04) 增加`HelpDoc`帮助文档跳转
|
||||
* (2023.05.30) 修复`Serie`的名字带`_`线导致`Legend`无法触发的问题 (#259) (by @svr2kos2)
|
||||
* (2023.05.10) 增加`Axis`的`MinMaxAuto`范围类型
|
||||
* (2023.05.10) 增加`Line`对`Clip`的支持
|
||||
* (2023.05.04) 优化`Axis`在-1到1范围时设置`CeilRate`不生效的问题
|
||||
* (2023.05.04) 优化`Axis`的`MinMax`类型范围计算
|
||||
* (2023.05.04) 修复`AxisLabel`在数据都是小于1的浮点数时显示`Label`格式不对的问题
|
||||
* (2023.05.04) 修复`Theme`在修改默认主题的参数后运行被重置的问题
|
||||
* (2023.05.04) 增加`Symbol`选择`Custom`类型时的`Warning`提示
|
||||
* (2023.04.15) 修复`DataZoom`在多个图表时可能异常的问题 (#252)
|
||||
* (2023.04.14) 修复`Tooltip`在只有一个数据时可能异常的问题
|
||||
* (2023.04.14) 增加`BaseChart`的`TriggerTooltip()`接口尝试触发`ToolTip`
|
||||
* (2023.04.12) 优化`RadarCood`设置`startAngle`时文本也跟随调整位置
|
||||
* (2023.04.12) 增加`Radar`对通配符`{b}`的支持
|
||||
* (2023.04.11) 修复`Inspector`在动态添加组件时可能异常的问题
|
||||
|
||||
## v3.6.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`InputSystem`支持 (by @Bian-Sh)
|
||||
* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by @SHL-COOL)
|
||||
* 完善对`VR`的支持 (by @Ambitroc)
|
||||
* 增加`UITable`,`UIStatistic`等[扩展UI组件](https://xcharts-team.github.io/docs/ui)
|
||||
* 增加`ItemStyle`的`MarkColor`
|
||||
* 增加通配符`{h}`的支持
|
||||
* 优化`Tooltip`,`Legend`,`DataZoom`,`Axis`等组件
|
||||
* 重构相关`API`接口,完善回调接口
|
||||
* 修复若干问题
|
||||
|
||||
升级注意:
|
||||
|
||||
* 部分接口有调整,可根据提示更换下接口即可。
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2023.04.01) 发布`v3.6.0`版本
|
||||
* (2023.03.14) 修复`Tooltip`的`titleFormater`设置`{b}`可能不生效的问题
|
||||
* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by @Ambitroc)
|
||||
* (2023.03.12) 增加`LabelStyle`的`autoRotate`可设置有角度的竖版文本的自动旋转
|
||||
* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by @Ambitroc)
|
||||
* (2023.03.09) 增加`Chart`的`onSerieClick`,`onSerieDown`,`onSerieEnter`和`onSerieExit`回调
|
||||
* (2023.03.09) 修复`Pie`的点击选中偏移不生效的问题
|
||||
* (2023.03.04) 增加`Legend`的`Positions`可自定义图例的位置
|
||||
* (2023.03.03) 修复`Animation`变更动画可能无效的问题
|
||||
* (2023.02.28) 修复`Legend`点击时`Serie`的`Label`不刷新的问题
|
||||
* (2023.02.26) 增加`DataZoom`的`startEndFunction`委托
|
||||
* (2023.02.12) 重构`Component`相关代码,调整API接口
|
||||
* (2023.02.10) 修复`Axis`在`Log`轴时某些情况下最小值不正确的问题
|
||||
* (2023.02.10) 优化`Axis`的数值`Label`的默认显示格式
|
||||
* (2023.02.08) 增加`DataZoom`的`startLock`和`endLock`参数支持锁定
|
||||
* (2023.02.02) 修复`DataZoom`开启时`X轴`的`Label`可能会显示在图表外的问题
|
||||
* (2023.02.02) 优化`SerieData`的`ignore`设置时的忽略数据判断
|
||||
* (2023.02.01) 修复`XChartsMgr.ContainsChart()`接口异常
|
||||
* (2023.01.31) 增加`InputSystem`的支持 (#242) (by @Bian-Sh)
|
||||
* (2023.01.11) 修复`Inspector`上移除`Component`后图表没有及时刷新的问题 (#241)
|
||||
* (2023.01.06) 修复`Pie`在最后的几个数据都为0时`Label`显示不正常的问题 (#240)
|
||||
* (2023.01.03) 删除`Serie`的`MarkColor`,增加`ItemStyle`的`MarkColor`
|
||||
* (2022.12.29) 增加`Editor`对`List`的`+`添加编辑功能
|
||||
* (2022.12.29) 修复`UpdateXYData()`接口影响数据精度的问题 (#238)
|
||||
* (2022.12.28) 修复`Pie`只有一个数据时设置`border`后显示异常的问题 (#237)
|
||||
* (2022.12.22) 调整`Covert`重命名为`Convert`,涉及的接口有:`ConvertXYAxis()`,`CovertSerie()`等
|
||||
* (2022.12.22) 修复`Convert XY Axis`后Y轴的`Label`显示异常的问题
|
||||
* (2022.12.12) 修复`Axis`的`Value`轴在某些情况下计算数值范围不准确的问题
|
||||
* (2022.12.12) 优化`Legend`的`formatter`支持`{h}`通配符
|
||||
* (2022.12.12) 修复`Legend`的`formatter`设置为固定值时显示不正常的问题
|
||||
* (2022.12.08) 增加`AreaStyle`的`toTop`参数可设置折线图渐变色是到顶部还是到实际位置
|
||||
* (2022.12.07) 增加`Formatter`的文本通配符`{h}`支持设置当前颜色值
|
||||
|
||||
## v3.5.0
|
||||
|
||||
版本要点:
|
||||
@@ -673,7 +1003,7 @@ slug: /changelog
|
||||
* (2020.04.19) 优化`LineChart`折线图的区域填充渐变效果
|
||||
* (2020.04.19) 增加`AxisLabel`的`onZero`参数可将`Label`显示在`0`刻度上
|
||||
* (2020.04.19) 增加`Serie`和`AxisLabel`的`showAsPositiveNumber`参数将负数数值显示为正数
|
||||
* (2020.04.18) 增加`Covert XY Axis`互换XY轴配置
|
||||
* (2020.04.18) 增加`Convert XY Axis`互换XY轴配置
|
||||
* (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转
|
||||
* (2020.04.16) 修复`Check warning`在`Unity2019.3`上的显示问题
|
||||
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,170 +1,187 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
sidebar_position: 41
|
||||
slug: /faq
|
||||
---
|
||||
|
||||
# 常见问题
|
||||
|
||||
[QA 1:如何调整坐标轴与背景的边距?](#如何调整坐标轴与背景的边距)
|
||||
[QA 2:如何让初始动画重新播放?](#如何让初始动画重新播放)
|
||||
[QA 3:如何自定义折线图、饼图等数据项的颜色?](#如何自定义折线图_饼图等数据项的颜色)
|
||||
[QA 4:如何格式化文字,如我想给坐标轴标签加上单位?](#如何格式化文字_如我想给坐标轴标签加上单位)
|
||||
[QA 5:如何让柱形图的柱子堆叠显示?](#如何让柱形图的柱子堆叠显示)
|
||||
[QA 6:如何让柱形图的柱子同柱但不重叠?](#如何让柱形图的柱子同柱但不重叠)
|
||||
[QA 7:如何调整柱形图的柱子宽度和间距?](#如何调整柱形图的柱子宽度和间距)
|
||||
[QA 8:如何调整柱形图单个柱子的颜色?](#如何调整柱形图单个柱子的颜色)
|
||||
[QA 9:如何调整图表的对齐方式?](#如何调整图表的对齐方式)
|
||||
[QA 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
[QA 11:折线图可以画虚线、点线、点划线吗?](#折线图可以画虚线_点线_点划线吗)
|
||||
[QA 12:如何限定Y轴(Value轴)的值范围?](#如何限定Y轴的值范围)
|
||||
[QA 13:如何自定义数值轴刻度大小?](#如何自定义数值轴刻度大小)
|
||||
[QA 14:如何在数据项顶上显示文本?](#如何在数据项顶上显示文本)
|
||||
[QA 15:如何给数据项自定义图标?](#如何给数据项自定义图标)
|
||||
[QA 16:锯齿太严重,如何让图表更顺滑?](#锯齿太严重_如何让图表更顺滑)
|
||||
[QA 17:为什么鼠标移上图表 Tooltip 不显示?](#为什么鼠标移上图表Tooltip不显示)
|
||||
[QA 18:如何取消 Tooltip 的竖线?](#如何取消Tooltip的竖线)
|
||||
[QA 19:如何自定义 Tooltip 的显示内容?](#如何自定义Tooltip的显示内容)
|
||||
[QA 20:如何让Y轴(数值轴)显示多位小数?](#如何让Y轴显示多位小数)
|
||||
[QA 21:如何用代码动态更新数据?](#如何用代码动态更新数据)
|
||||
[QA 22:如何显示图例?为什么有时候图例无法显示?](#如何显示图例_为什么有时候图例无法显示)
|
||||
[QA 23:如何做成预设?](#如何做成预设)
|
||||
[QA 24:如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
|
||||
[QA 25:如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
|
||||
[QA 26:如何使用背景组件?有什么条件限制?](#如何使用背景组件_有什么条件限制)
|
||||
[QA 27:Mesh can not have more than 65000 vertices?](#Mesh_cannot_have_more_than_65000_vertices)
|
||||
[QA 28:为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
|
||||
[QA 29:如何修改Serie的Symbol的颜色?](#如何修改Serie的Symbol的颜色)
|
||||
[QA 30:导入或更新XCharts时TMP报错怎么办?](#导入或更新XCharts时TMP报错怎么办)
|
||||
[QA 31:支持空数据吗?如何实现折线图断开的效果?](#支持空数据吗_如何实现折线图断开的效果)
|
||||
[FAQ 1:如何调整坐标轴与背景的边距?](#如何调整坐标轴与背景的边距)
|
||||
[FAQ 2:如何让初始动画重新播放?](#如何让初始动画重新播放)
|
||||
[FAQ 3:如何自定义折线图饼图的颜色?](#如何自定义折线图饼图的颜色)
|
||||
[FAQ 4:如何给坐标轴上的文本加上单位?](#如何给坐标轴上的文本加上单位)
|
||||
[FAQ 5:如何让柱形图的柱子堆叠显示?](#如何让柱形图的柱子堆叠显示)
|
||||
[FAQ 6:如何让柱形图的柱子同柱但不重叠?](#如何让柱形图的柱子同柱但不重叠)
|
||||
[FAQ 7:如何调整柱形图的柱子宽度和间距?](#如何调整柱形图的柱子宽度和间距)
|
||||
[FAQ 8:如何调整柱形图单个柱子的颜色?](#如何调整柱形图单个柱子的颜色)
|
||||
[FAQ 9:如何调整图表的对齐方式?](#如何调整图表的对齐方式)
|
||||
[FAQ 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
[FAQ 11:折线图可以画虚线、点线、点划线吗?](#折线图可以画虚线点线点划线吗)
|
||||
[FAQ 12:如何限定Y轴的值范围?](#如何限定y轴的值范围)
|
||||
[FAQ 13:如何自定义数值轴刻度大小?](#如何自定义数值轴刻度大小)
|
||||
[FAQ 14:如何在数据项顶上显示文本?](#如何在数据项顶上显示文本)
|
||||
[FAQ 15:如何给数据项自定义图标?](#如何给数据项自定义图标)
|
||||
[FAQ 16:锯齿太严重,如何让图表更顺滑?](#锯齿太严重如何让图表更顺滑)
|
||||
[FAQ 17:为什么鼠标移上图表Tooltip不显示?](#为什么鼠标移上图表tooltip不显示)
|
||||
[FAQ 18:如何取消Tooltip的竖线?](#如何取消tooltip的竖线)
|
||||
[FAQ 19:如何自定义Tooltip的显示内容?](#如何自定义tooltip的显示内容)
|
||||
[FAQ 20:如何让y轴显示多位小数?](#如何让y轴显示多位小数)
|
||||
[FAQ 21:如何用代码动态更新数据?](#如何用代码动态更新数据)
|
||||
[FAQ 22:如何显示图例?为什么有时候图例无法显示?](#如何显示图例为什么有时候图例无法显示)
|
||||
[FAQ 23:如何做成预设?](#如何做成预设)
|
||||
[FAQ 24:如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
|
||||
[FAQ 25:如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
|
||||
[FAQ 26:如何使用背景组件?有什么条件限制?](#如何使用背景组件有什么条件限制)
|
||||
[FAQ 27:Mesh can not have more than 65000 vertices?](#mesh_cannot_have_more_than_65000_vertices)
|
||||
[FAQ 28:为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
|
||||
[FAQ 29:如何修改serie的symbol的颜色?](#如何修改serie的symbol的颜色)
|
||||
[FAQ 30:导入或更新XCharts时TMP报错如何处理?](#导入或更新xcharts时tmp报错怎么办)
|
||||
[FAQ 31:支持空数据吗?如何实现折线图断开的效果?](#支持空数据吗如何实现折线图断开的效果)
|
||||
[FAQ 32:2.x版本升级3.x版本时常见的问题有哪些?](#xcharts2升级xcharts3时常见的问题有哪些)
|
||||
[FAQ 33:折线图如何两边不留空白而从0坐标开始显示?](#折线图如何两边不留空白而从0坐标开始显示)
|
||||
[FAQ 34:如何设置部分Serie不显示Tooltip?](#如何设置部分serie不显示tooltip)
|
||||
|
||||
## 如何调整坐标轴与背景的边距
|
||||
|
||||
答:`Grid`组件,可调整上下左右边距。
|
||||
调整`Grid`组件,可调整上下左右边距。
|
||||
|
||||
## 如何让初始动画重新播放
|
||||
|
||||
答:调用`AnimationReset()`接口。
|
||||
调用`chart.AnimationReset()`接口。
|
||||
|
||||
## 如何自定义折线图_饼图等数据项的颜色
|
||||
## 如何自定义折线图饼图的颜色
|
||||
|
||||
答:通过`Theme`的`colorPalette`调整,或者部分`Serie`下的`LineStyle`和`ItemStyle`。
|
||||
通过`Theme`的`colorPalette`调整,或者部分`Serie`下的`LineStyle`和`ItemStyle`。
|
||||
|
||||
## 如何格式化文字_如我想给坐标轴标签加上单位
|
||||
## 如何给坐标轴上的文本加上单位
|
||||
|
||||
答:通过`formatter`和`numericFormatter`参数,在`Legend`、`Axis`的`AxisLabel`、`Tooltop`、`Serie`的`Label`都提供该参数的配置。
|
||||
通过`formatter`和`numericFormatter`参数,在`Legend`、`Axis`的`AxisLabel`、`Tooltop`、`Serie`的`Label`都提供该参数的配置。
|
||||
|
||||
## 如何让柱形图的柱子堆叠显示
|
||||
|
||||
答:设置`Serie`下的`stack`,`stack`相同的`serie`会堆叠显示在一个柱子上。
|
||||
设置`Serie`下的`stack`,`stack`相同的`serie`会堆叠显示在一个柱子上。
|
||||
|
||||
## 如何让柱形图的柱子同柱但不重叠
|
||||
|
||||
答:设置`Serie`下的`barGap`为`-1`,`stack`为空。
|
||||
设置`Serie`下的`barGap`为`-1`,`stack`为空。
|
||||
|
||||
## 如何调整柱形图的柱子宽度和间距
|
||||
|
||||
答:调整`Serie`下的`barWidth`和`barGap`,多个`serie`时最后一个`serie`的`barWidth`和`barGap`有效。
|
||||
调整`Serie`下的`barWidth`和`barGap`,多个`serie`时最后一个`serie`的`barWidth`和`barGap`有效。
|
||||
|
||||
## 如何调整柱形图单个柱子的颜色
|
||||
|
||||
答:可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
|
||||
可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
|
||||
|
||||
## 如何调整图表的对齐方式
|
||||
|
||||
答:调整RectTransform的锚点,和UGUI的其他组件的用法一致。
|
||||
调整RectTransform的锚点,和UGUI的其他组件的用法一致。
|
||||
|
||||
## 可以显示超过1000以上的大数据吗
|
||||
|
||||
答:可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie`的`symbol`和`label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large`和`largeThreshold`参数来开启性能模式。
|
||||
可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie`的`symbol`和`label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large`和`largeThreshold`参数来开启性能模式。
|
||||
|
||||
## 折线图可以画虚线_点线_点划线吗
|
||||
## 折线图可以画虚线点线点划线吗
|
||||
|
||||
答:可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
|
||||
可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
|
||||
|
||||
## 如何限定Y轴的值范围
|
||||
## 如何限定y轴的值范围
|
||||
|
||||
答:设置`Axis`下的`minMaxType`为`Custom`,自定义`min`和`max`。
|
||||
设置`Axis`下的`minMaxType`为`Custom`,自定义`min`和`max`。
|
||||
|
||||
## 如何自定义数值轴刻度大小
|
||||
|
||||
答:默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
|
||||
默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
|
||||
|
||||
## 如何在数据项顶上显示文本
|
||||
|
||||
答:通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
|
||||
通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
|
||||
|
||||
## 如何给数据项自定义图标
|
||||
|
||||
答:通过设置`Serie`的`data`下的数据项可单独设置`icon`相关参数。
|
||||
通过设置`Serie`的`data`下的数据项可单独设置`icon`相关参数。
|
||||
|
||||
## 锯齿太严重_如何让图表更顺滑
|
||||
## 锯齿太严重如何让图表更顺滑
|
||||
|
||||
答:开启抗锯齿设置(在`Unity`里设置)。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
|
||||
开启抗锯齿设置(在`Unity`里设置)。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
|
||||
|
||||
## 为什么鼠标移上图表Tooltip不显示
|
||||
## 为什么鼠标移上图表tooltip不显示
|
||||
|
||||
答:确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
|
||||
确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
|
||||
|
||||
## 如何取消Tooltip的竖线
|
||||
## 如何取消tooltip的竖线
|
||||
|
||||
答:设置`Tooltip`的`type`为`None`。或者调整`lineStyle`的参数。
|
||||
设置`Tooltip`的`type`为`None`。或者调整`lineStyle`的参数。
|
||||
|
||||
## 如何自定义Tooltip的显示内容
|
||||
## 如何自定义tooltip的显示内容
|
||||
|
||||
答:自定义总的内容可以通过`Tooltip`的`formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter`和`titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie`的`itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](configuration.md)。
|
||||
自定义总的内容可以通过`Tooltip`的`formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter`和`titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie`的`itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
|
||||
|
||||
## 如何让Y轴显示多位小数
|
||||
## 如何让y轴显示多位小数
|
||||
|
||||
答:设置`Axis`下的`AxisLabel`中的`formatter`为`{value:f1}`或`{value:f2}`。`1.5.0`及以上版本通过`numericFormatter`设置。
|
||||
设置`Axis`下的`AxisLabel`中的`formatter`为`{value:f1}`或`{value:f2}`。`1.5.0`及以上版本通过`numericFormatter`设置。
|
||||
|
||||
## 如何用代码动态更新数据
|
||||
|
||||
答:请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能,相关API请查看文档:[XChartsAPI接口](api.md) 。
|
||||
请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能,相关API请查看文档:[XChartsAPI接口](api.md) 。
|
||||
|
||||
## 如何显示图例_为什么有时候图例无法显示
|
||||
## 如何显示图例为什么有时候图例无法显示
|
||||
|
||||
答:首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
|
||||
首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
|
||||
|
||||
## 如何做成预设
|
||||
|
||||
答:做成prefab前,执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
|
||||
做成prefab前,执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
|
||||
|
||||
## 如何在图表上画点画线等自定义内容
|
||||
|
||||
答:`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
|
||||
`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
|
||||
|
||||
## 如何实现心电图类似的数据移动效果
|
||||
|
||||
答:参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis`和`serie`都设置相同的`maxCache`。`maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
|
||||
参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis`和`serie`都设置相同的`maxCache`。`maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
|
||||
|
||||
## 如何使用背景组件_有什么条件限制
|
||||
## 如何使用背景组件有什么条件限制
|
||||
|
||||
答:设置`background`组件的`show`为`true`。
|
||||
设置`background`组件的`show`为`true`。
|
||||
|
||||
## 区域折线图在用半透明颜色时有时候会一条叠加的线
|
||||
|
||||
答:这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
|
||||
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
|
||||
|
||||
## Mesh_cannot_have_more_than_65000_vertices
|
||||
## mesh_cannot_have_more_than_65000_vertices
|
||||
|
||||
答:这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[QA 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[FAQ 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
|
||||
## 为什么serie里设置的参数运行后又被重置了
|
||||
|
||||
答:检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
|
||||
检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
|
||||
|
||||
## 如何修改Serie的Symbol的颜色
|
||||
## 如何修改serie的symbol的颜色
|
||||
|
||||
答:`Symbol` 的颜色是使用的 `ItemStyle` 的 `color`。
|
||||
`Symbol` 的颜色是使用的 `ItemStyle` 的 `color`。
|
||||
|
||||
## 导入或更新XCharts时TMP报错怎么办
|
||||
## 导入或更新xcharts时tmp报错怎么办
|
||||
|
||||
答:XCharts默认时不开启TMP,所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决:
|
||||
XCharts默认时不开启TMP,所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决:
|
||||
|
||||
1. 找到`XCharts.Runtime.asmdef`和`XCharts.Editor.asmdef`,手动加上 `TextMeshPro`的引用
|
||||
2. 移除`PlayerSetting`中`Scripting Define Symbols`的`dUI_TextMeshPro`宏
|
||||
|
||||
## 支持空数据吗_如何实现折线图断开的效果
|
||||
`3.8.0`版本后增加[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)守护程序,将XCharts-Daemon导入项目后,在更新XCharts时守护程序会自动根据本地开启的TMP情况刷新asmdef,确保编译正常。
|
||||
|
||||
答:`Serie`的`data`是`double`类型,所以无法表示空数据。可通过开启`Serie`的`ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
|
||||
## 支持空数据吗如何实现折线图断开的效果
|
||||
|
||||
`Serie`的`data`是`double`类型,所以无法表示空数据。可通过开启`Serie`的`ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
|
||||
|
||||
## xcharts2升级xcharts3时常见的问题有哪些
|
||||
|
||||
1. 'XCharts.Runtime.XChartsMgr' is missing the class attribute 'ExtensionOfNativeClass'!
|
||||
3.x版本时不需要挂载XChartsMgr,直接删掉场景上的`_xcharts_`节点即可。
|
||||
|
||||
## 折线图如何两边不留空白而从0坐标开始显示
|
||||
|
||||
设置X轴的`boundaryGap`参数。
|
||||
|
||||
## 如何设置部分serie不显示tooltip
|
||||
|
||||
`serie`的`itemStyle`的`itemFormatter`设置为`-`可以忽略`tooltip`。
|
||||
|
||||
BIN
Documentation~/zh/img/tutorial01_axisdata.png
Normal file
BIN
Documentation~/zh/img/tutorial01_axisdata.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
Documentation~/zh/img/tutorial01_seriedata.png
Normal file
BIN
Documentation~/zh/img/tutorial01_seriedata.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
BIN
Documentation~/zh/img/xcharts.png
Normal file
BIN
Documentation~/zh/img/xcharts.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
@@ -1,82 +1,102 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
title: 订阅服务
|
||||
sidebar_position: 51
|
||||
slug: /support
|
||||
---
|
||||
|
||||
# 订阅服务
|
||||
|
||||
如需技术支持,可订阅`个人VIP`服务。扫后面的二维码后可加VIP群`867291970`,验证信息请输入付费的账号。
|
||||
企业商务合作可联系QQ:3525422251(XCharts技术支持)。
|
||||
如需技术支持和购买扩展图表,可订阅`VIP`服务。详情可查看以下内容,也可以加QQ`3525422251(XCharts技术支持)`或发邮件到`monitor1394@gmail.com`进行咨询。
|
||||
|
||||
企业商务合作可QQ和邮件咨询。
|
||||
|
||||
## 订阅VIP服务
|
||||
|
||||
订阅服务分个人订阅和企业订阅:
|
||||
订阅服务分`个人订阅`和`企业订阅`:
|
||||
|
||||
- `个人`订阅:`个人VIP`属于个人,不可转让,`XCharts`团队只服务于订阅当事人。
|
||||
- `企业`订阅:`企业VIP`属于企业,席位内可安排固定职员,职员离职后席位可重新安排,`XCharts`团队通过专属企业群为企业服务。
|
||||
- __个人订阅__:`个人VIP`属于个人,不可转让,`XCharts`团队只服务于订阅当事人。
|
||||
- __企业订阅__:`企业VIP`属于企业,席位内可安排固定职员,职员离职后席位可重新安排,`XCharts`团队通过专属企业群为企业服务。
|
||||
|
||||
订阅服务的优势?
|
||||
订阅服务有哪些优势?
|
||||
|
||||
- 提高工作效率,节省时间成本。一方面,`XCharts`功能强大,相关配置项非常多,`VIP`服务可快速帮您定位,节省去查找和核对的时间;另一方面,`VIP`的即时回答服务可快速为您答疑解惑,避免中断开发流程。总之,订阅`VIP`可让您能快速上手,快速处理问题,至少能提高`10`倍以上的工作效率。
|
||||
- 更多技术交流,更多经验交流。`XCharts`团队成员从业多年,有丰富的技术和工作经验。`VIP`服务不仅可以交流`XCharts`相关的内容,也可以咨询其他方面的技术。`VIP`群也有更多的交流。
|
||||
- 扩展图表的需要订阅`VIP`服务后才能购买,扩展图表超过1年后的更新支持也需要持续订阅`VIP`服务。
|
||||
- `VIP`用户可加入`XCharts`的`GitHub`组织,参与`XCharts`社区构建,访问专有仓库。
|
||||
- __提高工作效率,节省时间成本__。`XCharts`功能强大,配置项众多,`VIP`服务可快速帮您定位,节省查找和核对的时间;`VIP`的即时回答服务可快速为您答疑解惑,快速上手,提高工作效率。
|
||||
- __更多技术交流,更多经验交流__。`XCharts`团队成员从业多年,有丰富的技术和工作经验。`VIP`服务不仅可以交流`XCharts`相关的内容,也可以咨询其他方面内容。`VIP`群也有更多的交流碰撞。
|
||||
- __订阅扩展图表,获得更新支持__。扩展图表需要订阅`VIP`服务后才能购买,扩展图表超过1年后的更新支持也需要持续订阅`VIP`服务。
|
||||
- __加入团队组织,参与社区建设__。订阅`VIP`后可加入`GitHub`组织,参与社区建设,访问专有仓库,扩展图表仓库等其他私有仓库。
|
||||
- __专属高级功能,专属身份标识__。订阅`VIP`后可以享有扩展UI组件,扩展图表等其他高级功能,XCharts后续也会陆续推出更多高级功能。在`XCharts交流群`里拥有`专属头衔`,方便快速识别,优先响应,第一时间回复VIP用户的各种问题。
|
||||
|
||||
| |免费用户|付费咨询|个人`VIP` | 个人`SVIP` | 企业`VIP` |
|
||||
| ----- |--|--|--|--|--|
|
||||
| 订阅费用 | -- | `98`¥ | `298`¥ | 首年`1298`¥<br/>后续`298¥`* | `联系我们` |
|
||||
| 订阅时长 | -- | `7`天* | `1`年 | `1`年* | `1`年
|
||||
| 订阅席位 | -- | `1`个席位 | `1`个席位 |`1`个席位|`5`个以上席位|
|
||||
| |免费用户|付费咨询|个人`VIP` | 个人`SVIP` | 企业`VIP` | 企业`SVIP` |
|
||||
| ----- |--|--|--|--|--|--|
|
||||
| 订阅费用 | -- | `98`¥ | `298`¥ | 首年`1298`¥<br/>后续`298¥`* | 首年`1698`¥<br/>后续`298¥`* | `联系我们` |
|
||||
| 订阅时长 | -- | `7`天* | `1`年 | `1`年 | `1`年 | `1`年 |
|
||||
| 拥有席位 | -- | `1`个席位 | `1`个席位 |`1`个席位|`1`个席位|`5`个以上席位|
|
||||
| 增加席位 | -- | -- | -- | -- |支持|支持|
|
||||
| __`服务方式:`__|
|
||||
| 官方QQ群交流 | √ | √ | √ | √ | √ |
|
||||
| 即时一对一交流 | | √ | √ | √ | √ |
|
||||
| 专属VIP群交流 | | | √ | √ | √(专属企业群) |
|
||||
| 官方QQ群交流 | √ | √ | √ | √ | √ | √ |
|
||||
| QQ一对一交流 | | √ | √ | √ | √ | √ |
|
||||
| 专属VIP群交流 | | | √ | √ | √ | √ |
|
||||
| 微信交流 | | | | | √ | √(企业专属群) |
|
||||
| 电话交流 | | | | | | √ |
|
||||
| __`服务内容:`__|
|
||||
| 可商用 | √ | √ | √ | √ | √ |
|
||||
| 可二次开发 | √ | √ | √ | √ | √ |
|
||||
| 有问必答 | | √ | √ | √ | √ |
|
||||
| 即时回答 | | √ | √ | √ | √ |
|
||||
| 新手指导 | | √ | √ | √ | √ |
|
||||
| 开发指导 | | √ | √ | √ | √ |
|
||||
| 优化指导 | | √ | √ | √ | √ |
|
||||
| 其他技术支持 | | | √ | √ | √ |
|
||||
| 问题及时处理 | | | √ | √ | √ |
|
||||
| 需求优先考虑 | | | √ | √ | √ |
|
||||
| 可另付费定制 | | | √ | √ | √ |
|
||||
| 可另付费加急 | | | √ | √ | √ |
|
||||
| VIP专有功能教程和文档 | | | √待开放 | √待开放 | √待开放 |
|
||||
| 扩展图表购买 | | | 按需购买 | __全部免费__ | __全部免费__ |
|
||||
| 扩展图表源码 | | | 永久持有 | 永久持有 | 永久持有 |
|
||||
| 扩展图表更新 | | | 1年更新支持 | 1年更新支持 | 1年更新支持 |
|
||||
| 可商用可二次开发 | √ | √ | √ | √ | √ | √ |
|
||||
| 有问即答 | | √ | √ | √ | √ | √ |
|
||||
| 新手入门指导 | | √ | √ | √ | √ | √ |
|
||||
| 开发优化指导 | | √ | √ | √ | √ | √ |
|
||||
| 其他技术支持 | | | √ | √ | √ | √ |
|
||||
| 问题及时处理 | | | √ | √ | √ | √ |
|
||||
| 需求优先考虑 | | | √ | √ | √ | √ |
|
||||
| 可另付费定制 | | | √ | √ | √ | √ |
|
||||
| 可另付费加急 | | | √ | √ | √ | √ |
|
||||
| 扩展UI组件 | | | √ | √ | √ | √ |
|
||||
| 首页赞助展示 | | | | | | √ |
|
||||
| 付费方式 | | | 二维码 | 二维码 | __公对公转账__* | __公对公转账__* |
|
||||
| 支持开发票 | | | 普票 | 普票 | __可开专票__ | __可开专票__ |
|
||||
| 扩展图表购买 | | | 按需购买 | __全部免费__* | __全部免费__* | __全部免费__* |
|
||||
| 扩展图表源码 | | | 永久持有 | 永久持有 | 永久持有 | 永久持有 |
|
||||
| 扩展图表更新 | | | 1年更新支持 | 1年更新支持 | 1年更新支持 | 1年更新支持 |
|
||||
| Github仓库 | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)<br/>[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)<br/>[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)<br/>[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)<br/>[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)<br/>[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)<br/>[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) |
|
||||
|
||||
>备注:
|
||||
>*__`付费定制`__ 用户可根据自己的需求可付费定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
|
||||
>*__`付费加急`__ 用户可对已在开发计划中或正在开发中的功能进行付费加急,将开发优先级提到最高,并可要求在指定`截止日期`内交付,只有`VIP`用户才享有`付费加急`权利。
|
||||
>*__`付费咨询`__ 付费咨询有效期`7`天,且总咨询时长不超过`7`个小时。
|
||||
>*__`扩展图表`__ 购买后代码可永久持有和商用,1年的更新和技术支持。可继续订阅VIP延长服务时间。
|
||||
>*__`全部免费`__ 是指在订阅期间的`个人SVIP`和`企业VIP`的订阅用户,可免费使用全部的扩展图表。
|
||||
>*__`次年付费`__ 个人SVIP和企业VIP的首年和次年付费不一样,次年付费都是`298¥`。
|
||||
>*__`增加席位`__ 企业VIP支持增加席位,每个席位`298¥`一年。
|
||||
>*__`对公转账`__ 有开专票需求时,可用企业银行帐号进行公对公转账支付。二维码支付不支持开专票,只能开普票。发票默认都是电子发票。
|
||||
>*__`登记资料`__ 订阅成功后,需提供手机号和Github帐号进行登记,手机号用于确认归属,Github帐号用于加入Github的Team组织,下载源码。
|
||||
|
||||
## 购买扩展图表
|
||||
|
||||
扩展图表为另付费购买图表,只对订阅了`VIP`服务的用户开放购买。对于`SVIP`的订阅用户,所有扩展图表仓库可免费使用,不用再单独购买。
|
||||
扩展图表为另付费购买图表,只对订阅了`VIP`服务的用户开放购买。对于`个人SVIP`和`企业VIP`的订阅用户,所有扩展图表仓库在订阅期间可全部免费使用,不用再单独购买。
|
||||
|
||||
对所有已购买的扩展图表,源码可永久持有,并获得持续一年的更新支持,一年后如需更新支持服务,可继续订阅`VIP`服务。
|
||||
对所有已购买的扩展图表,源码可永久持有但不能传播,并获得持续一年的更新支持和技术服务,一年后如需更新支持等服务,可再继续订阅`VIP`服务。
|
||||
|
||||
|编号|扩展图表|价格|备注|
|
||||
|编号|扩展图表|扩展图表|价格|
|
||||
|--|--|--|--|
|
||||
| 101 | PictorialBarChart | 98¥ | 象形柱图 |
|
||||
| 102 | FunnelChart | 98¥ | 漏斗图 |
|
||||
| 103 | PyramidChart | 98¥ | 3D金字塔 |
|
||||
| 104 | TreemapChart | 98¥ | 树形矩图 |
|
||||
| 201 | Bar3DChart | 198¥ | 3D柱图 |
|
||||
| 202 | Pie3DChart | 198¥ | 3D饼图 |
|
||||
| 203 | GanttChart | 198¥ | 甘特图 |
|
||||
| 204 | GaugeChart | 198¥ | 仪表盘 |
|
||||
| 205 | LiquidChart | 198¥ | 水位图 |
|
||||
| 101 | [象形柱图](https://xcharts-team.github.io/docs/pictorialbar) |PictorialBarChart | 98¥ |
|
||||
| 102 | [漏斗图](https://xcharts-team.github.io/docs/funnel) |FunnelChart | 98¥ |
|
||||
| 103 | [3D金字塔](https://xcharts-team.github.io/docs/pyramid) |PyramidChart | 98¥ |
|
||||
| 104 | [树形矩图](https://xcharts-team.github.io/docs/treemap) |TreemapChart | 98¥ |
|
||||
| 105 | [桑基图](https://xcharts-team.github.io/docs/sankey) |SankeyChart | 98¥ |
|
||||
| 201 | [3D柱图](https://xcharts-team.github.io/docs/bar3d) |Bar3DChart | 198¥ |
|
||||
| 202 | [3D饼图](https://xcharts-team.github.io/docs/pie3d) |Pie3DChart | 198¥ |
|
||||
| 203 | [甘特图](https://xcharts-team.github.io/docs/gantt) |GanttChart | 198¥ |
|
||||
| 204 | [仪表盘](https://xcharts-team.github.io/docs/gauge) |GaugeChart | 198¥ |
|
||||
| 205 | [水位图](https://xcharts-team.github.io/docs/liquid) |LiquidChart | 198¥ |
|
||||
| 206 | [3D折线图](https://xcharts-team.github.io/docs/line3d) |Line3DChart | 198¥ |
|
||||
| 207 | [关系图](https://xcharts-team.github.io/docs/graph) |GraphChart | 198¥ |
|
||||
|
||||
## 备注说明
|
||||
|
||||
1. __`付费定制`__ 是指用户可根据自己的需求定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
|
||||
2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并可要求在`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。
|
||||
3. __`付费咨询`__ 付费咨询有效期`7`天,且总咨询时长不超过`7`个小时。
|
||||
4. __`扩展图表`__ 购买后代码可永久持有和商用,1年的更新支持。
|
||||
扩展图表的在线效果图也可以查看[WebGL在线Demo](https://xcharts-team.github.io/examples/)
|
||||
|
||||
## 捐助支持
|
||||
|
||||
如果这个项目对您有帮助,请右上方点 `Star` 予以支持!也欢迎任意金额的捐助,非常您的支持!
|
||||
如果这个项目对您有帮助,请右上方点 `Star` 予以支持!也欢迎扫后面的二维码进行任意金额的捐助,XCharts需要您的支持和帮助。
|
||||
|
||||
## 二维码
|
||||
|
||||
如果看不到二维码图片,可以加Q联系`XCharts技术支持:3525422251`或邮件`monitor1394@gmail.com`咨询。
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -1,77 +1,127 @@
|
||||
---
|
||||
title: 入门教程:5分钟上手 XCharts 3.0
|
||||
sidebar_position: 1
|
||||
sidebar_position: 11
|
||||
slug: /tutorial01
|
||||
---
|
||||
|
||||
# 教程:5分钟上手 XCharts 3.0
|
||||
|
||||
## 获取和导入 XCharts
|
||||
> Note:本教程仅适用XCharts 3.x版本,2.x版本请看 [教程:5分钟上手XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/教程:5分钟上手XCharts.md)
|
||||
|
||||
XCharts可通过以下任意一种方式导入到项目:
|
||||
## XCharts的前提条件
|
||||
|
||||
- 直接将XCharts源码到项目
|
||||
XCharts是一个Unity图表插件,目前只能在Unity平台使用。
|
||||
|
||||
下载好XCharts源码后,直接将XCharts目录拷贝到Unity项目工程的Assets目录下。
|
||||
使用XCharts前,你需要:
|
||||
|
||||
- 通过`Assets/Import Package`导入XCharts
|
||||
- 掌握Unity的基本用法。
|
||||
- 掌握UGUI制作UI的基本用法。
|
||||
- 了解Unity的MonoBehavior脚本用法,知道怎么挂脚本和用代码操作脚本。
|
||||
|
||||
下载好XCharts的.unitypackage文件后,打开Unity,菜单栏 Assets-->Import Package-->选中.unitypackage导入即可开始使用XCharts。
|
||||
如果你刚接触Unity,建议先学习Unity相关的基础教程再使用XCharts。
|
||||
|
||||
- 通过`Package Manager`导入XCharts
|
||||
## XCharts的获取和导入
|
||||
|
||||
对于Unity 2018.3以上版本,可通过 Package Manager来导入XCharts,打开Package Manager后,通过 `Add package form git URL...`,输入XCharts3.0的GitHub URL: `https://github.com/XCharts-Team/XCharts.git#3.0` 稍等片刻后即可使用XCharts。
|
||||
XCharts主要通过Github来维护更新和发布,可以到【Github主页】(https://github.com/XCharts-Team)进行下载获取源码和Pacakge;对于无Github访问条件的用户,可以访问[【国内镜像】](https://gitee.com/monitor1394/unity-ugui-XCharts)进行下载。国内镜像的版本更新可能会相对滞后。
|
||||
|
||||
也可以直接将package加入到`manifest.json`文件:打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
|
||||
XCharts可通过以下任意一种方式导入到你的项目:
|
||||
|
||||
``` json
|
||||
"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git#3.0",
|
||||
```
|
||||
### 直接将XCharts源码拷贝到项目
|
||||
|
||||
如需更新`XCharts`,删除`manifest.json`文件(部分Unity版本可能是packages-lock.json文件)的`lock`下的`com.monitor1394.xcharts`相关内容即会重新下载编译。
|
||||
下载好XCharts源码后,直接将XCharts目录拷贝到Unity项目工程的Assets目录下。编译通过后即可使用。
|
||||
|
||||
## 添加一个简单图表
|
||||
### 通过Import Package导入XCharts
|
||||
|
||||
在`Hierarchy`视图下右键或菜单栏`GameObject`下拉选择`XCharts->LineChart`,即可快速创建一个默认的折线图出来:
|
||||
下载好XCharts的.unitypackage文件后,打开Unity,菜单栏 Assets-->Import Package-->选中下载好的.unitypackage进行导入。导入完成并通过编译后即可开始使用XCharts。
|
||||
|
||||
### 通过Package Manager导入XCharts
|
||||
|
||||
对于2018.3以上的Unity版本,可通过Package Manager来导入XCharts,打开Package Manager后,通过 `Add package form git URL...`,输入XCharts的GitHub URL: `https://github.com/XCharts-Team/XCharts.git` 编译通过后即可使用XCharts。
|
||||
|
||||
对于部分Unity版本,也可以直接将package加入到`manifest.json`文件:打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
|
||||
|
||||
>"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git",
|
||||
|
||||
如需更新`XCharts`,删除`manifest.json`文件(部分Unity版本可能是packages-lock.json文件)的`lock`下的`com.monitor1394.xcharts`相关内容即会重新下载编译。
|
||||
|
||||
### 建议导入XCharts的守护程序
|
||||
|
||||
守护程序[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)可以确保更新时编译正常,当本地开启TextMeshPro或NewInputSystem时将会非常有用。将XCharts-Daemon导入项目后,在更新XCharts时守护程序会自动根据本地TMP等的开启情况刷新XCharts的asmdef,确保编译正常,不用手动去解决,方便CI/CD等自动化流程执行。
|
||||
|
||||
XCharts-Daemon的导入方式可参考刚才的XCharts导入方式。可以通过源码或Package的方式导入项目,XCharts-Daemon的Github URL:https://github.com/XCharts-Team/XCharts-Daemon.git
|
||||
|
||||
## XCharts的基本使用
|
||||
|
||||
导入XCharts并编译通过后,Unity编辑器的菜单栏会显示XCharts,这时可以开始使用XCharts了。
|
||||
|
||||
>Note:Unity的菜单栏出现XCharts菜单时才表示XCharts可用。
|
||||
|
||||
### 添加一个简单图表
|
||||
|
||||
在`Hierarchy`视图下右键`UI->XCharts->LineChart`或菜单栏`XCharts`下拉选择`LineChart`,即可快速创建一个默认的折线图:
|
||||
|
||||

|
||||
|
||||
## 添加多个Seire
|
||||
如需在某个节点下创建图表,可以选中节点右键`UI->XCharts->LineChart`即可在节点下创建图表。
|
||||
|
||||
### 修改图表数据
|
||||
|
||||
刚创建的图表,它的数据可以在Inspector视图面板上进行修改。
|
||||
|
||||
对于X轴数据,可通过:`XAxis->Data`展开后进行增删和修改:
|
||||
|
||||

|
||||
|
||||
对于Serie数据,可通过:`Serie->Data`展开后进行增删和修改:
|
||||
|
||||

|
||||
|
||||
Serie支持多维数据,一般折线图只用到二维数据:第一维表示X轴类目数据的编号,第二维表示对应的数值。
|
||||
|
||||
### 添加多个Seire
|
||||
|
||||
在`Inspector`视图,找到`LineChart`的面板,通过`Add Serie`按钮,可以添加第二条`Line`折线:
|
||||
|
||||

|
||||

|
||||
|
||||
## 添加其他组件
|
||||
>Note:Serie通过`Add Serie`按钮添加。可添加不同类型的Serie。[XCharts有哪些Serie?](https://xcharts-team.github.io/docs/configuration#serie-系列)
|
||||
|
||||
### 添加其他主组件
|
||||
|
||||
默认图表没有`Legend`,需要`Legend`组件可通过`Add Component`按钮添加:
|
||||
|
||||

|
||||
|
||||
## 添加Serie组件
|
||||
>Note:主组件通过`Add Component`按钮添加。[XCharts有哪些主组件?](https://xcharts-team.github.io/docs/configuration/#maincomponent-主组件)
|
||||
|
||||
Serie只自带了几个常见的组件,其他组件按需额外添加。比如,需要给折线图区域填充颜色,可单独给`Serie`添加`AreaStyle`组件:
|
||||
### 添加Serie组件
|
||||
|
||||
Serie只自带了几个常见的组件,其他组件用到时需额外添加。比如,需要给折线图进行区域填充颜色,可单独给`Serie`添加`AreaStyle`组件:
|
||||
|
||||

|
||||

|
||||
|
||||
## 添加SerieData组件
|
||||
>Note:Serie组件通过Serie右边的按钮添加。[XCharts有哪些Serie组件?](https://xcharts-team.github.io/docs/configuration/#iseriecomponent-可添加到serie的组件)
|
||||
|
||||
如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加`Component`。比如我们给折线图的第二个数据单独显示`Label`:
|
||||
### 添加SerieData组件
|
||||
|
||||
如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加组件。比如我们给折线图的第二个数据单独显示`Label`:
|
||||
|
||||

|
||||

|
||||
|
||||
## 更多组件和配置参数
|
||||
>Note:SerieData组件通过展开SerieData后Component右边的按钮添加。[XCharts有哪些SerieData组件?](https://xcharts-team.github.io/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
|
||||
|
||||
XCharts经过不断的迭代优化,目前已有多达几十种的主组件和子组件,每个组件有几个至几十个不等的可配置参数,以支持各种灵活而复杂的功能。
|
||||
### 更多组件和配置参数
|
||||
|
||||
首次使用XCharts,可在 `Inspector` 视图添加各种图表,给图表添加或调整里面组件,`Game` 视图会实时反馈调整后的效果,以熟悉各种组件的使用。各个组件的详细参数说明可查阅[XCharts配置项手册](configuration.md)。
|
||||
XCharts经过不断的迭代优化,目前已有多达几十种的主组件和子组件,每个组件有几个到几十个的可配置参数,用来支持多样化的功能。
|
||||
|
||||
## 如何快速调整参数
|
||||
首次使用XCharts,建议亲自去测试下各个图表各个组件的实际效果。`Inspector` 视图可以直接添加各种图表,各种组件以及调整各个配置参数,`Game` 视图会实时反馈调整后的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](configuration.md)。
|
||||
|
||||
`XCharts`是配置和数据来驱动的。想要什么效果,只需要去调整对应组件下的配置参数就可以,不需要去改`Hierarchy`视图下的节点,因为那些节点是由`XCharts`内部根据配置和数据生成的,即使改了也会在刷新时还原回来。
|
||||
### 如何快速调整参数
|
||||
|
||||
XCharts是数据和参数驱动的。想要什么效果,只需要去调整对应组件下的配置参数就可以,不能去改`Hierarchy`视图下的节点,因为那些节点是由XCharts内部根据配置和数据生成的,即使改了也会在刷新时被还原掉。
|
||||
|
||||
如何快速定位你想要改的效果所对应的组件,这就需要对组件有一定的了解。比如我们想要让X轴的轴线末端显示箭头,如何定位?第一步,X轴定位到`XAxis0`;第二步,轴线定位到`AxisLine`;最后,再去看`AxisLine`组件下有没有这样的参数可以实现这个效果,对于不太确定的参数可以查阅[XCharts配置项手册](configuration.md)。
|
||||
|
||||
@@ -81,13 +131,13 @@ XCharts经过不断的迭代优化,目前已有多达几十种的主组件和
|
||||
2. 如果`Serie`的`ItemStyle`配置有非`0000`颜色值,则优先用这个颜色值。
|
||||
3. 否则颜色值取自主题`Theme`的`Color Palette`。
|
||||
|
||||
通常颜色值为0000时表示用主题默认颜色,配置为0或null时表示用主题默认配置。
|
||||
>Note:通常颜色值为0000时表示用主题默认颜色;其他参数为0或null时表示用主题默认配置;设置颜色时注意透明度。
|
||||
|
||||
## 用代码添加折线图
|
||||
### 用代码添加折线图
|
||||
|
||||
给`gameObject`挂上`LineChart`脚本:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
@@ -98,49 +148,57 @@ if (chart == null)
|
||||
|
||||
调整大小:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTransform,或直接在Inspector上改
|
||||
```
|
||||
|
||||
设置标题:
|
||||
|
||||
```C#
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple Line";
|
||||
```
|
||||
|
||||
设置提示框和图例是否显示:
|
||||
|
||||
```C#
|
||||
var tooltip = chart.GetOrAddChartComponent<Tooltip>();
|
||||
```csharp
|
||||
var tooltip = chart.EnsureChartComponent<Tooltip>();
|
||||
tooltip.show = true;
|
||||
|
||||
var legend = chart.GetOrAddChartComponent<Legend>();
|
||||
var legend = chart.EnsureChartComponent<Legend>();
|
||||
legend.show = false;
|
||||
```
|
||||
|
||||
设置坐标轴:
|
||||
|
||||
```C#
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
```csharp
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
```
|
||||
|
||||
清空默认数据,添加`Line`类型的`Serie`用于接收数据:
|
||||
清空所有默认数据(包含Serie),添加`Line`类型的`Serie`用于接收数据:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>("line");
|
||||
```
|
||||
|
||||
如果Serie是固定的,建议只是清空数据,不用把Serie也清掉:
|
||||
|
||||
```csharp
|
||||
chart.ClearData();
|
||||
```
|
||||
|
||||
这样可以提前在UI上设置好Serie的配置参数。
|
||||
|
||||
添加10个数据:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
@@ -152,30 +210,26 @@ for (int i = 0; i < 10; i++)
|
||||
|
||||

|
||||
|
||||
如果一个Chart里面有多个系列时,则Axis的data只需要加一次,不要多个循环加重复了。记住:Axis的数据个数要和Serie的数据个数一致。
|
||||
如果一个Chart里面有多个系列时,则Axis的data只需要加一次,不要多个循环加重复了。
|
||||
|
||||
>记住:Axis的数据个数要和Serie的数据个数一致。
|
||||
|
||||
完整代码请查阅`Examples`:`Example13_LineSimple.cs`
|
||||
|
||||
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](configuration.md)里面的所有参数都是可以通过代码控制的。
|
||||
|
||||
另外,除非定制,建议调用`Chart`下提供的`public`接口,特别是数据相关操作部分。这些接口内部会做一些关联处理,比如刷新图表等。常见的接口有:
|
||||
### 设置默认字体
|
||||
|
||||
1. `chart.ClearData()`:清空图表数据(不移除Series)
|
||||
2. `chart.RemoveData()`:清除图表数据(会移除所有Serie)
|
||||
3. `chart.AddSerie()`:添加Serie
|
||||
4. `chart.AddXAxisData()`:添加X轴数据
|
||||
5. `chart.AddData()`:添加Serie数据
|
||||
6. `chart.UpdateData()`:更新Serie数据
|
||||
7. `chart.UpdateXAxisData()`:更新X轴数据
|
||||
8. `chart.UpdateDataName()`:更新Serie数据的名字
|
||||
XCharts默认使用的是Unity默认字体`Arial`,在WebGL平台上可能无法显示中文。在将XCharts用在你的项目时,建议先设置好字体:
|
||||
|
||||
XCharts内部有自动刷新机制,但也是在一定条件才会触发。如果自己调用了内部组件的接口,碰到组件没有刷新,确实找不到原因的话,可以用以下两个接口强制刷新:
|
||||
- 找到`XCharts/Resources/XCSetting.asset`资源,修改里面的`Font`并保存。
|
||||
- 找到`XCharts/Resources/XCTheme-Default.asset`和`XCharts/Resources/XCTheme-Default.asset`两个字体配置,点击`Sync Font from Setting`和`Sync Font to Sub Theme`按钮将字体同步到主题配置文件上。
|
||||
|
||||
1. `chart.RefreshAllComponent()`:刷新图表组件,会重新初始化所有组件,不建议频繁待用。
|
||||
2. `chart.RefreshChart()`:刷新图表绘制,只刷新绘制部分,不会刷新组件文本,位置等部分。
|
||||
3. 各个组件也可以通过`SetAllDirty()`只刷新自己。
|
||||
字体设置好后,新创建的图表就会用新设置的字体了。对于旧图表,可以点击`Rebuild Chart Object`进行刷新。
|
||||
|
||||
## 使用TextMeshPro
|
||||
>Note:使用XCharts前建议先设置好字体;更新XCharts时注意设置的字体可能被还原的问题。
|
||||
|
||||
### 使用TextMeshPro
|
||||
|
||||
XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换。可通过以下方式开启和关闭:
|
||||
|
||||
@@ -192,30 +246,53 @@ XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换
|
||||
1. 找到`XCharts.Runtime.asmdef`和`XCharts.Editor.asmdef`,手动加上 `TextMeshPro`的引用
|
||||
2. 移除`PlayerSetting`中`Scripting Define Symbols`的`dUI_TextMeshPro`宏
|
||||
|
||||
## 用代码改图表参数
|
||||
`3.8.0`版本后增加[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)守护程序,将XCharts-Daemon导入项目后,在更新XCharts时守护程序会自动根据本地开启的TMP情况刷新asmdef,确保编译正常。
|
||||
|
||||
## XCharts的代码控制
|
||||
|
||||
`Inspector`上看到的所有参数都可以用代码来修改,关键是要定位好你要改的参数是在组件上、还是Serie上、还是在具体的数据项SerieData上。
|
||||
|
||||
另外,除非定制,建议调用`Chart`下提供的`public`接口,特别是数据相关和列表的操作。这些接口内部会做一些关联处理,比如刷新图表等。常见的接口有:
|
||||
|
||||
1. `chart.ClearData()`:清空图表数据(不移除Series)
|
||||
2. `chart.RemoveData()`:清除图表数据(会移除所有Serie)
|
||||
3. `chart.AddSerie()`:添加Serie
|
||||
4. `chart.AddXAxisData()`:添加X轴数据
|
||||
5. `chart.AddData()`:添加Serie数据
|
||||
6. `chart.UpdateData()`:更新Serie数据
|
||||
7. `chart.UpdateXAxisData()`:更新X轴数据
|
||||
8. `chart.UpdateDataName()`:更新Serie数据的名字
|
||||
|
||||
XCharts内部有自动刷新机制,但也是在一定条件才会触发。如果自己调用了内部组件的接口,碰到组件没有刷新,确实找不到原因的话,可以用以下两个接口强制刷新:
|
||||
|
||||
1. `chart.RefreshAllComponent()`:刷新图表组件,会重新初始化所有组件,不建议频繁待用。
|
||||
2. `chart.RefreshChart()`:刷新图表绘制,只刷新绘制部分,不会刷新组件文本,位置等部分。
|
||||
3. 各个组件也可以通过`SetAllDirty()`只刷新自己。
|
||||
|
||||
>Note:用API去操作数据和各种list,而不是直接访问list进行处理
|
||||
|
||||
### 改主组件上的参数
|
||||
|
||||
需要先获取组件,再修改里面的参数:
|
||||
|
||||
```C#
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple LineChart";
|
||||
title.subText = "normal line";
|
||||
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
```
|
||||
|
||||
> 注:低版本没有`EnsureChartComponent()`接口时,用`GetOrAddChartComponent()`
|
||||
|
||||
### 改Serie的参数
|
||||
|
||||
对于新添加的Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serie = chart.AddSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -227,7 +304,7 @@ serie.roundCap = true;
|
||||
|
||||
对于已存在的Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serie = chart.GetSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -239,21 +316,21 @@ serie.roundCap = true;
|
||||
|
||||
给Serie添加额外组件:
|
||||
|
||||
```C#
|
||||
serie.AddExtraComponent<AreaStyle>();
|
||||
```csharp
|
||||
serie.EnsureComponent<AreaStyle>();
|
||||
|
||||
var label = serie1.AddExtraComponent<LabelStyle>();
|
||||
var label = serie1.EnsureComponent<LabelStyle>();
|
||||
label.offset = new Vector3(0,20,0);
|
||||
```
|
||||
|
||||
### 改数据项SerieData上的参数
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serieData = chart.AddData(0, 20);
|
||||
//var serieData = serie.GetSerieData(0); //从已有数据中获取
|
||||
serieData.radius = 10;
|
||||
|
||||
var itemStyle = serieData.GetOrAddComponent<ItemStyle>(); //给数据项添加ItemStyle组件
|
||||
var itemStyle = serieData.EnsureComponent<ItemStyle>(); //给数据项添加ItemStyle组件
|
||||
itemStyle.color = Color.blue;
|
||||
|
||||
```
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
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 btnConvertXYAxis = new GUIContent("Convert XY Axis", "");
|
||||
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Chart Object", "");
|
||||
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
|
||||
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
|
||||
@@ -273,8 +273,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
if (m_Chart.HasChartComponent<XAxis>() && m_Chart.HasChartComponent<YAxis>())
|
||||
{
|
||||
if (GUILayout.Button(Styles.btnCovertXYAxis))
|
||||
m_Chart.CovertXYAxis(0);
|
||||
if (GUILayout.Button(Styles.btnConvertXYAxis))
|
||||
m_Chart.ConvertXYAxis(0);
|
||||
}
|
||||
if (GUILayout.Button(Styles.btnRebuildChartObject))
|
||||
{
|
||||
|
||||
@@ -4,6 +4,70 @@ using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationInfo), true)]
|
||||
public class AnimationInfoDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Enable", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Delay");
|
||||
PropertyField(prop, "m_Duration");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationChange), true)]
|
||||
public class AnimationChangeDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Enable", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Duration");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationAddition), true)]
|
||||
public class AnimationAdditionDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Enable", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Duration");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationInteraction), true)]
|
||||
public class AnimationInteractionDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Enable", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Duration");
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Radius");
|
||||
PropertyField(prop, "m_Offset");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(AnimationStyle), true)]
|
||||
public class AnimationDrawer : BasePropertyDrawer
|
||||
{
|
||||
@@ -15,17 +79,12 @@ namespace XCharts.Editor
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Type");
|
||||
PropertyField(prop, "m_FadeInDuration");
|
||||
PropertyField(prop, "m_FadeInDelay");
|
||||
PropertyField(prop, "m_FadeOutDuration");
|
||||
PropertyField(prop, "m_FadeOutDelay");
|
||||
PropertyField(prop, "m_DataChangeEnable");
|
||||
PropertyField(prop, "m_DataChangeDuration");
|
||||
PropertyField(prop, "m_UnscaledTime");
|
||||
// using(new EditorGUI.DisabledGroupScope(true))
|
||||
// {
|
||||
// PropertyField(prop, "m_ActualDuration");
|
||||
// }
|
||||
PropertyField(prop, "m_FadeIn");
|
||||
PropertyField(prop, "m_FadeOut");
|
||||
PropertyField(prop, "m_Change");
|
||||
PropertyField(prop, "m_Addition");
|
||||
PropertyField(prop, "m_Interaction");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_ToColor");
|
||||
PropertyField(prop, "m_Opacity");
|
||||
PropertyField(prop, "m_ToTop");
|
||||
PropertyField(prop, "m_InnerFill");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
28
Editor/ChildComponents/BackgroundDrawer.cs
Normal file
28
Editor/ChildComponents/BackgroundDrawer.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Background), true)]
|
||||
public class BackgroundDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Background"; } }
|
||||
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_Image");
|
||||
PropertyField(prop, "m_ImageType");
|
||||
PropertyField(prop, "m_ImageColor");
|
||||
PropertyField(prop, "m_ImageWidth");
|
||||
PropertyField(prop, "m_ImageHeight");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_BorderStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17cd5e3604edc43e5b7b6bfc3c71857b
|
||||
guid: 88c83fad35bc544cab4106096d171189
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -73,6 +73,14 @@ namespace XCharts.Editor
|
||||
return prop.propertyPath + "_" + index;
|
||||
}
|
||||
|
||||
protected void AddHelpBox(string message, MessageType type = MessageType.Warning, int line = 2)
|
||||
{
|
||||
var offset = EditorGUI.indentLevel * ChartEditorHelper.INDENT_WIDTH;
|
||||
EditorGUI.HelpBox(new Rect(m_DrawRect.x + offset, m_DrawRect.y, m_DrawRect.width - offset, EditorGUIUtility.singleLineHeight * line), message, type);
|
||||
for (int i = 0; i < line; i++)
|
||||
AddSingleLineHeight();
|
||||
}
|
||||
|
||||
protected void AddSingleLineHeight()
|
||||
{
|
||||
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
25
Editor/ChildComponents/BorderStyleDrawer.cs
Normal file
25
Editor/ChildComponents/BorderStyleDrawer.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(BorderStyle), true)]
|
||||
public class BorderStyleDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Border"; } }
|
||||
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_BorderWidth");
|
||||
PropertyField(prop, "m_BorderColor");
|
||||
PropertyField(prop, "m_RoundedCorner");
|
||||
PropertyListField(prop, "m_CornerRadius", true);
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b4ba2a9503ae46b1b7b1ae94ec59127
|
||||
guid: 47a460215ec5e4ec0bc7f8122a44302a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -148,9 +148,6 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_LineWidth");
|
||||
PropertyField(prop, "m_LineSymbolSize");
|
||||
PropertyField(prop, "m_ScatterSymbolSize");
|
||||
PropertyField(prop, "m_SelectedRate");
|
||||
PropertyField(prop, "m_PieTooltipExtraRadius");
|
||||
PropertyField(prop, "m_PieSelectedOffset");
|
||||
PropertyField(prop, "m_CandlestickColor");
|
||||
PropertyField(prop, "m_CandlestickColor0");
|
||||
PropertyField(prop, "m_CandlestickBorderColor");
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Color0");
|
||||
PropertyField(prop, "m_ToColor");
|
||||
PropertyField(prop, "m_ToColor2");
|
||||
PropertyField(prop, "m_MarkColor");
|
||||
PropertyField(prop, "m_BackgroundColor");
|
||||
PropertyField(prop, "m_BackgroundWidth");
|
||||
PropertyField(prop, "m_CenterColor");
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_LineGap");
|
||||
PropertyField(prop, "m_LineLength1");
|
||||
PropertyField(prop, "m_LineLength2");
|
||||
PropertyField(prop, "m_LineEndX");
|
||||
PropertyField(prop, "m_StartSymbol");
|
||||
PropertyField(prop, "m_EndSymbol");
|
||||
--EditorGUI.indentLevel;
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_AutoOffset");
|
||||
PropertyField(prop, "m_Offset");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_AutoRotate");
|
||||
PropertyField(prop, "m_Rotate");
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Height");
|
||||
|
||||
@@ -27,11 +27,16 @@ namespace XCharts.Editor
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Label");
|
||||
PropertyField(prop, "m_UpperLabel");
|
||||
PropertyField(prop, "m_ItemStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
if (MakeComponentFoldout(prop, "m_Depth", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Depth");
|
||||
PropertyField(prop, "m_Label");
|
||||
PropertyField(prop, "m_UpperLabel");
|
||||
PropertyField(prop, "m_LineStyle");
|
||||
PropertyField(prop, "m_ItemStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_ShowStartLine");
|
||||
PropertyField(prop, "m_ShowEndLine");
|
||||
PropertyField(prop, "m_ShowZLine");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Length");
|
||||
PropertyField(prop, "m_Opacity");
|
||||
PropertyField(prop, "m_DashLength");
|
||||
PropertyField(prop, "m_DotLength");
|
||||
PropertyField(prop, "m_GapLength");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
27
Editor/ChildComponents/MLValueDrawer.cs
Normal file
27
Editor/ChildComponents/MLValueDrawer.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
|
||||
[CustomPropertyDrawer(typeof(MLValue), true)]
|
||||
public class MLValueDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Percent = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Value");
|
||||
|
||||
ChartEditorHelper.MakeTwoField(ref drawRect, drawRect.width, m_Percent, m_Color, prop.displayName);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e5c24ed461624b8d924dfb1285e0a95
|
||||
guid: 364b6129b88e14605b1a1454b7bf876b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -15,10 +15,11 @@ namespace XCharts.Editor
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (SymbolType) prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
PropertyField(prop, "m_Type");
|
||||
if (type == SymbolType.Custom)
|
||||
{
|
||||
AddHelpBox("Custom symbol only work in PictorialBar serie", MessageType.Warning);
|
||||
PropertyField(prop, "m_Image");
|
||||
PropertyField(prop, "m_ImageType");
|
||||
PropertyField(prop, "m_Width");
|
||||
@@ -27,7 +28,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
PropertyField(prop, "m_Gap");
|
||||
PropertyField(prop, "m_SizeType");
|
||||
switch ((SymbolSizeType) prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
PropertyField(prop, "m_Size");
|
||||
|
||||
@@ -15,10 +15,11 @@ namespace XCharts.Editor
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var type = (SymbolType) prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||
PropertyField(prop, "m_Type");
|
||||
if (type == SymbolType.Custom)
|
||||
{
|
||||
AddHelpBox("Custom Symbol only work in PictorialBar serie", MessageType.Warning);
|
||||
PropertyField(prop, "m_Image");
|
||||
PropertyField(prop, "m_ImageType");
|
||||
PropertyField(prop, "m_Width");
|
||||
|
||||
23
Editor/ChildComponents/ViewControlDrawer.cs
Normal file
23
Editor/ChildComponents/ViewControlDrawer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ViewControl), true)]
|
||||
public class ViewControlDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "ViewControl"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Alpha");
|
||||
PropertyField(prop, "m_Beta");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d369a0cba6716422cb15efa26bef0918
|
||||
guid: faeb8611591ee4c038e88fdb5a67b5ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -12,7 +12,7 @@ namespace XCharts.Editor
|
||||
var m_Type = baseProperty.FindPropertyRelative("m_Type");
|
||||
var m_LogBase = baseProperty.FindPropertyRelative("m_LogBase");
|
||||
var m_MinMaxType = baseProperty.FindPropertyRelative("m_MinMaxType");
|
||||
var type = (Axis.AxisType) m_Type.enumValueIndex;
|
||||
var type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
EditorGUI.indentLevel++;
|
||||
if (component is ParallelAxis)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ namespace XCharts.Editor
|
||||
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
|
||||
{
|
||||
PropertyField("m_MinMaxType");
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType) m_MinMaxType.enumValueIndex;
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
|
||||
switch (minMaxType)
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
@@ -63,8 +63,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_SplitNumber");
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
//PropertyField("m_InsertDataToHead");
|
||||
PropertyField("m_MaxCache");
|
||||
PropertyField("m_MinCategorySpacing");
|
||||
PropertyField("m_BoundaryGap");
|
||||
}
|
||||
else
|
||||
@@ -72,6 +72,10 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Interval");
|
||||
}
|
||||
DrawExtendeds();
|
||||
if (type != Axis.AxisType.Category)
|
||||
{
|
||||
PropertyField("m_Animation");
|
||||
}
|
||||
PropertyField("m_AxisLine");
|
||||
PropertyField("m_AxisName");
|
||||
PropertyField("m_AxisTick");
|
||||
@@ -89,7 +93,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
PropertyListField("m_Data", true, new HeaderMenuInfo("Import ECharts Axis Data", () =>
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, null, component as Axis);
|
||||
PraseExternalDataEditor.UpdateData(chart, null, component as Axis, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
}
|
||||
@@ -103,6 +107,15 @@ namespace XCharts.Editor
|
||||
[ComponentEditor(typeof(YAxis))]
|
||||
public class YAxisEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(XAxis3D))]
|
||||
public class XAxis3DEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(YAxis3D))]
|
||||
public class YAxis3DEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(ZAxis3D))]
|
||||
public class ZAxis3DEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(SingleAxis))]
|
||||
public class SingleAxisEditor : AxisEditor
|
||||
{
|
||||
@@ -204,4 +217,21 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisAnimation), true)]
|
||||
public class AxisAnimationDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Animation"; } }
|
||||
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_UnscaledTime");
|
||||
PropertyField(prop, "m_Duration");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ImageType");
|
||||
PropertyField("m_ImageColor");
|
||||
PropertyField("m_AutoColor");
|
||||
PropertyField("m_BorderStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
112
Editor/MainComponents/BaseGraphEditor.cs
Normal file
112
Editor/MainComponents/BaseGraphEditor.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class BaseGraphEditor : UnityEditor.Editor
|
||||
{
|
||||
class Styles
|
||||
{
|
||||
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
|
||||
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", "");
|
||||
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
|
||||
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
|
||||
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
|
||||
}
|
||||
public BaseGraph m_BaseGraph;
|
||||
|
||||
public static T AddUIComponent<T>(string chartName) where T : BaseGraph
|
||||
{
|
||||
return XChartsEditor.AddGraph<T>(chartName);
|
||||
}
|
||||
|
||||
protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>();
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Properties.Clear();
|
||||
m_BaseGraph = (BaseGraph)target;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
PropertyField("m_Script");
|
||||
|
||||
OnStartInspectorGUI();
|
||||
OnDebugInspectorGUI();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected virtual void OnStartInspectorGUI() { }
|
||||
|
||||
protected virtual void OnDebugInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
OnDebugStartInspectorGUI();
|
||||
OnDebugEndInspectorGUI();
|
||||
}
|
||||
|
||||
protected virtual void OnDebugStartInspectorGUI() { }
|
||||
protected virtual void OnDebugEndInspectorGUI() { }
|
||||
|
||||
protected void PropertyField(string name)
|
||||
{
|
||||
if (!m_Properties.ContainsKey(name))
|
||||
{
|
||||
var prop = serializedObject.FindProperty(name);
|
||||
if (prop == null)
|
||||
{
|
||||
Debug.LogError("Property " + name + " not found!");
|
||||
return;
|
||||
}
|
||||
m_Properties.Add(name, prop);
|
||||
}
|
||||
EditorGUILayout.PropertyField(m_Properties[name]);
|
||||
}
|
||||
|
||||
protected void PropertyField(SerializedProperty property)
|
||||
{
|
||||
Assert.IsNotNull(property);
|
||||
var title = ChartEditorHelper.GetContent(property.displayName);
|
||||
PropertyField(property, title);
|
||||
}
|
||||
|
||||
protected void PropertyField(SerializedProperty property, GUIContent title)
|
||||
{
|
||||
EditorGUILayout.PropertyField(property, title);
|
||||
}
|
||||
|
||||
protected void PropertyListField(string relativePropName, bool showOrder = true, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||
var height = 0f;
|
||||
var prop = FindProperty(relativePropName);
|
||||
prop.isExpanded = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
|
||||
prop, prop.isExpanded, showOrder, true, menus);
|
||||
if (prop.isExpanded)
|
||||
{
|
||||
GUILayoutUtility.GetRect(1f, height - 17);
|
||||
}
|
||||
}
|
||||
|
||||
protected void PropertyTwoFiled(string relativePropName)
|
||||
{
|
||||
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||
var prop = FindProperty(relativePropName);
|
||||
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName);
|
||||
}
|
||||
|
||||
protected SerializedProperty FindProperty(string path)
|
||||
{
|
||||
if (!m_Properties.ContainsKey(path))
|
||||
{
|
||||
m_Properties.Add(path, serializedObject.FindProperty(path));
|
||||
}
|
||||
return m_Properties[path];
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/BaseGraphEditor.cs.meta
Normal file
11
Editor/MainComponents/BaseGraphEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88786092000154d359c1aa954ce664f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -29,6 +29,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_RangeMode");
|
||||
PropertyField(m_Start);
|
||||
PropertyField(m_End);
|
||||
PropertyField("m_StartLock");
|
||||
PropertyField("m_EndLock");
|
||||
PropertyField(m_MinShowNum);
|
||||
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
|
||||
if (m_End.floatValue > 100) m_End.floatValue = 100;
|
||||
|
||||
23
Editor/MainComponents/GridCoord3DEditor.cs
Normal file
23
Editor/MainComponents/GridCoord3DEditor.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[ComponentEditor(typeof(GridCoord3D))]
|
||||
public class GridCoord3DEditor : MainComponentEditor<GridCoord3D>
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Bottom");
|
||||
PropertyField("m_BoxWidth");
|
||||
PropertyField("m_BoxHeight");
|
||||
PropertyField("m_BoxDepth");
|
||||
PropertyField("m_XYExchanged");
|
||||
PropertyField("m_ShowBorder");
|
||||
PropertyField("m_ViewControl");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/GridCoord3DEditor.cs.meta
Normal file
11
Editor/MainComponents/GridCoord3DEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9a4a8a30b1124c4e996e234d5717a07
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -9,6 +9,8 @@ namespace XCharts.Editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
var layoutIndex = baseProperty.FindPropertyRelative("m_LayoutIndex").intValue;
|
||||
PropertyField("m_LayoutIndex");
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Right");
|
||||
PropertyField("m_Top");
|
||||
|
||||
23
Editor/MainComponents/GridLayoutEditor.cs
Normal file
23
Editor/MainComponents/GridLayoutEditor.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[ComponentEditor(typeof(GridLayout))]
|
||||
public class GridLayoutEditor : MainComponentEditor<GridLayout>
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Right");
|
||||
PropertyField("m_Top");
|
||||
PropertyField("m_Bottom");
|
||||
PropertyField("m_Row");
|
||||
PropertyField("m_Column");
|
||||
PropertyField("m_Spacing");
|
||||
PropertyField("m_Inverse");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/GridLayoutEditor.cs.meta
Normal file
11
Editor/MainComponents/GridLayoutEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4288bf299494d43d497436ace4b7a5a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -17,13 +17,14 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ItemOpacity");
|
||||
PropertyField("m_SelectedMode");
|
||||
PropertyField("m_Orient");
|
||||
PropertyField("m_Formatter");
|
||||
PropertyField("m_Location");
|
||||
PropertyField("m_LabelStyle");
|
||||
PropertyField("m_TextLimit");
|
||||
PropertyField("m_Background");
|
||||
PropertyField("m_Padding");
|
||||
PropertyListField("m_Icons");
|
||||
PropertyListField("m_Colors");
|
||||
PropertyListField("m_Positions");
|
||||
PropertyListField("m_Data");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using XCharts.Runtime;
|
||||
|
||||
@@ -81,8 +82,9 @@ namespace XCharts.Editor
|
||||
title,
|
||||
editor.baseProperty,
|
||||
editor.showProperty,
|
||||
() => { ResetComponentEditor(id); },
|
||||
() => { RemoveComponentEditor(id); }
|
||||
() => { if (EditorUtility.DisplayDialog("", "Sure reset " + editor.component.GetType().Name + "?", "Yes", "Cancel")) ResetComponentEditor(id); },
|
||||
() => { if (EditorUtility.DisplayDialog("", "Sure remove " + editor.component.GetType().Name + "?", "Yes", "Cancel")) RemoveComponentEditor(id); },
|
||||
() => { Application.OpenURL("https://xcharts-team.github.io/docs/configuration/#" + editor.component.GetType().Name.ToLower()); }
|
||||
);
|
||||
if (displayContent)
|
||||
{
|
||||
@@ -102,7 +104,8 @@ namespace XCharts.Editor
|
||||
editor.OnDisable();
|
||||
|
||||
m_Editors.Clear();
|
||||
for (int i = 0; i < chart.components.Count; i++)
|
||||
var count = Mathf.Min(chart.components.Count, m_ComponentsProperty.Count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (chart.components[i] != null)
|
||||
{
|
||||
@@ -119,7 +122,7 @@ namespace XCharts.Editor
|
||||
|
||||
if (!m_EditorTypes.TryGetValue(settingsType, out editorType))
|
||||
editorType = typeof(MainComponentBaseEditor);
|
||||
var editor = (MainComponentBaseEditor) Activator.CreateInstance(editorType);
|
||||
var editor = (MainComponentBaseEditor)Activator.CreateInstance(editorType);
|
||||
editor.Init(chart, component, property, m_BaseEditor);
|
||||
|
||||
if (index < 0)
|
||||
@@ -130,7 +133,26 @@ namespace XCharts.Editor
|
||||
|
||||
public void AddChartComponent(Type type)
|
||||
{
|
||||
chart.AddChartComponent(type);
|
||||
var component = chart.AddChartComponent(type);
|
||||
if (component != null)
|
||||
{
|
||||
if (component is YAxis)
|
||||
{
|
||||
var yAxis = component as YAxis;
|
||||
if (yAxis.index == 1)
|
||||
{
|
||||
yAxis.position = Axis.AxisPosition.Right;
|
||||
}
|
||||
}
|
||||
else if (component is XAxis)
|
||||
{
|
||||
var xAxis = component as XAxis;
|
||||
if (xAxis.index == 1)
|
||||
{
|
||||
xAxis.position = Axis.AxisPosition.Top;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
|
||||
RefreshEditors();
|
||||
EditorUtility.SetDirty(chart);
|
||||
@@ -151,6 +173,7 @@ namespace XCharts.Editor
|
||||
m_Editors[id].OnDisable();
|
||||
chart.RemoveChartComponent(m_Editors[id].component);
|
||||
m_Editors.RemoveAt(id);
|
||||
chart.RebuildChartObject();
|
||||
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
|
||||
RefreshEditors();
|
||||
EditorUtility.SetDirty(chart);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_SerieIndex");
|
||||
PropertyField("m_OnTop");
|
||||
PropertyField("m_Animation");
|
||||
PropertyListField("m_Data", true);
|
||||
--EditorGUI.indentLevel;
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace XCharts.Editor
|
||||
PropertyTwoFiled("m_Center");
|
||||
PropertyTwoFiled("m_Radius");
|
||||
PropertyField("m_BackgroundColor");
|
||||
PropertyField("m_IndicatorLabelOffset");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace XCharts.Editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_GridIndex");
|
||||
PropertyField("m_Shape");
|
||||
PropertyField("m_PositionType");
|
||||
PropertyTwoFiled("m_Center");
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace XCharts.Editor
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_Type");
|
||||
PropertyField("m_Trigger");
|
||||
PropertyField("m_TriggerOn");
|
||||
PropertyField("m_Position");
|
||||
PropertyField("m_FixedX");
|
||||
PropertyField("m_FixedY");
|
||||
|
||||
121
Editor/MainComponents/UIComponentEditor.cs
Normal file
121
Editor/MainComponents/UIComponentEditor.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class UIComponentEditor : UnityEditor.Editor
|
||||
{
|
||||
class Styles
|
||||
{
|
||||
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
|
||||
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", "");
|
||||
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
|
||||
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
|
||||
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
|
||||
}
|
||||
public UIComponent m_UIComponent;
|
||||
|
||||
public static T AddUIComponent<T>(string chartName) where T : UIComponent
|
||||
{
|
||||
return XChartsEditor.AddGraph<T>(chartName);
|
||||
}
|
||||
|
||||
protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>();
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Properties.Clear();
|
||||
m_UIComponent = (UIComponent) target;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
PropertyField("m_Script");
|
||||
|
||||
OnStartInspectorGUI();
|
||||
OnDebugInspectorGUI();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected virtual void OnStartInspectorGUI() { }
|
||||
|
||||
protected virtual void OnDebugInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
PropertyField("m_DebugModel");
|
||||
OnDebugStartInspectorGUI();
|
||||
if (GUILayout.Button(Styles.btnRebuildChartObject))
|
||||
{
|
||||
m_UIComponent.RebuildChartObject();
|
||||
}
|
||||
if (GUILayout.Button(Styles.btnSaveAsImage))
|
||||
{
|
||||
m_UIComponent.SaveAsImage();
|
||||
}
|
||||
OnDebugEndInspectorGUI();
|
||||
}
|
||||
|
||||
protected virtual void OnDebugStartInspectorGUI() { }
|
||||
protected virtual void OnDebugEndInspectorGUI() { }
|
||||
|
||||
protected void PropertyField(string name)
|
||||
{
|
||||
if (!m_Properties.ContainsKey(name))
|
||||
{
|
||||
var prop = serializedObject.FindProperty(name);
|
||||
if (prop == null)
|
||||
{
|
||||
Debug.LogError("Property " + name + " not found!");
|
||||
return;
|
||||
}
|
||||
m_Properties.Add(name, prop);
|
||||
}
|
||||
EditorGUILayout.PropertyField(m_Properties[name]);
|
||||
}
|
||||
|
||||
protected void PropertyField(SerializedProperty property)
|
||||
{
|
||||
Assert.IsNotNull(property);
|
||||
var title = ChartEditorHelper.GetContent(property.displayName);
|
||||
PropertyField(property, title);
|
||||
}
|
||||
|
||||
protected void PropertyField(SerializedProperty property, GUIContent title)
|
||||
{
|
||||
EditorGUILayout.PropertyField(property, title);
|
||||
}
|
||||
|
||||
protected void PropertyListField(string relativePropName, bool showOrder = true, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||
var height = 0f;
|
||||
var prop = FindProperty(relativePropName);
|
||||
prop.isExpanded = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
|
||||
prop, prop.isExpanded, showOrder, true, menus);
|
||||
if (prop.isExpanded)
|
||||
{
|
||||
GUILayoutUtility.GetRect(1f, height - 17);
|
||||
}
|
||||
}
|
||||
|
||||
protected void PropertyTwoFiled(string relativePropName)
|
||||
{
|
||||
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||
var prop = FindProperty(relativePropName);
|
||||
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName);
|
||||
}
|
||||
|
||||
protected SerializedProperty FindProperty(string path)
|
||||
{
|
||||
if (!m_Properties.ContainsKey(path))
|
||||
{
|
||||
m_Properties.Add(path, serializedObject.FindProperty(path));
|
||||
}
|
||||
return m_Properties[path];
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/UIComponentEditor.cs.meta
Normal file
11
Editor/MainComponents/UIComponentEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d226759112b0d463b8fba4830762893c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Editor/MainComponents/UIComponentThemeDrawer.cs
Normal file
23
Editor/MainComponents/UIComponentThemeDrawer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(UIComponentTheme), true)]
|
||||
public class UIComponentThemeDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Theme"; } }
|
||||
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_SharedTheme");
|
||||
PropertyField(prop, "m_TransparentBackground");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/UIComponentThemeDrawer.cs.meta
Normal file
11
Editor/MainComponents/UIComponentThemeDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dca2d7a2ed994420182384c2efa48c0c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -48,7 +48,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Large");
|
||||
PropertyField("m_LargeThreshold");
|
||||
PropertyField("m_PlaceHolder");
|
||||
PropertyField("m_MarkColor");
|
||||
PropertyField("m_MinShowLabel");
|
||||
PropertyField("m_MinShowLabelValue");
|
||||
});
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_HeatmapType");
|
||||
PropertyField("m_Ignore");
|
||||
PropertyField("m_IgnoreValue");
|
||||
PropertyField("m_MaxCache");
|
||||
|
||||
|
||||
PropertyField("m_Symbol");
|
||||
PropertyField("m_ItemStyle");
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
PropertyField("m_SmoothLimit");
|
||||
}
|
||||
//PropertyField("m_Clip");
|
||||
PropertyField("m_Clip");
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
PropertyFieldLimitMin("m_MinShow", 0);
|
||||
@@ -37,7 +37,6 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ShowAsPositiveNumber");
|
||||
PropertyField("m_Large");
|
||||
PropertyField("m_LargeThreshold");
|
||||
PropertyField("m_MarkColor");
|
||||
});
|
||||
PropertyField("m_Symbol");
|
||||
PropertyField("m_LineStyle");
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
public override void OnCustomInspectorGUI()
|
||||
{
|
||||
PropertyField("m_GridIndex");
|
||||
PropertyField("m_RoseType");
|
||||
PropertyField("m_Gap");
|
||||
PropertyTwoFiled("m_Center");
|
||||
@@ -14,10 +15,16 @@ namespace XCharts.Editor
|
||||
PropertyField("m_AvoidLabelOverlap");
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
PropertyField("m_MaxCache");
|
||||
PropertyField("m_MinAngle");
|
||||
PropertyField("m_MinRadius");
|
||||
PropertyField("m_RoundCap");
|
||||
PropertyField("m_Ignore");
|
||||
PropertyField("m_IgnoreValue");
|
||||
PropertyField("m_ClickOffset");
|
||||
PropertyField("m_RadiusGradient");
|
||||
PropertyField("m_MinShowLabel");
|
||||
PropertyField("m_MinShowLabelValue");
|
||||
});
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ColorBy");
|
||||
PropertyField("m_RadarType");
|
||||
PropertyField("m_RadarIndex");
|
||||
PropertyField("m_MaxCache");
|
||||
PropertyField("m_Smooth");
|
||||
|
||||
PropertyField("m_Symbol");
|
||||
|
||||
@@ -7,12 +7,16 @@ namespace XCharts.Editor
|
||||
{
|
||||
public override void OnCustomInspectorGUI()
|
||||
{
|
||||
PropertyField("m_GridIndex");
|
||||
PropertyTwoFiled("m_Center");
|
||||
PropertyTwoFiled("m_Radius");
|
||||
PropertyField("m_StartAngle");
|
||||
PropertyField("m_Gap");
|
||||
PropertyField("m_MaxCache");
|
||||
PropertyField("m_RoundCap");
|
||||
PropertyField("m_Clockwise");
|
||||
PropertyField("m_AvoidLabelOverlap");
|
||||
PropertyField("m_RadiusGradient");
|
||||
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_XAxisIndex");
|
||||
PropertyField("m_YAxisIndex");
|
||||
}
|
||||
PropertyField("m_MaxCache");
|
||||
PropertyField("m_Clip");
|
||||
|
||||
PropertyField("m_Symbol");
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
public class SerieBaseEditor
|
||||
{
|
||||
internal BaseChart chart { get; private set; }
|
||||
internal Serie serie { get; private set; }
|
||||
public BaseChart chart { get; private set; }
|
||||
public Serie serie { get; private set; }
|
||||
|
||||
//Editor m_Inspector;
|
||||
internal SerializedProperty baseProperty;
|
||||
|
||||
24
Editor/Series/SerieDataLinkDrawer.cs
Normal file
24
Editor/Series/SerieDataLinkDrawer.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieDataLink), true)]
|
||||
public class SerieDataLinkDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Link"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Source");
|
||||
PropertyField(prop, "m_Target");
|
||||
PropertyField(prop, "m_Value");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Series/SerieDataLinkDrawer.cs.meta
Normal file
11
Editor/Series/SerieDataLinkDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 877ff0f4c473d47f29e7e7e3a3eaf53b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,6 +12,8 @@ namespace XCharts.Editor
|
||||
private bool m_DataFoldout = false;
|
||||
private bool m_DataComponentFoldout = true;
|
||||
private Dictionary<int, bool> m_DataElementFoldout = new Dictionary<int, bool>();
|
||||
private bool m_LinksFoldout = false;
|
||||
private Dictionary<int, bool> m_LinksElementFoldout = new Dictionary<int, bool>();
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
@@ -31,12 +33,16 @@ namespace XCharts.Editor
|
||||
OnCustomInspectorGUI();
|
||||
OnExtraInspectorGUI();
|
||||
PropertyFieldData();
|
||||
OnEndCustomInspectorGUI();
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public virtual void OnCustomInspectorGUI()
|
||||
{ }
|
||||
|
||||
public virtual void OnEndCustomInspectorGUI()
|
||||
{ }
|
||||
|
||||
private void OnExtraInspectorGUI()
|
||||
{
|
||||
foreach (var kv in Serie.extraComponentMap)
|
||||
@@ -47,14 +53,18 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private HeaderMenuInfo headMenuInfo = new HeaderMenuInfo("Import ECharts Data", null);
|
||||
|
||||
private void HeadMenuInfoCallback()
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}
|
||||
|
||||
private void PropertyFieldData()
|
||||
{
|
||||
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Import ECharts Data", () =>
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
headMenuInfo.action = HeadMenuInfoCallback;
|
||||
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null, headMenuInfo);
|
||||
if (!m_DataFoldout) return;
|
||||
EditorGUI.indentLevel++;
|
||||
var m_Datas = FindProperty("m_Data");
|
||||
@@ -97,6 +107,52 @@ namespace XCharts.Editor
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
private HeaderMenuInfo linkHeadMenuInfo = new HeaderMenuInfo("Import ECharts Link", null);
|
||||
|
||||
private void LinkHeadMenuInfoCallback()
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}
|
||||
|
||||
protected void PropertyFieldLinks()
|
||||
{
|
||||
linkHeadMenuInfo.action = LinkHeadMenuInfoCallback;
|
||||
m_LinksFoldout = ChartEditorHelper.DrawHeader("Links", m_LinksFoldout, false, null, null, linkHeadMenuInfo);
|
||||
if (!m_LinksFoldout) return;
|
||||
EditorGUI.indentLevel++;
|
||||
var m_Links = FindProperty("m_Links");
|
||||
var listSize = m_Links.arraySize;
|
||||
listSize = EditorGUILayout.IntField("Size", listSize);
|
||||
if (listSize < 0) listSize = 0;
|
||||
if (listSize != m_Links.arraySize)
|
||||
{
|
||||
while (listSize > m_Links.arraySize) m_Links.arraySize++;
|
||||
while (listSize < m_Links.arraySize) m_Links.arraySize--;
|
||||
}
|
||||
if (listSize > 30) // && !XCSettings.editorShowAllListData)
|
||||
{
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
DrawSerieDataLink(m_Links, i);
|
||||
}
|
||||
if (num >= 10)
|
||||
{
|
||||
ChartEditorHelper.DrawHeader("... ", false, false, null, null);
|
||||
DrawSerieDataLink(m_Links, listSize - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_Links.arraySize; i++)
|
||||
{
|
||||
DrawSerieDataLink(m_Links, i);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
protected void PropertyFiledMore(System.Action action)
|
||||
{
|
||||
m_MoreFoldout = ChartEditorHelper.DrawHeader(MORE, m_MoreFoldout, false, null, null);
|
||||
@@ -106,6 +162,84 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSerieDataHeader(Rect drawRect, HeaderCallbackContext context)
|
||||
{
|
||||
var serieData = context.serieData;
|
||||
var fieldCount = context.fieldCount;
|
||||
var showName = context.showName;
|
||||
var index = context.index;
|
||||
var dimension = context.dimension;
|
||||
|
||||
//drawRect.width -= 2f;
|
||||
var maxX = drawRect.xMax;
|
||||
var currentWidth = drawRect.width;
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var gap = 2;
|
||||
var namegap = 3;
|
||||
var buttomLength = 30;
|
||||
#else
|
||||
var gap = 0;
|
||||
var namegap = 0;
|
||||
var buttomLength = 30;
|
||||
#endif
|
||||
if (showName)
|
||||
{
|
||||
buttomLength += 12;
|
||||
}
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
while (2 > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
drawRect.x = startX;
|
||||
drawRect.xMax = maxX - buttomLength;
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
else
|
||||
{
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
var dataWidTotal = currentWidth - (startX + 20.5f + 1) - buttomLength;
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 0;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
var dataCount = i < 1 ? 2 : i + 1;
|
||||
while (dataCount > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 25;
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
if (showName)
|
||||
{
|
||||
drawRect.x = startX + (fieldCount - 1) * xWid;
|
||||
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
}
|
||||
drawRect.x = lastX;
|
||||
drawRect.width = lastWid;
|
||||
ChartEditorHelper.UpDownAddDeleteButton(drawRect, context.listProp, index);
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSerieData(int dimension, SerializedProperty m_Datas, int index, bool showName)
|
||||
{
|
||||
bool flag;
|
||||
@@ -117,70 +251,16 @@ namespace XCharts.Editor
|
||||
var fieldCount = dimension + (showName ? 1 : 0);
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var dataIndex = serieData.FindPropertyRelative("m_Index").intValue;
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + dataIndex, flag, false, null,
|
||||
delegate(Rect drawRect)
|
||||
{
|
||||
//drawRect.width -= 2f;
|
||||
var maxX = drawRect.xMax;
|
||||
var currentWidth = drawRect.width;
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
//var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var gap = 2;
|
||||
var namegap = 3;
|
||||
#else
|
||||
var gap = 0;
|
||||
var namegap = 0;
|
||||
#endif
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
while (2 > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
drawRect.x = startX;
|
||||
drawRect.xMax = maxX;
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
else
|
||||
{
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 0;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
var dataCount = i < 1 ? 2 : i + 1;
|
||||
while (dataCount > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 25;
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
if (showName)
|
||||
{
|
||||
drawRect.x = startX + (fieldCount - 1) * xWid;
|
||||
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
}
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
});
|
||||
var callbackContext = new HeaderCallbackContext()
|
||||
{
|
||||
serieData = serieData,
|
||||
fieldCount = fieldCount,
|
||||
showName = showName,
|
||||
index = index,
|
||||
dimension = dimension,
|
||||
listProp = m_Datas
|
||||
};
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawSerieDataHeader("SerieData " + dataIndex, flag, false, null, callbackContext, DrawSerieDataHeader);
|
||||
if (m_DataElementFoldout[index])
|
||||
{
|
||||
if (!(serie is ISimplifiedSerie))
|
||||
@@ -204,15 +284,15 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
serieDataMenus.Clear();
|
||||
if (serie.GetType().IsDefined(typeof(SerieDataExtraComponentAttribute), false))
|
||||
if (serie.GetType().IsDefined(typeof(SerieDataComponentAttribute), false))
|
||||
{
|
||||
var attribute = serie.GetType().GetAttribute<SerieDataExtraComponentAttribute>();
|
||||
var attribute = serie.GetType().GetAttribute<SerieDataComponentAttribute>();
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = serieData.FindPropertyRelative(SerieData.extraComponentMap[type]).arraySize;
|
||||
serieDataMenus.Add(new HeaderMenuInfo("Add " + type.Name, () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent(type);
|
||||
serie.GetSerieData(index).EnsureComponent(type);
|
||||
EditorUtility.SetDirty(chart);
|
||||
}, size == 0));
|
||||
}
|
||||
@@ -242,5 +322,41 @@ namespace XCharts.Editor
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
private void DrawSerieDataLink(SerializedProperty m_Datas, int index)
|
||||
{
|
||||
bool flag;
|
||||
if (!m_LinksElementFoldout.TryGetValue(index, out flag))
|
||||
{
|
||||
flag = false;
|
||||
m_LinksElementFoldout[index] = false;
|
||||
}
|
||||
var dataLink = m_Datas.GetArrayElementAtIndex(index);
|
||||
m_LinksElementFoldout[index] = ChartEditorHelper.DrawHeader("Link " + index, flag, false, null,
|
||||
delegate (Rect drawRect)
|
||||
{
|
||||
var sourceIndex = dataLink.FindPropertyRelative("m_Source");
|
||||
var targetIndex = dataLink.FindPropertyRelative("m_Target");
|
||||
var value = dataLink.FindPropertyRelative("m_Value");
|
||||
var hig = ChartEditorHelper.MakeThreeField(ref drawRect, drawRect.width, sourceIndex, targetIndex, value, "");
|
||||
var btnRect = drawRect;
|
||||
btnRect.y -= hig;
|
||||
ChartEditorHelper.UpDownAddDeleteButton(btnRect, m_Datas, index);
|
||||
});
|
||||
if (m_LinksElementFoldout[index])
|
||||
{
|
||||
DrawSerieDataLinkDetail(m_Datas, index);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSerieDataLinkDetail(SerializedProperty m_Links, int index)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var dataLink = m_Links.GetArrayElementAtIndex(index);
|
||||
PropertyField(dataLink.FindPropertyRelative("m_Source"));
|
||||
PropertyField(dataLink.FindPropertyRelative("m_Target"));
|
||||
PropertyField(dataLink.FindPropertyRelative("m_Value"));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,22 +169,22 @@ namespace XCharts.Editor
|
||||
RefreshEditors();
|
||||
}
|
||||
}));
|
||||
foreach (var type in GetCovertToSerie(editor.serie.GetType()))
|
||||
foreach (var type in GetConvertToSerie(editor.serie.GetType()))
|
||||
{
|
||||
editor.menus.Add(new HeaderMenuInfo("Covert to " + type.Name, () =>
|
||||
editor.menus.Add(new HeaderMenuInfo("Convert to " + type.Name, () =>
|
||||
{
|
||||
CovertSerie(editor.serie, type);
|
||||
ConvertSerie(editor.serie, type);
|
||||
}));
|
||||
}
|
||||
if (editor.serie.GetType().IsDefined(typeof(SerieExtraComponentAttribute), false))
|
||||
if (editor.serie.GetType().IsDefined(typeof(SerieComponentAttribute), false))
|
||||
{
|
||||
var attribute = editor.serie.GetType().GetAttribute<SerieExtraComponentAttribute>();
|
||||
var attribute = editor.serie.GetType().GetAttribute<SerieComponentAttribute>();
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize;
|
||||
editor.menus.Add(new HeaderMenuInfo("Add " + type.Name, () =>
|
||||
{
|
||||
editor.serie.AddExtraComponent(type);
|
||||
editor.serie.EnsureComponent(type);
|
||||
RefreshEditors();
|
||||
chart.RefreshAllComponent();
|
||||
EditorUtility.SetDirty(chart);
|
||||
@@ -195,7 +195,7 @@ namespace XCharts.Editor
|
||||
var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize;
|
||||
editor.menus.Add(new HeaderMenuInfo("Remove " + type.Name, () =>
|
||||
{
|
||||
editor.serie.RemoveExtraComponent(type);
|
||||
editor.serie.RemoveComponent(type);
|
||||
RefreshEditors();
|
||||
chart.RefreshAllComponent();
|
||||
EditorUtility.SetDirty(chart);
|
||||
@@ -224,9 +224,9 @@ namespace XCharts.Editor
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
public void CovertSerie(Serie serie, Type type)
|
||||
public void ConvertSerie(Serie serie, Type type)
|
||||
{
|
||||
chart.CovertSerie(serie, type);
|
||||
chart.ConvertSerie(serie, type);
|
||||
m_SeriesProperty = m_BaseEditor.RefreshSeries();
|
||||
RefreshEditors();
|
||||
}
|
||||
@@ -254,7 +254,7 @@ namespace XCharts.Editor
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
private List<Type> GetCovertToSerie(Type serie)
|
||||
private List<Type> GetConvertToSerie(Type serie)
|
||||
{
|
||||
var list = new List<Type>();
|
||||
var typeMap = RuntimeUtil.GetAllTypesDerivedFrom<Serie>();
|
||||
|
||||
@@ -6,6 +6,16 @@ using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class HeaderCallbackContext
|
||||
{
|
||||
public int fieldCount = 0;
|
||||
public SerializedProperty serieData;
|
||||
public bool showName;
|
||||
public int index;
|
||||
public int dimension;
|
||||
public SerializedProperty listProp;
|
||||
}
|
||||
|
||||
public class HeaderMenuInfo
|
||||
{
|
||||
public string name;
|
||||
@@ -43,6 +53,8 @@ namespace XCharts.Editor
|
||||
public const float GAP_WIDTH = 0;
|
||||
public const float DIFF_WIDTH = 1;
|
||||
#endif
|
||||
public const float ICON_WIDHT = 10;
|
||||
public const float ICON_GAP = 0;
|
||||
static Dictionary<string, GUIContent> s_GUIContentCache;
|
||||
|
||||
static ChartEditorHelper()
|
||||
@@ -52,7 +64,7 @@ namespace XCharts.Editor
|
||||
|
||||
public static void SecondField(Rect drawRect, SerializedProperty prop)
|
||||
{
|
||||
RectOffset offset = new RectOffset(-(int) EditorGUIUtility.labelWidth, 0, 0, 0);
|
||||
RectOffset offset = new RectOffset(-(int)EditorGUIUtility.labelWidth, 0, 0, 0);
|
||||
drawRect = offset.Add(drawRect);
|
||||
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
|
||||
drawRect = offset.Remove(drawRect);
|
||||
@@ -106,6 +118,25 @@ namespace XCharts.Editor
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
|
||||
public static float MakeThreeField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
|
||||
SerializedProperty prop2, SerializedProperty prop3, string name, bool btnSpacing = true)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, name);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
|
||||
var diff = 13f + EditorGUI.indentLevel * 14;
|
||||
var offset = diff - INDENT_WIDTH;
|
||||
var tempWidth = (rectWidth - startX + diff - (btnSpacing ? (ICON_WIDHT + ICON_GAP) * 4 : 0)) / 3 + 8.5f;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
||||
var centerZRect = new Rect(centerYRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
||||
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
|
||||
EditorGUI.PropertyField(centerZRect, prop3, GUIContent.none);
|
||||
var hig = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += hig;
|
||||
return hig;
|
||||
}
|
||||
|
||||
public static void MakeVector2(ref Rect drawRect, float rectWidth, SerializedProperty prop, string name)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, name);
|
||||
@@ -180,8 +211,8 @@ namespace XCharts.Editor
|
||||
if (prop.propertyType == SerializedPropertyType.Boolean)
|
||||
{
|
||||
if (!propEnable)
|
||||
using(new EditorGUI.DisabledScope(true))
|
||||
MakeBool(drawRect, prop);
|
||||
using (new EditorGUI.DisabledScope(true))
|
||||
MakeBool(drawRect, prop);
|
||||
else
|
||||
MakeBool(drawRect, prop);
|
||||
if (prop2 != null && !moduleToggle[key])
|
||||
@@ -318,15 +349,12 @@ namespace XCharts.Editor
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var listSize = listProp.arraySize;
|
||||
var iconWidth = 14;
|
||||
var iconGap = 3f;
|
||||
|
||||
if (showSize)
|
||||
{
|
||||
var headerHeight = DrawSplitterAndBackground(drawRect);
|
||||
if (showOrder)
|
||||
{
|
||||
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth + 2, drawRect.height);
|
||||
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - ICON_WIDHT + 2, drawRect.height);
|
||||
var oldColor = GUI.contentColor;
|
||||
GUI.contentColor = Color.black;
|
||||
GUI.contentColor = oldColor;
|
||||
@@ -379,35 +407,14 @@ namespace XCharts.Editor
|
||||
DrawSplitterAndBackground(drawRect);
|
||||
if (showOrder)
|
||||
{
|
||||
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
|
||||
var isSerie = "Serie".Equals(element.type);
|
||||
var elementRect = isSerie ?
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height) :
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height);
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * ICON_GAP, drawRect.height) :
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * ICON_WIDHT, drawRect.height);
|
||||
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
|
||||
var iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
var oldColor = GUI.contentColor;
|
||||
GUI.contentColor = Color.black;
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i > 0) listProp.MoveArrayElement(i, i - 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element);
|
||||
height += EditorGUI.GetPropertyHeight(element);
|
||||
}
|
||||
GUI.contentColor = oldColor;
|
||||
UpDownAddDeleteButton(drawRect, listProp, i);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element);
|
||||
height += EditorGUI.GetPropertyHeight(element);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -420,6 +427,34 @@ namespace XCharts.Editor
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
public static void UpDownAddDeleteButton(Rect drawRect, SerializedProperty listProp, int i)
|
||||
{
|
||||
var temp = INDENT_WIDTH + GAP_WIDTH + ICON_GAP;
|
||||
var iconRect = new Rect(drawRect.width - 4 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
var oldColor = GUI.contentColor;
|
||||
GUI.contentColor = Color.black;
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i > 0) listProp.MoveArrayElement(i, i - 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - 3 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - 2 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
|
||||
}
|
||||
GUI.contentColor = oldColor;
|
||||
}
|
||||
|
||||
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
|
||||
SerializedProperty prop)
|
||||
{
|
||||
@@ -439,7 +474,7 @@ namespace XCharts.Editor
|
||||
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue < minValue)
|
||||
prop.floatValue = minValue;
|
||||
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue < minValue)
|
||||
prop.intValue = (int) minValue;
|
||||
prop.intValue = (int)minValue;
|
||||
var hig = EditorGUI.GetPropertyHeight(prop);
|
||||
drawRect.y += hig;
|
||||
heights[key] += hig;
|
||||
@@ -454,7 +489,7 @@ namespace XCharts.Editor
|
||||
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue > maxValue)
|
||||
prop.floatValue = maxValue;
|
||||
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue > maxValue)
|
||||
prop.intValue = (int) maxValue;
|
||||
prop.intValue = (int)maxValue;
|
||||
var hig = EditorGUI.GetPropertyHeight(prop);
|
||||
drawRect.y += hig;
|
||||
heights[key] += hig;
|
||||
@@ -539,7 +574,7 @@ namespace XCharts.Editor
|
||||
return HEADER_HEIGHT;
|
||||
}
|
||||
|
||||
internal static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
|
||||
public static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
|
||||
Action<Rect> drawCallback, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
var rect = GUILayoutUtility.GetRect(1f, HEADER_HEIGHT);
|
||||
@@ -564,6 +599,31 @@ namespace XCharts.Editor
|
||||
return state;
|
||||
}
|
||||
|
||||
public static bool DrawSerieDataHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
|
||||
HeaderCallbackContext context, Action<Rect, HeaderCallbackContext> drawCallback, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
var rect = GUILayoutUtility.GetRect(1f, HEADER_HEIGHT);
|
||||
var labelRect = DrawHeaderInternal(rect, title, ref state, drawBackground, activeField);
|
||||
DrawMenu(rect, menus);
|
||||
if (drawCallback != null)
|
||||
{
|
||||
drawCallback(rect, context);
|
||||
}
|
||||
var e = Event.current;
|
||||
if (e.type == EventType.MouseDown)
|
||||
{
|
||||
if (labelRect.Contains(e.mousePosition))
|
||||
{
|
||||
if (e.button == 0)
|
||||
{
|
||||
state = !state;
|
||||
e.Use();
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
internal static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
|
||||
Action<Rect> drawCallback, List<HeaderMenuInfo> menus)
|
||||
{
|
||||
@@ -630,11 +690,13 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
internal static bool DrawHeader(string title, SerializedProperty group, SerializedProperty activeField,
|
||||
Action resetAction, Action removeAction)
|
||||
Action resetAction, Action removeAction, Action docAction)
|
||||
{
|
||||
if (group == null) return false;
|
||||
group.isExpanded = DrawHeader(title, group.isExpanded, false, activeField, null,
|
||||
new HeaderMenuInfo("Reset", resetAction), new HeaderMenuInfo("Remove", removeAction));
|
||||
new HeaderMenuInfo("Reset", resetAction),
|
||||
new HeaderMenuInfo("Remove", removeAction),
|
||||
new HeaderMenuInfo("HelpDoc", docAction));
|
||||
return group.isExpanded;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
internal static class ThemeCheck
|
||||
internal static class XChartsDaemon
|
||||
{
|
||||
public class ThemeAssetPostprocessor : AssetPostprocessor
|
||||
public class XChartsAssetPostprocessor : AssetPostprocessor
|
||||
{
|
||||
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
|
||||
string[] movedFromAssetsPaths)
|
||||
@@ -28,17 +28,36 @@ namespace XCharts.Editor
|
||||
var fileName = Path.GetFileName(assetPath);
|
||||
if (fileName.Equals("XCSettings.asset"))
|
||||
{
|
||||
CheckAsmdef();
|
||||
XCThemeMgr.ReloadThemeList();
|
||||
return;
|
||||
}
|
||||
if (!IsThemeAsset(assetPath)) return;
|
||||
var theme = AssetDatabase.LoadAssetAtPath<Theme>(assetPath);
|
||||
if (XCSettings.AddCustomTheme(theme))
|
||||
else if (IsThemeAsset(assetPath))
|
||||
{
|
||||
XCThemeMgr.ReloadThemeList();
|
||||
var theme = AssetDatabase.LoadAssetAtPath<Theme>(assetPath);
|
||||
if (XCSettings.AddCustomTheme(theme))
|
||||
{
|
||||
XCThemeMgr.ReloadThemeList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckAsmdef()
|
||||
{
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
#if dUI_TextMeshPro
|
||||
XChartsEditor.CheckAsmdefTmpReference(true);
|
||||
#else
|
||||
XChartsEditor.CheckAsmdefTmpReference(false);
|
||||
#endif
|
||||
#elif UNITY_2019_1_OR_NEWER
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
XChartsEditor.CheckAsmdefInputSystemReference(true);
|
||||
#else
|
||||
XChartsEditor.CheckAsmdefInputSystemReference(false);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void CheckDeletedAsset(string assetPath)
|
||||
{
|
||||
if (!IsThemeAsset(assetPath)) return;
|
||||
11
Editor/Utilities/XChartsDaemon.cs.meta
Normal file
11
Editor/Utilities/XChartsDaemon.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 036a714dab7744d76849114f5bcf59a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,51 +0,0 @@
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ProgressBar), false)]
|
||||
public class ProgressBarEditor : UnityEditor.Editor
|
||||
{
|
||||
|
||||
[MenuItem("XCharts/ProgressBar", priority = 200)]
|
||||
[MenuItem("GameObject/XCharts/ProgressBar", priority = 200)]
|
||||
public static void AddPyramidChart()
|
||||
{
|
||||
XChartsEditor.AddChart<ProgressBar>("ProgressBar");
|
||||
}
|
||||
|
||||
protected SerializedProperty m_Script;
|
||||
protected SerializedProperty m_Value;
|
||||
protected SerializedProperty m_BackgroundColor;
|
||||
protected SerializedProperty m_StartColor;
|
||||
protected SerializedProperty m_EndColor;
|
||||
protected SerializedProperty m_CornerRadius;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Script = serializedObject.FindProperty("m_Script");
|
||||
m_Value = serializedObject.FindProperty("m_Value");
|
||||
m_BackgroundColor = serializedObject.FindProperty("m_BackgroundColor");
|
||||
m_StartColor = serializedObject.FindProperty("m_StartColor");
|
||||
m_EndColor = serializedObject.FindProperty("m_EndColor");
|
||||
m_CornerRadius = serializedObject.FindProperty("m_CornerRadius");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
OnStartInspectorGUI();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected virtual void OnStartInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_Script);
|
||||
EditorGUILayout.PropertyField(m_BackgroundColor);
|
||||
EditorGUILayout.PropertyField(m_StartColor);
|
||||
EditorGUILayout.PropertyField(m_EndColor);
|
||||
EditorGUILayout.PropertyField(m_Value);
|
||||
EditorGUILayout.PropertyField(m_CornerRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,12 @@ namespace XCharts.Editor
|
||||
{
|
||||
public class PraseExternalDataEditor : UnityEditor.EditorWindow
|
||||
{
|
||||
[SerializeField] private int m_DataDimension = 1;
|
||||
[SerializeField] private double m_DefaultYValue = 0;
|
||||
private static BaseChart s_Chart;
|
||||
private static Serie s_Serie;
|
||||
private static Axis s_Axis;
|
||||
private static bool s_LinksData;
|
||||
private static PraseExternalDataEditor window;
|
||||
private static string inputJsonText = "";
|
||||
|
||||
@@ -23,11 +26,12 @@ namespace XCharts.Editor
|
||||
window.Show();
|
||||
}
|
||||
|
||||
public static void UpdateData(BaseChart chart, Serie serie, Axis axis)
|
||||
public static void UpdateData(BaseChart chart, Serie serie, Axis axis, bool linksData)
|
||||
{
|
||||
s_Chart = chart;
|
||||
s_Serie = serie;
|
||||
s_Axis = axis;
|
||||
s_LinksData = linksData;
|
||||
inputJsonText = UnityEngine.GUIUtility.systemCopyBuffer;
|
||||
}
|
||||
|
||||
@@ -44,8 +48,13 @@ namespace XCharts.Editor
|
||||
return;
|
||||
}
|
||||
EditorGUILayout.LabelField("Input external data (echarts data):");
|
||||
m_DataDimension = EditorGUILayout.IntField("Data Dimension", m_DataDimension);
|
||||
if (m_DataDimension < 1)
|
||||
m_DataDimension = 1;
|
||||
else if (m_DataDimension == 2)
|
||||
m_DefaultYValue = EditorGUILayout.DoubleField("Default Y Value", m_DefaultYValue);
|
||||
inputJsonText = EditorGUILayout.TextArea(inputJsonText, GUILayout.Height(400));
|
||||
if (GUILayout.Button("Add"))
|
||||
if (GUILayout.Button("Try Add"))
|
||||
{
|
||||
if (s_Serie != null)
|
||||
{
|
||||
@@ -74,7 +83,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ParseArrayData(Axis axis, string arrayData)
|
||||
private bool ParseArrayData(Axis axis, string arrayData)
|
||||
{
|
||||
arrayData = arrayData.Trim();
|
||||
if (!arrayData.StartsWith("data: Array")) return false;
|
||||
@@ -93,11 +102,12 @@ namespace XCharts.Editor
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool ParseArrayData(Serie serie, string arrayData)
|
||||
private bool ParseArrayData(Serie serie, string arrayData)
|
||||
{
|
||||
arrayData = arrayData.Trim();
|
||||
if (!arrayData.StartsWith("data: Array")) return false;
|
||||
serie.ClearData();
|
||||
if (s_LinksData) serie.ClearLinks();
|
||||
else serie.ClearData();
|
||||
var list = arrayData.Split('\n');
|
||||
for (int i = 1; i < list.Length; i++)
|
||||
{
|
||||
@@ -117,7 +127,7 @@ namespace XCharts.Editor
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool ParseJsonData(Axis axis, string jsonData)
|
||||
private bool ParseJsonData(Axis axis, string jsonData)
|
||||
{
|
||||
if (!CheckJsonData(ref jsonData)) return false;
|
||||
axis.data.Clear();
|
||||
@@ -137,10 +147,11 @@ namespace XCharts.Editor
|
||||
/// 从json中导入数据
|
||||
/// </summary>
|
||||
/// <param name="jsonData"></param>
|
||||
private static bool ParseJsonData(Serie serie, string jsonData)
|
||||
private bool ParseJsonData(Serie serie, string jsonData)
|
||||
{
|
||||
if (!CheckJsonData(ref jsonData)) return false;
|
||||
serie.ClearData();
|
||||
if (s_LinksData) serie.ClearLinks();
|
||||
else serie.ClearData();
|
||||
if (jsonData.IndexOf("],") > -1 || jsonData.IndexOf("] ,") > -1)
|
||||
{
|
||||
string[] datas = jsonData.Split(new string[] { "],", "] ," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -152,7 +163,10 @@ namespace XCharts.Editor
|
||||
if (data.Length == 2 && !double.TryParse(data[0], out value))
|
||||
{
|
||||
double.TryParse(data[1], out value);
|
||||
serieData.data = new List<double>() { i, value };
|
||||
if (m_DataDimension == 2)
|
||||
serieData.data = new List<double>() { i, m_DefaultYValue, value };
|
||||
else
|
||||
serieData.data = new List<double>() { i, value };
|
||||
serieData.name = data[0].Replace("\"", "").Trim();
|
||||
}
|
||||
else
|
||||
@@ -183,7 +197,10 @@ namespace XCharts.Editor
|
||||
if (a.StartsWith("value:"))
|
||||
{
|
||||
double value = double.Parse(a.Substring(6, a.Length - 6));
|
||||
serieData.data = new List<double>() { i, value };
|
||||
if (m_DataDimension == 2)
|
||||
serieData.data = new List<double>() { i, m_DefaultYValue, value };
|
||||
else
|
||||
serieData.data = new List<double>() { i, value };
|
||||
}
|
||||
else if (a.StartsWith("name:"))
|
||||
{
|
||||
@@ -209,7 +226,10 @@ namespace XCharts.Editor
|
||||
if (flag)
|
||||
{
|
||||
var serieData = new SerieData();
|
||||
serieData.data = new List<double>() { i, value };
|
||||
if (m_DataDimension == 2)
|
||||
serieData.data = new List<double>() { i, m_DefaultYValue, value };
|
||||
else
|
||||
serieData.data = new List<double>() { i, value };
|
||||
serie.AddSerieData(serieData);
|
||||
}
|
||||
}
|
||||
|
||||
111
Editor/Windows/XChartsEditor.BarChart.cs
Normal file
111
Editor/Windows/XChartsEditor.BarChart.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/BarChart/Baisc Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Column", priority = 45)]
|
||||
public static void AddBarChart()
|
||||
{
|
||||
AddChart<BarChart>("BarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Zebra Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Column", priority = 45)]
|
||||
public static void AddBarChart_ZebraColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Zebra Column");
|
||||
chart.DefaultZebraColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Capsule Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Column", priority = 45)]
|
||||
public static void AddBarChart_CapsuleColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Capsule Column");
|
||||
chart.DefaultCapsuleColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Grouped Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Column", priority = 45)]
|
||||
public static void AddBarChart_GroupedColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Grouped Column");
|
||||
chart.DefaultGroupedColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Stacked Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Column", priority = 45)]
|
||||
public static void AddBarChart_StackedColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Stacked Column");
|
||||
chart.DefaultStackedColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Percent Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Column", priority = 45)]
|
||||
public static void AddBarChart_PercentColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Percent Column");
|
||||
chart.DefaultPercentColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Baisc Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Bar", priority = 45)]
|
||||
public static void AddBarChart_BasicBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart");
|
||||
chart.DefaultBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Zebra Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Bar", priority = 45)]
|
||||
public static void AddBarChart_ZebraBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Zebra Bar");
|
||||
chart.DefaultZebraBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Capsule Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Bar", priority = 45)]
|
||||
public static void AddBarChart_CapsuleBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Capsule Bar");
|
||||
chart.DefaultCapsuleBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Grouped Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Bar", priority = 45)]
|
||||
public static void AddBarChart_GroupedBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Grouped Bar");
|
||||
chart.DefaultGroupedBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Stacked Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Bar", priority = 45)]
|
||||
public static void AddBarChart_StackedBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Stacked Bar");
|
||||
chart.DefaultStackedBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Percent Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Bar", priority = 45)]
|
||||
public static void AddBarChart_PercentBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Percent Bar");
|
||||
chart.DefaultPercentBarChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.BarChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.BarChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56ff28653cd1148dc857e65c4440cf74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
95
Editor/Windows/XChartsEditor.LineChart.cs
Normal file
95
Editor/Windows/XChartsEditor.LineChart.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/LineChart/Basic Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Basic Line", priority = 44)]
|
||||
public static void AddLineChart()
|
||||
{
|
||||
AddChart<LineChart>("LineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Area Line", priority = 44)]
|
||||
public static void AddLineChart_Area()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Area", "Area Line");
|
||||
chart.DefaultAreaLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Smooth Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Line", priority = 44)]
|
||||
public static void AddLineChart_Smooth()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Smooth", "Smooth Line");
|
||||
chart.DefaultSmoothLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Smooth Area", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Area Line", priority = 44)]
|
||||
public static void AddLineChart_SmoothArea()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_SmoothArea", "Smooth Area Line");
|
||||
chart.DefaultSmoothAreaLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Stack Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Line", priority = 44)]
|
||||
public static void AddLineChart_Stack()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Stack", "Stack Line");
|
||||
chart.DefaultStackLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Stack Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Area Line", priority = 44)]
|
||||
public static void AddLineChart_StackArea()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_StackArea", "Stack Area Line");
|
||||
chart.DefaultStackAreaLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Step Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Step Line", priority = 44)]
|
||||
public static void AddLineChart_Step()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Step", "Step Line");
|
||||
chart.DefaultStepLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Dashed Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Dashed Line", priority = 44)]
|
||||
public static void AddLineChart_Dash()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Dashed", "Dashed Line");
|
||||
chart.DefaultDashLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Time Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Time Line", priority = 44)]
|
||||
public static void AddLineChart_Time()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Time", "Time Line");
|
||||
chart.DefaultTimeLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Log Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Log Line", priority = 44)]
|
||||
public static void AddLineChart_Log()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Log", "Log Line");
|
||||
chart.DefaultLogLineChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.LineChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.LineChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5036b2e279753473a906aaaf8b369d44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Editor/Windows/XChartsEditor.PieChart.cs
Normal file
63
Editor/Windows/XChartsEditor.PieChart.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/PieChart/Pie", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Pie", priority = 46)]
|
||||
public static void AddPieChart()
|
||||
{
|
||||
AddChart<PieChart>("PieChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Pie With Label", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Pie With Label", priority = 46)]
|
||||
public static void AddPieChart_WithLabel()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultLabelPieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Donut", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Donut", priority = 46)]
|
||||
public static void AddPieChart_Donut()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultDonutPieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Donut With Label", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Donut With Label", priority = 46)]
|
||||
public static void AddPieChart_DonutWithLabel()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultLabelDonutPieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Radius Rose", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Radius Rose", priority = 46)]
|
||||
public static void AddPieChart_RadiusRose()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultRadiusRosePieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Area Rose", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Area Rose", priority = 46)]
|
||||
public static void AddPieChart_AreaRose()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultAreaRosePieChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.PieChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.PieChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75bcae53ea72749418444c00f6281a3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
49
Editor/Windows/XChartsEditor.PolarChart.cs
Normal file
49
Editor/Windows/XChartsEditor.PolarChart.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/PolarChart/Line", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Line", priority = 54)]
|
||||
public static void PolarChart()
|
||||
{
|
||||
AddChart<PolarChart>("PolarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Radial Bar", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Radial Bar", priority = 54)]
|
||||
public static void PolarChart_RadialBar()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
chart.DefaultRadialBarPolarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Tangential Bar", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Tangential Bar", priority = 54)]
|
||||
public static void PolarChart_TangentialBar()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
chart.DefaultTangentialBarPolarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Heatmap", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Heatmap", priority = 54)]
|
||||
public static void PolarChart_Heatmap()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
chart.DefaultHeatmapPolarChart();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.PolarChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.PolarChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cf6923e1dcc04bb4a077d53bf7b6a0d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class XChartsEditor : UnityEditor.Editor
|
||||
public partial class XChartsEditor : UnityEditor.Editor
|
||||
{
|
||||
private static Transform GetParent()
|
||||
{
|
||||
@@ -22,7 +28,7 @@ namespace XCharts.Editor
|
||||
canvas = canvasObject.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceCamera;
|
||||
var mainCamera = GameObject.FindGameObjectWithTag("MainCamera");
|
||||
canvas.worldCamera = mainCamera == null? null : mainCamera.GetComponent<Camera>();
|
||||
canvas.worldCamera = mainCamera == null ? null : mainCamera.GetComponent<Camera>();
|
||||
canvasObject.AddComponent<CanvasScaler>();
|
||||
canvasObject.AddComponent<GraphicRaycaster>();
|
||||
if (GameObject.Find("EventSystem") == null)
|
||||
@@ -55,122 +61,137 @@ namespace XCharts.Editor
|
||||
return name;
|
||||
}
|
||||
|
||||
public static T AddChart<T>(string chartName) where T : BaseChart
|
||||
public static T AddChart<T>(string chartName, string titleName = null) where T : BaseChart
|
||||
{
|
||||
XCThemeMgr.CheckReloadTheme();
|
||||
var chart = AddGraph<T>(chartName);
|
||||
if (!string.IsNullOrEmpty(titleName))
|
||||
{
|
||||
var title = chart.GetChartComponent<Title>();
|
||||
title.text = titleName;
|
||||
}
|
||||
return chart;
|
||||
}
|
||||
|
||||
public static T AddGraph<T>(string graphName) where T : Graphic
|
||||
{
|
||||
var parent = GetParent();
|
||||
if (parent == null) return null;
|
||||
XCThemeMgr.CheckReloadTheme();
|
||||
var chart = new GameObject();
|
||||
chart.name = GetName(parent, chartName);
|
||||
chart.layer = LayerMask.NameToLayer("UI");
|
||||
var t = chart.AddComponent<T>();
|
||||
chart.transform.SetParent(parent);
|
||||
chart.transform.localScale = Vector3.one;
|
||||
chart.transform.localPosition = Vector3.zero;
|
||||
chart.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
var rect = chart.GetComponent<RectTransform>();
|
||||
var obj = new GameObject();
|
||||
obj.name = GetName(parent, graphName);
|
||||
obj.layer = LayerMask.NameToLayer("UI");
|
||||
var t = obj.AddComponent<T>();
|
||||
obj.transform.SetParent(parent);
|
||||
obj.transform.localScale = Vector3.one;
|
||||
obj.transform.localPosition = Vector3.zero;
|
||||
obj.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
var rect = obj.GetComponent<RectTransform>();
|
||||
rect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
rect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
rect.pivot = new Vector2(0.5f, 0.5f);
|
||||
Selection.activeGameObject = chart;
|
||||
EditorUtility.SetDirty(chart);
|
||||
Selection.activeGameObject = obj;
|
||||
EditorUtility.SetDirty(obj);
|
||||
return t;
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/EmptyChart", priority = 43)]
|
||||
[MenuItem("GameObject/XCharts/EmptyChart", priority = 43)]
|
||||
[MenuItem("GameObject/UI/XCharts/EmptyChart", priority = 43)]
|
||||
public static void AddBaseChart()
|
||||
{
|
||||
var chart = AddChart<BaseChart>("EmptyChart");
|
||||
chart.GetChartComponent<Title>().text = "EmptyChart";
|
||||
AddChart<BaseChart>("EmptyChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart", priority = 44)]
|
||||
public static void AddLineChart()
|
||||
{
|
||||
AddChart<LineChart>("LineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart", priority = 45)]
|
||||
public static void AddBarChart()
|
||||
{
|
||||
AddChart<BarChart>("BarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart", priority = 46)]
|
||||
public static void AddPieChart()
|
||||
{
|
||||
AddChart<PieChart>("PieChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RadarChart", priority = 47)]
|
||||
[MenuItem("GameObject/XCharts/RadarChart", priority = 47)]
|
||||
[MenuItem("XCharts/RadarChart/Polygon Radar", priority = 47)]
|
||||
[MenuItem("GameObject/UI/XCharts/RadarChart/Polygon Radar", priority = 47)]
|
||||
public static void AddRadarChart()
|
||||
{
|
||||
AddChart<RadarChart>("RadarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ScatterChart", priority = 48)]
|
||||
[MenuItem("GameObject/XCharts/ScatterChart", priority = 48)]
|
||||
[MenuItem("XCharts/RadarChart/Cirle Radar", priority = 47)]
|
||||
[MenuItem("GameObject/UI/XCharts/RadarChart/Cirle Radar", priority = 47)]
|
||||
public static void AddRadarChart_CirleRadar()
|
||||
{
|
||||
var chart = AddChart<RadarChart>("RadarChart");
|
||||
chart.DefaultCircleRadarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ScatterChart/Scatter", priority = 48)]
|
||||
[MenuItem("GameObject/UI/XCharts/ScatterChart/Scatter", priority = 48)]
|
||||
public static void AddScatterChart()
|
||||
{
|
||||
AddChart<ScatterChart>("ScatterChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/HeatmapChart", priority = 49)]
|
||||
[MenuItem("GameObject/XCharts/HeatmapChart", priority = 49)]
|
||||
[MenuItem("XCharts/ScatterChart/Bubble", priority = 48)]
|
||||
[MenuItem("GameObject/UI/XCharts/ScatterChart/Bubble", priority = 48)]
|
||||
public static void AddScatterChart_Bubble()
|
||||
{
|
||||
var chart = AddChart<ScatterChart>("ScatterChart");
|
||||
chart.DefaultBubbleChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/HeatmapChart/Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Heatmap", priority = 49)]
|
||||
public static void AddHeatmapChart()
|
||||
{
|
||||
AddChart<HeatmapChart>("HeatmapChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RingChart", priority = 51)]
|
||||
[MenuItem("GameObject/XCharts/RingChart", priority = 51)]
|
||||
[MenuItem("XCharts/HeatmapChart/Count Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Count Heatmap", priority = 49)]
|
||||
public static void AddHeatmapChart_Count()
|
||||
{
|
||||
var chart = AddChart<HeatmapChart>("HeatmapChart");
|
||||
chart.DefaultCountHeatmapChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RingChart/Ring", priority = 51)]
|
||||
[MenuItem("GameObject/UI/XCharts/RingChart/Ring", priority = 51)]
|
||||
public static void AddRingChart()
|
||||
{
|
||||
AddChart<RingChart>("RingChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/CandlestickChart", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/CandlestickChart", priority = 54)]
|
||||
[MenuItem("XCharts/RingChart/Multiple Ring", priority = 51)]
|
||||
[MenuItem("GameObject/UI/XCharts/RingChart/Multiple Ring", priority = 51)]
|
||||
public static void AddRingChart_MultiRing()
|
||||
{
|
||||
var chart = AddChart<RingChart>("RingChart");
|
||||
chart.DefaultMultipleRingChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/CandlestickChart/Candlestick", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/CandlestickChart/Candlestick", priority = 54)]
|
||||
public static void CandlestickChart()
|
||||
{
|
||||
AddChart<CandlestickChart>("CandlestickChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart", priority = 54)]
|
||||
public static void PolarChart()
|
||||
{
|
||||
AddChart<PolarChart>("PolarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ParallelChart", priority = 55)]
|
||||
[MenuItem("GameObject/XCharts/ParallelChart", priority = 55)]
|
||||
[MenuItem("XCharts/ParallelChart/Parallel", priority = 55)]
|
||||
[MenuItem("GameObject/UI/XCharts/ParallelChart/Parallel", priority = 55)]
|
||||
public static void ParallelChart()
|
||||
{
|
||||
AddChart<ParallelChart>("ParallelChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedLineChart", priority = 56)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedLineChart", priority = 56)]
|
||||
[MenuItem("XCharts/SimplifiedChart/Line", priority = 56)]
|
||||
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Line", priority = 56)]
|
||||
public static void SimplifiedLineChart()
|
||||
{
|
||||
AddChart<SimplifiedLineChart>("SimplifiedLineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedBarChart", priority = 57)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedBarChart", priority = 57)]
|
||||
[MenuItem("XCharts/SimplifiedChart/Bar", priority = 57)]
|
||||
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Bar", priority = 57)]
|
||||
public static void SimplifiedBarChart()
|
||||
{
|
||||
AddChart<SimplifiedBarChart>("SimplifiedBarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedCandlestickChart", priority = 58)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedCandlestickChart", priority = 58)]
|
||||
[MenuItem("XCharts/SimplifiedChart/Candlestick", priority = 58)]
|
||||
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Candlestick", priority = 58)]
|
||||
public static void SimplifiedCandlestickChart()
|
||||
{
|
||||
AddChart<SimplifiedCandlestickChart>("SimplifiedCandlestickChart");
|
||||
@@ -182,23 +203,197 @@ namespace XCharts.Editor
|
||||
XCThemeMgr.ReloadThemeList();
|
||||
}
|
||||
|
||||
#region Text mesh pro support
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
const string SYMBOL_TMP = "dUI_TextMeshPro";
|
||||
const string ASMDEF_TMP = "Unity.TextMeshPro";
|
||||
|
||||
#if !dUI_TextMeshPro
|
||||
[MenuItem("XCharts/TextMeshPro Enable")]
|
||||
#endif
|
||||
public static void EnableTextMeshPro()
|
||||
{
|
||||
if (!XChartsMgr.IsExistTMPAssembly())
|
||||
if (!IsSpecifyAssemblyExist(ASMDEF_TMP))
|
||||
{
|
||||
Debug.LogError("TextMeshPro is not in the project, please import TextMeshPro package first.");
|
||||
return;
|
||||
}
|
||||
XChartsMgr.EnableTextMeshPro();
|
||||
XChartsMgr.ModifyTMPRefence();
|
||||
if (EditorUtility.DisplayDialog("TextMeshPro Enable", "TextMeshPro is disabled, do you want to enable it?", "Yes", "Cancel"))
|
||||
{
|
||||
DefineSymbolsUtil.AddGlobalDefine(SYMBOL_TMP);
|
||||
XChartsMgr.RemoveAllChartObject();
|
||||
CheckAsmdefTmpReference(true);
|
||||
}
|
||||
}
|
||||
|
||||
#if dUI_TextMeshPro
|
||||
[MenuItem("XCharts/TextMeshPro Disable")]
|
||||
#endif
|
||||
public static void DisableTextMeshPro()
|
||||
{
|
||||
XChartsMgr.ModifyTMPRefence(true);
|
||||
XChartsMgr.DisableTextMeshPro();
|
||||
if (EditorUtility.DisplayDialog("TextMeshPro Disable", "TextMeshPro is enabled, do you want to disable it?", "Yes", "Cancel"))
|
||||
{
|
||||
CheckAsmdefTmpReference(false);
|
||||
DefineSymbolsUtil.RemoveGlobalDefine(SYMBOL_TMP);
|
||||
XChartsMgr.RemoveAllChartObject();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckAsmdefTmpReference(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
InsertSpecifyReferenceIntoAssembly(Platform.Editor, ASMDEF_TMP);
|
||||
InsertSpecifyReferenceIntoAssembly(Platform.Runtime, ASMDEF_TMP);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveSpecifyReferenceFromAssembly(Platform.Editor, ASMDEF_TMP);
|
||||
RemoveSpecifyReferenceFromAssembly(Platform.Runtime, ASMDEF_TMP);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region InputSystem Support
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
//As InputSystem is released in 2019.1+ ,when unity version is 2019.1+ , enable InputSystem Support
|
||||
const string SYMBOL_I_S = "INPUT_SYSTEM_ENABLED";
|
||||
const string ASMDEF_I_S = "Unity.InputSystem";
|
||||
|
||||
#if !INPUT_SYSTEM_ENABLED
|
||||
[MenuItem("XCharts/InputSystem Enable")]
|
||||
#endif
|
||||
public static void EnableInputSystem()
|
||||
{
|
||||
if (!IsSpecifyAssemblyExist(ASMDEF_I_S))
|
||||
{
|
||||
Debug.LogError("InputSystem is not in the project, please import InputSystem package first.");
|
||||
return;
|
||||
}
|
||||
if (EditorUtility.DisplayDialog("InputSystem Enable", "InputSystem is disabled, do you want to enable it?", "Yes", "Cancel"))
|
||||
{
|
||||
CheckAsmdefInputSystemReference(true);
|
||||
DefineSymbolsUtil.AddGlobalDefine(SYMBOL_I_S);
|
||||
}
|
||||
}
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
[MenuItem("XCharts/InputSystem Disable")]
|
||||
#endif
|
||||
public static void DisableInputSystem()
|
||||
{
|
||||
if (EditorUtility.DisplayDialog("InputSystem Disable", "InputSystem is enabled, do you want to disable it?", "Yes", "Cancel"))
|
||||
{
|
||||
CheckAsmdefInputSystemReference(false);
|
||||
DefineSymbolsUtil.RemoveGlobalDefine(SYMBOL_I_S);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckAsmdefInputSystemReference(bool enable)
|
||||
{
|
||||
if(enable)
|
||||
{
|
||||
InsertSpecifyReferenceIntoAssembly(Platform.Editor, ASMDEF_I_S);
|
||||
InsertSpecifyReferenceIntoAssembly(Platform.Runtime, ASMDEF_I_S);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveSpecifyReferenceFromAssembly(Platform.Editor, ASMDEF_I_S);
|
||||
RemoveSpecifyReferenceFromAssembly(Platform.Runtime, ASMDEF_I_S);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region Assistant members
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
// as text mesh pro is released in 2017.1, so we may use these function and types in 2017.1 or later
|
||||
private static void InsertSpecifyReferenceIntoAssembly(Platform platform, string reference)
|
||||
{
|
||||
var file = GetPackageAssemblyDefinitionPath(platform);
|
||||
var content = File.ReadAllText(file);
|
||||
var data = new AssemblyDefinitionData();
|
||||
EditorJsonUtility.FromJsonOverwrite(content, data);
|
||||
if (!data.references.Contains(reference))
|
||||
{
|
||||
data.references.Add(reference);
|
||||
var json = EditorJsonUtility.ToJson(data, true);
|
||||
File.WriteAllText(file, json);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveSpecifyReferenceFromAssembly(Platform platform, string reference)
|
||||
{
|
||||
var file = GetPackageAssemblyDefinitionPath(platform);
|
||||
var content = File.ReadAllText(file);
|
||||
var data = new AssemblyDefinitionData();
|
||||
EditorJsonUtility.FromJsonOverwrite(content, data);
|
||||
if (data.references.Contains(reference))
|
||||
{
|
||||
data.references.Remove(reference);
|
||||
var json = EditorJsonUtility.ToJson(data, true);
|
||||
File.WriteAllText(file, json);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Platform { Editor, Runtime }
|
||||
public static string GetPackageAssemblyDefinitionPath(Platform platform)
|
||||
{
|
||||
var p = platform == Platform.Editor ? "Editor" : "Runtime";
|
||||
var f = "XCharts." + p + ".asmdef";
|
||||
var sub = Path.Combine(p, f);
|
||||
string packagePath = Path.GetFullPath("Packages/com.monitor1394.xcharts");
|
||||
if (!Directory.Exists(packagePath))
|
||||
{
|
||||
packagePath = ADB.FindAssets("t:Script")
|
||||
.Where(v => Path.GetFileNameWithoutExtension(ADB.GUIDToAssetPath(v)) == "XChartsMgr")
|
||||
.Select(id => ADB.GUIDToAssetPath(id))
|
||||
.FirstOrDefault();
|
||||
packagePath = Path.GetDirectoryName(packagePath);
|
||||
packagePath = packagePath.Substring(0, packagePath.LastIndexOf("Runtime"));
|
||||
}
|
||||
return Path.Combine(packagePath, sub);
|
||||
}
|
||||
|
||||
public static bool IsSpecifyAssemblyExist(string name)
|
||||
{
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies(UnityEditor.Compilation.AssembliesType.Player))
|
||||
{
|
||||
if (assembly.name.Equals(name)) return true;
|
||||
}
|
||||
#elif UNITY_2017_3_OR_NEWER
|
||||
foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies())
|
||||
{
|
||||
if (assembly.name.Equals(name)) return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
class AssemblyDefinitionData
|
||||
{
|
||||
#pragma warning disable 649
|
||||
public string name;
|
||||
public List<string> references;
|
||||
public List<string> includePlatforms;
|
||||
public List<string> excludePlatforms;
|
||||
public bool allowUnsafeCode;
|
||||
public bool overrideReferences;
|
||||
public List<string> precompiledReferences;
|
||||
public bool autoReferenced;
|
||||
public List<string> defineConstraints;
|
||||
public List<string> versionDefines;
|
||||
public bool noEngineReferences;
|
||||
#pragma warning restore 649
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,58 +6,49 @@ using XCharts.Runtime;
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(LineChart))]
|
||||
public class Example00_CheatSheet : MonoBehaviour
|
||||
{
|
||||
private LineChart chart;
|
||||
private float speed = 100f;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(CheatSheet());
|
||||
}
|
||||
|
||||
IEnumerator CheatSheet()
|
||||
{
|
||||
StartCoroutine(InitChart());
|
||||
StartCoroutine(ComponentTitle());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentAxis());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentGrid());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentSerie());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentLegend());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentTheme());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentDataZoom());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(ComponentVisualMap());
|
||||
yield return new WaitForSeconds(3);
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(ComponentTitle());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentAxis());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentGrid());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentSerie());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentLegend());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentTheme());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentDataZoom());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(ComponentVisualMap());
|
||||
yield return new WaitForSeconds(3);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator InitChart()
|
||||
{
|
||||
chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null) gameObject.AddComponent<LineChart>();
|
||||
|
||||
chart.GetChartComponent<Title>().show = true;
|
||||
chart.GetChartComponent<Title>().text = "术语解析-组件";
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = "术语解析-组件";
|
||||
|
||||
var grid = chart.GetOrAddChartComponent<GridCoord>();
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
grid.bottom = 30;
|
||||
grid.right = 30;
|
||||
grid.left = 50;
|
||||
@@ -81,31 +72,31 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentTitle()
|
||||
{
|
||||
chart.GetChartComponent<Title>().text = "术语解析 - 组件";
|
||||
chart.GetChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题";
|
||||
chart.GetChartComponent<XAxis>().show = true;
|
||||
chart.GetChartComponent<YAxis>().show = true;
|
||||
chart.GetChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Title>().text = "术语解析 - 组件";
|
||||
chart.EnsureChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题";
|
||||
chart.EnsureChartComponent<XAxis>().show = true;
|
||||
chart.EnsureChartComponent<YAxis>().show = true;
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
chart.series[0].show = false;
|
||||
chart.series[1].show = false;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
chart.GetChartComponent<Title>().show = !chart.GetChartComponent<Title>().show;
|
||||
chart.EnsureChartComponent<Title>().show = !chart.EnsureChartComponent<Title>().show;
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
chart.GetChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.RefreshChart();
|
||||
}
|
||||
|
||||
IEnumerator ComponentAxis()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Axis 坐标轴:配置X和Y轴的轴线、刻度、标签等样式外观配置";
|
||||
chart.EnsureChartComponent<Title>().subText = "Axis 坐标轴:配置X和Y轴的轴线、刻度、标签等样式外观配置";
|
||||
chart.series[0].show = false;
|
||||
chart.series[1].show = false;
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
xAxis.show = !xAxis.show;
|
||||
@@ -121,8 +112,8 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentGrid()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等";
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
chart.EnsureChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等";
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
grid.backgroundColor = i % 2 == 0 ? Color.clear : Color.grey;
|
||||
@@ -136,7 +127,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentSerie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等";
|
||||
chart.EnsureChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等";
|
||||
chart.series[0].show = true;
|
||||
chart.series[1].show = true;
|
||||
chart.AnimationReset();
|
||||
@@ -157,10 +148,10 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentLegend()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等";
|
||||
var legend = chart.GetChartComponent<Legend>();
|
||||
chart.EnsureChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等";
|
||||
var legend = chart.EnsureChartComponent<Legend>();
|
||||
legend.show = true;
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
grid.top = 80;
|
||||
legend.location.top = 50;
|
||||
chart.RefreshChart();
|
||||
@@ -187,26 +178,26 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentTheme()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
yield return new WaitForSeconds(1f);
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:Light主题";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:Light主题";
|
||||
chart.UpdateTheme(ThemeType.Light);
|
||||
yield return new WaitForSeconds(1f);
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:Dark主题";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:Dark主题";
|
||||
chart.UpdateTheme(ThemeType.Dark);
|
||||
yield return new WaitForSeconds(1f);
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:Default主题";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:Default主题";
|
||||
chart.UpdateTheme(ThemeType.Default);
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
|
||||
IEnumerator ComponentDataZoom()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据";
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
chart.EnsureChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据";
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
grid.bottom = 70;
|
||||
|
||||
var dataZoom = chart.GetOrAddChartComponent<DataZoom>();
|
||||
var dataZoom = chart.EnsureChartComponent<DataZoom>();
|
||||
dataZoom.enable = true;
|
||||
dataZoom.supportInside = true;
|
||||
dataZoom.supportSlider = true;
|
||||
@@ -265,9 +256,9 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentVisualMap()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
chart.EnsureChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
|
||||
var visualMap = chart.GetOrAddChartComponent<VisualMap>();
|
||||
var visualMap = chart.EnsureChartComponent<VisualMap>();
|
||||
visualMap.show = true;
|
||||
visualMap.showUI = true;
|
||||
visualMap.orient = Orient.Vertical;
|
||||
@@ -292,7 +283,7 @@ namespace XCharts.Example
|
||||
"#a50026"
|
||||
};
|
||||
visualMap.AddColors(colors);
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
grid.left = 80;
|
||||
grid.bottom = 100;
|
||||
chart.RefreshChart();
|
||||
|
||||
238
Examples/Example01_RandomData.cs
Normal file
238
Examples/Example01_RandomData.cs
Normal file
@@ -0,0 +1,238 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(BaseChart))]
|
||||
public class Example01_RandomData : MonoBehaviour
|
||||
{
|
||||
public bool loopAdd = false;
|
||||
public float loopAddTime = 1f;
|
||||
public bool loopUpdate = false;
|
||||
public float loopUpadteTime = 1f;
|
||||
public int maxCache = 0;
|
||||
public bool insertDataToHead = false;
|
||||
|
||||
BaseChart chart;
|
||||
float lastAddTime;
|
||||
float lastUpdateTime;
|
||||
int dataCount;
|
||||
|
||||
int lastMaxCache = 0;
|
||||
bool lastInsertDataToHead = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<BaseChart>();
|
||||
chart.onInit = () =>
|
||||
{
|
||||
dataCount = chart.GetSerie(0).dataCount;
|
||||
SetMaxCache(maxCache);
|
||||
SetInsertDataToHead(insertDataToHead);
|
||||
lastMaxCache = maxCache;
|
||||
lastInsertDataToHead = insertDataToHead;
|
||||
};
|
||||
}
|
||||
|
||||
void SetMaxCache(int maxCache)
|
||||
{
|
||||
chart.SetMaxCache(maxCache);
|
||||
}
|
||||
|
||||
void SetInsertDataToHead(bool insertDataToHead)
|
||||
{
|
||||
foreach (var serie in chart.series)
|
||||
serie.insertDataToHead = insertDataToHead;
|
||||
|
||||
var coms = chart.GetChartComponents<XAxis>();
|
||||
if (coms != null)
|
||||
{
|
||||
foreach (var com in coms)
|
||||
{
|
||||
var axis = com as XAxis;
|
||||
if (axis.type == Axis.AxisType.Category)
|
||||
{
|
||||
axis.insertDataToHead = insertDataToHead;
|
||||
Debug.LogError("axis:" + axis + "," + insertDataToHead);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
AddData();
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.U))
|
||||
{
|
||||
UpdateData();
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.C))
|
||||
{
|
||||
chart.ClearData();
|
||||
}
|
||||
if (lastMaxCache != maxCache)
|
||||
{
|
||||
lastMaxCache = maxCache;
|
||||
SetMaxCache(maxCache);
|
||||
}
|
||||
if (lastInsertDataToHead != insertDataToHead)
|
||||
{
|
||||
lastInsertDataToHead = insertDataToHead;
|
||||
SetInsertDataToHead(insertDataToHead);
|
||||
}
|
||||
lastAddTime += Time.deltaTime;
|
||||
if (loopAdd && lastAddTime >= loopAddTime)
|
||||
{
|
||||
lastAddTime = 0;
|
||||
AddData();
|
||||
}
|
||||
|
||||
lastUpdateTime += Time.deltaTime;
|
||||
if (loopUpdate && lastUpdateTime >= loopUpadteTime)
|
||||
{
|
||||
lastUpdateTime = 0;
|
||||
UpdateData();
|
||||
}
|
||||
}
|
||||
|
||||
void AddData()
|
||||
{
|
||||
if (chart is HeatmapChart)
|
||||
{
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
if (xAxis != null && yAxis != null)
|
||||
{
|
||||
chart.AddXAxisData((xAxis.GetAddedDataCount() + 1).ToString());
|
||||
for (int i = 0; i < yAxis.data.Count; i++)
|
||||
{
|
||||
chart.AddData(0, xAxis.GetAddedDataCount() - 1, i, Random.Range(10, 90));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddXAxisData();
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
AddSerieRandomData(serie, xAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddXAxisData()
|
||||
{
|
||||
var xAxes = chart.GetChartComponents<XAxis>();
|
||||
foreach (var com in xAxes)
|
||||
{
|
||||
var xAxis = com as XAxis;
|
||||
if (xAxis.type == Axis.AxisType.Category)
|
||||
{
|
||||
chart.AddXAxisData("x" + (xAxis.GetAddedDataCount() + 1), xAxis.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateData()
|
||||
{
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
UpdateSerieRandomData(serie);
|
||||
}
|
||||
}
|
||||
|
||||
void AddSerieRandomData(Serie serie, XAxis xAxis)
|
||||
{
|
||||
if (serie is Line || serie is Bar || serie is Scatter || serie is EffectScatter)
|
||||
{
|
||||
if (xAxis.type == Axis.AxisType.Category)
|
||||
{
|
||||
chart.AddData(serie.index, Random.Range(10, 90), "data" + serie.dataCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (serie is Line)
|
||||
chart.AddData(serie.index, dataCount++, Random.Range(10, 90), "data" + serie.dataCount);
|
||||
else
|
||||
chart.AddData(serie.index, Random.Range(10, 90), Random.Range(10, 90), "data" + serie.dataCount);
|
||||
}
|
||||
}
|
||||
else if (serie is Ring)
|
||||
{
|
||||
chart.AddData(serie.index, Random.Range(10, 90), 100, "data" + serie.dataCount);
|
||||
}
|
||||
else if (serie is Radar)
|
||||
{
|
||||
var list = new System.Collections.Generic.List<double>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
list.Add(Random.Range(10, 90));
|
||||
chart.AddData(serie.index, list, "data" + serie.dataCount);
|
||||
}
|
||||
else if (serie is Candlestick)
|
||||
{
|
||||
var open = Random.Range(20, 60);
|
||||
var close = Random.Range(40, 90);
|
||||
var lowest = Random.Range(0, 50);
|
||||
var heighest = Random.Range(50, 100);
|
||||
chart.AddData(serie.index, serie.dataCount, open, close, lowest, heighest);
|
||||
}
|
||||
else if (serie is Heatmap)
|
||||
{
|
||||
var yAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
for (int i = 0; i < yAxis.data.Count; i++)
|
||||
{
|
||||
chart.AddData(serie.index, xAxis.GetAddedDataCount() - 1, i, Random.Range(0, 150));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.AddData(serie.index, Random.Range(10, 90), "data" + serie.dataCount);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSerieRandomData(Serie serie)
|
||||
{
|
||||
var index = Random.Range(0, serie.dataCount);
|
||||
if (serie is Ring)
|
||||
{
|
||||
chart.UpdateData(serie.index, index, 0, Random.Range(10, 90));
|
||||
}
|
||||
else if (serie is Radar)
|
||||
{
|
||||
var dimension = Random.Range(0, 5);
|
||||
chart.UpdateData(serie.index, index, dimension, Random.Range(10, 90));
|
||||
}
|
||||
else if (serie is Heatmap)
|
||||
{
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var xIndex = Random.Range(0, xAxis.data.Count);
|
||||
var yIndex = Random.Range(0, yAxis.data.Count);
|
||||
chart.UpdateData(serie.index, xIndex, yIndex, Random.Range(10, 90));
|
||||
}
|
||||
else if (serie is Candlestick)
|
||||
{
|
||||
var open = Random.Range(20, 60);
|
||||
var close = Random.Range(40, 90);
|
||||
var lowest = Random.Range(0, 50);
|
||||
var heighest = Random.Range(50, 100);
|
||||
chart.UpdateData(serie.index, index, new List<double> { open, close, lowest, heighest });
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.UpdateData(serie.index, index, Random.Range(10, 90));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Examples/Example01_RandomData.cs.meta
Normal file
11
Examples/Example01_RandomData.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c7cdc29e9a8040fdbc7100c3325e9ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,46 +0,0 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Example01_UpdateData : MonoBehaviour
|
||||
{
|
||||
private float updateTime = 0;
|
||||
BaseChart chart;
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<BaseChart>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
updateTime += Time.deltaTime;
|
||||
if (chart && updateTime > 2)
|
||||
{
|
||||
updateTime = 0;
|
||||
var serie = chart.GetSerie(0);
|
||||
//serie.animation.dataChangeEnable = true;
|
||||
var dataCount = serie.dataCount;
|
||||
if (chart is RadarChart)
|
||||
{
|
||||
var dimension = serie.GetSerieData(0).data.Count - 1;
|
||||
chart.UpdateData(0, 0, Random.Range(0, dimension + 1), Random.Range(0, 100));
|
||||
}
|
||||
else if (chart is HeatmapChart)
|
||||
{
|
||||
var dimension = serie.GetSerieData(0).data.Count - 1;
|
||||
for (int i = 0; i < dataCount; i++)
|
||||
{
|
||||
chart.UpdateData(0, i, dimension, Random.Range(0, 10));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.UpdateData(0, Random.Range(0, dataCount), Random.Range(10, 90));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using XUGL;
|
||||
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(BaseChart))]
|
||||
public class Example02_ChartEvent : MonoBehaviour
|
||||
{
|
||||
BaseChart chart;
|
||||
@@ -13,46 +15,99 @@ namespace XCharts.Example
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<BaseChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
}
|
||||
|
||||
chart.onPointerEnter = OnPointerEnter;
|
||||
chart.onPointerExit = OnPointerExit;
|
||||
chart.onPointerDown = OnPointerDown;
|
||||
chart.onPointerUp = OnPointerUp;
|
||||
chart.onPointerClick = OnPointerClick;
|
||||
chart.onScroll = OnScroll;
|
||||
|
||||
chart.onSerieClick = OnSerieClick;
|
||||
chart.onSerieEnter = OnSerieEnter;
|
||||
chart.onSerieExit = OnSerieExit;
|
||||
|
||||
chart.onDraw = OnDraw;
|
||||
chart.onDrawBeforeSerie = OnDrawBeforeSerie;
|
||||
chart.onDrawAfterSerie = OnDrawAfterSerie;
|
||||
chart.onDrawTop = OnDrawTop;
|
||||
}
|
||||
|
||||
void OnPointerEnter(PointerEventData eventData, BaseGraph chart)
|
||||
{
|
||||
//Debug.LogError("enter:" + chart);
|
||||
Debug.Log("enter:" + chart);
|
||||
}
|
||||
|
||||
void OnPointerExit(PointerEventData eventData, BaseGraph chart)
|
||||
{
|
||||
//Debug.LogError("exit:" + chart);
|
||||
Debug.Log("exit:" + chart);
|
||||
}
|
||||
|
||||
void OnPointerDown(PointerEventData eventData, BaseGraph chart)
|
||||
{
|
||||
//Debug.LogError("down:" + chart);
|
||||
Debug.Log("down:" + chart);
|
||||
}
|
||||
|
||||
void OnPointerUp(PointerEventData eventData, BaseGraph chart)
|
||||
{
|
||||
//Debug.LogError("up:" + chart);
|
||||
Debug.Log("up:" + chart);
|
||||
}
|
||||
|
||||
void OnPointerClick(PointerEventData eventData, BaseGraph chart)
|
||||
{
|
||||
//Debug.LogError("click:" + chart);
|
||||
Debug.Log("click:" + chart);
|
||||
}
|
||||
|
||||
void OnScroll(PointerEventData eventData, BaseGraph chart)
|
||||
{
|
||||
//Debug.LogError("scroll:" + chart);
|
||||
Debug.Log("scroll:" + chart);
|
||||
}
|
||||
|
||||
void OnSerieClick(SerieEventData data)
|
||||
{
|
||||
Debug.Log("OnSerieClick: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
|
||||
}
|
||||
|
||||
void OnSerieEnter(SerieEventData data)
|
||||
{
|
||||
Debug.Log("OnSerieEnter: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
|
||||
}
|
||||
|
||||
void OnSerieExit(SerieEventData data)
|
||||
{
|
||||
Debug.Log("OnSerieExit: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
|
||||
}
|
||||
|
||||
void OnDraw(VertexHelper vh)
|
||||
{
|
||||
//Debug.Log("OnDraw");
|
||||
}
|
||||
|
||||
void OnDrawBeforeSerie(VertexHelper vh, Serie serie)
|
||||
{
|
||||
//Debug.Log("OnDrawBeforeSerie: " + serie.index);
|
||||
}
|
||||
|
||||
void OnDrawAfterSerie(VertexHelper vh, Serie serie)
|
||||
{
|
||||
//Debug.Log("OnDrawAfterSerie: " + serie.index);
|
||||
if (serie.index != 0) return;
|
||||
var dataPoints = serie.context.dataPoints;
|
||||
if (dataPoints.Count > 4)
|
||||
{
|
||||
var pos = dataPoints[3];
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
var zeroPos = new Vector3(grid.context.x, grid.context.y);
|
||||
var startPos = new Vector3(pos.x, zeroPos.y);
|
||||
var endPos = new Vector3(pos.x, zeroPos.y + grid.context.height);
|
||||
UGL.DrawLine(vh, startPos, endPos, chart.theme.serie.lineWidth, Color.blue);
|
||||
UGL.DrawCricle(vh, pos, 5, Color.blue);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDrawTop(VertexHelper vh)
|
||||
{
|
||||
//Debug.Log("OnDrawTop");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,14 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<BarChart>();
|
||||
chart.Init();
|
||||
}
|
||||
var serie = chart.GetSerie(0);
|
||||
serie.animation.enable = true;
|
||||
//自定义每个数据项的渐入延时
|
||||
serie.animation.fadeInDelayFunction = CustomFadeInDelay;
|
||||
serie.animation.fadeIn.delayFunction = CustomFadeInDelay;
|
||||
//自定义每个数据项的渐入时长
|
||||
serie.animation.fadeInDurationFunction = CustomFadeInDuration;
|
||||
serie.animation.fadeIn.durationFunction = CustomFadeInDuration;
|
||||
}
|
||||
|
||||
float CustomFadeInDelay(int dataIndex)
|
||||
|
||||
@@ -38,11 +38,11 @@ namespace XCharts.Example
|
||||
{
|
||||
if (dataZoom.IsInMarqueeArea(serieData))
|
||||
{
|
||||
serieData.GetOrAddComponent<ItemStyle>().color = Color.red;
|
||||
serieData.EnsureComponent<ItemStyle>().color = Color.red;
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.GetOrAddComponent<ItemStyle>().color = Color.clear;
|
||||
serieData.EnsureComponent<ItemStyle>().color = Color.clear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
public class Example_DynamicChart : MonoBehaviour
|
||||
public class Example05_DynamicChart : MonoBehaviour
|
||||
{
|
||||
BaseChart chart;
|
||||
|
||||
@@ -12,7 +14,7 @@ namespace XCharts.Example
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
if (Input.GetKeyDown(KeyCode.P))
|
||||
{
|
||||
AddPieChart("Dynamic PieChart");
|
||||
}
|
||||
@@ -40,14 +42,13 @@ namespace XCharts.Example
|
||||
{
|
||||
var chartObject = CreateChartObject(chartName);
|
||||
var chart = chartObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
|
||||
chart.GetOrAddChartComponent<Title>().show = true;
|
||||
chart.GetOrAddChartComponent<Title>().text = chartName;
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = chartName;
|
||||
|
||||
chart.GetOrAddChartComponent<Tooltip>().show = true;
|
||||
chart.GetOrAddChartComponent<Legend>().show = true;
|
||||
chart.EnsureChartComponent<Tooltip>().show = true;
|
||||
chart.EnsureChartComponent<Legend>().show = true;
|
||||
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Pie>();
|
||||
@@ -62,19 +63,18 @@ namespace XCharts.Example
|
||||
{
|
||||
var chartObject = CreateChartObject(chartName);
|
||||
var chart = chartObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
|
||||
chart.GetOrAddChartComponent<Title>().show = true;
|
||||
chart.GetOrAddChartComponent<Title>().text = chartName;
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = chartName;
|
||||
|
||||
chart.GetOrAddChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
|
||||
var tooltip = chart.GetOrAddChartComponent<Tooltip>();
|
||||
var tooltip = chart.EnsureChartComponent<Tooltip>();
|
||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.show = true;
|
||||
11
Examples/Example05_DynamicChart.cs.meta
Normal file
11
Examples/Example05_DynamicChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3dbcd4fb120c4508b7bba52b41fbdb9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,45 +11,39 @@ namespace XCharts.Example
|
||||
private Serie serie;
|
||||
private int m_DataNum = 8;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(PieDemo());
|
||||
}
|
||||
|
||||
IEnumerator PieDemo()
|
||||
{
|
||||
StartCoroutine(AddSimpleLine());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ChangeLineType());
|
||||
yield return new WaitForSeconds(8);
|
||||
StartCoroutine(LineAreaStyleSettings());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(LineArrowSettings());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(LineSymbolSettings());
|
||||
yield return new WaitForSeconds(7);
|
||||
StartCoroutine(LineLabelSettings());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(LineMutilSerie());
|
||||
yield return new WaitForSeconds(5);
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(AddSimpleLine());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ChangeLineType());
|
||||
yield return new WaitForSeconds(8);
|
||||
StartCoroutine(LineAreaStyleSettings());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(LineArrowSettings());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(LineSymbolSettings());
|
||||
yield return new WaitForSeconds(7);
|
||||
StartCoroutine(LineLabelSettings());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(LineMutilSerie());
|
||||
yield return new WaitForSeconds(5);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator AddSimpleLine()
|
||||
{
|
||||
chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<LineChart>();
|
||||
if (chart == null){
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.GetChartComponent<Title>().text = "LineChart - 折线图";
|
||||
chart.GetChartComponent<Title>().subText = "普通折线图";
|
||||
|
||||
@@ -116,7 +110,7 @@ namespace XCharts.Example
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "AreaStyle 面积图";
|
||||
|
||||
serie.AddExtraComponent<AreaStyle>();
|
||||
serie.EnsureComponent<AreaStyle>();
|
||||
serie.areaStyle.show = true;
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(1f);
|
||||
@@ -145,7 +139,7 @@ namespace XCharts.Example
|
||||
IEnumerator LineArrowSettings()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "LineArrow 头部箭头";
|
||||
chart.GetSerie(0).AddExtraComponent<LineArrow>();
|
||||
chart.GetSerie(0).EnsureComponent<LineArrow>();
|
||||
serie.lineArrow.show = true;
|
||||
serie.lineArrow.position = LineArrow.Position.Start;
|
||||
chart.RefreshChart();
|
||||
@@ -207,7 +201,7 @@ namespace XCharts.Example
|
||||
IEnumerator LineLabelSettings()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "SerieLabel 文本标签";
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
chart.RefreshChart();
|
||||
while (serie.label.offset[1] < 20)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using XCharts.Runtime;
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Example11_AddSinCurve : MonoBehaviour
|
||||
{
|
||||
private float time;
|
||||
@@ -17,15 +16,16 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.GetChartComponent<Title>().show = true;
|
||||
chart.GetChartComponent<Title>().text = "Sin Curve";
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = "Sin Curve";
|
||||
|
||||
chart.GetChartComponent<Tooltip>().show = true;
|
||||
chart.GetChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Tooltip>().show = true;
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
|
||||
xAxis.show = true;
|
||||
yAxis.show = true;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using UnityEngine;
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Example
|
||||
@@ -22,21 +25,20 @@ namespace XCharts.Example
|
||||
|
||||
void AddData()
|
||||
{
|
||||
var chart = gameObject.GetComponent<SimplifiedLineChart>();
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<SimplifiedLineChart>();
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
}
|
||||
chart.GetOrAddChartComponent<Title>().show = true;
|
||||
chart.GetOrAddChartComponent<Title>().text = "Line Simple";
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = "Line Simple";
|
||||
|
||||
chart.GetOrAddChartComponent<Tooltip>().show = true;
|
||||
chart.GetOrAddChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Tooltip>().show = true;
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
xAxis.show = true;
|
||||
yAxis.show = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
@@ -46,9 +48,9 @@ namespace XCharts.Example
|
||||
xAxis.boundaryGap = true;
|
||||
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<SimplifiedLine>();
|
||||
chart.AddSerie<SimplifiedLine>();
|
||||
for (int i = 0; i < 200; i++)
|
||||
chart.AddSerie<Line>();
|
||||
chart.AddSerie<Line>();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
chart.AddData(0, Random.Range(10, 20));
|
||||
|
||||
@@ -11,48 +11,42 @@ namespace XCharts.Example
|
||||
private Serie serie, serie2;
|
||||
private int m_DataNum = 5;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(PieDemo());
|
||||
}
|
||||
|
||||
IEnumerator PieDemo()
|
||||
{
|
||||
StartCoroutine(AddSimpleBar());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(BarMutilSerie());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(ZebraBar());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndNotStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndPercentStack());
|
||||
yield return new WaitForSeconds(10);
|
||||
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(AddSimpleBar());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(BarMutilSerie());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(ZebraBar());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndNotStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndPercentStack());
|
||||
yield return new WaitForSeconds(10);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator AddSimpleBar()
|
||||
{
|
||||
chart = gameObject.GetComponent<BarChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<BarChart>();
|
||||
chart.GetChartComponent<Title>().text = "BarChart - 柱状图";
|
||||
chart.GetChartComponent<Title>().subText = "普通柱状图";
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<BarChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.EnsureChartComponent<Title>().text = "BarChart - 柱状图";
|
||||
chart.EnsureChartComponent<Title>().subText = "普通柱状图";
|
||||
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
yAxis.minMaxType = Axis.AxisMinMaxType.Default;
|
||||
|
||||
chart.RemoveData();
|
||||
@@ -68,7 +62,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator BarMutilSerie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "多条柱状图";
|
||||
chart.EnsureChartComponent<Title>().subText = "多条柱状图";
|
||||
|
||||
float now = serie.barWidth - 0.35f;
|
||||
while (serie.barWidth > 0.35f)
|
||||
@@ -90,7 +84,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ZebraBar()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "斑马柱状图";
|
||||
chart.EnsureChartComponent<Title>().subText = "斑马柱状图";
|
||||
serie.barType = BarType.Zebra;
|
||||
serie2.barType = BarType.Zebra;
|
||||
serie.barZebraWidth = serie.barZebraGap = 4;
|
||||
@@ -101,7 +95,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator SameBarAndNotStack()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "非堆叠同柱";
|
||||
chart.EnsureChartComponent<Title>().subText = "非堆叠同柱";
|
||||
serie.barType = serie2.barType = BarType.Normal;
|
||||
serie.stack = "";
|
||||
serie2.stack = "";
|
||||
@@ -112,7 +106,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator SameBarAndStack()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "堆叠同柱";
|
||||
chart.EnsureChartComponent<Title>().subText = "堆叠同柱";
|
||||
serie.barType = serie2.barType = BarType.Normal;
|
||||
serie.stack = "samename";
|
||||
serie2.stack = "samename";
|
||||
@@ -132,19 +126,25 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator SameBarAndPercentStack()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "百分比堆叠同柱";
|
||||
chart.EnsureChartComponent<Title>().subText = "百分比堆叠同柱";
|
||||
serie.barType = serie2.barType = BarType.Normal;
|
||||
serie.stack = "samename";
|
||||
serie2.stack = "samename";
|
||||
|
||||
serie.barPercentStack = true;
|
||||
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
if (null == serie.label)
|
||||
{
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
}
|
||||
serie.label.show = true;
|
||||
serie.label.position = LabelStyle.Position.Center;
|
||||
serie.label.textStyle.color = Color.white;
|
||||
serie.label.formatter = "{d:f0}%";
|
||||
|
||||
if (null == serie2.label)
|
||||
{
|
||||
serie2.EnsureComponent<LabelStyle>();
|
||||
}
|
||||
serie2.label.show = true;
|
||||
serie2.label.position = LabelStyle.Position.Center;
|
||||
serie2.label.textStyle.color = Color.white;
|
||||
|
||||
@@ -13,45 +13,41 @@ namespace XCharts.Example
|
||||
private float m_RadiusSpeed = 100f;
|
||||
private float m_CenterSpeed = 1f;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(PieDemo());
|
||||
}
|
||||
|
||||
IEnumerator PieDemo()
|
||||
{
|
||||
StartCoroutine(PieAdd());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(PieShowLabel());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(Doughnut());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(DoublePie());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(RosePie());
|
||||
yield return new WaitForSeconds(5);
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(PieAdd());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(PieShowLabel());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(Doughnut());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(DoublePie());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(RosePie());
|
||||
yield return new WaitForSeconds(5);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator PieAdd()
|
||||
{
|
||||
chart = gameObject.GetComponent<PieChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<PieChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
}
|
||||
yield return null;
|
||||
chart.GetChartComponent<Title>().text = "PieChart - 饼图";
|
||||
chart.GetChartComponent<Title>().subText = "基础饼图";
|
||||
|
||||
var legend = chart.GetChartComponent<Legend>();
|
||||
var legend = chart.EnsureChartComponent<Legend>();
|
||||
legend.show = true;
|
||||
legend.location.align = Location.Align.TopLeft;
|
||||
legend.location.top = 60;
|
||||
@@ -61,7 +57,7 @@ namespace XCharts.Example
|
||||
legend.orient = Orient.Vertical;
|
||||
|
||||
chart.RemoveData();
|
||||
serie = chart.AddSerie<Bar>("访问来源");
|
||||
serie = chart.AddSerie<Pie>("访问来源");
|
||||
serie.radius[0] = 0;
|
||||
serie.radius[1] = 110;
|
||||
serie.center[0] = 0.5f;
|
||||
@@ -72,7 +68,7 @@ namespace XCharts.Example
|
||||
chart.AddData(0, 135, "视频广告");
|
||||
chart.AddData(0, 1548, "搜索引擎");
|
||||
|
||||
chart.onPointerClickPie = delegate(PointerEventData e, int serieIndex, int dataIndex)
|
||||
chart.onSerieClick = delegate (SerieEventData data)
|
||||
{
|
||||
|
||||
};
|
||||
@@ -81,9 +77,9 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator PieShowLabel()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "显示文本标签";
|
||||
chart.EnsureChartComponent<Title>().subText = "显示文本标签";
|
||||
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
serie.label.show = true;
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(1);
|
||||
@@ -105,7 +101,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator Doughnut()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "圆环图";
|
||||
chart.EnsureChartComponent<Title>().subText = "圆环图";
|
||||
serie.radius[0] = 2f;
|
||||
while (serie.radius[0] < serie.radius[1] * 0.7f)
|
||||
{
|
||||
@@ -129,8 +125,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator DoublePie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "多图组合";
|
||||
|
||||
chart.EnsureChartComponent<Title>().subText = "多图组合";
|
||||
serie1 = chart.AddSerie<Pie>("访问来源2");
|
||||
chart.AddData(1, 335, "直达");
|
||||
chart.AddData(1, 679, "营销广告");
|
||||
@@ -146,7 +141,14 @@ namespace XCharts.Example
|
||||
chart.RefreshChart();
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (null == serie.label)
|
||||
{
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
}
|
||||
if (null == serie1.label)
|
||||
{
|
||||
serie1.EnsureComponent<LabelStyle>();
|
||||
}
|
||||
serie1.label.show = true;
|
||||
serie1.label.position = LabelStyle.Position.Inside;
|
||||
serie1.label.textStyle.color = Color.white;
|
||||
@@ -158,8 +160,8 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator RosePie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "玫瑰图";
|
||||
chart.GetChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Title>().subText = "玫瑰图";
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
serie1.ClearData();
|
||||
serie.ClearData();
|
||||
serie1.radius = serie.radius = new float[2] { 0, 80 };
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
@@ -15,11 +17,12 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
}
|
||||
var serieIndex = 0;
|
||||
var serie = chart.GetSerie(serieIndex);
|
||||
if (serie == null) return;
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
serie.label.show = true;
|
||||
serie.label.position = LabelStyle.Position.Outside;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user