mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 11:40:13 +00:00
Compare commits
680 Commits
v0.8.2
...
v3.0.0-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edd6d940b6 | ||
|
|
09f7557e1f | ||
|
|
2e954490ec | ||
|
|
f597a3f116 | ||
|
|
6cb3709655 | ||
|
|
ab21d97029 | ||
|
|
2dfda6c0ca | ||
|
|
59896d2323 | ||
|
|
da611012da | ||
|
|
1ba362ad11 | ||
|
|
c510831f59 | ||
|
|
4e24ba7922 | ||
|
|
407b3625d7 | ||
|
|
d6c45aaf6b | ||
|
|
115a47a5df | ||
|
|
7582a76d1f | ||
|
|
5745fea9a1 | ||
|
|
1ee0df09eb | ||
|
|
e72349a69f | ||
|
|
ce5aeb2d98 | ||
|
|
a19b796a02 | ||
|
|
cc4ee3735c | ||
|
|
a32f5f5bcf | ||
|
|
d9840bef52 | ||
|
|
a8b2068029 | ||
|
|
c9addaf02c | ||
|
|
0282dae582 | ||
|
|
228a4b2840 | ||
|
|
c160867765 | ||
|
|
d20f27b610 | ||
|
|
3a41f1e00e | ||
|
|
90cb25b74f | ||
|
|
fa3137eb55 | ||
|
|
18ed060c67 | ||
|
|
761ae595c2 | ||
|
|
0aa476e757 | ||
|
|
9c69774d35 | ||
|
|
081cd4b503 | ||
|
|
cd1a36cc18 | ||
|
|
6109b62eb7 | ||
|
|
a5469c0996 | ||
|
|
f39cddaa5e | ||
|
|
1b3fa7fb43 | ||
|
|
d87e0f8267 | ||
|
|
3590d1ebbc | ||
|
|
6fae151c8e | ||
|
|
92ee57baf8 | ||
|
|
b5098d5682 | ||
|
|
a4963435d7 | ||
|
|
25972f0382 | ||
|
|
708b08e701 | ||
|
|
f69aa1d232 | ||
|
|
bdd53bbe24 | ||
|
|
b20e768cd1 | ||
|
|
4de732a369 | ||
|
|
f87c8445f9 | ||
|
|
8d6d4ce0c5 | ||
|
|
5238689baa | ||
|
|
6f39e692ef | ||
|
|
e873709443 | ||
|
|
8d4a65a002 | ||
|
|
32a8fed625 | ||
|
|
1fccc25873 | ||
|
|
0621845e5a | ||
|
|
18391881d7 | ||
|
|
0e1d5cc81d | ||
|
|
78a83238f7 | ||
|
|
05f21f2d02 | ||
|
|
bcb30f3c82 | ||
|
|
470da8f975 | ||
|
|
8c83e828bf | ||
|
|
a91d190d85 | ||
|
|
e9e7371213 | ||
|
|
9349900ea5 | ||
|
|
0ae9be9c63 | ||
|
|
953bea6962 | ||
|
|
1f676c431a | ||
|
|
f953a069cb | ||
|
|
442206dad8 | ||
|
|
8dd3ef2a63 | ||
|
|
44110feaaf | ||
|
|
a42c1845d6 | ||
|
|
d233f64a68 | ||
|
|
055d3806d8 | ||
|
|
b4f6bd7248 | ||
|
|
fb49b2f46a | ||
|
|
f1a14830b7 | ||
|
|
b849633110 | ||
|
|
f656cba56b | ||
|
|
6872d42f2e | ||
|
|
93e376bdbf | ||
|
|
efc82d01a7 | ||
|
|
057376882d | ||
|
|
d92640c49b | ||
|
|
bc25663db4 | ||
|
|
d9f99e0d27 | ||
|
|
0c549bf23b | ||
|
|
4de87fd358 | ||
|
|
01b77ccb55 | ||
|
|
e2aec83de2 | ||
|
|
d5c8b296a7 | ||
|
|
f2c944baa9 | ||
|
|
7070c5caa7 | ||
|
|
f2b7cfd40b | ||
|
|
79a02e5594 | ||
|
|
a88b1979d8 | ||
|
|
c1f604f1b6 | ||
|
|
cb29b38e1c | ||
|
|
6bee9b20dd | ||
|
|
6e35907f46 | ||
|
|
44d67151ee | ||
|
|
2f98f6a486 | ||
|
|
53085b01b6 | ||
|
|
424577ca4d | ||
|
|
636df6ebd6 | ||
|
|
e28c730c21 | ||
|
|
3d457bb681 | ||
|
|
fdd6ab0063 | ||
|
|
13a81b8374 | ||
|
|
11fc9d15a2 | ||
|
|
bf82904e66 | ||
|
|
3c58396c1f | ||
|
|
6291fd27b0 | ||
|
|
59f1fda131 | ||
|
|
8a8f352bad | ||
|
|
20ea9e2620 | ||
|
|
05f0002ef4 | ||
|
|
3507434e7a | ||
|
|
7c762b4455 | ||
|
|
6220b6af6f | ||
|
|
63f054493a | ||
|
|
cd35d00e06 | ||
|
|
0bc5a24595 | ||
|
|
ce08b0f81e | ||
|
|
5aa90274dc | ||
|
|
4b40604a27 | ||
|
|
adfc15efd8 | ||
|
|
1e43fc7283 | ||
|
|
a2307d9c21 | ||
|
|
2bec0f1178 | ||
|
|
c19870444e | ||
|
|
d423ad6c9e | ||
|
|
9c96fbb604 | ||
|
|
d6caeb585e | ||
|
|
e23f8b4a96 | ||
|
|
fbeca8f442 | ||
|
|
aebbfaac83 | ||
|
|
e26220ef93 | ||
|
|
ed93fc3005 | ||
|
|
ac64bd9435 | ||
|
|
6a548899fa | ||
|
|
ddea85d9f0 | ||
|
|
e8a725fb05 | ||
|
|
09c32f171d | ||
|
|
457db21751 | ||
|
|
e06393a22f | ||
|
|
e182827509 | ||
|
|
234b5ecfa6 | ||
|
|
b7b8d37ecd | ||
|
|
5d19466fdc | ||
|
|
7d46feb1a5 | ||
|
|
7169fdc8ae | ||
|
|
db9e0659f3 | ||
|
|
00057788ab | ||
|
|
117ab9e31a | ||
|
|
404430e4b2 | ||
|
|
0d53fa91ff | ||
|
|
b3037f0818 | ||
|
|
9fe8b762b6 | ||
|
|
0a2751b220 | ||
|
|
220b829279 | ||
|
|
c507771cff | ||
|
|
09daa2f027 | ||
|
|
4ea5168e9a | ||
|
|
2fdd554751 | ||
|
|
b96e1dcf4d | ||
|
|
80b000ed32 | ||
|
|
f0c553b0b7 | ||
|
|
f7b8f2f76f | ||
|
|
04efcf3959 | ||
|
|
3a02f66d9e | ||
|
|
69c830c520 | ||
|
|
49fe5fdb70 | ||
|
|
15da731cfe | ||
|
|
3e1b84029f | ||
|
|
0a427de273 | ||
|
|
b4cd770c8d | ||
|
|
3b697edd09 | ||
|
|
9f7ec8be64 | ||
|
|
7f23cd4676 | ||
|
|
82d1bed46b | ||
|
|
e9df74ec3c | ||
|
|
d34959287d | ||
|
|
ee5cfc3d78 | ||
|
|
ec4eee58a2 | ||
|
|
0ae92afc09 | ||
|
|
aebbdf57be | ||
|
|
16b3ca1f40 | ||
|
|
f8d882c046 | ||
|
|
0a5d923592 | ||
|
|
f330d2eb7b | ||
|
|
5c9e52a807 | ||
|
|
f5c76ce3c5 | ||
|
|
ee4aae2019 | ||
|
|
660415ae97 | ||
|
|
d36a9fda9d | ||
|
|
d9724ee7f3 | ||
|
|
a1c2f554d4 | ||
|
|
77f17c7dec | ||
|
|
e8737ec50e | ||
|
|
045e1576b6 | ||
|
|
b1c9f36a30 | ||
|
|
1b4e3a449d | ||
|
|
9ebbdaba28 | ||
|
|
779ab98762 | ||
|
|
105d0a85f9 | ||
|
|
a4281288ee | ||
|
|
30f40b601f | ||
|
|
a3a9850e13 | ||
|
|
0027968e99 | ||
|
|
ea8d560f3f | ||
|
|
95cf5ed303 | ||
|
|
7e7d7270ab | ||
|
|
a69667337d | ||
|
|
a4f1726ab1 | ||
|
|
3e1b3637c9 | ||
|
|
8627494972 | ||
|
|
be71983047 | ||
|
|
9274844548 | ||
|
|
075b0939e9 | ||
|
|
1cf0ecf9d6 | ||
|
|
b07798f5a2 | ||
|
|
ecb09e4ca4 | ||
|
|
f266655d24 | ||
|
|
a43cf64fb3 | ||
|
|
be61cb908f | ||
|
|
afc84a0dc0 | ||
|
|
b2f5f69619 | ||
|
|
cd519f021f | ||
|
|
f18dd10f0d | ||
|
|
92e4d9de1b | ||
|
|
e64284f5ab | ||
|
|
683f4e1c97 | ||
|
|
b9566cb180 | ||
|
|
e82ee56b7f | ||
|
|
2c1c50c72b | ||
|
|
f290ca2ba6 | ||
|
|
c9d11b3ab8 | ||
|
|
411695d0dd | ||
|
|
ea62d03142 | ||
|
|
c2aa222bbd | ||
|
|
872020e729 | ||
|
|
951c3fe16c | ||
|
|
85e8b17171 | ||
|
|
b2cba25a1e | ||
|
|
2cc01d4101 | ||
|
|
dbbe6de544 | ||
|
|
18be460bee | ||
|
|
c1c7312f2c | ||
|
|
342337c13e | ||
|
|
0849b359ce | ||
|
|
2eeec329b2 | ||
|
|
ef10fd987c | ||
|
|
b52105e798 | ||
|
|
fe15760aab | ||
|
|
3c3730db44 | ||
|
|
fa118d93f8 | ||
|
|
04507ee863 | ||
|
|
2c25af3694 | ||
|
|
87d7668768 | ||
|
|
d17a306f7c | ||
|
|
6a88d899b7 | ||
|
|
2a42bcfbef | ||
|
|
af8765734c | ||
|
|
3a3c79c3cc | ||
|
|
2cafbc7706 | ||
|
|
3860d1c862 | ||
|
|
5818c3404f | ||
|
|
87511da0c4 | ||
|
|
ebceea3491 | ||
|
|
fe1c11fc5d | ||
|
|
64178ef88d | ||
|
|
7c95d2d8b8 | ||
|
|
7144f1a2af | ||
|
|
70a27f2aca | ||
|
|
7a90b6c943 | ||
|
|
b59c0c790c | ||
|
|
6da8784102 | ||
|
|
c2c6b87b2c | ||
|
|
158e56abdf | ||
|
|
67fc201e83 | ||
|
|
d66f22ddc8 | ||
|
|
aed0485ba7 | ||
|
|
bd65007851 | ||
|
|
aa2f90d048 | ||
|
|
d343ff9d07 | ||
|
|
fe8fa90625 | ||
|
|
cc23df6821 | ||
|
|
d6859f5543 | ||
|
|
b6139514f5 | ||
|
|
9e48c23225 | ||
|
|
5cf93b6111 | ||
|
|
a3aa610d57 | ||
|
|
ce69581a3a | ||
|
|
523067ad58 | ||
|
|
e67bab471c | ||
|
|
10fe66fcb8 | ||
|
|
1639dcd4ee | ||
|
|
b8bb3abac7 | ||
|
|
75a58c6975 | ||
|
|
eb9da8210e | ||
|
|
04c69ea9e0 | ||
|
|
02a5b45e10 | ||
|
|
5835a372f5 | ||
|
|
590a13688d | ||
|
|
45dede8aee | ||
|
|
e77c9fd327 | ||
|
|
d694c5d9f1 | ||
|
|
30b6b061e6 | ||
|
|
a65ad893eb | ||
|
|
77fd92d2b0 | ||
|
|
8c759fd94d | ||
|
|
536cccbfaf | ||
|
|
64568ce2cc | ||
|
|
22ca68e04a | ||
|
|
63fd4c81b4 | ||
|
|
c77d13f5db | ||
|
|
63fb591b46 | ||
|
|
f93355e6c4 | ||
|
|
53e988e8d2 | ||
|
|
a2e1cd9840 | ||
|
|
9b0165b291 | ||
|
|
91a7c88ea1 | ||
|
|
384c6a842e | ||
|
|
6590b70db6 | ||
|
|
930fb59755 | ||
|
|
8851e54266 | ||
|
|
e597ab7d3f | ||
|
|
e1ed738ec9 | ||
|
|
5811ebfda1 | ||
|
|
c897d78a79 | ||
|
|
9a300dc531 | ||
|
|
68cccdec32 | ||
|
|
bc6e5675e9 | ||
|
|
c08367fdac | ||
|
|
36200c7386 | ||
|
|
2c5577f534 | ||
|
|
b9a11845ef | ||
|
|
bacec6dec2 | ||
|
|
af0cc9988b | ||
|
|
b0aad6405c | ||
|
|
738173fe7c | ||
|
|
b4a127511c | ||
|
|
e8eb8a5468 | ||
|
|
3db8eba92c | ||
|
|
463305a63e | ||
|
|
51f3558b55 | ||
|
|
b56099ad2e | ||
|
|
f3ec7dc196 | ||
|
|
382c976f02 | ||
|
|
5d85fdb7f9 | ||
|
|
314362321d | ||
|
|
a0fd70372f | ||
|
|
47c8f76252 | ||
|
|
7191f8a5ad | ||
|
|
18d02be719 | ||
|
|
40a1a0cbf6 | ||
|
|
2f61dfd9bd | ||
|
|
a2394a506c | ||
|
|
eabf202755 | ||
|
|
738bee9ed5 | ||
|
|
16377cabfa | ||
|
|
c8165c896e | ||
|
|
54103be0f8 | ||
|
|
7432f75f2f | ||
|
|
55c374c07f | ||
|
|
f476c2c907 | ||
|
|
897d596174 | ||
|
|
2859496156 | ||
|
|
2c420ac336 | ||
|
|
2e2a16bbf4 | ||
|
|
d3484d6283 | ||
|
|
9990f54edd | ||
|
|
b234a53b73 | ||
|
|
8916cb5250 | ||
|
|
a178858b85 | ||
|
|
00ce32fffd | ||
|
|
898f1bd563 | ||
|
|
c0cd81bf6f | ||
|
|
41d01f0555 | ||
|
|
b333a87f04 | ||
|
|
00d139d553 | ||
|
|
f4f1bb4b54 | ||
|
|
e512d27784 | ||
|
|
6cdeb2516b | ||
|
|
6d64156db4 | ||
|
|
a66b8a576c | ||
|
|
839e1fe9d1 | ||
|
|
c64653cab8 | ||
|
|
3df6465764 | ||
|
|
b689a18a01 | ||
|
|
20886dd1d5 | ||
|
|
0e892fbb55 | ||
|
|
6290b9ae91 | ||
|
|
753b1d5b2b | ||
|
|
97a81b7816 | ||
|
|
1a0412a984 | ||
|
|
0dde0217f9 | ||
|
|
cc0187291e | ||
|
|
90f5c1ef8a | ||
|
|
b3e9e8833c | ||
|
|
772701a549 | ||
|
|
bef00f18e1 | ||
|
|
72cf428bd9 | ||
|
|
e64486079d | ||
|
|
9a295d674f | ||
|
|
af8127ef2c | ||
|
|
0d63c23493 | ||
|
|
4c2a5a76ce | ||
|
|
99d78549c2 | ||
|
|
ca1e6957a8 | ||
|
|
25941d2050 | ||
|
|
0d361555f3 | ||
|
|
d50db7b16c | ||
|
|
27c2c88e26 | ||
|
|
46ecdf430e | ||
|
|
0e22dcbcdb | ||
|
|
a0f20f696e | ||
|
|
541bc421b7 | ||
|
|
a1018801d4 | ||
|
|
2a3d8dc5b2 | ||
|
|
b6c206c299 | ||
|
|
cc065edb0f | ||
|
|
2db035a9e1 | ||
|
|
78c76878d3 | ||
|
|
f130c8378a | ||
|
|
43c323153c | ||
|
|
64636b1f0f | ||
|
|
c42a46b1a9 | ||
|
|
11f639ba8d | ||
|
|
7c0534098a | ||
|
|
9118fdb660 | ||
|
|
1cf107f47b | ||
|
|
16f7781e49 | ||
|
|
ca5839576a | ||
|
|
3ef5f9653a | ||
|
|
d6df474182 | ||
|
|
5cf7b5d571 | ||
|
|
8c1cc28776 | ||
|
|
d4426776b7 | ||
|
|
2468393f14 | ||
|
|
70a303cb12 | ||
|
|
e5f136c954 | ||
|
|
dd72e773e7 | ||
|
|
8459bccb1e | ||
|
|
c73e1d6e3f | ||
|
|
695c2fe311 | ||
|
|
29598de9b7 | ||
|
|
d60ae1a5cf | ||
|
|
5443e4931a | ||
|
|
3cee08c434 | ||
|
|
5246d59173 | ||
|
|
5b923f9990 | ||
|
|
c458d4c27c | ||
|
|
49ed5ac153 | ||
|
|
616d63a4de | ||
|
|
8043b116a2 | ||
|
|
8b7955f498 | ||
|
|
ce11222784 | ||
|
|
87059b2e7f | ||
|
|
4e7bcceda3 | ||
|
|
c4f95d3c4f | ||
|
|
892b84829d | ||
|
|
519063e5e0 | ||
|
|
9dea742254 | ||
|
|
5b9652e48d | ||
|
|
02915db85b | ||
|
|
db36d68788 | ||
|
|
0dbc2e1c5c | ||
|
|
4c27359cc0 | ||
|
|
44ebca4a39 | ||
|
|
c7272f1817 | ||
|
|
4898b0060f | ||
|
|
3147eb156e | ||
|
|
6f8017f0bf | ||
|
|
7e6d7d72d7 | ||
|
|
3df991e5c0 | ||
|
|
5d885e190b | ||
|
|
be0bdd0248 | ||
|
|
78cf3dafa7 | ||
|
|
03aaa61e91 | ||
|
|
44ed434e13 | ||
|
|
067a70e385 | ||
|
|
ac61213db3 | ||
|
|
59d8b7fb52 | ||
|
|
1a52a8e098 | ||
|
|
9e51e16e9c | ||
|
|
b29fc0ed02 | ||
|
|
74b304a72d | ||
|
|
ab057cb623 | ||
|
|
3a478c2abc | ||
|
|
d8a8b5e50e | ||
|
|
8b5ddc725d | ||
|
|
55807ac941 | ||
|
|
110f4ee5f8 | ||
|
|
5aaa53c503 | ||
|
|
dc3168747c | ||
|
|
38d9232136 | ||
|
|
b661c8e3d1 | ||
|
|
1a949ecb50 | ||
|
|
27dca7c67b | ||
|
|
a19a917941 | ||
|
|
fb08b62839 | ||
|
|
bd75f43b2a | ||
|
|
668aa4ef0f | ||
|
|
837658ddcc | ||
|
|
6503ac2e24 | ||
|
|
eae0afe659 | ||
|
|
ddb526fb42 | ||
|
|
db50c8ffbe | ||
|
|
7198734083 | ||
|
|
6cfcf84b5d | ||
|
|
70bcebe9ea | ||
|
|
d45e2695a5 | ||
|
|
aef05a53ef | ||
|
|
70c9dafda3 | ||
|
|
6491660432 | ||
|
|
31b0a385de | ||
|
|
301a507c9b | ||
|
|
322a1bd9d6 | ||
|
|
fde0b3e242 | ||
|
|
6b1fb386f1 | ||
|
|
759b3f22f9 | ||
|
|
ec9277c0d8 | ||
|
|
a4d91b3c4e | ||
|
|
00996b92d0 | ||
|
|
8ba251d5be | ||
|
|
773cfe6c7d | ||
|
|
e01c55c3ca | ||
|
|
e58fb2b31f | ||
|
|
d4e7fdbb9c | ||
|
|
9e6632897b | ||
|
|
13222ddbc6 | ||
|
|
e13049774a | ||
|
|
39278499a4 | ||
|
|
912e0b55eb | ||
|
|
55a3533230 | ||
|
|
88428b8faa | ||
|
|
7a351a7e7d | ||
|
|
89635a442f | ||
|
|
656407723a | ||
|
|
fcaab01e22 | ||
|
|
78ebc47359 | ||
|
|
ed76f2b652 | ||
|
|
8792f7b458 | ||
|
|
567dc49830 | ||
|
|
b8440c9eae | ||
|
|
fe225796a7 | ||
|
|
c7c90f857b | ||
|
|
1ff54a187d | ||
|
|
319a205b07 | ||
|
|
57dd2d704f | ||
|
|
fcae6d3bce | ||
|
|
c5f9d59a5f | ||
|
|
8966b55ab7 | ||
|
|
652c73e453 | ||
|
|
f139d4df1f | ||
|
|
8437590b00 | ||
|
|
c1ec8be133 | ||
|
|
7c7f21fd27 | ||
|
|
8465f0cb06 | ||
|
|
b44f3042f8 | ||
|
|
b043a87d3a | ||
|
|
f111505110 | ||
|
|
a047a89447 | ||
|
|
8c74e8f3a5 | ||
|
|
b7a59247f9 | ||
|
|
a2edc9acdb | ||
|
|
f29b52f544 | ||
|
|
466585d8ef | ||
|
|
26e28f8b80 | ||
|
|
af6a65f4fb | ||
|
|
948a0f1a02 | ||
|
|
90d250eb77 | ||
|
|
4aba7e49c8 | ||
|
|
616df1c2f5 | ||
|
|
6f12757fa2 | ||
|
|
d6ab1cc88b | ||
|
|
99a737a78c | ||
|
|
6a36830115 | ||
|
|
36b3a31733 | ||
|
|
bbab8cb30d | ||
|
|
e2f2ea76fb | ||
|
|
afa44c4257 | ||
|
|
2e8e55a85f | ||
|
|
1c465f244c | ||
|
|
f160e0daa6 | ||
|
|
5d0c05e743 | ||
|
|
a9e64c88ea | ||
|
|
dd64ab74f1 | ||
|
|
3f9ec0fc19 | ||
|
|
bcfdabb0ba | ||
|
|
9aafbe5d22 | ||
|
|
fcd63fc525 | ||
|
|
4a2a395922 | ||
|
|
0a39463bac | ||
|
|
c148c8ccd4 | ||
|
|
450e091095 | ||
|
|
ce91d4045f | ||
|
|
9e6e01c718 | ||
|
|
e180a84c64 | ||
|
|
3e51467346 | ||
|
|
f5b8468b62 | ||
|
|
4266b07a5f | ||
|
|
5bf8ecc001 | ||
|
|
2b877973aa | ||
|
|
ba346f994a | ||
|
|
ffe096a612 | ||
|
|
fae92e1a5e | ||
|
|
ddf73c7f21 | ||
|
|
35cababb2c | ||
|
|
3d5ee319e5 | ||
|
|
0f80a75fe7 | ||
|
|
c282d15889 | ||
|
|
22484eb8df | ||
|
|
516d35a8c8 | ||
|
|
09f7fe4fa6 | ||
|
|
8d2183a333 | ||
|
|
40ba70f6c0 | ||
|
|
62d767ae20 | ||
|
|
a52fbd023e | ||
|
|
a59723ecef | ||
|
|
0a60f76c87 | ||
|
|
9cfcdd5d10 | ||
|
|
bc4fd066ee | ||
|
|
cce0724842 | ||
|
|
d8148ef9ef | ||
|
|
48c867b1ef | ||
|
|
32967df5c9 | ||
|
|
ec3f9e40bf | ||
|
|
7881f092e6 | ||
|
|
4adda8da9d | ||
|
|
0b9abefda9 | ||
|
|
7757e396cb | ||
|
|
1a3a1d2b03 | ||
|
|
5532640c5d | ||
|
|
afe1663926 | ||
|
|
572d7b39f1 | ||
|
|
73bacfaceb | ||
|
|
71b7691e90 | ||
|
|
fd4ef2c879 | ||
|
|
342ce41d58 | ||
|
|
8748206a5e | ||
|
|
06a23d0940 | ||
|
|
cf0648b1f6 | ||
|
|
e4d3ac82b6 | ||
|
|
bdc1a43710 | ||
|
|
5f9028b33e | ||
|
|
dbac61384f | ||
|
|
29306f3398 | ||
|
|
25880c8db7 | ||
|
|
09402a163c | ||
|
|
4afb670f04 | ||
|
|
68704aab2e | ||
|
|
8538ef3faf | ||
|
|
adea68df65 | ||
|
|
869087aa0e | ||
|
|
a08c0c535c | ||
|
|
46399b5bd7 | ||
|
|
c9c43c2a9e | ||
|
|
d145fc716e | ||
|
|
f19dcbb017 | ||
|
|
938aca4699 | ||
|
|
0acf03a2ed | ||
|
|
2c01a8d130 | ||
|
|
2dfabb998e | ||
|
|
614d340835 | ||
|
|
8ea961d2ca | ||
|
|
f881a0cedd | ||
|
|
96e2255960 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,13 +1,6 @@
|
||||
/.vs
|
||||
/.vscode
|
||||
.vs
|
||||
/Library
|
||||
/Temp
|
||||
/UnityPackageManager
|
||||
/Assets/Res
|
||||
/Assets/Res.meta
|
||||
/Assets/XCharts/Demo/demo_test.unity
|
||||
/Assets/XCharts/Demo/demo_test.unity.meta
|
||||
|
||||
*.sln
|
||||
*.csproj
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ChartModule), true)]
|
||||
public class ChartModuleDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
SerializedProperty m_Name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty m_Title = prop.FindPropertyRelative("m_Title");
|
||||
SerializedProperty m_Selected = prop.FindPropertyRelative("m_Selected");
|
||||
SerializedProperty m_Panel = prop.FindPropertyRelative("m_Panel");
|
||||
var fieldWid = EditorGUIUtility.currentViewWidth - 30 - 5 - 50 - 90;
|
||||
drawRect.width = 15;
|
||||
EditorGUI.PropertyField(drawRect,m_Selected,GUIContent.none);
|
||||
drawRect.x += 15;
|
||||
drawRect.width = 50;
|
||||
EditorGUI.PropertyField(drawRect,m_Name,GUIContent.none);
|
||||
drawRect.x += 52;
|
||||
drawRect.width = fieldWid;
|
||||
EditorGUI.PropertyField(drawRect,m_Title,GUIContent.none);
|
||||
drawRect.x += fieldWid + 2;
|
||||
drawRect.width = 90;
|
||||
EditorGUI.PropertyField(drawRect,m_Panel,GUIContent.none);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI BaseChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(Demo), false)]
|
||||
public class DemoEditor : Editor
|
||||
{
|
||||
protected Demo m_Target;
|
||||
protected SerializedProperty m_Script;
|
||||
protected SerializedProperty m_ButtonNormalColor;
|
||||
protected SerializedProperty m_ButtonSelectedColor;
|
||||
protected SerializedProperty m_ButtonHighlightColor;
|
||||
protected SerializedProperty m_ChartModule;
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Target = (Demo)target;
|
||||
m_Script = serializedObject.FindProperty("m_Script");
|
||||
m_ButtonNormalColor = serializedObject.FindProperty("m_ButtonNormalColor");
|
||||
m_ButtonSelectedColor = serializedObject.FindProperty("m_ButtonSelectedColor");
|
||||
m_ButtonHighlightColor = serializedObject.FindProperty("m_ButtonHighlightColor");
|
||||
m_ChartModule = serializedObject.FindProperty("m_ChartModule");
|
||||
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (m_Target == null && target == null)
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
return;
|
||||
}
|
||||
serializedObject.Update();
|
||||
EditorGUILayout.PropertyField(m_ButtonNormalColor);
|
||||
EditorGUILayout.PropertyField(m_ButtonSelectedColor);
|
||||
EditorGUILayout.PropertyField(m_ButtonHighlightColor);
|
||||
|
||||
var size = m_ChartModule.arraySize;
|
||||
size = EditorGUILayout.IntField("Chart Module Size", size);
|
||||
if (size != m_ChartModule.arraySize)
|
||||
{
|
||||
while (size > m_ChartModule.arraySize)
|
||||
m_ChartModule.InsertArrayElementAtIndex(m_ChartModule.arraySize);
|
||||
while (size < m_ChartModule.arraySize)
|
||||
m_ChartModule.DeleteArrayElementAtIndex(m_ChartModule.arraySize - 1);
|
||||
}
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_ChartModule.GetArrayElementAtIndex(i));
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fa21c3b32aa26a49ababb5a99f12222
|
||||
folderAsset: yes
|
||||
timeCreated: 1555731519
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,188 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts;
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class ChartModule
|
||||
{
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private string m_Title;
|
||||
[SerializeField] private bool m_Selected;
|
||||
[SerializeField] private GameObject m_Panel;
|
||||
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
public string title { get { return m_Title; } set { m_Title = value; } }
|
||||
public bool select { get { return m_Selected; } set { m_Selected = value; } }
|
||||
public GameObject panel { get { return m_Panel; } set { m_Panel = value; } }
|
||||
public Button button { get; set; }
|
||||
}
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Demo : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Color m_ButtonNormalColor;
|
||||
[SerializeField] private Color m_ButtonSelectedColor;
|
||||
[SerializeField] private Color m_ButtonHighlightColor;
|
||||
[SerializeField] private List<ChartModule> m_ChartModule;
|
||||
|
||||
private GameObject m_BtnClone;
|
||||
private Theme m_SelectedTheme;
|
||||
private int m_LastSelectedModuleIndex;
|
||||
|
||||
private Button m_DefaultThemeButton;
|
||||
private Button m_LightThemeButton;
|
||||
private Button m_DarkThemeButton;
|
||||
|
||||
private Text m_Title;
|
||||
|
||||
private ScrollRect m_ScrollRect;
|
||||
private Mask m_Mark;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
m_SelectedTheme = Theme.Default;
|
||||
|
||||
m_ButtonNormalColor = ChartHelper.GetColor("#293C55FF");
|
||||
m_ButtonSelectedColor = ChartHelper.GetColor("#e43c59ff");
|
||||
m_ButtonHighlightColor = ChartHelper.GetColor("#0E151FFF");
|
||||
|
||||
m_ScrollRect = transform.Find("chart_detail").GetComponent<ScrollRect>();
|
||||
m_Mark = transform.Find("chart_detail/Viewport").GetComponent<Mask>();
|
||||
m_Mark.enabled = true;
|
||||
m_Title = transform.Find("chart_title/Text").GetComponent<Text>();
|
||||
|
||||
InitThemeButton();
|
||||
InitModuleButton();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (m_ChartModule.Count <= 0) return;
|
||||
int selectedModuleIndex = -1;
|
||||
for (int i = 0; i < m_ChartModule.Count; i++)
|
||||
{
|
||||
if (selectedModuleIndex >= 0 && i > selectedModuleIndex)
|
||||
{
|
||||
m_ChartModule[i].select = false;
|
||||
}
|
||||
else if (m_ChartModule[i].select)
|
||||
{
|
||||
selectedModuleIndex = i;
|
||||
}
|
||||
}
|
||||
if (selectedModuleIndex < 0) selectedModuleIndex = 0;
|
||||
if (selectedModuleIndex != m_LastSelectedModuleIndex)
|
||||
{
|
||||
InitModuleButton();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void InitModuleButton()
|
||||
{
|
||||
var btnPanel = transform.Find("chart_list");
|
||||
m_BtnClone = transform.Find("btn_clone").gameObject;
|
||||
m_BtnClone.SetActive(false);
|
||||
ChartHelper.DestoryAllChilds(btnPanel);
|
||||
foreach (var module in m_ChartModule)
|
||||
{
|
||||
var btnName = "btn_" + module.name;
|
||||
GameObject btn;
|
||||
if (btnPanel.Find(btnName))
|
||||
{
|
||||
btn = btnPanel.Find(btnName).gameObject;
|
||||
btn.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
btn = GameObject.Instantiate(m_BtnClone);
|
||||
btn.SetActive(true);
|
||||
btn.name = btnName;
|
||||
btn.transform.SetParent(btnPanel);
|
||||
btn.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
btn.transform.localScale = Vector3.one;
|
||||
module.button = btn.GetComponent<Button>();
|
||||
module.button.GetComponentInChildren<Text>().text = module.name;
|
||||
|
||||
ChartHelper.AddEventListener(btn.gameObject, EventTriggerType.PointerDown, (data) =>
|
||||
{
|
||||
ClickModule(module);
|
||||
});
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_ChartModule.Count; i++)
|
||||
{
|
||||
var module = m_ChartModule[i];
|
||||
if (module.select)
|
||||
{
|
||||
ClickModule(module);
|
||||
m_LastSelectedModuleIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClickModule(ChartModule selectedModule)
|
||||
{
|
||||
foreach (var module in m_ChartModule)
|
||||
{
|
||||
if (selectedModule != module)
|
||||
{
|
||||
var block = module.button.colors;
|
||||
block.highlightedColor = m_ButtonHighlightColor;
|
||||
block.normalColor = m_ButtonNormalColor;
|
||||
module.button.colors = block;
|
||||
module.panel.SetActive(false);
|
||||
module.select = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var block = module.button.colors;
|
||||
block.highlightedColor = m_ButtonSelectedColor;
|
||||
block.normalColor = m_ButtonSelectedColor;
|
||||
module.button.colors = block;
|
||||
module.panel.SetActive(true);
|
||||
module.select = true;
|
||||
}
|
||||
}
|
||||
m_ScrollRect.content = selectedModule.panel.GetComponent<RectTransform>();
|
||||
m_Title.text = string.IsNullOrEmpty(selectedModule.title) ?
|
||||
selectedModule.name : selectedModule.title;
|
||||
}
|
||||
|
||||
void InitThemeButton()
|
||||
{
|
||||
m_DefaultThemeButton = transform.Find("chart_theme/btn_default").GetComponent<Button>();
|
||||
m_LightThemeButton = transform.Find("chart_theme/btn_light").GetComponent<Button>();
|
||||
m_DarkThemeButton = transform.Find("chart_theme/btn_dark").GetComponent<Button>();
|
||||
|
||||
m_DefaultThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Default);
|
||||
m_LightThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Light);
|
||||
m_DarkThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Dark);
|
||||
|
||||
m_DefaultThemeButton.onClick.AddListener(delegate () { SelecteTheme(Theme.Default); });
|
||||
m_LightThemeButton.onClick.AddListener(delegate () { SelecteTheme(Theme.Light); });
|
||||
m_DarkThemeButton.onClick.AddListener(delegate () { SelecteTheme(Theme.Dark); });
|
||||
|
||||
//SelecteTheme(Theme.Default);
|
||||
}
|
||||
|
||||
void SelecteTheme(Theme theme)
|
||||
{
|
||||
m_SelectedTheme = theme;
|
||||
m_DefaultThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Default);
|
||||
m_LightThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Light);
|
||||
m_DarkThemeButton.transform.Find("selected").gameObject.SetActive(m_SelectedTheme == Theme.Dark);
|
||||
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||
foreach (var chart in charts)
|
||||
{
|
||||
chart.UpdateTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2cb45775d5ecfa4488a53912a49a832
|
||||
timeCreated: 1555862356
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,39 +0,0 @@
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Demo10_LineSimple : MonoBehaviour
|
||||
{
|
||||
void Awake()
|
||||
{
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null) return;
|
||||
|
||||
chart.title.show = true;
|
||||
chart.title.text = "Line Simple";
|
||||
|
||||
chart.tooltip.show = true;
|
||||
chart.legend.show = false;
|
||||
|
||||
chart.xAxises[0].show = true;
|
||||
chart.xAxises[1].show = false;
|
||||
chart.yAxises[0].show = true;
|
||||
chart.yAxises[1].show = false;
|
||||
|
||||
chart.xAxises[0].type = Axis.AxisType.Category;
|
||||
chart.yAxises[0].type = Axis.AxisType.Value;
|
||||
|
||||
int dataCount = 10;
|
||||
chart.xAxises[0].splitNumber = dataCount;
|
||||
chart.xAxises[0].boundaryGap = true;
|
||||
|
||||
chart.RemoveData();
|
||||
chart.AddSerie("test", SerieType.Line);
|
||||
for (int i = 0; i < dataCount; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
chart.AddData(0, Random.Range(10, 20));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Demo11_AddSinCurve : MonoBehaviour
|
||||
{
|
||||
private float time;
|
||||
public int angle;
|
||||
private LineChart chart;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart != null)
|
||||
{
|
||||
GameObject.DestroyImmediate(chart);
|
||||
}
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.title.show = true;
|
||||
chart.title.text = "Sin Curve";
|
||||
|
||||
chart.tooltip.show = true;
|
||||
chart.legend.show = false;
|
||||
|
||||
chart.xAxises[0].show = true;
|
||||
chart.xAxises[1].show = false;
|
||||
chart.yAxises[0].show = true;
|
||||
chart.yAxises[1].show = false;
|
||||
|
||||
chart.xAxises[0].type = Axis.AxisType.Value;
|
||||
chart.yAxises[0].type = Axis.AxisType.Value;
|
||||
|
||||
chart.xAxises[0].boundaryGap = false;
|
||||
chart.maxCacheDataNumber = 0;
|
||||
|
||||
chart.line.step = false;
|
||||
chart.line.smooth = false;
|
||||
chart.line.area = false;
|
||||
|
||||
chart.RemoveData();
|
||||
|
||||
var serie = chart.AddSerie("test", SerieType.Line);
|
||||
serie.symbol.type = SerieSymbolType.None;
|
||||
for (angle = 0; angle < 1080; angle++)
|
||||
{
|
||||
float xvalue = Mathf.PI / 180 * angle;
|
||||
float yvalue = Mathf.Sin(xvalue);
|
||||
chart.AddData(0, xvalue, yvalue);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(angle > 3000) return;
|
||||
angle++;
|
||||
float xvalue = Mathf.PI / 180 * angle;
|
||||
float yvalue = Mathf.Sin(xvalue);
|
||||
chart.AddData(0, xvalue, yvalue);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Demo50_Scatter : MonoBehaviour
|
||||
{
|
||||
private ScatterChart chart;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<ScatterChart>();
|
||||
if (chart == null) return;
|
||||
chart.series.SetSerieSymbolSizeCallback(SymbolSize,SymbolSelectedSize);
|
||||
}
|
||||
|
||||
float SymbolSize(List<float> data)
|
||||
{
|
||||
//return Mathf.Clamp(data[1] * 10,1,100);
|
||||
return (float)(Mathf.Sqrt(data[2]) / 6e2);
|
||||
}
|
||||
|
||||
float SymbolSelectedSize(List<float> data)
|
||||
{
|
||||
//return Mathf.Clamp(data[1] * 10,1,100);
|
||||
return (float)(Mathf.Sqrt(data[2]) / 5e2);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb4941eb0bbd14736b16b39d256255bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(CoordinateChart))]
|
||||
public class Demo_Dynamic : MonoBehaviour
|
||||
{
|
||||
public int maxCacheDataNumber = 100;
|
||||
public float initDataTime = 2;
|
||||
|
||||
private CoordinateChart chart;
|
||||
private float updateTime;
|
||||
private float initTime;
|
||||
private int initCount;
|
||||
private int count;
|
||||
private bool isInited;
|
||||
private DateTime timeNow;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponentInChildren<CoordinateChart>();
|
||||
chart.RemoveData();
|
||||
var serie = chart.AddSerie("data", SerieType.Line);
|
||||
serie.symbol.type = SerieSymbolType.None;
|
||||
chart.maxCacheDataNumber = maxCacheDataNumber;
|
||||
timeNow = DateTime.Now;
|
||||
timeNow = timeNow.AddSeconds(-maxCacheDataNumber);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (initCount < maxCacheDataNumber)
|
||||
{
|
||||
int count = (int)(maxCacheDataNumber / initDataTime * Time.deltaTime);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
timeNow = timeNow.AddSeconds(1);
|
||||
string category = timeNow.ToString("hh:mm:ss");
|
||||
float value = UnityEngine.Random.Range(60, 150);
|
||||
chart.AddXAxisData(category);
|
||||
chart.AddData(0, value);
|
||||
initCount++;
|
||||
if (initCount > maxCacheDataNumber) break;
|
||||
}
|
||||
chart.RefreshChart();
|
||||
}
|
||||
updateTime += Time.deltaTime;
|
||||
if (updateTime >= 1)
|
||||
{
|
||||
updateTime = 0;
|
||||
count++;
|
||||
string category = DateTime.Now.ToString("hh:mm:ss");
|
||||
float value = UnityEngine.Random.Range(60, 150);
|
||||
chart.AddXAxisData(category);
|
||||
chart.AddData(0, value);
|
||||
chart.RefreshChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c3d5e10d25691247b392b09eec051bf
|
||||
timeCreated: 1557485360
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,44 +0,0 @@
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(CoordinateChart))]
|
||||
public class Demo_LargeData : MonoBehaviour
|
||||
{
|
||||
public int maxCacheDataNumber = 3000;
|
||||
public float initDataTime = 5;
|
||||
|
||||
private CoordinateChart chart;
|
||||
private float initTime;
|
||||
private int initCount = 0;
|
||||
private System.DateTime timeNow;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponentInChildren<CoordinateChart>();
|
||||
timeNow = System.DateTime.Now;
|
||||
chart.ClearAxisData();
|
||||
chart.series.ClearData();
|
||||
chart.maxCacheDataNumber = 0;
|
||||
chart.title.text = maxCacheDataNumber + "数据";
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (initCount < maxCacheDataNumber)
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
initCount++;
|
||||
if (initCount > maxCacheDataNumber) break;
|
||||
chart.title.text = initCount+"数据";
|
||||
timeNow = timeNow.AddSeconds(1);
|
||||
float xvalue = Mathf.PI / 180 * initCount;
|
||||
float yvalue = Mathf.Sin(xvalue);
|
||||
chart.AddData(0, 15 + yvalue * 2);
|
||||
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b7f7cfd79a632a46bdc2aac41160f37
|
||||
timeCreated: 1557485007
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,37 +0,0 @@
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(PieChart))]
|
||||
public class Demo_PieChart : MonoBehaviour
|
||||
{
|
||||
private PieChart chart;
|
||||
private float time;
|
||||
private int count = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
chart = transform.GetComponent<PieChart>();
|
||||
chart.ClearData();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time > 1)
|
||||
{
|
||||
time = 0;
|
||||
if (count < 5)
|
||||
{
|
||||
chart.AddData(0, Random.Range(10, 100), "time" + count);
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = count % 5;
|
||||
chart.UpdateData(0, Random.Range(10, 100),index);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f0aafe148c9e4f4dbf24fc6542722fa
|
||||
timeCreated: 1557832345
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd29cbce72290724b8772e66460b2a1d
|
||||
folderAsset: yes
|
||||
timeCreated: 1536101222
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ed45d2c9978fbf4aac0915d767f8853
|
||||
folderAsset: yes
|
||||
timeCreated: 1554216875
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,31 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI BarChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(BarChart), false)]
|
||||
public class BarChartEditor : CoordinateChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Bar;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (BarChart)target;
|
||||
m_Bar = serializedObject.FindProperty("m_Bar");
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
if (m_Target == null && target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
EditorGUILayout.PropertyField(m_Bar, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5acea6fd06c0e9c498c434f941e4cba9
|
||||
timeCreated: 1554219116
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,107 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI BaseChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(BaseChart), false)]
|
||||
public class BaseChartEditor : Editor
|
||||
{
|
||||
protected BaseChart m_Target;
|
||||
protected SerializedProperty m_Script;
|
||||
protected SerializedProperty m_ChartWidth;
|
||||
protected SerializedProperty m_ChartHeight;
|
||||
protected SerializedProperty m_Theme;
|
||||
protected SerializedProperty m_ThemeInfo;
|
||||
protected SerializedProperty m_Title;
|
||||
protected SerializedProperty m_Legend;
|
||||
protected SerializedProperty m_Tooltip;
|
||||
protected SerializedProperty m_Series;
|
||||
|
||||
protected SerializedProperty m_Large;
|
||||
protected SerializedProperty m_MinShowDataNumber;
|
||||
protected SerializedProperty m_MaxShowDataNumber;
|
||||
protected SerializedProperty m_MaxCacheDataNumber;
|
||||
|
||||
protected float m_DefaultLabelWidth;
|
||||
protected float m_DefaultFieldWidth;
|
||||
private int m_SeriesSize;
|
||||
private bool m_BaseModuleToggle = false;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Target = (BaseChart)target;
|
||||
m_Script = serializedObject.FindProperty("m_Script");
|
||||
m_ChartWidth = serializedObject.FindProperty("m_ChartWidth");
|
||||
m_ChartHeight = serializedObject.FindProperty("m_ChartHeight");
|
||||
m_Theme = serializedObject.FindProperty("m_Theme");
|
||||
m_ThemeInfo = serializedObject.FindProperty("m_ThemeInfo");
|
||||
m_Title = serializedObject.FindProperty("m_Title");
|
||||
m_Legend = serializedObject.FindProperty("m_Legend");
|
||||
m_Tooltip = serializedObject.FindProperty("m_Tooltip");
|
||||
m_Series = serializedObject.FindProperty("m_Series");
|
||||
|
||||
m_Large = serializedObject.FindProperty("m_Large");
|
||||
m_MinShowDataNumber = serializedObject.FindProperty("m_MinShowDataNumber");
|
||||
m_MaxShowDataNumber = serializedObject.FindProperty("m_MaxShowDataNumber");
|
||||
m_MaxCacheDataNumber = serializedObject.FindProperty("m_MaxCacheDataNumber");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (m_Target == null && target == null)
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
return;
|
||||
}
|
||||
serializedObject.Update();
|
||||
m_DefaultLabelWidth = EditorGUIUtility.labelWidth;
|
||||
m_DefaultFieldWidth = EditorGUIUtility.fieldWidth;
|
||||
|
||||
OnStartInspectorGUI();
|
||||
OnMiddleInspectorGUI();
|
||||
OnEndInspectorGUI();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected virtual void OnStartInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_Script);
|
||||
EditorGUILayout.PropertyField(m_ChartWidth);
|
||||
EditorGUILayout.PropertyField(m_ChartHeight);
|
||||
EditorGUILayout.PropertyField(m_ThemeInfo, true);
|
||||
EditorGUILayout.PropertyField(m_Title, true);
|
||||
EditorGUILayout.PropertyField(m_Legend, true);
|
||||
EditorGUILayout.PropertyField(m_Tooltip, true);
|
||||
}
|
||||
|
||||
protected virtual void OnMiddleInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_Series, true);
|
||||
m_BaseModuleToggle = EditorGUILayout.Foldout(m_BaseModuleToggle,
|
||||
new GUIContent("Base", "基础配置"),
|
||||
ChartEditorHelper.foldoutStyle);
|
||||
if (m_BaseModuleToggle)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var largeTip = "Whether to enable the optimization of large-scale graph. \n是否启用大规模线图的优化,在数据图形特别多的时候(>=5k)可以开启。";
|
||||
EditorGUILayout.PropertyField(m_Large, new GUIContent("Large", largeTip));
|
||||
EditorGUILayout.PropertyField(m_MinShowDataNumber, true);
|
||||
EditorGUILayout.PropertyField(m_MaxShowDataNumber, true);
|
||||
EditorGUILayout.PropertyField(m_MaxCacheDataNumber, true);
|
||||
if (m_MinShowDataNumber.intValue < 0) m_MinShowDataNumber.intValue = 0;
|
||||
if (m_MaxShowDataNumber.intValue < 0) m_MaxShowDataNumber.intValue = 0;
|
||||
if (m_MaxCacheDataNumber.intValue < 0) m_MaxCacheDataNumber.intValue = 0;
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnEndInspectorGUI()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI CoordinateChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(CoordinateChart), false)]
|
||||
public class CoordinateChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Grid;
|
||||
protected SerializedProperty m_MultipleXAxis;
|
||||
protected SerializedProperty m_XAxises;
|
||||
protected SerializedProperty m_MultipleYAxis;
|
||||
protected SerializedProperty m_YAxises;
|
||||
protected SerializedProperty m_DataZoom;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (CoordinateChart)target;
|
||||
m_Grid = serializedObject.FindProperty("m_Grid");
|
||||
m_XAxises = serializedObject.FindProperty("m_XAxises");
|
||||
m_YAxises = serializedObject.FindProperty("m_YAxises");
|
||||
m_DataZoom = serializedObject.FindProperty("m_DataZoom");
|
||||
}
|
||||
|
||||
protected override void OnStartInspectorGUI()
|
||||
{
|
||||
base.OnStartInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_DataZoom);
|
||||
EditorGUILayout.PropertyField(m_Grid);
|
||||
for (int i = 0; i < m_XAxises.arraySize; i++)
|
||||
{
|
||||
SerializedProperty axis = m_XAxises.GetArrayElementAtIndex(i);
|
||||
EditorGUILayout.PropertyField(axis);
|
||||
}
|
||||
for (int i = 0; i < m_YAxises.arraySize; i++)
|
||||
{
|
||||
SerializedProperty axis = m_YAxises.GetArrayElementAtIndex(i);
|
||||
EditorGUILayout.PropertyField(axis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dd7acd8b13f3f14e9891af4e8dd0b0b
|
||||
timeCreated: 1554475249
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,27 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI LineChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(LineChart), false)]
|
||||
public class LineChartEditor : CoordinateChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Line;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (LineChart)target;
|
||||
m_Line = serializedObject.FindProperty("m_Line");
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_Line, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bd1a238bc5b407408b8f902aa3db9fd
|
||||
timeCreated: 1554539035
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,27 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI PieChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(PieChart), false)]
|
||||
public class PieChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Pie;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (PieChart)target;
|
||||
m_Pie = serializedObject.FindProperty("m_Pie");
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_Pie, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28de30021bed0f945af09633584fcb44
|
||||
timeCreated: 1554768152
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ad1e8940e4805b49a18ea7a2cbd4bce
|
||||
folderAsset: yes
|
||||
timeCreated: 1554304641
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,53 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AreaStyle), true)]
|
||||
public class AreaStyleDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AreaStyleToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Origin = prop.FindPropertyRelative("m_Origin");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_ToColor = prop.FindPropertyRelative("m_ToColor");
|
||||
SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AreaStyleToggle, prop, "Area Style", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AreaStyleToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Origin);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ToColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Opacity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AreaStyleToggle, prop))
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis), true)]
|
||||
public class AxisDrawer : PropertyDrawer
|
||||
{
|
||||
private List<bool> m_AxisModuleToggle = new List<bool>();
|
||||
private List<bool> m_DataFoldout = new List<bool>();
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
|
||||
|
||||
protected virtual string GetDisplayName(string displayName)
|
||||
{
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
SerializedProperty m_Show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
|
||||
SerializedProperty m_AxisLabel = prop.FindPropertyRelative("m_AxisLabel");
|
||||
SerializedProperty m_ShowSplitLine = prop.FindPropertyRelative("m_ShowSplitLine");
|
||||
SerializedProperty m_SplitLineType = prop.FindPropertyRelative("m_SplitLineType");
|
||||
SerializedProperty m_BoundaryGap = prop.FindPropertyRelative("m_BoundaryGap");
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
SerializedProperty m_AxisLine = prop.FindPropertyRelative("m_AxisLine");
|
||||
SerializedProperty m_AxisName = prop.FindPropertyRelative("m_AxisName");
|
||||
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
||||
SerializedProperty m_SplitArea = prop.FindPropertyRelative("m_SplitArea");
|
||||
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
||||
SerializedProperty m_Min = prop.FindPropertyRelative("m_Min");
|
||||
SerializedProperty m_Max = prop.FindPropertyRelative("m_Max");
|
||||
|
||||
int index = InitToggle(prop);
|
||||
bool toggle = m_AxisModuleToggle[index];
|
||||
m_AxisModuleToggle[index] = ChartEditorHelper.MakeFoldout(ref drawRect, ref toggle,
|
||||
GetDisplayName(prop.displayName), m_Show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisModuleToggle[index])
|
||||
{
|
||||
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (type == Axis.AxisType.Value)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_MinMaxType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
|
||||
switch (minMaxType)
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
break;
|
||||
case Axis.AxisMinMaxType.MinMax:
|
||||
break;
|
||||
case Axis.AxisMinMaxType.Custom:
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.PropertyField(drawRect, m_Min);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Max);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.indentLevel--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_ShowSplitLine.boolValue)
|
||||
{
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowSplitLine);
|
||||
//drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 35;
|
||||
drawRect.width = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 55;
|
||||
EditorGUI.PropertyField(drawRect, m_SplitLineType, GUIContent.none);
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_ShowSplitLine);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_BoundaryGap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AxisLine);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLine);
|
||||
EditorGUI.PropertyField(drawRect, m_AxisName);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisName);
|
||||
EditorGUI.PropertyField(drawRect, m_AxisTick);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||
EditorGUI.PropertyField(drawRect, m_AxisLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLabel);
|
||||
EditorGUI.PropertyField(drawRect, m_SplitArea);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_SplitArea);
|
||||
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop, pos.width);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int index = InitToggle(prop);
|
||||
if (!m_AxisModuleToggle[index])
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
||||
SerializedProperty m_AxisLine = prop.FindPropertyRelative("m_AxisLine");
|
||||
SerializedProperty m_AxisName = prop.FindPropertyRelative("m_AxisName");
|
||||
SerializedProperty m_AxisLabel = prop.FindPropertyRelative("m_AxisLabel");
|
||||
SerializedProperty m_SplitArea = prop.FindPropertyRelative("m_SplitArea");
|
||||
float height = 0;
|
||||
height += 10 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
|
||||
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 2;
|
||||
if (num > 50) num = 13;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
else if (type == Axis.AxisType.Value)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
||||
if (m_MinMaxType.enumValueIndex == (int)Axis.AxisMinMaxType.Custom)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisName);
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisLine);
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||
height += EditorGUI.GetPropertyHeight(m_AxisLabel);
|
||||
height += EditorGUI.GetPropertyHeight(m_SplitArea);
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
private int InitToggle(SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
int.TryParse(prop.displayName.Split(' ')[1],out index);
|
||||
if (index >= m_DataFoldout.Count)
|
||||
{
|
||||
m_DataFoldout.Add(false);
|
||||
}
|
||||
if (index >= m_AxisModuleToggle.Count)
|
||||
{
|
||||
m_AxisModuleToggle.Add(false);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0544f1db7f17644bb3cbe7c85da84d5
|
||||
timeCreated: 1554507809
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisLabel), true)]
|
||||
public class AxisLabelDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AxisLabelToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Inside = prop.FindPropertyRelative("m_Inside");
|
||||
SerializedProperty m_Interval = prop.FindPropertyRelative("m_Interval");
|
||||
SerializedProperty m_Rotate = prop.FindPropertyRelative("m_Rotate");
|
||||
SerializedProperty m_Margin = prop.FindPropertyRelative("m_Margin");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisLabelToggle,prop, "Axis Label", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLabelToggle,prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Inside);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Interval);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rotate);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Margin);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLabelToggle,prop))
|
||||
{
|
||||
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88f38952bcbcd448dbe12f98e9c9110d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,55 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisLine), true)]
|
||||
public class AxisLineDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AxisLineToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_OnZero = prop.FindPropertyRelative("m_OnZero");
|
||||
SerializedProperty m_Symbol = prop.FindPropertyRelative("m_Symbol");
|
||||
SerializedProperty m_SymbolWidth = prop.FindPropertyRelative("m_SymbolWidth");
|
||||
SerializedProperty m_SymbolHeight = prop.FindPropertyRelative("m_SymbolHeight");
|
||||
SerializedProperty m_SymbolOffset = prop.FindPropertyRelative("m_SymbolOffset");
|
||||
SerializedProperty m_SymbolDent = prop.FindPropertyRelative("m_SymbolDent");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisLineToggle, prop, "Axis Line", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLineToggle,prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_OnZero);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Symbol);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolOffset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SymbolDent);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisLineToggle,prop))
|
||||
{
|
||||
height += 6 * EditorGUIUtility.singleLineHeight + 7 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 866eefe266c3c47809d9dff3e89be0ab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisName), true)]
|
||||
public class AxisNameDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_AxisNameToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty m_Location = prop.FindPropertyRelative("m_Location");
|
||||
SerializedProperty m_Gap = prop.FindPropertyRelative("m_Gap");
|
||||
SerializedProperty m_Rotate = prop.FindPropertyRelative("m_Rotate");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisNameToggle, prop, "Axis Name", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisNameToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Location);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Gap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rotate);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_AxisNameToggle, prop))
|
||||
{
|
||||
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93f4873273d9c4d76bd651c8d774637f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,54 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisSplitArea), true)]
|
||||
public class AxisSplitAreaDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_ColorFoldout = false;
|
||||
private int m_ColorSize = 0;
|
||||
private Dictionary<string, bool> m_SplitAreaToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SplitAreaToggle, prop, "Split Area", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_SplitAreaToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
m_ColorFoldout = EditorGUI.Foldout(drawRect, m_ColorFoldout, "Color");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.width = pos.width;
|
||||
if (m_ColorFoldout)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_ColorSize, m_Color);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_SplitAreaToggle, prop))
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_ColorFoldout)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Color");
|
||||
int num = m_Data.arraySize + 1;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 988570bd6485942da9879649ed4adb5b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,45 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AxisTick), true)]
|
||||
public class AxisTickDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_AxisTickToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_AlignWithLabel = prop.FindPropertyRelative("m_AlignWithLabel");
|
||||
SerializedProperty m_Inside = prop.FindPropertyRelative("m_Inside");
|
||||
SerializedProperty m_Length = prop.FindPropertyRelative("m_Length");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisTickToggle, "Axis Tick", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisTickToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_AlignWithLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Inside);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Length);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_AxisTickToggle)
|
||||
{
|
||||
height += 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c7d45bc59dedc140b08f6e9d26ccd9d
|
||||
timeCreated: 1555890921
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,51 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Bar), true)]
|
||||
public class BarDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_InSameBar;
|
||||
SerializedProperty m_BarWidth;
|
||||
SerializedProperty m_Space;
|
||||
bool m_BarModuleToggle = true;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_InSameBar = prop.FindPropertyRelative("m_InSameBar");
|
||||
m_BarWidth = prop.FindPropertyRelative("m_BarWidth");
|
||||
m_Space = prop.FindPropertyRelative("m_Space");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_BarModuleToggle, "Bar");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (m_BarModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_InSameBar);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BarWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Space);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_BarModuleToggle)
|
||||
return 4 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a443d39bebe073645a240a745feb9fc5
|
||||
timeCreated: 1554768582
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,80 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(DataZoom), true)]
|
||||
public class DataZoomDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_DataZoomModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_FilterMode = prop.FindPropertyRelative("m_FilterMode");
|
||||
//SerializedProperty m_Orient = prop.FindPropertyRelative("m_Orient");
|
||||
SerializedProperty m_ShowDataShadow = prop.FindPropertyRelative("m_ShowDataShadow");
|
||||
SerializedProperty m_ShowDetail = prop.FindPropertyRelative("m_ShowDetail");
|
||||
SerializedProperty m_ZoomLock = prop.FindPropertyRelative("m_ZoomLock");
|
||||
SerializedProperty m_Realtime = prop.FindPropertyRelative("m_Realtime");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_Height = prop.FindPropertyRelative("m_Height");
|
||||
SerializedProperty m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
SerializedProperty m_RangeMode = prop.FindPropertyRelative("m_RangeMode");
|
||||
SerializedProperty m_Start = prop.FindPropertyRelative("m_Start");
|
||||
SerializedProperty m_End = prop.FindPropertyRelative("m_End");
|
||||
SerializedProperty m_ScrollSensitivity = prop.FindPropertyRelative("m_ScrollSensitivity");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_DataZoomModuleToggle, "DataZoom", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_DataZoomModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FilterMode);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
//EditorGUI.PropertyField(drawRect, m_Orient);
|
||||
//drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowDataShadow);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ShowDetail);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ZoomLock);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Realtime);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ScrollSensitivity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Height);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_RangeMode);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Start);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_End);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_DataZoomModuleToggle)
|
||||
{
|
||||
height += 13 * EditorGUIUtility.singleLineHeight + 12 * EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
}
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cba26e421f79077499f05aaf10d06b4f
|
||||
timeCreated: 1559609801
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,51 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Grid), true)]
|
||||
public class GridDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_GridModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
SerializedProperty m_Show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Left = prop.FindPropertyRelative("m_Left");
|
||||
SerializedProperty m_Right = prop.FindPropertyRelative("m_Right");
|
||||
SerializedProperty m_Top = prop.FindPropertyRelative("m_Top");
|
||||
SerializedProperty m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_GridModuleToggle, "Grid",m_Show);
|
||||
EditorGUI.LabelField(drawRect, "Grid", EditorStyles.boldLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_GridModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_GridModuleToggle)
|
||||
return 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4142159d55a64e1d88d81ac84b714d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,85 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Legend), true)]
|
||||
public class LegendDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_DataFoldout = false;
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_LegendModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_SelectedMode = prop.FindPropertyRelative("m_SelectedMode");
|
||||
SerializedProperty orient = prop.FindPropertyRelative("m_Orient");
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
SerializedProperty itemWidth = prop.FindPropertyRelative("m_ItemWidth");
|
||||
SerializedProperty itemHeight = prop.FindPropertyRelative("m_ItemHeight");
|
||||
SerializedProperty itemGap = prop.FindPropertyRelative("m_ItemGap");
|
||||
SerializedProperty itemFontSize = prop.FindPropertyRelative("m_ItemFontSize");
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LegendModuleToggle, "Legend", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_LegendModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, itemWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, itemHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, itemGap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, itemFontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedMode);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, orient);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, location);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(location);
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop,pos.width);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_LegendModuleToggle)
|
||||
{
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
height += 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(location);
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 1;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b96d10541649a23468168ba0bf1c0bc5
|
||||
timeCreated: 1554395454
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,94 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Line), true)]
|
||||
public class LineDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Tickness;
|
||||
SerializedProperty m_Smooth;
|
||||
SerializedProperty m_SmoothStyle;
|
||||
SerializedProperty m_Area;
|
||||
SerializedProperty m_Step;
|
||||
SerializedProperty m_StepType;
|
||||
|
||||
private bool m_LineModuleToggle = false;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Tickness = prop.FindPropertyRelative("m_Tickness");
|
||||
m_Smooth = prop.FindPropertyRelative("m_Smooth");
|
||||
m_SmoothStyle = prop.FindPropertyRelative("m_SmoothStyle");
|
||||
m_Area = prop.FindPropertyRelative("m_Area");
|
||||
m_Step = prop.FindPropertyRelative("m_Step");
|
||||
m_StepType = prop.FindPropertyRelative("m_StepType");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LineModuleToggle, "Line");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_LineModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Tickness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
EditorGUI.PropertyField(drawRect, m_Smooth);
|
||||
if (m_Smooth.boolValue)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
||||
EditorGUI.LabelField(drawRect, "Style");
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
||||
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||
if (tempWidth < 20) tempWidth = 20;
|
||||
drawRect.width = tempWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_SmoothStyle, GUIContent.none);
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
EditorGUI.PropertyField(drawRect, m_Step);
|
||||
if (m_Step.boolValue)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
||||
EditorGUI.LabelField(drawRect, "Type");
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
||||
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||
if (tempWidth < 20) tempWidth = 20;
|
||||
drawRect.width = tempWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_StepType, GUIContent.none);
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Area);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_LineModuleToggle)
|
||||
{
|
||||
height = 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0eeb8c12e86239b4e93a6c75d766cb15
|
||||
timeCreated: 1554720052
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,52 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(LineStyle), true)]
|
||||
public class LineStyleDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_LineStyleToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_Width = prop.FindPropertyRelative("m_Width");
|
||||
SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity");
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LineStyleToggle, prop, "Line Style", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_LineStyleToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Width);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Opacity);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_LineStyleToggle, prop))
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Location), true)]
|
||||
public class LocationDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty align = prop.FindPropertyRelative("m_Align");
|
||||
SerializedProperty left = prop.FindPropertyRelative("m_Left");
|
||||
SerializedProperty right = prop.FindPropertyRelative("m_Right");
|
||||
SerializedProperty top = prop.FindPropertyRelative("m_Top");
|
||||
SerializedProperty bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
EditorGUI.PropertyField(drawRect, align, new GUIContent("Location"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
++EditorGUI.indentLevel;
|
||||
switch ((Location.Align)align.enumValueIndex)
|
||||
{
|
||||
case Location.Align.TopCenter:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.TopLeft:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.TopRight:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomCenter:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomLeft:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomRight:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.Center:
|
||||
break;
|
||||
case Location.Align.CenterLeft:
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.CenterRight:
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
SerializedProperty align = prop.FindPropertyRelative("m_Align");
|
||||
switch ((Location.Align)align.enumValueIndex)
|
||||
{
|
||||
case Location.Align.Center:
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case Location.Align.TopCenter:
|
||||
case Location.Align.BottomCenter:
|
||||
case Location.Align.CenterLeft:
|
||||
case Location.Align.CenterRight:
|
||||
return 2 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
default:
|
||||
return 3 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Pie), true)]
|
||||
public class PieInfoDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Name;
|
||||
SerializedProperty m_InsideRadius;
|
||||
SerializedProperty m_OutsideRadius;
|
||||
SerializedProperty m_TooltipExtraRadius;
|
||||
SerializedProperty m_Rose;
|
||||
SerializedProperty m_Space;
|
||||
SerializedProperty m_Left;
|
||||
SerializedProperty m_Right;
|
||||
SerializedProperty m_Top;
|
||||
SerializedProperty m_Bottom;
|
||||
SerializedProperty m_Selected;
|
||||
SerializedProperty m_SelectedIndex;
|
||||
SerializedProperty m_SelectedOffset;
|
||||
bool m_PieModuleToggle = true;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_TooltipExtraRadius = prop.FindPropertyRelative("m_TooltipExtraRadius");
|
||||
m_SelectedOffset = prop.FindPropertyRelative("m_SelectedOffset");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_PieModuleToggle, "Pie");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_PieModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipExtraRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedOffset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_PieModuleToggle)
|
||||
return 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 019eadbd43e952945925f357ae8ef74b
|
||||
timeCreated: 1554773154
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,122 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar), true)]
|
||||
public class RadarDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Shape;
|
||||
SerializedProperty m_Radius;
|
||||
SerializedProperty m_SplitNumber;
|
||||
SerializedProperty m_Center;
|
||||
SerializedProperty m_LineStyle;
|
||||
SerializedProperty m_SplitArea;
|
||||
SerializedProperty m_Indicator;
|
||||
SerializedProperty m_IndicatorList;
|
||||
|
||||
private Dictionary<string, bool> m_RadarModuleToggle = new Dictionary<string, bool>();
|
||||
private Dictionary<string, bool> m_IndicatorToggle = new Dictionary<string, bool>();
|
||||
private bool m_IndicatorJsonAreaToggle = false;
|
||||
private string m_IndicatorJsonAreaText;
|
||||
private int m_IndicatorSize;
|
||||
private bool m_BackgroundColorToggle = false;
|
||||
private int m_BackgroundColorSize;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Shape = prop.FindPropertyRelative("m_Shape");
|
||||
m_Radius = prop.FindPropertyRelative("m_Radius");
|
||||
m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
|
||||
m_Center = prop.FindPropertyRelative("m_Center");
|
||||
m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
||||
m_SplitArea = prop.FindPropertyRelative("m_SplitArea");
|
||||
m_Indicator = prop.FindPropertyRelative("m_Indicator");
|
||||
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InitProperty(prop);
|
||||
Rect drawRect = pos;
|
||||
float defaultLabelWidth = EditorGUIUtility.labelWidth;
|
||||
float defaultFieldWidth = EditorGUIUtility.fieldWidth;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
int index = ChartEditorHelper.GetIndexFromPath(prop);
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, prop, "Radar " + index, null, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUIUtility.labelWidth = defaultLabelWidth;
|
||||
EditorGUIUtility.fieldWidth = defaultFieldWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_Shape);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.LabelField(drawRect, "Center");
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
var tempWidth = (pos.width - startX + 35) / 2;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - 20, drawRect.y, tempWidth, drawRect.height);
|
||||
while (m_Center.arraySize < 2)
|
||||
{
|
||||
m_Center.InsertArrayElementAtIndex(m_Center.arraySize);
|
||||
}
|
||||
EditorGUI.PropertyField(centerXRect, m_Center.GetArrayElementAtIndex(0), GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, m_Center.GetArrayElementAtIndex(1), GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Radius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_LineStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
||||
EditorGUI.PropertyField(drawRect, m_SplitArea);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_SplitArea);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_IndicatorToggle, prop, "Indicators", m_Indicator, false);
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_IndicatorJsonAreaToggle, ref m_IndicatorJsonAreaText, prop, pos.width, 20);
|
||||
drawRect.width = pos.width;
|
||||
drawRect.x = pos.x;
|
||||
if (ChartEditorHelper.IsToggle(m_IndicatorToggle, prop))
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_IndicatorSize, m_IndicatorList);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int propNum = 1;
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
propNum += 6;
|
||||
if (m_IndicatorJsonAreaToggle) propNum += 4;
|
||||
float height = propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_SplitArea"));
|
||||
|
||||
if (ChartEditorHelper.IsToggle(m_IndicatorToggle, prop))
|
||||
{
|
||||
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
for (int i = 0; i < m_IndicatorList.arraySize; i++)
|
||||
{
|
||||
height += EditorGUI.GetPropertyHeight(m_IndicatorList.GetArrayElementAtIndex(i));
|
||||
}
|
||||
}
|
||||
return height;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09bf71ecf64f321468ac28af28bec878
|
||||
timeCreated: 1555563898
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,55 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar.Indicator), true)]
|
||||
public class RadarIndicatorDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_RadarModuleToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
SerializedProperty m_Name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty m_Max = prop.FindPropertyRelative("m_Max");
|
||||
SerializedProperty m_Min = prop.FindPropertyRelative("m_Min");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
Rect drawRect = pos;
|
||||
float defaultLabelWidth = EditorGUIUtility.labelWidth;
|
||||
float defaultFieldWidth = EditorGUIUtility.fieldWidth;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
int index = ChartEditorHelper.GetIndexFromPath(prop);
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, prop, "Indicator " + index, m_Name, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Min);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Max);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (ChartEditorHelper.IsToggle(m_RadarModuleToggle,prop))
|
||||
{
|
||||
return 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fb5d2a98871919459956dc252632435
|
||||
timeCreated: 1556220585
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,311 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Serie), true)]
|
||||
public class SerieDrawer : PropertyDrawer
|
||||
{
|
||||
|
||||
private Dictionary<string, bool> m_SerieModuleToggle = new Dictionary<string, bool>();
|
||||
private List<bool> m_DataFoldout = new List<bool>();
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty stack = prop.FindPropertyRelative("m_Stack");
|
||||
SerializedProperty m_AxisIndex = prop.FindPropertyRelative("m_AxisIndex");
|
||||
SerializedProperty m_RadarIndex = prop.FindPropertyRelative("m_RadarIndex");
|
||||
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
||||
SerializedProperty m_AreaStyle = prop.FindPropertyRelative("m_AreaStyle");
|
||||
SerializedProperty m_Symbol = prop.FindPropertyRelative("m_Symbol");
|
||||
SerializedProperty m_RoseType = prop.FindPropertyRelative("m_RoseType");
|
||||
SerializedProperty m_ClickOffset = prop.FindPropertyRelative("m_ClickOffset");
|
||||
SerializedProperty m_Space = prop.FindPropertyRelative("m_Space");
|
||||
SerializedProperty m_Center = prop.FindPropertyRelative("m_Center");
|
||||
SerializedProperty m_Radius = prop.FindPropertyRelative("m_Radius");
|
||||
SerializedProperty m_Label = prop.FindPropertyRelative("m_Label");
|
||||
SerializedProperty m_HighlightLabel = prop.FindPropertyRelative("m_HighlightLabel");
|
||||
SerializedProperty m_DataDimension = prop.FindPropertyRelative("m_ShowDataDimension");
|
||||
SerializedProperty m_ShowDataName = prop.FindPropertyRelative("m_ShowDataName");
|
||||
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
|
||||
|
||||
int index = InitToggle(prop);
|
||||
string moduleName = "Serie " + index;
|
||||
var toggle = ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieModuleToggle, prop, moduleName, show);
|
||||
if (!toggle)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2 + 20;
|
||||
drawRect.width = pos.width - drawRect.x + 15;
|
||||
EditorGUI.PropertyField(drawRect, type, GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
var serieType = (SerieType)type.enumValueIndex;
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, stack);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (serieType == SerieType.Radar)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_RadarIndex);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_AxisIndex);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (serieType == SerieType.Line
|
||||
|| serieType == SerieType.Scatter
|
||||
|| serieType == SerieType.EffectScatter
|
||||
|| serieType == SerieType.Radar)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_Symbol);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Symbol);
|
||||
}
|
||||
if (serieType == SerieType.Pie)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_RoseType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Space);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.LabelField(drawRect, "Center");
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
var tempWidth = (pos.width - startX + 35) / 2;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - 20, drawRect.y, tempWidth, drawRect.height);
|
||||
while (m_Center.arraySize < 2)
|
||||
{
|
||||
m_Center.InsertArrayElementAtIndex(m_Center.arraySize);
|
||||
}
|
||||
EditorGUI.PropertyField(centerXRect, m_Center.GetArrayElementAtIndex(0), GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, m_Center.GetArrayElementAtIndex(1), GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
|
||||
centerYRect = new Rect(centerXRect.x + tempWidth - 20, drawRect.y, tempWidth, drawRect.height);
|
||||
EditorGUI.LabelField(drawRect, "Radius");
|
||||
while (m_Radius.arraySize < 2)
|
||||
{
|
||||
m_Radius.InsertArrayElementAtIndex(m_Radius.arraySize);
|
||||
}
|
||||
EditorGUI.PropertyField(centerXRect, m_Radius.GetArrayElementAtIndex(0), GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, m_Radius.GetArrayElementAtIndex(1), GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ClickOffset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_LineStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_LineStyle);
|
||||
EditorGUI.PropertyField(drawRect, m_AreaStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AreaStyle);
|
||||
EditorGUI.PropertyField(drawRect, m_Label, new GUIContent("Normal Label"));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
|
||||
EditorGUI.PropertyField(drawRect, m_HighlightLabel, new GUIContent("Highlight Label"));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_HighlightLabel);
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop, pos.width);
|
||||
drawRect.width = pos.width;
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
float nameWid = 76;
|
||||
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - nameWid - 2, pos.height), m_DataDimension);
|
||||
var nameRect = new Rect(pos.width - nameWid + 14, drawRect.y, nameWid, pos.height);
|
||||
var btnName = m_ShowDataName.boolValue ? "Hide Name" : "Show Name";
|
||||
if (GUI.Button(nameRect, new GUIContent(btnName)))
|
||||
{
|
||||
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
var listSize = m_Datas.arraySize;
|
||||
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (listSize < 0) listSize = 0;
|
||||
if (m_DataDimension.intValue < 1) m_DataDimension.intValue = 1;
|
||||
int dimension = m_DataDimension.intValue;
|
||||
bool showName = m_ShowDataName.boolValue;
|
||||
bool showSelected = (serieType == SerieType.Pie);
|
||||
if (listSize != m_Datas.arraySize)
|
||||
{
|
||||
while (listSize > m_Datas.arraySize)
|
||||
m_Datas.InsertArrayElementAtIndex(m_Datas.arraySize);
|
||||
while (listSize < m_Datas.arraySize)
|
||||
m_Datas.DeleteArrayElementAtIndex(m_Datas.arraySize - 1);
|
||||
}
|
||||
if (listSize > 30)
|
||||
{
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showSelected, i, pos.width);
|
||||
}
|
||||
if (num >= 10)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, "...");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showSelected, listSize - 1, pos.width);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_Datas.arraySize; i++)
|
||||
{
|
||||
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showSelected, i, pos.width);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDataElement(ref Rect drawRect, int dimension, SerializedProperty m_Datas, bool showName,
|
||||
bool showSelected, int index, float currentWidth)
|
||||
{
|
||||
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 selected = serieData.FindPropertyRelative("m_Selected");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
var fieldCount = dimension + (showName ? 1 : 0);
|
||||
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
while (2 > data.arraySize)
|
||||
data.InsertArrayElementAtIndex(data.arraySize);
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
if (showSelected)
|
||||
{
|
||||
drawRect.width = drawRect.width - 18;
|
||||
EditorGUI.PropertyField(drawRect, element);
|
||||
drawRect.x = currentWidth - 45;
|
||||
EditorGUI.PropertyField(drawRect, selected, GUIContent.none);
|
||||
drawRect.x = lastX;
|
||||
drawRect.width = lastWid;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, element);
|
||||
}
|
||||
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, "Element " + index);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
|
||||
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 4;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
if (i >= data.arraySize - 1)
|
||||
{
|
||||
data.InsertArrayElementAtIndex(data.arraySize);
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 40;
|
||||
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;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = lastX;
|
||||
drawRect.width = lastWid;
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
int index = InitToggle(prop);
|
||||
if (!m_SerieModuleToggle[prop.propertyPath])
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 6 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_LineStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_AreaStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_HighlightLabel"));
|
||||
SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
||||
var serieType = (SerieType)type.enumValueIndex;
|
||||
if (serieType == SerieType.Line
|
||||
|| serieType == SerieType.Scatter
|
||||
|| serieType == SerieType.EffectScatter
|
||||
|| serieType == SerieType.Radar)
|
||||
{
|
||||
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Symbol"));
|
||||
}
|
||||
if (serieType == SerieType.Pie)
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 2;
|
||||
if (num > 30) num = 14;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
private int InitToggle(SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
var sindex = prop.propertyPath.LastIndexOf('[');
|
||||
var eindex = prop.propertyPath.LastIndexOf(']');
|
||||
if (sindex >= 0 && eindex >= 0)
|
||||
{
|
||||
var str = prop.propertyPath.Substring(sindex + 1, eindex - sindex - 1);
|
||||
int.TryParse(str, out index);
|
||||
}
|
||||
if (index >= m_DataFoldout.Count)
|
||||
{
|
||||
m_DataFoldout.Add(false);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c30d9496b99e39944a6987e390bed91f
|
||||
timeCreated: 1555200849
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,71 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieLabel), true)]
|
||||
public class SerieLabelDrawer : PropertyDrawer
|
||||
{
|
||||
private Dictionary<string, bool> m_SerieLabelToggle = new Dictionary<string, bool>();
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty m_Position = prop.FindPropertyRelative("m_Position");
|
||||
SerializedProperty m_Distance = prop.FindPropertyRelative("m_Distance");
|
||||
SerializedProperty m_Rotate = prop.FindPropertyRelative("m_Rotate");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_FontStyle = prop.FindPropertyRelative("m_FontStyle");
|
||||
SerializedProperty m_Line = prop.FindPropertyRelative("m_Line");
|
||||
SerializedProperty m_LineWidth = prop.FindPropertyRelative("m_LineWidth");
|
||||
SerializedProperty m_LineLength1 = prop.FindPropertyRelative("m_LineLength1");
|
||||
SerializedProperty m_LineLength2 = prop.FindPropertyRelative("m_LineLength2");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SerieLabelToggle, prop, null, show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (ChartEditorHelper.IsToggle(m_SerieLabelToggle, prop))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Position);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Distance);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rotate);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontStyle);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Line);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineLength1);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineLength2);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (ChartEditorHelper.IsToggle(m_SerieLabelToggle, prop))
|
||||
{
|
||||
height += 11 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d30d82b48b553451fad726478777a02e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,64 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
|
||||
public class SerieSymbolDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
|
||||
SerializedProperty m_SizeType = prop.FindPropertyRelative("m_SizeType");
|
||||
SerializedProperty m_Size = prop.FindPropertyRelative("m_Size");
|
||||
SerializedProperty m_SelectedSize = prop.FindPropertyRelative("m_SelectedSize");
|
||||
SerializedProperty m_DataIndex = prop.FindPropertyRelative("m_DataIndex");
|
||||
SerializedProperty m_DataScale = prop.FindPropertyRelative("m_DataScale");
|
||||
SerializedProperty m_SelectedDataScale = prop.FindPropertyRelative("m_SelectedDataScale");
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Type, new GUIContent("Symbol Type"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SizeType, new GUIContent("Symbol SizeType"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
SerieSymbolSizeType sizeType = (SerieSymbolSizeType)m_SizeType.enumValueIndex;
|
||||
switch (sizeType)
|
||||
{
|
||||
case SerieSymbolSizeType.Custom:
|
||||
EditorGUI.PropertyField(drawRect, m_Size, new GUIContent("Symbol Size"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedSize, new GUIContent("Symbol SelectedSize"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case SerieSymbolSizeType.FromData:
|
||||
EditorGUI.PropertyField(drawRect, m_DataIndex, new GUIContent("Symbol DataIndex"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_DataScale, new GUIContent("Symbol DataScale"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedDataScale, new GUIContent("Symbol SelectedDataScale"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case SerieSymbolSizeType.Callback:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
SerializedProperty m_SizeType = prop.FindPropertyRelative("m_SizeType");
|
||||
SerieSymbolSizeType sizeType = (SerieSymbolSizeType)m_SizeType.enumValueIndex;
|
||||
switch (sizeType)
|
||||
{
|
||||
case SerieSymbolSizeType.Custom:
|
||||
return 4 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case SerieSymbolSizeType.FromData:
|
||||
return 5 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case SerieSymbolSizeType.Callback:
|
||||
return 4 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return 4 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0c4d3c3303994821bde654cf67d414d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,51 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Series), true)]
|
||||
public class SeriesDrawer : PropertyDrawer
|
||||
{
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_SeriesModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Series = prop.FindPropertyRelative("m_Series");
|
||||
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SeriesModuleToggle, "Series");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
//ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop);
|
||||
drawRect.width = pos.width;
|
||||
if (m_SeriesModuleToggle)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Series);
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_SeriesModuleToggle)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Series");
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
for (int i = 0; i < m_Data.arraySize; i++)
|
||||
{
|
||||
height += EditorGUI.GetPropertyHeight(m_Data.GetArrayElementAtIndex(i));
|
||||
}
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c2458b1901047547b1a59d097786816
|
||||
timeCreated: 1556016849
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,334 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ThemeInfo), true)]
|
||||
public class ThemeInfoDrawer : PropertyDrawer
|
||||
{
|
||||
ReorderableList m_ColorPaletteList;
|
||||
bool m_ColorPaletteFoldout;
|
||||
bool m_ThemeModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
var defaultWidth = drawRect.width;
|
||||
var defaultX = drawRect.x;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Theme = prop.FindPropertyRelative("m_Theme");
|
||||
SerializedProperty m_Font = prop.FindPropertyRelative("m_Font");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_TextColor = prop.FindPropertyRelative("m_TitleTextColor");
|
||||
SerializedProperty m_SubTextColor = prop.FindPropertyRelative("m_TitleSubTextColor");
|
||||
SerializedProperty m_LegendTextColor = prop.FindPropertyRelative("m_LegendTextColor");
|
||||
SerializedProperty m_LegendUnableColor = prop.FindPropertyRelative("m_LegendUnableColor");
|
||||
SerializedProperty m_AxisTextColor = prop.FindPropertyRelative("m_AxisTextColor");
|
||||
SerializedProperty m_AxisLineColor = prop.FindPropertyRelative("m_AxisLineColor");
|
||||
SerializedProperty m_AxisSplitLineColor = prop.FindPropertyRelative("m_AxisSplitLineColor");
|
||||
SerializedProperty m_TooltipBackgroundColor = prop.FindPropertyRelative("m_TooltipBackgroundColor");
|
||||
SerializedProperty m_TooltipFlagAreaColor = prop.FindPropertyRelative("m_TooltipFlagAreaColor");
|
||||
SerializedProperty m_TooltipTextColor = prop.FindPropertyRelative("m_TooltipTextColor");
|
||||
SerializedProperty m_TooltipLabelColor = prop.FindPropertyRelative("m_TooltipLabelColor");
|
||||
SerializedProperty m_TooltipLineColor = prop.FindPropertyRelative("m_TooltipLineColor");
|
||||
SerializedProperty m_DataZoomLineColor = prop.FindPropertyRelative("m_DataZoomLineColor");
|
||||
SerializedProperty m_DataZoomSelectedColor = prop.FindPropertyRelative("m_DataZoomSelectedColor");
|
||||
SerializedProperty m_DataZoomTextColor = prop.FindPropertyRelative("m_DataZoomTextColor");
|
||||
SerializedProperty m_ColorPalette = prop.FindPropertyRelative("m_ColorPalette");
|
||||
|
||||
SerializedProperty m_CustomFont = prop.FindPropertyRelative("m_CustomFont");
|
||||
SerializedProperty m_CustomBackgroundColor = prop.FindPropertyRelative("m_CustomBackgroundColor");
|
||||
SerializedProperty m_CustomTextColor = prop.FindPropertyRelative("m_CustomTitleTextColor");
|
||||
SerializedProperty m_CustomSubTextColor = prop.FindPropertyRelative("m_CustomTitleSubTextColor");
|
||||
SerializedProperty m_CustomLegendTextColor = prop.FindPropertyRelative("m_CustomLegendTextColor");
|
||||
SerializedProperty m_CustomLegendUnableColor = prop.FindPropertyRelative("m_CustomLegendUnableColor");
|
||||
SerializedProperty m_CustomAxisTextColor = prop.FindPropertyRelative("m_CustomAxisTextColor");
|
||||
SerializedProperty m_CustomAxisLineColor = prop.FindPropertyRelative("m_CustomAxisLineColor");
|
||||
SerializedProperty m_CustomAxisSplitLineColor = prop.FindPropertyRelative("m_CustomAxisSplitLineColor");
|
||||
SerializedProperty m_CustomTooltipBackgroundColor = prop.FindPropertyRelative("m_CustomTooltipBackgroundColor");
|
||||
SerializedProperty m_CustomTooltipFlagAreaColor = prop.FindPropertyRelative("m_CustomTooltipFlagAreaColor");
|
||||
SerializedProperty m_CustomTooltipTextColor = prop.FindPropertyRelative("m_CustomTooltipTextColor");
|
||||
SerializedProperty m_CustomTooltipLabelColor = prop.FindPropertyRelative("m_CustomTooltipLabelColor");
|
||||
SerializedProperty m_CustomTooltipLineColor = prop.FindPropertyRelative("m_CustomTooltipLineColor");
|
||||
SerializedProperty m_CustomDataZoomLineColor = prop.FindPropertyRelative("m_CustomDataZoomLineColor");
|
||||
SerializedProperty m_CustomDataZoomSelectedColor = prop.FindPropertyRelative("m_CustomDataZoomSelectedColor");
|
||||
SerializedProperty m_CustomDataZoomTextColor = prop.FindPropertyRelative("m_CustomDataZoomTextColor");
|
||||
SerializedProperty m_CustomColorPalette = prop.FindPropertyRelative("m_CustomColorPalette");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_ThemeModuleToggle, "Theme");
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2;
|
||||
drawRect.width = defaultWidth - EditorGUIUtility.labelWidth - (m_ThemeModuleToggle ? 45 : 0);
|
||||
EditorGUI.PropertyField(drawRect, m_Theme, GUIContent.none);
|
||||
if (m_ThemeModuleToggle)
|
||||
{
|
||||
drawRect.x = defaultWidth - 30;
|
||||
drawRect.width = 45;
|
||||
if (GUI.Button(drawRect, new GUIContent("Reset", "Reset to theme default color")))
|
||||
{
|
||||
m_CustomFont.objectReferenceValue = null;
|
||||
m_CustomBackgroundColor.colorValue = Color.clear;
|
||||
m_CustomTextColor.colorValue = Color.clear;
|
||||
m_CustomSubTextColor.colorValue = Color.clear;
|
||||
m_CustomLegendTextColor.colorValue = Color.clear;
|
||||
m_CustomLegendUnableColor.colorValue = Color.clear;
|
||||
m_CustomAxisTextColor.colorValue = Color.clear;
|
||||
m_CustomAxisLineColor.colorValue = Color.clear;
|
||||
m_CustomAxisSplitLineColor.colorValue = Color.clear;
|
||||
m_CustomTooltipBackgroundColor.colorValue = Color.clear;
|
||||
m_CustomTooltipFlagAreaColor.colorValue = Color.clear;
|
||||
m_CustomTooltipTextColor.colorValue = Color.clear;
|
||||
m_CustomTooltipLabelColor.colorValue = Color.clear;
|
||||
m_CustomTooltipLineColor.colorValue = Color.clear;
|
||||
m_CustomDataZoomLineColor.colorValue = Color.clear;
|
||||
m_CustomDataZoomSelectedColor.colorValue = Color.clear;
|
||||
m_CustomDataZoomTextColor.colorValue = Color.clear;
|
||||
for (int i = 0; i < m_CustomColorPalette.arraySize; i++)
|
||||
{
|
||||
m_CustomColorPalette.GetArrayElementAtIndex(i).colorValue = Color.clear;
|
||||
}
|
||||
|
||||
ThemeInfo defaultThemeInfo = ThemeInfo.Default;
|
||||
switch (m_Theme.enumValueIndex)
|
||||
{
|
||||
case ((int)Theme.Default): defaultThemeInfo = ThemeInfo.Default; break;
|
||||
case ((int)Theme.Light): defaultThemeInfo = ThemeInfo.Light; break;
|
||||
case ((int)Theme.Dark): defaultThemeInfo = ThemeInfo.Dark; break;
|
||||
}
|
||||
m_Font.objectReferenceValue = defaultThemeInfo.font;
|
||||
m_BackgroundColor.colorValue = defaultThemeInfo.backgroundColor;
|
||||
m_TextColor.colorValue = defaultThemeInfo.titleTextColor;
|
||||
m_SubTextColor.colorValue = defaultThemeInfo.titleSubTextColor;
|
||||
m_LegendTextColor.colorValue = defaultThemeInfo.legendTextColor;
|
||||
m_LegendUnableColor.colorValue = defaultThemeInfo.legendUnableColor;
|
||||
m_AxisTextColor.colorValue = defaultThemeInfo.axisTextColor;
|
||||
m_AxisLineColor.colorValue = defaultThemeInfo.axisLineColor;
|
||||
m_AxisSplitLineColor.colorValue = defaultThemeInfo.axisSplitLineColor;
|
||||
m_TooltipBackgroundColor.colorValue = defaultThemeInfo.tooltipBackgroundColor;
|
||||
m_TooltipFlagAreaColor.colorValue = defaultThemeInfo.tooltipFlagAreaColor;
|
||||
m_TooltipTextColor.colorValue = defaultThemeInfo.tooltipTextColor;
|
||||
m_TooltipLabelColor.colorValue = defaultThemeInfo.tooltipLabelColor;
|
||||
m_TooltipLineColor.colorValue = defaultThemeInfo.tooltipLineColor;
|
||||
m_DataZoomLineColor.colorValue = defaultThemeInfo.dataZoomLineColor;
|
||||
m_DataZoomSelectedColor.colorValue = defaultThemeInfo.dataZoomSelectedColor;
|
||||
m_DataZoomTextColor.colorValue = defaultThemeInfo.dataZoomTextColor;
|
||||
for (int i = 0; i < m_ColorPalette.arraySize; i++)
|
||||
{
|
||||
m_ColorPalette.GetArrayElementAtIndex(i).colorValue = defaultThemeInfo.GetColor(i);
|
||||
}
|
||||
}
|
||||
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = defaultX;
|
||||
drawRect.width = defaultWidth;
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var font =m_CustomFont.objectReferenceValue != null?m_CustomFont: m_Font;
|
||||
EditorGUI.PropertyField(drawRect, font);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomFont.objectReferenceValue = font.objectReferenceValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var color = m_CustomBackgroundColor.colorValue != Color.clear ? m_CustomBackgroundColor : m_BackgroundColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Background Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomBackgroundColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTextColor.colorValue != Color.clear ? m_CustomTextColor : m_TextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Title Text Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomSubTextColor.colorValue != Color.clear ? m_CustomSubTextColor : m_SubTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Title SubText Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomSubTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomLegendTextColor.colorValue != Color.clear ? m_CustomLegendTextColor : m_LegendTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("LegendText Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomLegendTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomLegendUnableColor.colorValue != Color.clear ? m_CustomLegendUnableColor : m_LegendUnableColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("LegendUnable Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomLegendUnableColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomAxisTextColor.colorValue != Color.clear ? m_CustomAxisTextColor : m_AxisTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("AxisText Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomAxisTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomAxisLineColor.colorValue != Color.clear ? m_CustomAxisLineColor : m_AxisLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("AxisLine Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomAxisLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomAxisSplitLineColor.colorValue != Color.clear ? m_CustomAxisSplitLineColor : m_AxisSplitLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("AxisSplitLine Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomAxisSplitLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipBackgroundColor.colorValue != Color.clear ? m_CustomTooltipBackgroundColor : m_TooltipBackgroundColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Background Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipBackgroundColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipFlagAreaColor.colorValue != Color.clear ? m_CustomTooltipFlagAreaColor : m_TooltipFlagAreaColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip FlagArea Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipFlagAreaColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipTextColor.colorValue != Color.clear ? m_CustomTooltipTextColor : m_TooltipTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Text Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipLabelColor.colorValue != Color.clear ? m_CustomTooltipLabelColor : m_TooltipLabelColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Label Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipLabelColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTooltipLineColor.colorValue != Color.clear ? m_CustomTooltipLineColor : m_TooltipLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Tooltip Line Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTooltipLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomDataZoomLineColor.colorValue != Color.clear ? m_CustomDataZoomLineColor : m_DataZoomLineColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("DataZoom Line Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomDataZoomLineColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomDataZoomSelectedColor.colorValue != Color.clear ? m_CustomDataZoomSelectedColor : m_DataZoomSelectedColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("DataZoom Selected Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomDataZoomSelectedColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomDataZoomTextColor.colorValue != Color.clear ? m_CustomDataZoomTextColor : m_DataZoomTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("DataZoom Text Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomDataZoomTextColor.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
m_ColorPaletteFoldout = EditorGUI.Foldout(drawRect, m_ColorPaletteFoldout, "ColorPalette");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_ColorPaletteFoldout)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < m_ColorPalette.arraySize; i++)
|
||||
{
|
||||
while (i > m_CustomColorPalette.arraySize - 1)
|
||||
{
|
||||
m_CustomColorPalette.InsertArrayElementAtIndex(m_CustomColorPalette.arraySize);
|
||||
}
|
||||
var customElement = m_CustomColorPalette.GetArrayElementAtIndex(i);
|
||||
color = customElement.colorValue != Color.clear ?
|
||||
customElement :
|
||||
m_ColorPalette.GetArrayElementAtIndex(i);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.PropertyField(drawRect, color);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
customElement.colorValue = color.colorValue;
|
||||
}
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (!m_ThemeModuleToggle)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
float height = 0;
|
||||
int propertyCount = 18;
|
||||
if (m_ColorPaletteFoldout)
|
||||
{
|
||||
SerializedProperty m_ColorPalette = prop.FindPropertyRelative("m_ColorPalette");
|
||||
propertyCount += m_ColorPalette.arraySize + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyCount += 1;
|
||||
}
|
||||
height += propertyCount * EditorGUIUtility.singleLineHeight + (propertyCount - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcac1baa719179549b24d7056f7e0cb5
|
||||
timeCreated: 1554541305
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,60 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Title), true)]
|
||||
public class TitleDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_TitleModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty text = prop.FindPropertyRelative("m_Text");
|
||||
SerializedProperty m_TextFontSize = prop.FindPropertyRelative("m_TextFontSize");
|
||||
SerializedProperty subText = prop.FindPropertyRelative("m_SubText");
|
||||
SerializedProperty m_SubTextFontSize = prop.FindPropertyRelative("m_SubTextFontSize");
|
||||
SerializedProperty m_ItemGap = prop.FindPropertyRelative("m_ItemGap");
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TitleModuleToggle, "Title", show);
|
||||
++EditorGUI.indentLevel;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_TitleModuleToggle)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, text);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_TextFontSize, new GUIContent("Font Size"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, subText);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_SubTextFontSize, new GUIContent("Font Size"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ItemGap, new GUIContent("Item Gap"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, location);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
if (m_TitleModuleToggle)
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
SerializedProperty location = prop.FindPropertyRelative("m_Location");
|
||||
height += EditorGUI.GetPropertyHeight(location);
|
||||
}
|
||||
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22ae7ec778f27c1409cb9151ce7b9aba
|
||||
timeCreated: 1554304641
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,35 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Tooltip), true)]
|
||||
public class TooltipDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_TooltipModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty show = prop.FindPropertyRelative("m_Show");
|
||||
SerializedProperty type = prop.FindPropertyRelative("m_Type");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_TooltipModuleToggle)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, type);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_TooltipModuleToggle)
|
||||
return 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5600b7009bc024a49800448cece012e2
|
||||
timeCreated: 1554419729
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(XAxis), true)]
|
||||
public class XAxisDrawer : AxisDrawer
|
||||
{
|
||||
protected override string GetDisplayName(string displayName)
|
||||
{
|
||||
if (displayName.StartsWith("Element"))
|
||||
{
|
||||
displayName = displayName.Replace("Element", "X Axis");
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 723807bbaeaa64991a421011ce530266
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(YAxis), true)]
|
||||
public class YAxisDrawer : AxisDrawer
|
||||
{
|
||||
protected override string GetDisplayName(string displayName)
|
||||
{
|
||||
if (displayName.StartsWith("Element"))
|
||||
{
|
||||
displayName = displayName.Replace("Element", "Y Axis");
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d1fca6c98f3d41fd989d0e41fbd4eb9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,28 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI RadarChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(RadarChart), false)]
|
||||
public class RadarChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Radar;
|
||||
protected SerializedProperty m_Radars;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (RadarChart)target;
|
||||
m_Radars = serializedObject.FindProperty("m_Radars");
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_Radars, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ea6609b1e1634241947b4ef14c38849
|
||||
timeCreated: 1555512890
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,23 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI ScatterChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(ScatterChart), false)]
|
||||
public class ScatterChartEditor : CoordinateChartEditor
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (ScatterChart)target;
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3995bd8e5f80b49008624a5746622f68
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb0b30c9bc2c84f46a99514a69d7e462
|
||||
folderAsset: yes
|
||||
timeCreated: 1555303340
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,189 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ChartEditorHelper
|
||||
{
|
||||
public static GUIStyle headerStyle = EditorStyles.boldLabel;
|
||||
public static GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout)
|
||||
{
|
||||
font = headerStyle.font,
|
||||
fontStyle = headerStyle.fontStyle,
|
||||
};
|
||||
|
||||
public static void SecondField(Rect drawRect, SerializedProperty prop)
|
||||
{
|
||||
RectOffset offset = new RectOffset(-(int)EditorGUIUtility.labelWidth, 0, 0, 0);
|
||||
drawRect = offset.Add(drawRect);
|
||||
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
|
||||
drawRect = offset.Remove(drawRect);
|
||||
}
|
||||
|
||||
public static void MakeJsonData(ref Rect drawRect, ref bool showTextArea, ref string inputString,
|
||||
SerializedProperty prop, float currentWidth, float diff = 0)
|
||||
{
|
||||
SerializedProperty stringDataProp = prop.FindPropertyRelative("m_JsonData");
|
||||
SerializedProperty needParseProp = prop.FindPropertyRelative("m_DataFromJson");
|
||||
float defalutX = drawRect.x;
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 14 + diff;
|
||||
drawRect.width = currentWidth - EditorGUIUtility.labelWidth - diff;
|
||||
if (GUI.Button(drawRect, new GUIContent("Parse JsonData", "Parse data from input json")))
|
||||
{
|
||||
showTextArea = !showTextArea;
|
||||
bool needParse = !showTextArea;
|
||||
if (needParse)
|
||||
{
|
||||
stringDataProp.stringValue = inputString;
|
||||
needParseProp.boolValue = true;
|
||||
}
|
||||
}
|
||||
drawRect.x = defalutX;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (showTextArea)
|
||||
{
|
||||
drawRect.width = currentWidth;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight * 4;
|
||||
inputString = EditorGUI.TextArea(drawRect, inputString);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool MakeFoldout(ref Rect drawRect, ref bool moduleToggle, string content,
|
||||
SerializedProperty prop = null, bool bold = true)
|
||||
{
|
||||
float defaultWidth = drawRect.width;
|
||||
float defaultX = drawRect.x;
|
||||
drawRect.width = EditorGUIUtility.labelWidth;
|
||||
moduleToggle = EditorGUI.Foldout(drawRect, moduleToggle, content, bold ? foldoutStyle : EditorStyles.foldout);
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2;
|
||||
drawRect.width = 40;
|
||||
if (prop != null)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
|
||||
}
|
||||
drawRect.width = defaultWidth;
|
||||
drawRect.x = defaultX;
|
||||
return moduleToggle;
|
||||
}
|
||||
|
||||
public static bool MakeFoldout(ref Rect drawRect, ref Dictionary<string, bool> moduleToggle, SerializedProperty prop,
|
||||
string moduleName, SerializedProperty showProp = null, bool bold = true)
|
||||
{
|
||||
var key = prop.propertyPath;
|
||||
if (!moduleToggle.ContainsKey(key))
|
||||
{
|
||||
moduleToggle.Add(key, false);
|
||||
}
|
||||
var toggle = moduleToggle[key];
|
||||
|
||||
float defaultWidth = drawRect.width;
|
||||
float defaultX = drawRect.x;
|
||||
drawRect.width = EditorGUIUtility.labelWidth;
|
||||
var displayName = string.IsNullOrEmpty(moduleName) ? prop.displayName : moduleName;
|
||||
toggle = EditorGUI.Foldout(drawRect, toggle, displayName, bold ? foldoutStyle : EditorStyles.foldout);
|
||||
if (moduleToggle[key] != toggle)
|
||||
{
|
||||
moduleToggle[key] = toggle;
|
||||
}
|
||||
drawRect.x = EditorGUIUtility.labelWidth - (EditorGUI.indentLevel - 1) * 15 - 2;
|
||||
if (showProp != null)
|
||||
{
|
||||
if (showProp.propertyType == SerializedPropertyType.Boolean)
|
||||
{
|
||||
drawRect.width = 40;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect.width = defaultWidth - drawRect.x + 15;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, showProp, GUIContent.none);
|
||||
}
|
||||
drawRect.width = defaultWidth;
|
||||
drawRect.x = defaultX;
|
||||
return toggle;
|
||||
}
|
||||
|
||||
public static void MakeList(ref Rect drawRect, ref int listSize, SerializedProperty listProp, SerializedProperty large = null)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
listSize = listProp.arraySize;
|
||||
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
|
||||
if (listSize < 0) listSize = 0;
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (listSize != listProp.arraySize)
|
||||
{
|
||||
while (listSize > listProp.arraySize)
|
||||
listProp.InsertArrayElementAtIndex(listProp.arraySize);
|
||||
while (listSize < listProp.arraySize)
|
||||
listProp.DeleteArrayElementAtIndex(listProp.arraySize - 1);
|
||||
}
|
||||
if (listSize > 30)
|
||||
{
|
||||
SerializedProperty element;
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
element = listProp.GetArrayElementAtIndex(i);
|
||||
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + i));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (num >= 10)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, "...");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
element = listProp.GetArrayElementAtIndex(listSize - 1);
|
||||
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + (listSize - 1)));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < listProp.arraySize; i++)
|
||||
{
|
||||
SerializedProperty element = listProp.GetArrayElementAtIndex(i);
|
||||
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + i));
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
public static int InitModuleToggle(ref List<bool> moduleToggle, SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
var temp = prop.displayName.Split(' ');
|
||||
if (temp == null || temp.Length < 2)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int.TryParse(temp[1], out index);
|
||||
}
|
||||
if (index >= moduleToggle.Count)
|
||||
{
|
||||
moduleToggle.Add(false);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public static int GetIndexFromPath(SerializedProperty prop)
|
||||
{
|
||||
int index = 0;
|
||||
var sindex = prop.propertyPath.LastIndexOf('[');
|
||||
var eindex = prop.propertyPath.LastIndexOf(']');
|
||||
if (sindex >= 0 && eindex >= 0)
|
||||
{
|
||||
var str = prop.propertyPath.Substring(sindex + 1, eindex - sindex - 1);
|
||||
int.TryParse(str, out index);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public static bool IsToggle(Dictionary<string, bool> toggle, SerializedProperty prop)
|
||||
{
|
||||
return toggle.ContainsKey(prop.propertyPath) && toggle[prop.propertyPath] == true;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3f125a3accd30240b3ca251090f11b4
|
||||
folderAsset: yes
|
||||
timeCreated: 1554216875
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,183 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[AddComponentMenu("XCharts/BarChart", 14)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[DisallowMultipleComponent]
|
||||
public class BarChart : CoordinateChart
|
||||
{
|
||||
[SerializeField] private Bar m_Bar = Bar.defaultBar;
|
||||
|
||||
public Bar bar { get { return m_Bar; } }
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
m_Bar = Bar.defaultBar;
|
||||
m_Title.text = "BarChart";
|
||||
m_Tooltip.type = Tooltip.Type.Shadow;
|
||||
RemoveData();
|
||||
AddSerie("serie1", SerieType.Line);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
AddXAxisData("x" + (i + 1));
|
||||
AddData(0, Random.Range(10, 90));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private void DrawYBarSerie(VertexHelper vh, int serieIndex, int stackCount,
|
||||
Serie serie, Color color, ref List<float> seriesHig)
|
||||
{
|
||||
if (!IsActive(serie.name)) return;
|
||||
var xAxis = m_XAxises[serie.axisIndex];
|
||||
var yAxis = m_YAxises[serie.axisIndex];
|
||||
if (!yAxis.show) yAxis = m_YAxises[(serie.axisIndex + 1) % m_YAxises.Count];
|
||||
float scaleWid = yAxis.GetDataWidth(coordinateHig, m_DataZoom);
|
||||
float barWid = m_Bar.barWidth > 1 ? m_Bar.barWidth : scaleWid * m_Bar.barWidth;
|
||||
float offset = m_Bar.inSameBar ?
|
||||
(scaleWid - barWid - m_Bar.space * (stackCount - 1)) / 2 :
|
||||
(scaleWid - barWid * stackCount - m_Bar.space * (stackCount - 1)) / 2;
|
||||
var showData = serie.GetDataList(m_DataZoom);
|
||||
int maxCount = maxShowDataNumber > 0 ?
|
||||
(maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
|
||||
: showData.Count;
|
||||
if (seriesHig.Count < minShowDataNumber)
|
||||
{
|
||||
for (int i = 0; i < minShowDataNumber; i++)
|
||||
{
|
||||
seriesHig.Add(0);
|
||||
}
|
||||
}
|
||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||
{
|
||||
if (i >= seriesHig.Count)
|
||||
{
|
||||
seriesHig.Add(0);
|
||||
}
|
||||
float value = showData[i].data[1];
|
||||
float pX = seriesHig[i] + coordinateX + xAxis.zeroXOffset + yAxis.axisLine.width;
|
||||
float pY = coordinateY + +i * scaleWid;
|
||||
if (!yAxis.boundaryGap) pY -= scaleWid / 2;
|
||||
float barHig = (xAxis.minValue > 0 ? value - xAxis.minValue : value)
|
||||
/ (xAxis.maxValue - xAxis.minValue) * coordinateWid;
|
||||
float space = m_Bar.inSameBar ? offset :
|
||||
offset + serieIndex * (barWid + m_Bar.space);
|
||||
seriesHig[i] += barHig;
|
||||
Vector3 p1 = new Vector3(pX, pY + space + barWid);
|
||||
Vector3 p2 = new Vector3(pX + barHig, pY + space + barWid);
|
||||
Vector3 p3 = new Vector3(pX + barHig, pY + space);
|
||||
Vector3 p4 = new Vector3(pX, pY + space);
|
||||
if ((m_Tooltip.show && m_Tooltip.IsSelected(i))
|
||||
|| serie.data[i].highlighted
|
||||
|| serie.highlighted)
|
||||
{
|
||||
color *= 1.05f;
|
||||
}
|
||||
if (serie.show)
|
||||
{
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawXBarSerie(VertexHelper vh, int serieIndex, int stackCount,
|
||||
Serie serie, Color color, ref List<float> seriesHig)
|
||||
{
|
||||
if (!IsActive(serie.name)) return;
|
||||
var showData = serie.GetDataList(m_DataZoom);
|
||||
var yAxis = m_YAxises[serie.axisIndex];
|
||||
var xAxis = m_XAxises[serie.axisIndex];
|
||||
if (!xAxis.show) xAxis = m_XAxises[(serie.axisIndex + 1) % m_XAxises.Count];
|
||||
float scaleWid = xAxis.GetDataWidth(coordinateWid, m_DataZoom);
|
||||
float barWid = m_Bar.barWidth > 1 ? m_Bar.barWidth : scaleWid * m_Bar.barWidth;
|
||||
float offset = m_Bar.inSameBar ?
|
||||
(scaleWid - barWid - m_Bar.space * (stackCount - 1)) / 2 :
|
||||
(scaleWid - barWid * stackCount - m_Bar.space * (stackCount - 1)) / 2;
|
||||
int maxCount = maxShowDataNumber > 0 ?
|
||||
(maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
|
||||
: showData.Count;
|
||||
if (seriesHig.Count < minShowDataNumber)
|
||||
{
|
||||
for (int i = 0; i < minShowDataNumber; i++)
|
||||
{
|
||||
seriesHig.Add(0);
|
||||
}
|
||||
}
|
||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||
{
|
||||
if (i >= seriesHig.Count)
|
||||
{
|
||||
seriesHig.Add(0);
|
||||
}
|
||||
float value = showData[i].data[1];
|
||||
float pX = coordinateX + i * scaleWid;
|
||||
float zeroY = coordinateY + yAxis.zeroYOffset;
|
||||
if (!xAxis.boundaryGap) pX -= scaleWid / 2;
|
||||
float pY = seriesHig[i] + zeroY + xAxis.axisLine.width;
|
||||
float barHig = (yAxis.minValue > 0 ? value - yAxis.minValue : value)
|
||||
/ (yAxis.maxValue - yAxis.minValue) * coordinateHig;
|
||||
seriesHig[i] += barHig;
|
||||
float space = m_Bar.inSameBar ? offset :
|
||||
offset + serieIndex * (barWid + m_Bar.space);
|
||||
Vector3 p1 = new Vector3(pX + space, pY);
|
||||
Vector3 p2 = new Vector3(pX + space, pY + barHig);
|
||||
Vector3 p3 = new Vector3(pX + space + barWid, pY + barHig);
|
||||
Vector3 p4 = new Vector3(pX + space + barWid, pY);
|
||||
if ((m_Tooltip.show && m_Tooltip.IsSelected(i))
|
||||
|| serie.data[i].highlighted
|
||||
|| serie.highlighted)
|
||||
{
|
||||
color *= 1.05f;
|
||||
}
|
||||
if (serie.show)
|
||||
{
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<string> serieNameSet = new HashSet<string>();
|
||||
private Dictionary<int, List<Serie>> stackSeries = new Dictionary<int, List<Serie>>();
|
||||
private List<float> seriesCurrHig = new List<float>();
|
||||
protected override void DrawChart(VertexHelper vh)
|
||||
{
|
||||
base.DrawChart(vh);
|
||||
bool yCategory = m_YAxises[0].IsCategory() || m_YAxises[1].IsCategory();
|
||||
m_Series.GetStackSeries(ref stackSeries);
|
||||
int seriesCount = stackSeries.Count;
|
||||
int serieNameCount = -1;
|
||||
serieNameSet.Clear();
|
||||
for (int j = 0; j < seriesCount; j++)
|
||||
{
|
||||
var serieList = stackSeries[j];
|
||||
seriesCurrHig.Clear();
|
||||
if (seriesCurrHig.Capacity != serieList[0].dataCount)
|
||||
{
|
||||
seriesCurrHig.Capacity = serieList[0].dataCount;
|
||||
}
|
||||
for (int n = 0; n < serieList.Count; n++)
|
||||
{
|
||||
Serie serie = serieList[n];
|
||||
if (string.IsNullOrEmpty(serie.name)) serieNameCount++;
|
||||
else if (!serieNameSet.Contains(serie.name))
|
||||
{
|
||||
serieNameSet.Add(serie.name);
|
||||
serieNameCount++;
|
||||
}
|
||||
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
||||
if (yCategory) DrawYBarSerie(vh, j, seriesCount, serie, color, ref seriesCurrHig);
|
||||
else DrawXBarSerie(vh, j, seriesCount, serie, color, ref seriesCurrHig);
|
||||
|
||||
}
|
||||
}
|
||||
if (yCategory) DrawYTooltipIndicator(vh);
|
||||
else DrawXTooltipIndicator(vh);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,724 +0,0 @@
|
||||
using System.Net.Mime;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// The axis in rectangular coordinate.
|
||||
/// 直角坐标系的坐标轴组件。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Axis : JsonDataSupport, IEquatable<Axis>
|
||||
{
|
||||
/// <summary>
|
||||
/// the type of axis.
|
||||
/// 坐标轴类型。
|
||||
/// </summary>
|
||||
public enum AxisType
|
||||
{
|
||||
/// <summary>
|
||||
/// Numerical axis, suitable for continuous data.
|
||||
/// 数值轴,适用于连续数据。
|
||||
/// </summary>
|
||||
Value,
|
||||
/// <summary>
|
||||
/// Category axis, suitable for discrete category data. Data should only be set via data for this type.
|
||||
/// 类目轴,适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。
|
||||
/// </summary>
|
||||
Category
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the type of axis min and max value.
|
||||
/// 坐标轴最大最小刻度显示类型。
|
||||
/// </summary>
|
||||
public enum AxisMinMaxType
|
||||
{
|
||||
/// <summary>
|
||||
/// 0 - maximum.
|
||||
/// 0-最大值。
|
||||
/// </summary>
|
||||
Default,
|
||||
/// <summary>
|
||||
/// minimum - maximum.
|
||||
/// 最小值-最大值。
|
||||
/// </summary>
|
||||
MinMax,
|
||||
/// <summary>
|
||||
/// Customize the minimum and maximum.
|
||||
/// 自定义最小值最大值。
|
||||
/// </summary>
|
||||
Custom
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the type of split line.
|
||||
/// 分割线类型
|
||||
/// </summary>
|
||||
public enum SplitLineType
|
||||
{
|
||||
/// <summary>
|
||||
/// 不显示分割线
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// 实线
|
||||
/// </summary>
|
||||
Solid,
|
||||
/// <summary>
|
||||
/// 破折线
|
||||
/// </summary>
|
||||
Dashed,
|
||||
/// <summary>
|
||||
/// 虚线
|
||||
/// </summary>
|
||||
Dotted
|
||||
}
|
||||
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] protected AxisType m_Type;
|
||||
[SerializeField] protected AxisMinMaxType m_MinMaxType;
|
||||
[SerializeField] protected int m_Min;
|
||||
[SerializeField] protected int m_Max;
|
||||
[SerializeField] protected int m_SplitNumber = 5;
|
||||
[SerializeField] protected bool m_ShowSplitLine = false;
|
||||
[SerializeField] protected SplitLineType m_SplitLineType = SplitLineType.Dashed;
|
||||
[SerializeField] protected bool m_BoundaryGap = true;
|
||||
[SerializeField] protected List<string> m_Data = new List<string>();
|
||||
[SerializeField] protected AxisLine m_AxisLine = AxisLine.defaultAxisLine;
|
||||
[SerializeField] protected AxisName m_AxisName = AxisName.defaultAxisName;
|
||||
[SerializeField] protected AxisTick m_AxisTick = AxisTick.defaultTick;
|
||||
[SerializeField] protected AxisLabel m_AxisLabel = AxisLabel.defaultAxisLabel;
|
||||
[SerializeField] protected AxisSplitArea m_SplitArea = AxisSplitArea.defaultSplitArea;
|
||||
|
||||
/// <summary>
|
||||
/// Set this to false to prevent the axis from showing.
|
||||
/// 是否显示坐标轴。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// the type of axis.
|
||||
/// 坐标轴类型。
|
||||
/// </summary>
|
||||
public AxisType type { get { return m_Type; } set { m_Type = value; } }
|
||||
/// <summary>
|
||||
/// the type of axis minmax.
|
||||
/// 坐标轴刻度最大最小值显示类型。
|
||||
/// </summary>
|
||||
public AxisMinMaxType minMaxType { get { return m_MinMaxType; } set { m_MinMaxType = value; } }
|
||||
/// <summary>
|
||||
/// The minimun value of axis.
|
||||
/// 设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
|
||||
/// </summary>
|
||||
public int min { get { return m_Min; } set { m_Min = value; } }
|
||||
/// <summary>
|
||||
/// The maximum value of axis.
|
||||
/// 设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
|
||||
/// </summary>
|
||||
public int max { get { return m_Max; } set { m_Max = value; } }
|
||||
/// <summary>
|
||||
/// Number of segments that the axis is split into.
|
||||
/// 坐标轴的分割段数。
|
||||
/// </summary>
|
||||
public int splitNumber { get { return m_SplitNumber; } set { m_SplitNumber = value; } }
|
||||
/// <summary>
|
||||
/// showSplitLineSet this to false to prevent the splitLine from showing. value type axes are shown by default, while category type axes are hidden.
|
||||
/// 是否显示分隔线。默认数值轴显示,类目轴不显示。
|
||||
/// </summary>
|
||||
public bool showSplitLine { get { return m_ShowSplitLine; } set { m_ShowSplitLine = value; } }
|
||||
/// <summary>
|
||||
/// the type of split line.
|
||||
/// 分割线类型。
|
||||
/// </summary>
|
||||
public SplitLineType splitLineType { get { return m_SplitLineType; } set { m_SplitLineType = value; } }
|
||||
/// <summary>
|
||||
/// The boundary gap on both sides of a coordinate axis.
|
||||
/// 坐标轴两边是否留白。
|
||||
/// </summary>
|
||||
public bool boundaryGap { get { return m_BoundaryGap; } set { m_BoundaryGap = value; } }
|
||||
/// <summary>
|
||||
/// Category data, available in type: 'Category' axis.
|
||||
/// 类目数据,在类目轴(type: 'category')中有效。
|
||||
/// </summary>
|
||||
public List<string> data { get { return m_Data; } }
|
||||
/// <summary>
|
||||
/// axis Line.
|
||||
/// 坐标轴轴线。
|
||||
/// </summary>
|
||||
public AxisLine axisLine { get { return m_AxisLine; } set { m_AxisLine = value; } }
|
||||
/// <summary>
|
||||
/// axis name.
|
||||
/// 坐标轴名称。
|
||||
/// </summary>
|
||||
public AxisName axisName { get { return m_AxisName; } set { m_AxisName = value; } }
|
||||
/// <summary>
|
||||
/// axis tick.
|
||||
/// 坐标轴刻度。
|
||||
/// </summary>
|
||||
public AxisTick axisTick { get { return m_AxisTick; } set { m_AxisTick = value; } }
|
||||
/// <summary>
|
||||
/// axis label.
|
||||
/// 坐标轴刻度标签。
|
||||
/// </summary>
|
||||
public AxisLabel axisLabel { get { return m_AxisLabel; } set { m_AxisLabel = value; } }
|
||||
/// <summary>
|
||||
/// axis split area.
|
||||
/// 坐标轴分割区域。
|
||||
/// </summary>
|
||||
public AxisSplitArea splitArea { get { return m_SplitArea; } set { m_SplitArea = value; } }
|
||||
/// <summary>
|
||||
/// the axis label text list.
|
||||
/// 坐标轴刻度标签的Text列表。
|
||||
/// </summary>
|
||||
public List<Text> axisLabelTextList { get { return m_AxisLabelTextList; } set { m_AxisLabelTextList = value; } }
|
||||
/// <summary>
|
||||
/// the current minimun value.
|
||||
/// 当前最小值。
|
||||
/// </summary>
|
||||
public float minValue { get; set; }
|
||||
/// <summary>
|
||||
/// the current maximum value.
|
||||
/// 当前最大值。
|
||||
/// </summary>
|
||||
public float maxValue { get; set; }
|
||||
/// <summary>
|
||||
/// the x offset of zero position.
|
||||
/// 坐标轴原点在X轴的偏移。
|
||||
/// </summary>
|
||||
public float zeroXOffset { get; set; }
|
||||
/// <summary>
|
||||
/// the y offset of zero position.
|
||||
/// 坐标轴原点在Y轴的偏移。
|
||||
/// </summary>
|
||||
public float zeroYOffset { get; set; }
|
||||
|
||||
private int filterStart;
|
||||
private int filterEnd;
|
||||
private List<string> filterData;
|
||||
private List<Text> m_AxisLabelTextList = new List<Text>();
|
||||
private GameObject m_TooltipLabel;
|
||||
private Text m_TooltipLabelText;
|
||||
private RectTransform m_TooltipLabelRect;
|
||||
|
||||
public void Copy(Axis other)
|
||||
{
|
||||
m_Show = other.show;
|
||||
m_Type = other.type;
|
||||
m_Min = other.min;
|
||||
m_Max = other.max;
|
||||
m_SplitNumber = other.splitNumber;
|
||||
|
||||
m_ShowSplitLine = other.showSplitLine;
|
||||
m_SplitLineType = other.splitLineType;
|
||||
m_BoundaryGap = other.boundaryGap;
|
||||
m_AxisName.Copy(other.axisName);
|
||||
m_AxisLabel.Copy(other.axisLabel);
|
||||
m_Data.Clear();
|
||||
m_Data.Capacity = m_Data.Count;
|
||||
foreach (var d in other.data) m_Data.Add(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空类目数据
|
||||
/// </summary>
|
||||
public void ClearData()
|
||||
{
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前坐标轴是否时类目轴
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsCategory()
|
||||
{
|
||||
return type == AxisType.Category;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前坐标轴是否时数值轴
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsValue()
|
||||
{
|
||||
return type == AxisType.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个类目到类目数据列表
|
||||
/// </summary>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
public void AddData(string category, int maxDataNumber)
|
||||
{
|
||||
if (maxDataNumber > 0)
|
||||
{
|
||||
while (m_Data.Count > maxDataNumber) m_Data.RemoveAt(0);
|
||||
}
|
||||
m_Data.Add(category);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得在dataZoom范围内指定索引的类目数据
|
||||
/// </summary>
|
||||
/// <param name="index">类目数据索引</param>
|
||||
/// <param name="dataZoom">区域缩放</param>
|
||||
/// <returns></returns>
|
||||
public string GetData(int index, DataZoom dataZoom)
|
||||
{
|
||||
var showData = GetDataList(dataZoom);
|
||||
if (index >= 0 && index < showData.Count)
|
||||
return showData[index];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定区域缩放的类目数据列表
|
||||
/// </summary>
|
||||
/// <param name="dataZoom">区域缩放</param>
|
||||
/// <returns></returns>
|
||||
public List<string> GetDataList(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.show)
|
||||
{
|
||||
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
||||
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
||||
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
||||
if (filterData == null || filterData.Count != count)
|
||||
{
|
||||
UpdateFilterData(dataZoom);
|
||||
}
|
||||
return filterData;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_Data;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新dataZoom对应的类目数据列表
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateFilterData(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.show)
|
||||
{
|
||||
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
||||
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
||||
if (startIndex != filterStart || endIndex != filterEnd)
|
||||
{
|
||||
filterStart = startIndex;
|
||||
filterEnd = endIndex;
|
||||
if (m_Data.Count > 0)
|
||||
{
|
||||
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
||||
filterData = m_Data.GetRange(startIndex, count);
|
||||
}
|
||||
else
|
||||
{
|
||||
filterData = m_Data;
|
||||
}
|
||||
}
|
||||
else if (endIndex == 0)
|
||||
{
|
||||
filterData = new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得分割段数
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public int GetSplitNumber(DataZoom dataZoom)
|
||||
{
|
||||
if (type == AxisType.Value) return m_SplitNumber;
|
||||
int dataCount = GetDataList(dataZoom).Count;
|
||||
if (dataCount > 2 * m_SplitNumber || dataCount <= 0)
|
||||
return m_SplitNumber;
|
||||
else
|
||||
return dataCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得分割段的宽度
|
||||
/// </summary>
|
||||
/// <param name="coordinateWidth"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
return coordinateWidth / (m_BoundaryGap ? GetSplitNumber(dataZoom) : GetSplitNumber(dataZoom) - 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得类目数据个数
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public int GetDataNumber(DataZoom dataZoom)
|
||||
{
|
||||
return GetDataList(dataZoom).Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得一个类目数据在坐标系中代表的宽度
|
||||
/// </summary>
|
||||
/// <param name="coordinateWidth"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetDataWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
var dataCount = GetDataNumber(dataZoom);
|
||||
return coordinateWidth / (m_BoundaryGap ? dataCount : dataCount - 1);
|
||||
}
|
||||
|
||||
private Dictionary<float, string> _cacheValue2str = new Dictionary<float, string>();
|
||||
/// <summary>
|
||||
/// 获得标签显示的名称
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public string GetLabelName(int index, float minValue, float maxValue, DataZoom dataZoom)
|
||||
{
|
||||
if (m_Type == AxisType.Value)
|
||||
{
|
||||
float value = (minValue + (maxValue - minValue) * index / (GetSplitNumber(dataZoom) - 1));
|
||||
if (_cacheValue2str.ContainsKey(value)) return _cacheValue2str[value];
|
||||
else
|
||||
{
|
||||
if (value - (int)value == 0)
|
||||
_cacheValue2str[value] = (value).ToString();
|
||||
else
|
||||
_cacheValue2str[value] = (value).ToString("f1");
|
||||
return _cacheValue2str[value];
|
||||
}
|
||||
}
|
||||
var showData = GetDataList(dataZoom);
|
||||
int dataCount = showData.Count;
|
||||
if (dataCount <= 0) return "";
|
||||
|
||||
if (index == GetSplitNumber(dataZoom) - 1 && !m_BoundaryGap)
|
||||
{
|
||||
return showData[dataCount - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
float rate = dataCount / GetSplitNumber(dataZoom);
|
||||
if (rate < 1) rate = 1;
|
||||
int offset = m_BoundaryGap ? (int)(rate / 2) : 0;
|
||||
int newIndex = (int)(index * rate >= dataCount - 1 ?
|
||||
dataCount - 1 : offset + index * rate);
|
||||
return showData[newIndex];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得分割线条数
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public int GetScaleNumber(DataZoom dataZoom)
|
||||
{
|
||||
if (type == AxisType.Value)
|
||||
{
|
||||
return m_BoundaryGap ? m_SplitNumber + 1 : m_SplitNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
var showData = GetDataList(dataZoom);
|
||||
int dataCount = showData.Count;
|
||||
if (dataCount > 2 * splitNumber || dataCount <= 0)
|
||||
return m_BoundaryGap ? m_SplitNumber + 1 : m_SplitNumber;
|
||||
else
|
||||
return m_BoundaryGap ? dataCount + 1 : dataCount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得分割段宽度
|
||||
/// </summary>
|
||||
/// <param name="coordinateWidth"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetScaleWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
int num = GetScaleNumber(dataZoom) - 1;
|
||||
if (num <= 0) num = 1;
|
||||
return coordinateWidth / num;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新刻度标签文字
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateLabelText(DataZoom dataZoom)
|
||||
{
|
||||
for (int i = 0; i < axisLabelTextList.Count; i++)
|
||||
{
|
||||
if (axisLabelTextList[i] != null)
|
||||
{
|
||||
axisLabelTextList[i].text = GetLabelName(i, minValue, maxValue, dataZoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTooltipLabel(GameObject label)
|
||||
{
|
||||
m_TooltipLabel = label;
|
||||
m_TooltipLabelRect = label.GetComponent<RectTransform>();
|
||||
m_TooltipLabelText = label.GetComponentInChildren<Text>();
|
||||
m_TooltipLabel.SetActive(true);
|
||||
}
|
||||
|
||||
public void SetTooltipLabelColor(Color bgColor, Color textColor)
|
||||
{
|
||||
m_TooltipLabel.GetComponent<Image>().color = bgColor;
|
||||
m_TooltipLabelText.color = textColor;
|
||||
}
|
||||
|
||||
public void SetTooltipLabelActive(bool flag)
|
||||
{
|
||||
if (m_TooltipLabel && m_TooltipLabel.activeInHierarchy != flag)
|
||||
{
|
||||
m_TooltipLabel.SetActive(flag);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTooptipLabelText(string text)
|
||||
{
|
||||
if (m_TooltipLabelText)
|
||||
{
|
||||
m_TooltipLabelText.text = text;
|
||||
m_TooltipLabelRect.sizeDelta = new Vector2(m_TooltipLabelText.preferredWidth + 8,
|
||||
m_TooltipLabelText.preferredHeight + 8);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTooltipLabelPos(Vector2 pos)
|
||||
{
|
||||
if (m_TooltipLabel)
|
||||
{
|
||||
m_TooltipLabel.transform.localPosition = pos;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调整最大最小值
|
||||
/// </summary>
|
||||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public void AdjustMinMaxValue(ref int minValue, ref int maxValue)
|
||||
{
|
||||
if (minMaxType == Axis.AxisMinMaxType.Custom)
|
||||
{
|
||||
if (min != 0 || max != 0)
|
||||
{
|
||||
minValue = min;
|
||||
maxValue = max;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (minMaxType)
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
if (minValue > 0 && maxValue > 0)
|
||||
{
|
||||
minValue = 0;
|
||||
maxValue = ChartHelper.GetMaxDivisibleValue(maxValue);
|
||||
}
|
||||
else if (minValue < 0 && maxValue < 0)
|
||||
{
|
||||
minValue = ChartHelper.GetMinDivisibleValue(minValue);
|
||||
maxValue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
minValue = ChartHelper.GetMinDivisibleValue(minValue);
|
||||
maxValue = ChartHelper.GetMaxDivisibleValue(maxValue);
|
||||
}
|
||||
break;
|
||||
case Axis.AxisMinMaxType.MinMax:
|
||||
minValue = ChartHelper.GetMinDivisibleValue(minValue);
|
||||
maxValue = ChartHelper.GetMaxDivisibleValue(maxValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Axis)
|
||||
{
|
||||
return Equals((Axis)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Axis other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return show == other.show &&
|
||||
type == other.type &&
|
||||
min == other.min &&
|
||||
max == other.max &&
|
||||
splitNumber == other.splitNumber &&
|
||||
showSplitLine == other.showSplitLine &&
|
||||
m_AxisLabel.Equals(other.axisLabel) &&
|
||||
splitLineType == other.splitLineType &&
|
||||
boundaryGap == other.boundaryGap &&
|
||||
axisName.Equals(other.axisName) &&
|
||||
ChartHelper.IsValueEqualsList<string>(m_Data, other.data);
|
||||
}
|
||||
|
||||
public static bool operator ==(Axis left, Axis right)
|
||||
{
|
||||
if (ReferenceEquals(left, null) && ReferenceEquals(right, null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (ReferenceEquals(left, null) || ReferenceEquals(right, null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Axis left, Axis right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(jsonData) || !m_DataFromJson) return;
|
||||
m_Data = ChartHelper.ParseStringFromString(jsonData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The x axis in cartesian(rectangular) coordinate. a grid component can place at most 2 x axis,
|
||||
/// one on the bottom and another on the top.
|
||||
/// <para>直角坐标系 grid 中的 x 轴,单个 grid 组件最多只能放上下两个 x 轴。</para>
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class XAxis : Axis
|
||||
{
|
||||
public XAxis Clone()
|
||||
{
|
||||
var axis = new XAxis();
|
||||
axis.show = show;
|
||||
axis.type = type;
|
||||
axis.min = min;
|
||||
axis.max = max;
|
||||
axis.splitNumber = splitNumber;
|
||||
|
||||
axis.showSplitLine = showSplitLine;
|
||||
axis.splitLineType = splitLineType;
|
||||
axis.boundaryGap = boundaryGap;
|
||||
axis.axisName.Copy(axisName);
|
||||
axis.axisLabel.Copy(axisLabel);
|
||||
axis.data.Clear();
|
||||
axis.data.Capacity = data.Count;
|
||||
foreach (var d in data) axis.data.Add(d);
|
||||
return axis;
|
||||
}
|
||||
|
||||
public static XAxis defaultXAxis
|
||||
{
|
||||
get
|
||||
{
|
||||
var axis = new XAxis
|
||||
{
|
||||
m_Show = true,
|
||||
m_Type = AxisType.Category,
|
||||
m_Min = 0,
|
||||
m_Max = 0,
|
||||
m_SplitNumber = 5,
|
||||
m_ShowSplitLine = false,
|
||||
m_SplitLineType = SplitLineType.Dashed,
|
||||
m_BoundaryGap = true,
|
||||
m_Data = new List<string>()
|
||||
{
|
||||
"x1","x2","x3","x4","x5"
|
||||
}
|
||||
};
|
||||
return axis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The x axis in cartesian(rectangular) coordinate. a grid component can place at most 2 x axis,
|
||||
/// one on the bottom and another on the top.
|
||||
/// <para>直角坐标系 grid 中的 y 轴,单个 grid 组件最多只能放左右两个 y 轴</para>
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class YAxis : Axis
|
||||
{
|
||||
public YAxis Clone()
|
||||
{
|
||||
var axis = new YAxis();
|
||||
axis.show = show;
|
||||
axis.type = type;
|
||||
axis.min = min;
|
||||
axis.max = max;
|
||||
axis.splitNumber = splitNumber;
|
||||
|
||||
axis.showSplitLine = showSplitLine;
|
||||
axis.splitLineType = splitLineType;
|
||||
axis.boundaryGap = boundaryGap;
|
||||
axis.axisName.Copy(axisName);
|
||||
axis.axisLabel.Copy(axisLabel);
|
||||
axis.data.Clear();
|
||||
axis.data.Capacity = data.Count;
|
||||
foreach (var d in data) axis.data.Add(d);
|
||||
return axis;
|
||||
}
|
||||
|
||||
public static YAxis defaultYAxis
|
||||
{
|
||||
get
|
||||
{
|
||||
var axis = new YAxis
|
||||
{
|
||||
m_Show = true,
|
||||
m_Type = AxisType.Value,
|
||||
m_Min = 0,
|
||||
m_Max = 0,
|
||||
m_SplitNumber = 5,
|
||||
m_ShowSplitLine = true,
|
||||
m_SplitLineType = SplitLineType.Dashed,
|
||||
m_BoundaryGap = false,
|
||||
m_Data = new List<string>(5),
|
||||
};
|
||||
return axis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// bar component.global setting for bar chart.
|
||||
/// 柱状图的全局配置组件。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Bar
|
||||
{
|
||||
[SerializeField] private bool m_InSameBar = false;
|
||||
[SerializeField] private float m_BarWidth = 0.7f;
|
||||
[SerializeField] private float m_Space = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to draw all bar in the same bar,but not stacked.
|
||||
/// 非堆叠同柱。多序列绘制在同一bar上,但不堆叠,而是覆盖绘制。
|
||||
/// </summary>
|
||||
public bool inSameBar { get { return m_InSameBar; } set { m_InSameBar = value; } }
|
||||
/// <summary>
|
||||
/// the width of bar.
|
||||
/// 状态的宽度。
|
||||
/// </summary>
|
||||
public float barWidth { get { return m_BarWidth; } set { m_BarWidth = value; } }
|
||||
/// <summary>
|
||||
/// the space of bars.
|
||||
/// 多柱状间的间距。
|
||||
/// </summary>
|
||||
public float space { get { return m_Space; } set { m_Space = value; } }
|
||||
|
||||
public static Bar defaultBar
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Bar()
|
||||
{
|
||||
m_InSameBar = false,
|
||||
m_BarWidth = 0.6f,
|
||||
m_Space = 10
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,324 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// DataZoom component is used for zooming a specific area,
|
||||
/// which enables user to investigate data in detail,
|
||||
/// or get an overview of the data, or get rid of outlier points.
|
||||
/// <para>DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。</para>
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class DataZoom
|
||||
{
|
||||
public enum DataZoomType
|
||||
{
|
||||
/// <summary>
|
||||
/// DataZoom functionalities is embeded inside coordinate systems, enable user to
|
||||
/// zoom or roam coordinate system by mouse dragging, mouse move or finger touch (in touch screen).
|
||||
/// 内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。
|
||||
/// </summary>
|
||||
Inside,
|
||||
/// <summary>
|
||||
/// A special slider bar is provided, on which coordinate systems can be zoomed or
|
||||
/// roamed by mouse dragging or finger touch (in touch screen).
|
||||
/// 有单独的滑动条,用户在滑动条上进行缩放或漫游。
|
||||
/// </summary>
|
||||
Slider
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generally dataZoom component zoom or roam coordinate system through data filtering
|
||||
/// and set the windows of axes internally.
|
||||
/// Its behaviours vary according to filtering mode settings.
|
||||
/// dataZoom 的运行原理是通过 数据过滤 来达到 数据窗口缩放 的效果。数据过滤模式的设置不同,效果也不同。
|
||||
/// </summary>
|
||||
public enum FilterMode
|
||||
{
|
||||
/// <summary>
|
||||
/// data that outside the window will be filtered, which may lead to some changes of windows of other axes.
|
||||
/// For each data item, it will be filtered if one of the relevant dimensions is out of the window.
|
||||
/// 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只要有一个维度在数据窗口外,整个数据项就会被过滤掉。
|
||||
/// </summary>
|
||||
Filter,
|
||||
/// <summary>
|
||||
/// data that outside the window will be filtered, which may lead to some changes of windows of other axes.
|
||||
/// For each data item, it will be filtered only if all of the relevant dimensions are out of the same side of the window.
|
||||
/// 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只有当全部维度都在数据窗口同侧外部,整个数据项才会被过滤掉。
|
||||
/// </summary>
|
||||
WeakFilter,
|
||||
/// <summary>
|
||||
/// data that outside the window will be set to NaN, which will not lead to changes of windows of other axes.
|
||||
/// 当前数据窗口外的数据,被 设置为空。即 不会 影响其他轴的数据范围。
|
||||
/// </summary>
|
||||
Empty,
|
||||
/// <summary>
|
||||
/// Do not filter data.
|
||||
/// 不过滤数据,只改变数轴范围。
|
||||
/// </summary>
|
||||
None
|
||||
}
|
||||
/// <summary>
|
||||
/// The value type of start and end.取值类型
|
||||
/// </summary>
|
||||
public enum RangeMode
|
||||
{
|
||||
//Value,
|
||||
/// <summary>
|
||||
/// percent value. 百分比
|
||||
/// </summary>
|
||||
Percent
|
||||
}
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private DataZoomType m_Type;
|
||||
[SerializeField] private FilterMode m_FilterMode;
|
||||
[SerializeField] private Orient m_Orient;
|
||||
[SerializeField] private int m_XAxisIndex;
|
||||
[SerializeField] private int m_YAxisIndex;
|
||||
[SerializeField] private bool m_ShowDataShadow;
|
||||
[SerializeField] private bool m_ShowDetail;
|
||||
[SerializeField] private bool m_ZoomLock;
|
||||
[SerializeField] private bool m_Realtime;
|
||||
[SerializeField] private Color m_BackgroundColor;
|
||||
[SerializeField] private float m_Height;
|
||||
[SerializeField] private float m_Bottom;
|
||||
[SerializeField] private RangeMode m_RangeMode;
|
||||
[SerializeField] private float m_Start;
|
||||
[SerializeField] private float m_End;
|
||||
[SerializeField] private float m_StartValue;
|
||||
[SerializeField] private float m_EndValue;
|
||||
[Range(1f, 20f)]
|
||||
[SerializeField] private float m_ScrollSensitivity;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show dataZoom.
|
||||
/// 是否显示缩放区域。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// The type of dataZoom.
|
||||
/// 缩放区域的类型。
|
||||
/// </summary>
|
||||
public DataZoomType type { get { return m_Type; } set { m_Type = value; } }
|
||||
/// <summary>
|
||||
/// The mode of data filter.
|
||||
/// 数据过滤类型。
|
||||
/// </summary>
|
||||
public FilterMode filterMode { get { return m_FilterMode; } set { m_FilterMode = value; } }
|
||||
/// <summary>
|
||||
/// Specify whether the layout of dataZoom component is horizontal or vertical.
|
||||
/// 水平还是垂直显示。
|
||||
/// </summary>
|
||||
public Orient orient { get { return m_Orient; } set { m_Orient = value; } }
|
||||
/// <summary>
|
||||
/// Specify which xAxis is controlled by the dataZoom.
|
||||
/// 控制哪个一 x 轴。
|
||||
/// </summary>
|
||||
public int xAxisIndex { get { return m_XAxisIndex; } set { m_XAxisIndex = value; } }
|
||||
/// <summary>
|
||||
/// Specify which yAxis is controlled by the dataZoom.
|
||||
/// 控制哪一个 y 轴。
|
||||
/// </summary>
|
||||
public int yAxisIndex { get { return m_YAxisIndex; } set { m_YAxisIndex = value; } }
|
||||
/// <summary>
|
||||
/// Whether to show data shadow, to indicate the data tendency in brief.
|
||||
/// default:true
|
||||
/// 是否显示数据阴影。数据阴影可以简单地反应数据走势。
|
||||
/// </summary>
|
||||
public bool showDataShadow { get { return m_ShowDataShadow; } set { m_ShowDataShadow = value; } }
|
||||
/// <summary>
|
||||
/// Whether to show detail, that is, show the detailed data information when dragging.
|
||||
/// 是否显示detail,即拖拽时候显示详细数值信息。
|
||||
/// </summary>
|
||||
public bool showDetail { get { return m_ShowDetail; } set { m_ShowDetail = value; } }
|
||||
/// <summary>
|
||||
/// Specify whether to lock the size of window (selected area).
|
||||
/// default:false
|
||||
/// 是否锁定选择区域(或叫做数据窗口)的大小。
|
||||
/// 如果设置为 true 则锁定选择区域的大小,也就是说,只能平移,不能缩放。
|
||||
/// </summary>
|
||||
public bool zoomLock { get { return m_ZoomLock; } set { m_ZoomLock = value; } }
|
||||
/// <summary>
|
||||
/// Whether to show data shadow in dataZoom-silder component, to indicate the data tendency in brief.
|
||||
/// default:true
|
||||
/// 如果设置为 true 则锁定选择区域的大小,也就是说,只能平移,不能缩放。
|
||||
/// </summary>
|
||||
public bool realtime { get { return m_Realtime; } set { m_Realtime = value; } }
|
||||
/// <summary>
|
||||
/// The background color of the component.
|
||||
/// 组件的背景颜色。
|
||||
/// </summary>
|
||||
public Color backgroundColor { get { return m_BackgroundColor; } set { m_BackgroundColor = value; } }
|
||||
/// <summary>
|
||||
/// Distance between dataZoom component and the bottom side of the container.
|
||||
/// bottom value is a instant pixel value like 10.
|
||||
/// default:10
|
||||
/// 组件离容器下侧的距离。
|
||||
/// </summary>
|
||||
public float bottom { get { return m_Bottom; } set { m_Bottom = value; } }
|
||||
/// <summary>
|
||||
/// The height of dataZoom component.
|
||||
/// height value is a instant pixel value like 10.
|
||||
/// default:50
|
||||
/// 组件高度。
|
||||
/// </summary>
|
||||
public float height { get { return m_Height; } set { m_Height = value; } }
|
||||
/// <summary>
|
||||
/// Use absolute value or percent value in DataZoom.start and DataZoom.end.
|
||||
/// default:RangeMode.Percent.
|
||||
/// 取绝对值还是百分比。
|
||||
/// </summary>
|
||||
public RangeMode rangeMode { get { return m_RangeMode; } set { m_RangeMode = value; } }
|
||||
/// <summary>
|
||||
/// The start percentage of the window out of the data extent, in the range of 0 ~ 100.
|
||||
/// default:30
|
||||
/// 数据窗口范围的起始百分比。范围是:0 ~ 100。
|
||||
/// </summary>
|
||||
public float start { get { return m_Start; } set { m_Start = value; } }
|
||||
/// <summary>
|
||||
/// The end percentage of the window out of the data extent, in the range of 0 ~ 100.
|
||||
/// default:70
|
||||
/// 数据窗口范围的结束百分比。范围是:0 ~ 100。
|
||||
/// </summary>
|
||||
public float end { get { return m_End; } set { m_End = value; } }
|
||||
/// <summary>
|
||||
/// The sensitivity of dataZoom scroll.
|
||||
/// The larger the number, the more sensitive it is.
|
||||
/// default:10
|
||||
/// 缩放区域组件的敏感度。值越高每次缩放所代表的数据越多。
|
||||
/// </summary>
|
||||
public float scrollSensitivity { get { return m_ScrollSensitivity; } set { m_ScrollSensitivity = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// DataZoom is in draging.
|
||||
/// 正在拖拽组件。
|
||||
/// </summary>
|
||||
public bool isDraging { get; set; }
|
||||
/// <summary>
|
||||
/// The start label.
|
||||
/// 组件的开始信息文本。
|
||||
/// </summary>
|
||||
public Text startLabel { get; set; }
|
||||
/// <summary>
|
||||
/// The end label.
|
||||
/// 组件的结束信息文本。
|
||||
/// </summary>
|
||||
public Text endLabel { get; set; }
|
||||
|
||||
public static DataZoom defaultDataZoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DataZoom()
|
||||
{
|
||||
m_Type = DataZoomType.Slider,
|
||||
filterMode = FilterMode.None,
|
||||
orient = Orient.Horizonal,
|
||||
xAxisIndex = 0,
|
||||
yAxisIndex = 0,
|
||||
showDataShadow = true,
|
||||
showDetail = false,
|
||||
zoomLock = false,
|
||||
realtime = true,
|
||||
m_Height = 50,
|
||||
m_Bottom = 10,
|
||||
rangeMode = RangeMode.Percent,
|
||||
start = 30,
|
||||
end = 70,
|
||||
m_ScrollSensitivity = 10,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给定的坐标是否在缩放区域内
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="startX"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsInZoom(Vector2 pos, float startX, float width)
|
||||
{
|
||||
Rect rect = Rect.MinMaxRect(startX, m_Bottom, startX + width, m_Bottom + m_Height);
|
||||
return rect.Contains(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给定的坐标是否在选中区域内
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="startX"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsInSelectedZoom(Vector2 pos, float startX, float width)
|
||||
{
|
||||
var start = startX + width * m_Start / 100;
|
||||
var end = startX + width * m_End / 100;
|
||||
Rect rect = Rect.MinMaxRect(start, m_Bottom, end, m_Bottom + m_Height);
|
||||
return rect.Contains(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给定的坐标是否在开始活动条触发区域内
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="startX"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsInStartZoom(Vector2 pos, float startX, float width)
|
||||
{
|
||||
var start = startX + width * m_Start / 100;
|
||||
Rect rect = Rect.MinMaxRect(start - 10, m_Bottom, start + 10, m_Bottom + m_Height);
|
||||
return rect.Contains(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给定的坐标是否在结束活动条触发区域内
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="startX"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsInEndZoom(Vector2 pos, float startX, float width)
|
||||
{
|
||||
var end = startX + width * m_End / 100;
|
||||
Rect rect = Rect.MinMaxRect(end - 10, m_Bottom, end + 10, m_Bottom + m_Height);
|
||||
return rect.Contains(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示文本
|
||||
/// </summary>
|
||||
/// <param name="flag"></param>
|
||||
public void SetLabelActive(bool flag)
|
||||
{
|
||||
if (startLabel && startLabel.gameObject.activeInHierarchy != flag)
|
||||
{
|
||||
startLabel.gameObject.SetActive(flag);
|
||||
}
|
||||
if (endLabel && endLabel.gameObject.activeInHierarchy != flag)
|
||||
{
|
||||
endLabel.gameObject.SetActive(flag);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置开始文本内容
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void SetStartLabelText(string text)
|
||||
{
|
||||
if (startLabel) startLabel.text = text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置结束文本内容
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void SetEndLabelText(string text)
|
||||
{
|
||||
if (endLabel) endLabel.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Grid component.
|
||||
/// Drawing grid in rectangular coordinate. In a single grid, at most two X and Y axes each is allowed.
|
||||
/// Line chart, bar chart, and scatter chart can be drawn in grid.
|
||||
/// There is only one single grid component at most in a single echarts instance.
|
||||
/// <para>
|
||||
/// 网格组件。
|
||||
/// 直角坐标系内绘图网格,单个 grid 内最多可以放置上下两个 X 轴,左右两个 Y 轴。可以在网格上绘制折线图,柱状图,散点图。
|
||||
/// 单个xcharts实例中只能存在一个grid组件。
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Grid : IEquatable<Grid>
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private float m_Left;
|
||||
[SerializeField] private float m_Right;
|
||||
[SerializeField] private float m_Top;
|
||||
[SerializeField] private float m_Bottom;
|
||||
[SerializeField] private Color m_BackgroundColor;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show the grid in rectangular coordinate.
|
||||
/// 是否显示直角坐标系网格。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// Distance between grid component and the left side of the container.
|
||||
/// grid 组件离容器左侧的距离。
|
||||
/// </summary>
|
||||
public float left { get { return m_Left; } set { m_Left = value; } }
|
||||
/// <summary>
|
||||
/// Distance between grid component and the right side of the container.
|
||||
/// grid 组件离容器右侧的距离。
|
||||
/// </summary>
|
||||
public float right { get { return m_Right; } set { m_Right = value; } }
|
||||
/// <summary>
|
||||
/// Distance between grid component and the top side of the container.
|
||||
/// grid 组件离容器上侧的距离。
|
||||
/// </summary>
|
||||
public float top { get { return m_Top; } set { m_Top = value; } }
|
||||
/// <summary>
|
||||
/// Distance between grid component and the bottom side of the container.
|
||||
/// grid 组件离容器下侧的距离。
|
||||
/// </summary>
|
||||
public float bottom { get { return m_Bottom; } set { m_Bottom = value; } }
|
||||
/// <summary>
|
||||
/// Background color of grid, which is transparent by default.
|
||||
/// 网格背景色,默认透明。
|
||||
/// </summary>
|
||||
public Color backgroundColor { get { return m_BackgroundColor; } set { m_BackgroundColor = value; } }
|
||||
|
||||
public static Grid defaultGrid
|
||||
{
|
||||
get
|
||||
{
|
||||
var coordinate = new Grid
|
||||
{
|
||||
m_Show = false,
|
||||
m_Left = 50,
|
||||
m_Right = 30,
|
||||
m_Top = 50,
|
||||
m_Bottom = 30
|
||||
};
|
||||
return coordinate;
|
||||
}
|
||||
}
|
||||
public void Copy(Grid other)
|
||||
{
|
||||
m_Show = other.show;
|
||||
m_Left = other.left;
|
||||
m_Right = other.right;
|
||||
m_Top = other.top;
|
||||
m_Bottom = other.bottom;
|
||||
m_BackgroundColor = other.backgroundColor;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Grid)
|
||||
{
|
||||
return Equals((Grid)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Grid other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Show == other.show &&
|
||||
m_Left == other.left &&
|
||||
m_Right == other.right &&
|
||||
m_Top == other.top &&
|
||||
m_Bottom == other.bottom &&
|
||||
ChartHelper.IsValueEqualsColor(m_BackgroundColor, other.backgroundColor);
|
||||
}
|
||||
|
||||
public static bool operator ==(Grid left, Grid right)
|
||||
{
|
||||
if (ReferenceEquals(left, null) && ReferenceEquals(right, null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (ReferenceEquals(left, null) || ReferenceEquals(right, null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Grid left, Grid right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15d97f34ea6674855859ef7d7941e2e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,372 +0,0 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// 图例组件。
|
||||
/// 图例组件展现了不同系列的标记,颜色和名字。可以通过点击图例控制哪些系列不显示。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Legend : JsonDataSupport, IPropertyChanged, IEquatable<Legend>
|
||||
{
|
||||
/// <summary>
|
||||
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
|
||||
/// It is enabled by default, and you may set it to be false to disabled it.
|
||||
/// 图例选择的模式,控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
|
||||
/// </summary>
|
||||
public enum SelectedMode
|
||||
{
|
||||
/// <summary>
|
||||
/// 多选。
|
||||
/// </summary>
|
||||
Multiple,
|
||||
/// <summary>
|
||||
/// 单选。
|
||||
/// </summary>
|
||||
Single,
|
||||
/// <summary>
|
||||
/// 无法选择。
|
||||
/// </summary>
|
||||
None
|
||||
}
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private SelectedMode m_SelectedMode;
|
||||
[SerializeField] private Orient m_Orient = Orient.Horizonal;
|
||||
[SerializeField] private Location m_Location = Location.defaultRight;
|
||||
[SerializeField] private float m_ItemWidth = 50.0f;
|
||||
[SerializeField] private float m_ItemHeight = 20.0f;
|
||||
[SerializeField] private float m_ItemGap = 5;
|
||||
[SerializeField] private int m_ItemFontSize = 18;
|
||||
[SerializeField] private List<string> m_Data = new List<string>();
|
||||
|
||||
private Dictionary<string, Button> m_DataBtnList = new Dictionary<string, Button>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show legend component.
|
||||
/// 是否显示图例组件。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
|
||||
/// 选择模式。控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public SelectedMode selectedMode { get { return m_SelectedMode; } set { m_SelectedMode = value; } }
|
||||
/// <summary>
|
||||
/// Specify whether the layout of legend component is horizontal or vertical.
|
||||
/// 布局方式是横还是竖。
|
||||
/// </summary>
|
||||
public Orient orient { get { return m_Orient; } set { m_Orient = value; } }
|
||||
/// <summary>
|
||||
/// The location of legend.
|
||||
/// 图例显示的位置。
|
||||
/// </summary>
|
||||
public Location location { get { return m_Location; } set { m_Location = value; } }
|
||||
/// <summary>
|
||||
/// the width of legend item.
|
||||
/// 每个图例项的宽度。
|
||||
/// </summary>
|
||||
public float itemWidth { get { return m_ItemWidth; } set { m_ItemWidth = value; } }
|
||||
/// <summary>
|
||||
/// the height of legend item.
|
||||
/// 每个图例项的高度。
|
||||
/// </summary>
|
||||
public float itemHeight { get { return m_ItemHeight; } set { m_ItemHeight = value; } }
|
||||
/// <summary>
|
||||
/// The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout.
|
||||
/// 图例每项之间的间隔。横向布局时为水平间隔,纵向布局时为纵向间隔。
|
||||
/// </summary>
|
||||
public float itemGap { get { return m_ItemGap; } set { m_ItemGap = value; } }
|
||||
/// <summary>
|
||||
/// font size of item text.
|
||||
/// 图例项的字体大小。
|
||||
/// </summary>
|
||||
public int itemFontSize { get { return m_ItemFontSize; } set { m_ItemFontSize = value; } }
|
||||
/// <summary>
|
||||
/// Data array of legend. An array item is usually a name representing string. (If it is a pie chart,
|
||||
/// it could also be the name of a single data in the pie chart) of a series.
|
||||
/// If data is not specified, it will be auto collected from series.
|
||||
/// 图例的数据数组。数组项通常为一个字符串,每一项代表一个系列的 name(如果是饼图,也可以是饼图单个数据的 name)。
|
||||
/// 如果 data 没有被指定,会自动从当前系列中获取。指定data时里面的数据项和serie匹配时才会生效。
|
||||
/// </summary>
|
||||
public List<string> data { get { return m_Data; } }
|
||||
/// <summary>
|
||||
/// the button list of legend.
|
||||
/// 图例按钮列表。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Dictionary<string, Button> buttonList { get { return m_DataBtnList; } }
|
||||
|
||||
/// <summary>
|
||||
/// 一个在顶部居中显示的默认图例。
|
||||
/// </summary>
|
||||
public static Legend defaultLegend
|
||||
{
|
||||
get
|
||||
{
|
||||
var legend = new Legend
|
||||
{
|
||||
m_Show = false,
|
||||
m_SelectedMode = SelectedMode.Multiple,
|
||||
m_Orient = Orient.Horizonal,
|
||||
m_Location = Location.defaultTop,
|
||||
m_ItemWidth = 60.0f,
|
||||
m_ItemHeight = 20.0f,
|
||||
m_ItemGap = 5,
|
||||
m_ItemFontSize = 16
|
||||
};
|
||||
legend.location.top = 30;
|
||||
return legend;
|
||||
}
|
||||
}
|
||||
public void Copy(Legend legend)
|
||||
{
|
||||
m_Show = legend.show;
|
||||
m_SelectedMode = legend.selectedMode;
|
||||
m_Orient = legend.orient;
|
||||
m_Location.Copy(legend.location);
|
||||
m_ItemWidth = legend.itemWidth;
|
||||
m_ItemHeight = legend.itemHeight;
|
||||
m_ItemGap = legend.itemGap;
|
||||
m_ItemFontSize = legend.itemFontSize;
|
||||
m_Data.Clear();
|
||||
foreach (var d in legend.data) m_Data.Add(d);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Legend)
|
||||
{
|
||||
return Equals((Legend)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Legend other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return show == other.show &&
|
||||
selectedMode == other.selectedMode &&
|
||||
orient == other.orient &&
|
||||
location == other.location &&
|
||||
itemWidth == other.itemWidth &&
|
||||
itemHeight == other.itemHeight &&
|
||||
itemGap == other.itemGap &&
|
||||
itemFontSize == other.itemFontSize &&
|
||||
ChartHelper.IsValueEqualsList<string>(m_Data, other.data);
|
||||
}
|
||||
|
||||
public static bool operator ==(Legend left, Legend right)
|
||||
{
|
||||
if (ReferenceEquals(left, null) && ReferenceEquals(right, null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (ReferenceEquals(left, null) || ReferenceEquals(right, null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Legend left, Legend right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空
|
||||
/// </summary>
|
||||
public void ClearData()
|
||||
{
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否包括由指定名字的图例
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public bool ContainsData(string name)
|
||||
{
|
||||
return m_Data.Contains(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除指定名字的图例
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void RemoveData(string name)
|
||||
{
|
||||
if (m_Data.Contains(name))
|
||||
{
|
||||
m_Data.Remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加图例项
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void AddData(string name)
|
||||
{
|
||||
if (!m_Data.Contains(name) && !string.IsNullOrEmpty(name))
|
||||
{
|
||||
m_Data.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定索引的图例
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public string GetData(int index)
|
||||
{
|
||||
if (index >= 0 && index < m_Data.Count)
|
||||
{
|
||||
return m_Data[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定图例的索引
|
||||
/// </summary>
|
||||
/// <param name="legendName"></param>
|
||||
/// <returns></returns>
|
||||
public int GetIndex(string legendName)
|
||||
{
|
||||
return m_Data.IndexOf(legendName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除所有图例按钮
|
||||
/// </summary>
|
||||
public void RemoveButton()
|
||||
{
|
||||
m_DataBtnList.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给图例绑定按钮
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="btn"></param>
|
||||
/// <param name="total"></param>
|
||||
public void SetButton(string name, Button btn, int total)
|
||||
{
|
||||
int index = m_DataBtnList.Values.Count;
|
||||
btn.transform.localPosition = GetButtonLocationPosition(total, index);
|
||||
m_DataBtnList[name] = btn;
|
||||
btn.gameObject.SetActive(show);
|
||||
btn.GetComponentInChildren<Text>().text = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新图例按钮颜色
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="color"></param>
|
||||
public void UpdateButtonColor(string name, Color color)
|
||||
{
|
||||
if (m_DataBtnList.ContainsKey(name))
|
||||
{
|
||||
m_DataBtnList[name].GetComponent<Image>().color = color;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参数变更时的回调处理
|
||||
/// </summary>
|
||||
public void OnChanged()
|
||||
{
|
||||
m_Location.OnChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据图例的布局和位置类型获得具体位置
|
||||
/// </summary>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
private Vector2 GetButtonLocationPosition(int size, int index)
|
||||
{
|
||||
switch (m_Orient)
|
||||
{
|
||||
case Orient.Vertical:
|
||||
switch (m_Location.align)
|
||||
{
|
||||
case Location.Align.TopCenter:
|
||||
case Location.Align.TopLeft:
|
||||
case Location.Align.TopRight:
|
||||
return new Vector2(0, -index * (itemHeight + itemGap));
|
||||
|
||||
case Location.Align.Center:
|
||||
case Location.Align.CenterLeft:
|
||||
case Location.Align.CenterRight:
|
||||
float totalHeight = size * itemHeight + (size - 1) * itemGap;
|
||||
float startY = totalHeight / 2;
|
||||
return new Vector2(0, startY - index * (itemHeight + itemGap));
|
||||
|
||||
case Location.Align.BottomCenter:
|
||||
case Location.Align.BottomLeft:
|
||||
case Location.Align.BottomRight:
|
||||
return new Vector2(0, (size - index - 1) * (itemHeight + itemGap));
|
||||
}
|
||||
return Vector2.zero;
|
||||
|
||||
case Orient.Horizonal:
|
||||
switch (m_Location.align)
|
||||
{
|
||||
case Location.Align.TopLeft:
|
||||
case Location.Align.CenterLeft:
|
||||
case Location.Align.BottomLeft:
|
||||
return new Vector2(index * (itemWidth + itemGap), 0);
|
||||
|
||||
case Location.Align.TopCenter:
|
||||
case Location.Align.Center:
|
||||
case Location.Align.BottomCenter:
|
||||
float totalWidth = size * itemWidth + (size - 1) * itemGap;
|
||||
float startX = totalWidth / 2;
|
||||
return new Vector2(-startX + itemWidth / 2 + index * (itemWidth + itemGap), 0);
|
||||
case Location.Align.TopRight:
|
||||
case Location.Align.CenterRight:
|
||||
case Location.Align.BottomRight:
|
||||
return new Vector2(-(size - index - 1) * (itemWidth + itemGap), 0);
|
||||
}
|
||||
return Vector2.zero;
|
||||
}
|
||||
return Vector2.zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从json字符串解析数据,json格式如:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
|
||||
/// </summary>
|
||||
/// <param name="jsonData"></param>
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(jsonData) || !m_DataFromJson) return;
|
||||
m_Data = ChartHelper.ParseStringFromString(jsonData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// The global settings of line chart.
|
||||
/// LineChart的全局配置。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Line
|
||||
{
|
||||
/// <summary>
|
||||
/// the type fo step line.
|
||||
/// 阶梯线图类型。
|
||||
/// </summary>
|
||||
public enum StepType
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前点。
|
||||
/// </summary>
|
||||
Start,
|
||||
/// <summary>
|
||||
/// 当前点和下一个点的中间。
|
||||
/// </summary>
|
||||
Middle,
|
||||
/// <summary>
|
||||
/// 下一个拐点
|
||||
/// </summary>
|
||||
End
|
||||
}
|
||||
[SerializeField] private float m_Tickness;
|
||||
[SerializeField] private bool m_Smooth;
|
||||
[SerializeField] [Range(1f, 10f)] private float m_SmoothStyle;
|
||||
[SerializeField] private bool m_Area;
|
||||
[SerializeField] private bool m_Step;
|
||||
[SerializeField] private StepType m_StepType;
|
||||
|
||||
/// <summary>
|
||||
/// the tickness of lines.
|
||||
/// 线条粗细。
|
||||
/// </summary>
|
||||
public float tickness { get { return m_Tickness; } set { m_Tickness = value; } }
|
||||
/// <summary>
|
||||
/// smoothness.
|
||||
/// 平滑风格。
|
||||
/// </summary>
|
||||
public float smoothStyle { get { return m_SmoothStyle; } set { m_SmoothStyle = value; } }
|
||||
/// <summary>
|
||||
/// Whether the lines are displayed smoothly.
|
||||
/// 是否平滑显示。
|
||||
/// </summary>
|
||||
public bool smooth { get { return m_Smooth; } set { m_Smooth = value; } }
|
||||
/// <summary>
|
||||
/// Whether to show area.
|
||||
/// 是否显示区域填充颜色。
|
||||
/// </summary>
|
||||
public bool area { get { return m_Area; } set { m_Area = value; } }
|
||||
/// <summary>
|
||||
/// Whether to show as a step line.
|
||||
/// 是否是阶梯线图。
|
||||
/// </summary>
|
||||
public bool step { get { return m_Step; } set { m_Step = value; } }
|
||||
/// <summary>
|
||||
/// the type of step line.
|
||||
/// 阶梯线图类型。
|
||||
/// </summary>
|
||||
public StepType stepTpe { get { return m_StepType; } set { m_StepType = value; } }
|
||||
|
||||
public static Line defaultLine
|
||||
{
|
||||
get
|
||||
{
|
||||
var line = new Line
|
||||
{
|
||||
m_Tickness = 0.8f,
|
||||
m_Smooth = false,
|
||||
m_SmoothStyle = 2f,
|
||||
m_Area = false,
|
||||
m_Step = false,
|
||||
m_StepType = StepType.Middle
|
||||
};
|
||||
return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// the global setting of pie chart.
|
||||
/// 饼图的全局设置。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Pie
|
||||
{
|
||||
[SerializeField] private float m_TooltipExtraRadius;
|
||||
[SerializeField] private float m_SelectedOffset;
|
||||
/// <summary>
|
||||
/// the extra dadius of pie chart when the tooltip indicatored pie.
|
||||
/// 提示框指示时的额外半径。
|
||||
/// </summary>
|
||||
public float tooltipExtraRadius { get { return m_TooltipExtraRadius; } set { m_TooltipExtraRadius = value; } }
|
||||
/// <summary>
|
||||
/// the offset of pie when the pie item is selected.
|
||||
/// 饼图项被选中时的偏移。
|
||||
/// </summary>
|
||||
public float selectedOffset { get { return m_SelectedOffset; } set { m_SelectedOffset = value; } }
|
||||
|
||||
public static Pie defaultPie
|
||||
{
|
||||
get
|
||||
{
|
||||
var pie = new Pie
|
||||
{
|
||||
m_TooltipExtraRadius = 10f,
|
||||
m_SelectedOffset = 10f,
|
||||
};
|
||||
return pie;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,369 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinate for radar charts.
|
||||
/// 雷达图坐标系组件,只适用于雷达图。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Radar : JsonDataSupport, IEquatable<Radar>
|
||||
{
|
||||
/// <summary>
|
||||
/// Radar render type, in which 'Polygon' and 'Circle' are supported.
|
||||
/// 雷达图绘制类型,支持 'Polygon' 和 'Circle'。
|
||||
/// </summary>
|
||||
public enum Shape
|
||||
{
|
||||
Polygon,
|
||||
Circle
|
||||
}
|
||||
/// <summary>
|
||||
/// Indicator of radar chart, which is used to assign multiple variables(dimensions) in radar chart.
|
||||
/// 雷达图的指示器,用来指定雷达图中的多个变量(维度)。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Indicator : IEquatable<Indicator>
|
||||
{
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private float m_Max;
|
||||
[SerializeField] private float m_Min;
|
||||
[SerializeField] private Color m_Color;
|
||||
/// <summary>
|
||||
/// 指示器名称。
|
||||
/// </summary>
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
/// <summary>
|
||||
/// The maximum value of indicator, with default value of 0, but we recommend to set it manually.
|
||||
/// 指示器的最大值,默认为 0 无限制。
|
||||
/// </summary>
|
||||
public float max { get { return m_Max; } set { m_Max = value; } }
|
||||
/// <summary>
|
||||
/// The minimum value of indicator, with default value of 0.
|
||||
/// 指示器的最小值,默认为 0 无限制。
|
||||
/// </summary>
|
||||
public float min { get { return m_Min; } set { m_Min = value; } }
|
||||
/// <summary>
|
||||
/// Specfy a color the the indicator.
|
||||
/// 标签特定的颜色。默认取自主题的axisTextColor。
|
||||
/// </summary>
|
||||
public Color color { get { return m_Color; } set { m_Color = value; } }
|
||||
/// <summary>
|
||||
/// the text conponent of indicator.
|
||||
/// 指示器的文本组件。
|
||||
/// </summary>
|
||||
public Text text { get; set; }
|
||||
|
||||
public Indicator Clone()
|
||||
{
|
||||
return new Indicator()
|
||||
{
|
||||
m_Name = name,
|
||||
m_Max = max,
|
||||
m_Min = min,
|
||||
m_Color = color
|
||||
};
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Indicator)
|
||||
{
|
||||
return Equals((Indicator)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Indicator other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Name.Equals(other.name) &&
|
||||
ChartHelper.IsValueEqualsColor(m_Color, other.color);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
[SerializeField] private Shape m_Shape;
|
||||
[SerializeField] private float m_Radius = 100;
|
||||
[SerializeField] private int m_SplitNumber = 5;
|
||||
[SerializeField] private float[] m_Center = new float[2] { 0.5f, 0.5f };
|
||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle();
|
||||
[SerializeField] private AxisSplitArea m_SplitArea = AxisSplitArea.defaultSplitArea;
|
||||
[SerializeField] private bool m_Indicator = true;
|
||||
[SerializeField] private List<Indicator> m_IndicatorList = new List<Indicator>();
|
||||
/// <summary>
|
||||
/// Radar render type, in which 'Polygon' and 'Circle' are supported.
|
||||
/// 雷达图绘制类型,支持 'Polygon' 和 'Circle'。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Shape shape { get { return m_Shape; } set { m_Shape = value; } }
|
||||
/// <summary>
|
||||
/// the radius of radar.
|
||||
/// 雷达图的半径。
|
||||
/// </summary>
|
||||
public float radius { get { return m_Radius; } set { m_Radius = value; } }
|
||||
/// <summary>
|
||||
/// Segments of indicator axis.
|
||||
/// 指示器轴的分割段数。
|
||||
/// </summary>
|
||||
public int splitNumber { get { return m_SplitNumber; } set { m_SplitNumber = value; } }
|
||||
/// <summary>
|
||||
/// the center of radar chart.
|
||||
/// 雷达图的中心点。数组的第一项是横坐标,第二项是纵坐标。
|
||||
/// 当值为0-1之间时表示百分比,设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度。
|
||||
/// </summary>
|
||||
public float[] center { get { return m_Center; } set { m_Center = value; } }
|
||||
/// <summary>
|
||||
/// the line style of radar.
|
||||
/// 线条样式。
|
||||
/// </summary>
|
||||
public LineStyle lineStyle { get { return m_LineStyle; } set { m_LineStyle = value; } }
|
||||
/// <summary>
|
||||
/// Split area of axis in grid area.
|
||||
/// 分割区域。
|
||||
/// </summary>
|
||||
public AxisSplitArea splitArea { get { return m_SplitArea; } set { m_SplitArea = value; } }
|
||||
/// <summary>
|
||||
/// Whether to show indicator.
|
||||
/// 是否显示指示器。
|
||||
/// </summary>
|
||||
public bool indicator { get { return m_Indicator; } set { m_Indicator = value; } }
|
||||
/// <summary>
|
||||
/// the indicator list.
|
||||
/// 指示器列表。
|
||||
/// </summary>
|
||||
public List<Indicator> indicatorList { get { return m_IndicatorList; } }
|
||||
|
||||
/// <summary>
|
||||
/// the center position of radar in container.
|
||||
/// 雷达图在容器中的具体中心点。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Vector2 centerPos { get; set; }
|
||||
/// <summary>
|
||||
/// the true radius of radar.
|
||||
/// 雷达图的运行时实际半径。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float actualRadius { get; set; }
|
||||
/// <summary>
|
||||
/// the data position list of radar.
|
||||
/// 雷达图的所有数据坐标点列表。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<int,List<Vector3>> dataPosList = new Dictionary<int,List<Vector3>>();
|
||||
|
||||
public static Radar defaultRadar
|
||||
{
|
||||
get
|
||||
{
|
||||
var radar = new Radar
|
||||
{
|
||||
m_Shape = Shape.Polygon,
|
||||
m_Radius = 0.4f,
|
||||
m_SplitNumber = 5,
|
||||
m_Indicator = true,
|
||||
m_IndicatorList = new List<Indicator>(5){
|
||||
new Indicator(){name="indicator1",max = 100},
|
||||
new Indicator(){name="indicator2",max = 100},
|
||||
new Indicator(){name="indicator3",max = 100},
|
||||
new Indicator(){name="indicator4",max = 100},
|
||||
new Indicator(){name="indicator5",max = 100},
|
||||
}
|
||||
};
|
||||
radar.center[0] = 0.5f;
|
||||
radar.center[1] = 0.45f;
|
||||
radar.splitArea.show = true;
|
||||
radar.lineStyle.width = 0.3f;
|
||||
return radar;
|
||||
}
|
||||
}
|
||||
|
||||
public void Copy(Radar other)
|
||||
{
|
||||
m_Shape = other.shape;
|
||||
m_Radius = other.radius;
|
||||
m_SplitNumber = other.splitNumber;
|
||||
m_Center[0] = other.center[0];
|
||||
m_Center[1] = other.center[1];
|
||||
m_Indicator = other.indicator;
|
||||
indicatorList.Clear();
|
||||
foreach (var d in other.indicatorList) indicatorList.Add(d.Clone());
|
||||
}
|
||||
|
||||
public Radar Clone()
|
||||
{
|
||||
var radar = new Radar();
|
||||
radar.shape = shape;
|
||||
radar.radius = radius;
|
||||
radar.splitNumber = splitNumber;
|
||||
radar.center[0] = center[0];
|
||||
radar.center[1] = center[1];
|
||||
radar.indicatorList.Clear();
|
||||
radar.indicator = indicator;
|
||||
foreach (var d in indicatorList) radar.indicatorList.Add(d.Clone());
|
||||
return radar;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Radar)
|
||||
{
|
||||
return Equals((Radar)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Radar other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return radius == other.radius &&
|
||||
shape == other.shape &&
|
||||
splitNumber == other.splitNumber &&
|
||||
center[0] == other.center[0] &&
|
||||
center[1] == other.center[1] &&
|
||||
indicator == other.indicator &&
|
||||
IsEqualsIndicatorList(indicatorList, other.indicatorList);
|
||||
}
|
||||
|
||||
private bool IsEqualsIndicatorList(List<Indicator> indicators1, List<Indicator> indicators2)
|
||||
{
|
||||
if (indicators1.Count != indicators2.Count) return false;
|
||||
for (int i = 0; i < indicators1.Count; i++)
|
||||
{
|
||||
var indicator1 = indicators1[i];
|
||||
var indicator2 = indicators2[i];
|
||||
if (!indicator1.Equals(indicator2)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool operator ==(Radar left, Radar right)
|
||||
{
|
||||
if (ReferenceEquals(left, null) && ReferenceEquals(right, null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (ReferenceEquals(left, null) || ReferenceEquals(right, null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Radar left, Radar right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(jsonData) || !m_DataFromJson) return;
|
||||
string pattern = "[\"|'](.*?)[\"|']";
|
||||
if (Regex.IsMatch(jsonData, pattern))
|
||||
{
|
||||
m_IndicatorList.Clear();
|
||||
MatchCollection m = Regex.Matches(jsonData, pattern);
|
||||
foreach (Match match in m)
|
||||
{
|
||||
m_IndicatorList.Add(new Indicator()
|
||||
{
|
||||
name = match.Groups[1].Value
|
||||
});
|
||||
}
|
||||
}
|
||||
pattern = "(\\d+)";
|
||||
if (Regex.IsMatch(jsonData, pattern))
|
||||
{
|
||||
MatchCollection m = Regex.Matches(jsonData, pattern);
|
||||
int index = 0;
|
||||
foreach (Match match in m)
|
||||
{
|
||||
if (m_IndicatorList[index] != null)
|
||||
{
|
||||
m_IndicatorList[index].max = int.Parse(match.Groups[1].Value);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float GetIndicatorMin(int index)
|
||||
{
|
||||
if (index >= 0 && index < m_IndicatorList.Count)
|
||||
{
|
||||
return m_IndicatorList[index].min;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public float GetIndicatorMax(int index)
|
||||
{
|
||||
if (index >= 0 && index < m_IndicatorList.Count)
|
||||
{
|
||||
return m_IndicatorList[index].max;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void UpdateRadarCenter(float chartWidth, float chartHeight)
|
||||
{
|
||||
if (center.Length < 2) return;
|
||||
var centerX = center[0] <= 1 ? chartWidth * center[0] : center[0];
|
||||
var centerY = center[1] <= 1 ? chartHeight * center[1] : center[1];
|
||||
centerPos = new Vector2(centerX, centerY);
|
||||
if (radius <= 0)
|
||||
{
|
||||
actualRadius = 0;
|
||||
}
|
||||
else if (radius <= 1)
|
||||
{
|
||||
actualRadius = Mathf.Min(chartWidth, chartHeight) * radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
actualRadius = radius;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 GetIndicatorPosition(int index)
|
||||
{
|
||||
int indicatorNum = indicatorList.Count;
|
||||
var angle = 2 * Mathf.PI / indicatorNum * index;
|
||||
var x = centerPos.x + actualRadius * Mathf.Sin(angle);
|
||||
var y = centerPos.y + actualRadius * Mathf.Cos(angle);
|
||||
return new Vector3(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,790 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// the type of serie.
|
||||
/// 系列类型。
|
||||
/// </summary>
|
||||
public enum SerieType
|
||||
{
|
||||
/// <summary>
|
||||
/// 折线图。折线图是用折线将各个数据点标志连接起来的图表,用于展现数据的变化趋势。可用于直角坐标系和极坐标系上。
|
||||
/// </summary>
|
||||
Line,
|
||||
/// <summary>
|
||||
/// 柱状图。柱状/条形图 通过 柱形的高度/条形的宽度 来表现数据的大小,用于有至少一个类目轴或时间轴的直角坐标系上。
|
||||
/// </summary>
|
||||
Bar,
|
||||
/// <summary>
|
||||
/// 饼图。饼图主要用于表现不同类目的数据在总和中的占比。每个的弧度表示数据数量的比例。
|
||||
/// 饼图更适合表现数据相对于总数的百分比等关系。
|
||||
/// </summary>
|
||||
Pie,
|
||||
/// <summary>
|
||||
/// 雷达图。雷达图主要用于表现多变量的数据,例如球员的各个属性分析。依赖 radar 组件。
|
||||
/// </summary>
|
||||
Radar,
|
||||
/// <summary>
|
||||
/// 散点图。直角坐标系上的散点图可以用来展现数据的 x,y 之间的关系,如果数据项有多个维度,
|
||||
/// 其它维度的值可以通过不同大小的 symbol 展现成气泡图,也可以用颜色来表现。
|
||||
/// </summary>
|
||||
Scatter,
|
||||
/// <summary>
|
||||
/// 带有涟漪特效动画的散点图。利用动画特效可以将某些想要突出的数据进行视觉突出。
|
||||
/// </summary>
|
||||
EffectScatter
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show as Nightingale chart, which distinguishs data through radius.
|
||||
/// 是否展示成南丁格尔图,通过半径区分数据大小。
|
||||
/// </summary>
|
||||
public enum RoseType
|
||||
{
|
||||
/// <summary>
|
||||
/// Don't show as Nightingale chart.不展示成南丁格尔玫瑰图
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Use central angle to show the percentage of data, radius to show data size.
|
||||
/// 扇区圆心角展现数据的百分比,半径展现数据的大小。
|
||||
/// </summary>
|
||||
Radius,
|
||||
/// <summary>
|
||||
/// All the sectors will share the same central angle, the data size is shown only through radiuses.
|
||||
/// 所有扇区圆心角相同,仅通过半径展现数据大小。
|
||||
/// </summary>
|
||||
Area
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系列。每个系列通过 type 决定自己的图表类型。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Serie : JsonDataSupport
|
||||
{
|
||||
[SerializeField] [DefaultValue("true")] private bool m_Show = true;
|
||||
[SerializeField] private SerieType m_Type;
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private string m_Stack;
|
||||
[SerializeField] [Range(0, 1)] private int m_AxisIndex = 0;
|
||||
[SerializeField] private int m_RadarIndex = 0;
|
||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle();
|
||||
[SerializeField] private AreaStyle m_AreaStyle = AreaStyle.defaultAreaStyle;
|
||||
[SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
|
||||
#region PieChart field
|
||||
[SerializeField] private bool m_ClickOffset = true;
|
||||
[SerializeField] private RoseType m_RoseType = RoseType.None;
|
||||
[SerializeField] private float m_Space;
|
||||
[SerializeField] private float[] m_Center = new float[2] { 0.5f, 0.5f };
|
||||
[SerializeField] private float[] m_Radius = new float[2] { 0, 80 };
|
||||
#endregion
|
||||
[SerializeField] private SerieLabel m_Label = new SerieLabel();
|
||||
[SerializeField] private SerieLabel m_HighlightLabel = new SerieLabel();
|
||||
[SerializeField] [Range(1, 10)] private int m_ShowDataDimension;
|
||||
[SerializeField] private bool m_ShowDataName;
|
||||
[FormerlySerializedAs("m_Data")]
|
||||
[SerializeField] private List<float> m_YData = new List<float>();
|
||||
[SerializeField] private List<float> m_XData = new List<float>();
|
||||
[SerializeField] private List<SerieData> m_Data = new List<SerieData>();
|
||||
|
||||
[NonSerialized] private int m_FilterStart;
|
||||
[NonSerialized] private int m_FilterEnd;
|
||||
[NonSerialized] private List<SerieData> m_FilterData;
|
||||
[NonSerialized] private Dictionary<int, List<Vector3>> m_SmoothPoints = new Dictionary<int, List<Vector3>>();
|
||||
[NonSerialized] private List<Vector3> m_DataPoints = new List<Vector3>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show serie in chart.
|
||||
/// 系列是否显示在图表上。
|
||||
/// </summary>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// the chart type of serie.
|
||||
/// 系列的图表类型。
|
||||
/// </summary>
|
||||
public SerieType type { get { return m_Type; } set { m_Type = value; } }
|
||||
/// <summary>
|
||||
/// Series name used for displaying in tooltip and filtering with legend.
|
||||
/// 系列名称,用于 tooltip 的显示,legend 的图例筛选。
|
||||
/// </summary>
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
/// <summary>
|
||||
/// If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
|
||||
/// 数据堆叠,同个类目轴上系列配置相同的stack值后,后一个系列的值会在前一个系列的值上相加。
|
||||
/// </summary>
|
||||
public string stack { get { return m_Stack; } set { m_Stack = value; } }
|
||||
/// <summary>
|
||||
/// Index of axis to combine with, which is useful for multiple x axes in one chart.
|
||||
/// 使用的坐标轴轴的 index,在单个图表实例中存在多个坐标轴轴的时候有用。
|
||||
/// </summary>
|
||||
public int axisIndex { get { return m_AxisIndex; } set { m_AxisIndex = value; } }
|
||||
/// <summary>
|
||||
/// Index of radar component that radar chart uses.
|
||||
/// 雷达图所使用的 radar 组件的 index。
|
||||
/// </summary>
|
||||
public int radarIndex { get { return m_RadarIndex; } set { m_RadarIndex = value; } }
|
||||
/// <summary>
|
||||
/// The style of line.
|
||||
/// 线条样式。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public LineStyle lineStyle { get { return m_LineStyle; } set { m_LineStyle = value; } }
|
||||
/// <summary>
|
||||
/// The style of area.
|
||||
/// 区域填充样式。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public AreaStyle areaStyle { get { return m_AreaStyle; } set { m_AreaStyle = value; } }
|
||||
/// <summary>
|
||||
/// the symbol of serie data item.
|
||||
/// 标记的图形。
|
||||
/// </summary>
|
||||
public SerieSymbol symbol { get { return m_Symbol; } set { m_Symbol = value; } }
|
||||
/// <summary>
|
||||
/// Whether offset when mouse click pie chart item.
|
||||
/// 鼠标点击时是否开启偏移,一般用在PieChart图表中。
|
||||
/// </summary>
|
||||
public bool clickOffset { get { return m_ClickOffset; } set { m_ClickOffset = value; } }
|
||||
/// <summary>
|
||||
/// Whether to show as Nightingale chart.
|
||||
/// 是否展示成南丁格尔图,通过半径区分数据大小。
|
||||
/// </summary>
|
||||
public RoseType roseType { get { return m_RoseType; } set { m_RoseType = value; } }
|
||||
/// <summary>
|
||||
/// the space of pie chart item.
|
||||
/// 饼图项间的空隙留白。
|
||||
/// </summary>
|
||||
public float space { get { return m_Space; } set { m_Space = value; } }
|
||||
/// <summary>
|
||||
/// the center of pie chart.
|
||||
/// 饼图的中心点。
|
||||
/// </summary>
|
||||
public float[] center { get { return m_Center; } set { m_Center = value; } }
|
||||
/// <summary>
|
||||
/// the radius of pie chart.
|
||||
/// 饼图的半径。radius[0]表示内径,radius[1]表示外径。
|
||||
/// </summary>
|
||||
public float[] radius { get { return m_Radius; } set { m_Radius = value; } }
|
||||
/// <summary>
|
||||
/// Text label of graphic element,to explain some data information about graphic item like value, name and so on.
|
||||
/// 图形上的文本标签,可用于说明图形的一些数据信息,比如值,名称等。
|
||||
/// </summary>
|
||||
public SerieLabel label { get { return m_Label; } set { m_Label = value; } }
|
||||
/// <summary>
|
||||
/// Text label of highlight graphic element.
|
||||
/// 高亮时的文本标签配置。
|
||||
/// </summary>
|
||||
public SerieLabel highlightLabel { get { return m_HighlightLabel; } set { m_HighlightLabel = value; } }
|
||||
/// <summary>
|
||||
/// 维度Y的数据列表。默认对应yAxis。
|
||||
/// </summary>
|
||||
public List<float> yData { get { return m_YData; } }
|
||||
/// <summary>
|
||||
/// 维度X的数据列表。默认对应xAxis。
|
||||
/// </summary>
|
||||
public List<float> xData { get { return m_XData; } }
|
||||
/// <summary>
|
||||
/// 系列中的数据内容数组。SerieData可以设置1到n维数据。
|
||||
/// </summary>
|
||||
public List<SerieData> data { get { return m_Data; } }
|
||||
|
||||
/// <summary>
|
||||
/// The index of serie,start at 0.
|
||||
/// 系列的索引,从0开始。
|
||||
/// </summary>
|
||||
public int index { get; set; }
|
||||
/// <summary>
|
||||
/// Whether the serie is highlighted.
|
||||
/// 该系列是否高亮,一般由图例悬停触发。
|
||||
/// </summary>
|
||||
public bool highlighted { get; set; }
|
||||
/// <summary>
|
||||
/// the count of data list.
|
||||
/// 数据项个数。
|
||||
/// </summary>
|
||||
public int dataCount { get { return m_Data.Count; } }
|
||||
/// <summary>
|
||||
/// 整个系列的每段曲线的点列表
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Dictionary<int, List<Vector3>> smoothPoints { get { return m_SmoothPoints; } }
|
||||
|
||||
public List<Vector3> dataPoints { get { return m_DataPoints; } }
|
||||
|
||||
public List<Vector3> GetSmoothList(int dataIndex, int size = 100)
|
||||
{
|
||||
if (m_SmoothPoints.ContainsKey(dataIndex))
|
||||
{
|
||||
return m_SmoothPoints[dataIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
var list = new List<Vector3>(size);
|
||||
m_SmoothPoints[dataIndex] = list;
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 维度Y对应数据中最大值。
|
||||
/// </summary>
|
||||
public float yMax
|
||||
{
|
||||
get
|
||||
{
|
||||
float max = int.MinValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[1] > max)
|
||||
{
|
||||
max = sdata.data[1];
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 维度X对应数据中的最大值。
|
||||
/// </summary>
|
||||
public float xMax
|
||||
{
|
||||
get
|
||||
{
|
||||
float max = int.MinValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[0] > max)
|
||||
{
|
||||
max = sdata.data[0];
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 维度Y对应数据的最小值。
|
||||
/// </summary>
|
||||
public float yMin
|
||||
{
|
||||
get
|
||||
{
|
||||
float min = int.MaxValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[1] < min)
|
||||
{
|
||||
min = sdata.data[1];
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 维度X对应数据的最小值。
|
||||
/// </summary>
|
||||
public float xMin
|
||||
{
|
||||
get
|
||||
{
|
||||
float min = int.MaxValue;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show && sdata.data[0] < min)
|
||||
{
|
||||
min = sdata.data[0];
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 维度Y数据的总和。
|
||||
/// </summary>
|
||||
public float yTotal
|
||||
{
|
||||
get
|
||||
{
|
||||
float total = 0;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show)
|
||||
total += sdata.data[1];
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 维度X数据的总和。
|
||||
/// </summary>
|
||||
public float xTotal
|
||||
{
|
||||
get
|
||||
{
|
||||
float total = 0;
|
||||
foreach (var sdata in data)
|
||||
{
|
||||
if (sdata.show)
|
||||
total += sdata.data[0];
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有数据
|
||||
/// </summary>
|
||||
public void ClearData()
|
||||
{
|
||||
m_XData.Clear();
|
||||
m_YData.Clear();
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除指定索引的数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
public void RemoveData(int index)
|
||||
{
|
||||
m_XData.RemoveAt(index);
|
||||
m_YData.RemoveAt(index);
|
||||
m_Data.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个数据到维度Y(此时维度X对应的数据是索引)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
public void AddYData(float value, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
if (maxDataNumber > 0)
|
||||
{
|
||||
while (m_XData.Count > maxDataNumber) m_XData.RemoveAt(0);
|
||||
while (m_YData.Count > maxDataNumber) m_YData.RemoveAt(0);
|
||||
while (m_Data.Count > maxDataNumber) m_Data.RemoveAt(0);
|
||||
}
|
||||
int xValue = m_XData.Count;
|
||||
m_XData.Add(xValue);
|
||||
m_YData.Add(value);
|
||||
m_Data.Add(new SerieData() { data = new List<float>() { xValue, value }, name = dataName });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加(x,y)数据到维度X和维度Y
|
||||
/// </summary>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
public void AddXYData(float xValue, float yValue, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
if (maxDataNumber > 0)
|
||||
{
|
||||
while (m_XData.Count > maxDataNumber) m_XData.RemoveAt(0);
|
||||
while (m_YData.Count > maxDataNumber) m_YData.RemoveAt(0);
|
||||
while (m_Data.Count > maxDataNumber) m_Data.RemoveAt(0);
|
||||
}
|
||||
m_XData.Add(xValue);
|
||||
m_YData.Add(yValue);
|
||||
m_Data.Add(new SerieData() { data = new List<float>() { xValue, yValue }, name = dataName });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将一组数据添加到系列中。
|
||||
/// 如果数据只有一个,默认添加到维度Y中。
|
||||
/// </summary>
|
||||
/// <param name="valueList"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
public void AddData(List<float> valueList, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
if (valueList == null || valueList.Count == 0) return;
|
||||
if (valueList.Count == 1)
|
||||
{
|
||||
AddYData(valueList[0], dataName, maxDataNumber);
|
||||
}
|
||||
else if (valueList.Count == 2)
|
||||
{
|
||||
AddXYData(valueList[0], valueList[1], dataName, maxDataNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maxDataNumber > 0)
|
||||
{
|
||||
while (m_XData.Count > maxDataNumber) m_XData.RemoveAt(0);
|
||||
while (m_YData.Count > maxDataNumber) m_YData.RemoveAt(0);
|
||||
while (m_Data.Count > maxDataNumber) m_Data.RemoveAt(0);
|
||||
}
|
||||
var serieData = new SerieData();
|
||||
serieData.name = dataName;
|
||||
for (int i = 0; i < valueList.Count; i++)
|
||||
{
|
||||
if (i == 0) m_XData.Add(valueList[i]);
|
||||
else if (i == 1) m_YData.Add(valueList[i]);
|
||||
serieData.data.Add(valueList[i]);
|
||||
}
|
||||
m_Data.Add(serieData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得维度Y索引对应的数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetYData(int index, DataZoom dataZoom = null)
|
||||
{
|
||||
if (index < 0) return 0;
|
||||
var serieData = GetDataList(dataZoom);
|
||||
if (index < serieData.Count)
|
||||
{
|
||||
return serieData[index].data[1];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得维度Y索引对应的数据和数据名
|
||||
/// </summary>
|
||||
/// <param name="index">索引</param>
|
||||
/// <param name="yData">对应的数据值</param>
|
||||
/// <param name="dataName">对应的数据名</param>
|
||||
/// <param name="dataZoom">区域缩放</param>
|
||||
public void GetYData(int index, out float yData, out string dataName, DataZoom dataZoom = null)
|
||||
{
|
||||
yData = 0;
|
||||
dataName = null;
|
||||
if (index < 0) return;
|
||||
var serieData = GetDataList(dataZoom);
|
||||
if (index < serieData.Count)
|
||||
{
|
||||
yData = serieData[index].data[1];
|
||||
dataName = serieData[index].name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定索引的数据项
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public SerieData GetSerieData(int index, DataZoom dataZoom = null)
|
||||
{
|
||||
var data = GetDataList(dataZoom);
|
||||
if (index >= 0 && index <= data.Count - 1)
|
||||
{
|
||||
return data[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定索引的维度X和维度Y的数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yVlaue"></param>
|
||||
public void GetXYData(int index, DataZoom dataZoom, out float xValue, out float yVlaue)
|
||||
{
|
||||
xValue = 0;
|
||||
yVlaue = 0;
|
||||
if (index < 0) return;
|
||||
var showData = GetDataList(dataZoom);
|
||||
if (index < showData.Count)
|
||||
{
|
||||
var serieData = showData[index];
|
||||
xValue = serieData.data[0];
|
||||
yVlaue = serieData.data[1];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得系列的数据列表
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public List<SerieData> GetDataList(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.show)
|
||||
{
|
||||
var startIndex = (int)((m_Data.Count - 1) * dataZoom.start / 100);
|
||||
var endIndex = (int)((m_Data.Count - 1) * dataZoom.end / 100);
|
||||
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
||||
if (m_FilterData == null || m_FilterData.Count != count)
|
||||
{
|
||||
UpdateFilterData(dataZoom);
|
||||
}
|
||||
return m_FilterData;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_Data;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定维数的最大最小值
|
||||
/// </summary>
|
||||
/// <param name="dimension"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public void GetMinMaxData(int dimension, out float minValue, out float maxValue, DataZoom dataZoom = null)
|
||||
{
|
||||
var dataList = GetDataList(dataZoom);
|
||||
float max = float.MinValue;
|
||||
float min = float.MaxValue;
|
||||
for (int i = 0; i < dataList.Count; i++)
|
||||
{
|
||||
var serieData = dataList[i];
|
||||
if (serieData.data.Count > dimension)
|
||||
{
|
||||
var value = serieData.data[dimension];
|
||||
if (value > max) max = value;
|
||||
if (value < min) min = value;
|
||||
}
|
||||
}
|
||||
maxValue = max;
|
||||
minValue = min;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据dataZoom更新数据列表缓存
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateFilterData(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.show)
|
||||
{
|
||||
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
||||
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
||||
if (startIndex != m_FilterStart || endIndex != m_FilterEnd)
|
||||
{
|
||||
m_FilterStart = startIndex;
|
||||
m_FilterEnd = endIndex;
|
||||
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
||||
if (m_Data.Count > 0)
|
||||
{
|
||||
m_FilterData = m_Data.GetRange(startIndex, count);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FilterData = m_Data;
|
||||
}
|
||||
}
|
||||
else if (endIndex == 0)
|
||||
{
|
||||
m_FilterData = new List<SerieData>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定索引的维度Y数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="value"></param>
|
||||
public void UpdateYData(int index, float value)
|
||||
{
|
||||
UpdateData(index, 2, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定索引的维度X和维度Y的数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yValue"></param>
|
||||
public void UpdateXYData(int index, float xValue, float yValue)
|
||||
{
|
||||
UpdateData(index, 1, xValue);
|
||||
UpdateData(index, 2, yValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定索引指定维数的数据
|
||||
/// </summary>
|
||||
/// <param name="index">要更新数据的索引</param>
|
||||
/// <param name="dimension">要更新数据的维数</param>
|
||||
/// <param name="value">新的数据值</param>
|
||||
public void UpdateData(int index, int dimension, float value)
|
||||
{
|
||||
if (index < 0) return;
|
||||
if (dimension == 1)
|
||||
{
|
||||
if (index < m_XData.Count) m_XData[index] = value;
|
||||
}
|
||||
else if (dimension == 2)
|
||||
{
|
||||
if (index < m_YData.Count) m_YData[index] = value;
|
||||
}
|
||||
if (index < m_Data.Count && dimension < m_Data[index].data.Count)
|
||||
{
|
||||
m_Data[index].data[dimension] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除所有数据的高亮标志
|
||||
/// </summary>
|
||||
public void ClearHighlight()
|
||||
{
|
||||
highlighted = false;
|
||||
foreach (var sd in m_Data)
|
||||
{
|
||||
sd.highlighted = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定索引的数据为高亮状态
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
public void SetHighlight(int index)
|
||||
{
|
||||
if (index <= 0) return;
|
||||
for (int i = 0; i < m_Data.Count; i++)
|
||||
{
|
||||
m_Data[i].highlighted = index == i;
|
||||
}
|
||||
}
|
||||
|
||||
public Color GetAreaColor(ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
if (areaStyle.color != Color.clear)
|
||||
{
|
||||
var color = areaStyle.color;
|
||||
if (highlight) color *= color;
|
||||
color.a *= areaStyle.opactiy;
|
||||
return color;
|
||||
}
|
||||
else
|
||||
{
|
||||
var color = (Color)theme.GetColor(index);
|
||||
if (highlight) color *= color;
|
||||
color.a *= areaStyle.opactiy;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
public Color GetLineColor(ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
if (lineStyle.color != Color.clear)
|
||||
{
|
||||
var color = lineStyle.color;
|
||||
if (highlight) color *= color;
|
||||
color.a *= lineStyle.opactiy;
|
||||
return color;
|
||||
}
|
||||
else
|
||||
{
|
||||
var color = (Color)theme.GetColor(index);
|
||||
if (highlight) color *= color;
|
||||
color.a *= lineStyle.opactiy;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从json中导入数据
|
||||
/// </summary>
|
||||
/// <param name="jsonData"></param>
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(jsonData) || !m_DataFromJson) return;
|
||||
jsonData = jsonData.Replace("\r\n", "");
|
||||
jsonData = jsonData.Replace(" ", "");
|
||||
jsonData = jsonData.Replace("\n", "");
|
||||
int startIndex = jsonData.IndexOf("[");
|
||||
int endIndex = jsonData.LastIndexOf("]");
|
||||
if (startIndex == -1 || endIndex == -1)
|
||||
{
|
||||
Debug.LogError("json data need include in [ ]");
|
||||
return;
|
||||
}
|
||||
ClearData();
|
||||
string temp = jsonData.Substring(startIndex + 1, endIndex - startIndex - 1);
|
||||
if (temp.IndexOf("],") > -1 || temp.IndexOf("] ,") > -1)
|
||||
{
|
||||
string[] datas = temp.Split(new string[] { "],", "] ," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; i < datas.Length; i++)
|
||||
{
|
||||
var data = datas[i].Split(new char[] { '[', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var serieData = new SerieData();
|
||||
for (int j = 0; j < data.Length; j++)
|
||||
{
|
||||
var txt = data[j].Trim().Replace("]", "");
|
||||
float value;
|
||||
var flag = float.TryParse(txt, out value);
|
||||
if (flag)
|
||||
{
|
||||
serieData.data.Add(value);
|
||||
if (j == 0) m_XData.Add(value);
|
||||
else if (j == 1) m_YData.Add(value);
|
||||
}
|
||||
else serieData.name = txt.Replace("\"", "").Trim();
|
||||
}
|
||||
m_Data.Add(serieData);
|
||||
}
|
||||
}
|
||||
else if (temp.IndexOf("value") > -1 && temp.IndexOf("name") > -1)
|
||||
{
|
||||
string[] datas = temp.Split(new string[] { "},", "} ,", "}" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; i < datas.Length; i++)
|
||||
{
|
||||
var arr = datas[i].Replace("{", "").Split(',');
|
||||
var serieData = new SerieData();
|
||||
foreach (var a in arr)
|
||||
{
|
||||
if (a.StartsWith("value:"))
|
||||
{
|
||||
float value = float.Parse(a.Substring(6, a.Length - 6));
|
||||
serieData.data = new List<float>() { i, value };
|
||||
}
|
||||
else if (a.StartsWith("name:"))
|
||||
{
|
||||
string name = a.Substring(6, a.Length - 6 - 1);
|
||||
serieData.name = name;
|
||||
}
|
||||
else if (a.StartsWith("selected:"))
|
||||
{
|
||||
string selected = a.Substring(9, a.Length - 9);
|
||||
serieData.selected = bool.Parse(selected);
|
||||
}
|
||||
}
|
||||
m_Data.Add(serieData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] datas = temp.Split(',');
|
||||
for (int i = 0; i < datas.Length; i++)
|
||||
{
|
||||
float value;
|
||||
var flag = float.TryParse(datas[i].Trim(), out value);
|
||||
if (flag)
|
||||
{
|
||||
var serieData = new SerieData();
|
||||
serieData.data = new List<float>() { i, value };
|
||||
m_Data.Add(serieData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,745 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// the list of series.
|
||||
/// 系列列表。每个系列通过 type 决定自己的图表类型。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Series : JsonDataSupport
|
||||
{
|
||||
[SerializeField] protected List<Serie> m_Series;
|
||||
|
||||
/// <summary>
|
||||
/// the list of serie
|
||||
/// 系列列表。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public List<Serie> series { get { return m_Series; } }
|
||||
/// <summary>
|
||||
/// the size of serie list.
|
||||
/// 系列个数。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public int Count { get { return m_Series.Count; } }
|
||||
|
||||
public static Series defaultSeries
|
||||
{
|
||||
get
|
||||
{
|
||||
var series = new Series
|
||||
{
|
||||
m_Series = new List<Serie>(){new Serie(){
|
||||
show = true,
|
||||
name = "serie1",
|
||||
index = 0
|
||||
}}
|
||||
};
|
||||
return series;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有系列的数据
|
||||
/// </summary>
|
||||
public void ClearData()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
serie.ClearData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定序列指定索引的数据值
|
||||
/// </summary>
|
||||
/// <param name="serieIndex"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <returns></returns>
|
||||
public float GetData(int serieIndex, int dataIndex)
|
||||
{
|
||||
if (serieIndex >= 0 && serieIndex < Count)
|
||||
{
|
||||
return m_Series[serieIndex].GetYData(dataIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定系列名的第一个系列
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public Serie GetSerie(string name)
|
||||
{
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
if (name.Equals(m_Series[i].name))
|
||||
{
|
||||
m_Series[i].index = i;
|
||||
return m_Series[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定系列名的所有系列
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public List<Serie> GetSeries(string name)
|
||||
{
|
||||
var list = new List<Serie>();
|
||||
if (name == null) return list;
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (name.Equals(serie.name)) list.Add(serie);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定索引的系列
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public Serie GetSerie(int index)
|
||||
{
|
||||
if (index >= 0 && index < m_Series.Count)
|
||||
{
|
||||
return m_Series[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否包含指定名字的系列
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public bool Contains(string name)
|
||||
{
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
if (name.Equals(m_Series[i].name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove serie from series.
|
||||
/// 移除指定名字的系列。
|
||||
/// </summary>
|
||||
/// <param name="serieName">the name of serie</param>
|
||||
public void Remove(string serieName)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
{
|
||||
m_Series.Remove(serie);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all serie from series.
|
||||
/// 移除所有系列。
|
||||
/// </summary>
|
||||
public void RemoveAll()
|
||||
{
|
||||
m_Series.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个系列到列表中。
|
||||
/// </summary>
|
||||
/// <param name="serieName"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="show"></param>
|
||||
/// <returns></returns>
|
||||
public Serie AddSerie(string serieName, SerieType type, bool show = true)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie == null)
|
||||
{
|
||||
serie = new Serie();
|
||||
serie.type = type;
|
||||
serie.show = show;
|
||||
serie.name = serieName;
|
||||
serie.index = m_Series.Count;
|
||||
|
||||
if (type == SerieType.Scatter)
|
||||
{
|
||||
serie.symbol.type = SerieSymbolType.Circle;
|
||||
serie.symbol.size = 20f;
|
||||
serie.symbol.selectedSize = 30f;
|
||||
}
|
||||
else if (type == SerieType.Line)
|
||||
{
|
||||
serie.symbol.type = SerieSymbolType.EmptyCircle;
|
||||
serie.symbol.size = 2.5f;
|
||||
serie.symbol.selectedSize = 5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
serie.symbol.type = SerieSymbolType.None;
|
||||
}
|
||||
m_Series.Add(serie);
|
||||
}
|
||||
else
|
||||
{
|
||||
serie.show = show;
|
||||
}
|
||||
return serie;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个数据到指定系列的维度Y数据中
|
||||
/// </summary>
|
||||
/// <param name="serieName"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
/// <returns></returns>
|
||||
public bool AddData(string serieName, float value, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.AddYData(value, dataName, maxDataNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个数据到指定系列的维度Y中
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
/// <returns></returns>
|
||||
public bool AddData(int index, float value, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.AddYData(value, dataName, maxDataNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一组数据到指定的系列中
|
||||
/// </summary>
|
||||
/// <param name="serieName"></param>
|
||||
/// <param name="multidimensionalData"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
/// <returns></returns>
|
||||
public bool AddData(string serieName, List<float> multidimensionalData, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.AddData(multidimensionalData, dataName, maxDataNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一组数据到指定的系列中
|
||||
/// </summary>
|
||||
/// <param name="serieIndex"></param>
|
||||
/// <param name="multidimensionalData"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
/// <returns></returns>
|
||||
public bool AddData(int serieIndex, List<float> multidimensionalData, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.AddData(multidimensionalData, dataName, maxDataNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加(x,y)数据到指定的系列中
|
||||
/// </summary>
|
||||
/// <param name="serieName"></param>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
/// <returns></returns>
|
||||
public bool AddXYData(string serieName, float xValue, float yValue, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
var serie = GetSerie(serieName);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.AddXYData(xValue, yValue, dataName, maxDataNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加(x,y)数据到指定的系列中
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataName"></param>
|
||||
/// <param name="maxDataNumber"></param>
|
||||
/// <returns></returns>
|
||||
public bool AddXYData(int index, float xValue, float yValue, string dataName = null, int maxDataNumber = 0)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.AddXYData(xValue, yValue, dataName, maxDataNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定系列的维度Y数据
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
public void UpdateData(string name, float value, int dataIndex = 0)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.UpdateYData(dataIndex, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定系列的维度Y数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
public void UpdateData(int index, float value, int dataIndex = 0)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.UpdateYData(dataIndex, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定系列的维度X和维度Y数据
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
public void UpdateXYData(string name, float xValue, float yValue, int dataIndex = 0)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.UpdateXYData(dataIndex, xValue, yValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定系列的维度X和维度Y数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="xValue"></param>
|
||||
/// <param name="yValue"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
public void UpdateXYData(int index, float xValue, float yValue, int dataIndex = 0)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.UpdateXYData(dataIndex, xValue, yValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// dataZoom由变化是更新系列的缓存数据
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateFilterData(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.show)
|
||||
{
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
m_Series[i].UpdateFilterData(dataZoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 指定系列是否显示
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsActive(string name)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
return serie == null ? false : serie.show;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 指定系列是否显示
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsActive(int index)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
return serie == null ? false : serie.show;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定系列是否显示
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="active"></param>
|
||||
public void SetActive(string name, bool active)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.show = active;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定系列是否显示
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="active"></param>
|
||||
public void SetActive(int index, bool active)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.show = active;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否由系列在用指定索引的axis
|
||||
/// </summary>
|
||||
/// <param name="axisIndex"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsUsedAxisIndex(int axisIndex)
|
||||
{
|
||||
foreach (var serie in series)
|
||||
{
|
||||
if (serie.axisIndex == axisIndex) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 指定系列是否处于高亮选中状态
|
||||
/// </summary>
|
||||
/// <param name="serieIndex"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsHighlight(int serieIndex)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null) return serie.highlighted;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得维度X的最大最小值
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <param name="axisIndex"></param>
|
||||
/// <param name="minVaule"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public void GetXMinMaxValue(DataZoom dataZoom, int axisIndex, out int minVaule, out int maxValue)
|
||||
{
|
||||
GetMinMaxValue(dataZoom, axisIndex, false, out minVaule, out maxValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得维度Y的最大最小值
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <param name="axisIndex"></param>
|
||||
/// <param name="minVaule"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public void GetYMinMaxValue(DataZoom dataZoom, int axisIndex, out int minVaule, out int maxValue)
|
||||
{
|
||||
GetMinMaxValue(dataZoom, axisIndex, true, out minVaule, out maxValue);
|
||||
}
|
||||
|
||||
private Dictionary<int, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
|
||||
private Dictionary<int, float> _serieTotalValueForMinMax = new Dictionary<int, float>();
|
||||
public void GetMinMaxValue(DataZoom dataZoom, int axisIndex, bool yValue, out int minVaule, out int maxValue)
|
||||
{
|
||||
float min = int.MaxValue;
|
||||
float max = int.MinValue;
|
||||
if (IsStack())
|
||||
{
|
||||
GetStackSeries(ref _stackSeriesForMinMax);
|
||||
foreach (var ss in _stackSeriesForMinMax)
|
||||
{
|
||||
_serieTotalValueForMinMax.Clear();
|
||||
for (int i = 0; i < ss.Value.Count; i++)
|
||||
{
|
||||
var serie = ss.Value[i];
|
||||
if (serie.axisIndex != axisIndex) continue;
|
||||
var showData = serie.GetDataList(dataZoom);
|
||||
for (int j = 0; j < showData.Count; j++)
|
||||
{
|
||||
if (!_serieTotalValueForMinMax.ContainsKey(j))
|
||||
_serieTotalValueForMinMax[j] = 0;
|
||||
_serieTotalValueForMinMax[j] = _serieTotalValueForMinMax[j] + (yValue ? showData[j].data[1] : showData[i].data[0]);
|
||||
}
|
||||
}
|
||||
float tmax = int.MinValue;
|
||||
float tmin = int.MaxValue;
|
||||
foreach (var tt in _serieTotalValueForMinMax)
|
||||
{
|
||||
if (tt.Value > tmax) tmax = tt.Value;
|
||||
if (tt.Value < tmin) tmin = tt.Value;
|
||||
}
|
||||
if (tmax > max) max = tmax;
|
||||
if (tmin < min) min = tmin;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
if (m_Series[i].axisIndex != axisIndex) continue;
|
||||
if (IsActive(i))
|
||||
{
|
||||
var showData = m_Series[i].GetDataList(dataZoom);
|
||||
foreach (var data in showData)
|
||||
{
|
||||
if (yValue)
|
||||
{
|
||||
if (data.data[1] > max) max = data.data[1];
|
||||
if (data.data[1] < min) min = data.data[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.data[0] > max) max = data.data[0];
|
||||
if (data.data[0] < min) min = data.data[0];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (max == int.MinValue && min == int.MaxValue)
|
||||
{
|
||||
minVaule = 0;
|
||||
maxValue = 90;
|
||||
}
|
||||
else
|
||||
{
|
||||
minVaule = Mathf.FloorToInt(min);
|
||||
maxValue = Mathf.CeilToInt(max);
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<string> _setForStack = new HashSet<string>();
|
||||
/// <summary>
|
||||
/// 是否由数据堆叠
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsStack()
|
||||
{
|
||||
_setForStack.Clear();
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serie.stack)) continue;
|
||||
if (_setForStack.Contains(serie.stack)) return true;
|
||||
else
|
||||
{
|
||||
_setForStack.Add(serie.stack);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsStack(string stackName)
|
||||
{
|
||||
_setForStack.Clear();
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serie.stack)) continue;
|
||||
if (_setForStack.Contains(serie.stack))
|
||||
{
|
||||
if (serie.stack.Equals(stackName)) return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_setForStack.Add(serie.stack);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得堆叠系列列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<int, List<Serie>> GetStackSeries()
|
||||
{
|
||||
int count = 0;
|
||||
Dictionary<string, int> sets = new Dictionary<string, int>();
|
||||
Dictionary<int, List<Serie>> stackSeries = new Dictionary<int, List<Serie>>();
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
var serie = m_Series[i];
|
||||
serie.index = i;
|
||||
if (string.IsNullOrEmpty(serie.stack))
|
||||
{
|
||||
stackSeries[count] = new List<Serie>();
|
||||
stackSeries[count].Add(serie);
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sets.ContainsKey(serie.stack))
|
||||
{
|
||||
sets.Add(serie.stack, count);
|
||||
stackSeries[count] = new List<Serie>();
|
||||
stackSeries[count].Add(serie);
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int stackIndex = sets[serie.stack];
|
||||
stackSeries[stackIndex].Add(serie);
|
||||
}
|
||||
}
|
||||
}
|
||||
return stackSeries;
|
||||
}
|
||||
|
||||
private Dictionary<string, int> sets = new Dictionary<string, int>();
|
||||
/// <summary>
|
||||
/// 获得堆叠系列列表
|
||||
/// </summary>
|
||||
/// <param name="Dictionary<int"></param>
|
||||
/// <param name="stackSeries"></param>
|
||||
public void GetStackSeries(ref Dictionary<int, List<Serie>> stackSeries)
|
||||
{
|
||||
int count = 0;
|
||||
sets.Clear();
|
||||
if (stackSeries == null)
|
||||
{
|
||||
stackSeries = new Dictionary<int, List<Serie>>(m_Series.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var kv in stackSeries)
|
||||
{
|
||||
kv.Value.Clear();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
var serie = m_Series[i];
|
||||
serie.index = i;
|
||||
if (string.IsNullOrEmpty(serie.stack))
|
||||
{
|
||||
if (!stackSeries.ContainsKey(count))
|
||||
stackSeries[count] = new List<Serie>(m_Series.Count);
|
||||
stackSeries[count].Add(serie);
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sets.ContainsKey(serie.stack))
|
||||
{
|
||||
sets.Add(serie.stack, count);
|
||||
if (!stackSeries.ContainsKey(count))
|
||||
stackSeries[count] = new List<Serie>(m_Series.Count);
|
||||
stackSeries[count].Add(serie);
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int stackIndex = sets[serie.stack];
|
||||
stackSeries[stackIndex].Add(serie);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> serieNameList = new List<string>();
|
||||
/// <summary>
|
||||
/// 获得所有系列名,不包含空名字。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<string> GetSerieNameList()
|
||||
{
|
||||
serieNameList.Clear();
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(serie.name) && !serieNameList.Contains(serie.name))
|
||||
{
|
||||
serieNameList.Add(serie.name);
|
||||
}
|
||||
foreach (var data in serie.data)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(data.name) && !serieNameList.Contains(data.name))
|
||||
{
|
||||
serieNameList.Add(data.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return serieNameList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置获得标志图形大小的回调
|
||||
/// </summary>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="selectedSize"></param>
|
||||
public void SetSerieSymbolSizeCallback(SymbolSizeCallback size, SymbolSizeCallback selectedSize)
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
serie.symbol.sizeCallback = size;
|
||||
serie.symbol.selectedSizeCallback = selectedSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从json中解析数据
|
||||
/// </summary>
|
||||
/// <param name="jsonData"></param>
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96ea96c66cf5d47c481d8d692a35ed93
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,603 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// 主题
|
||||
/// </summary>
|
||||
public enum Theme
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认主题。
|
||||
/// </summary>
|
||||
Default,
|
||||
/// <summary>
|
||||
/// 亮主题。
|
||||
/// </summary>
|
||||
Light,
|
||||
/// <summary>
|
||||
/// 暗主题。
|
||||
/// </summary>
|
||||
Dark
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
/// <summary>
|
||||
/// Theme.
|
||||
/// 主题相关配置。
|
||||
/// </summary>
|
||||
public class ThemeInfo : IEquatable<ThemeInfo>
|
||||
{
|
||||
[SerializeField] private Theme m_Theme = Theme.Default;
|
||||
[SerializeField] private Font m_Font;
|
||||
[SerializeField] private Color32 m_BackgroundColor;
|
||||
[FormerlySerializedAs("m_TextColor")]
|
||||
[SerializeField] private Color32 m_TitleTextColor;
|
||||
[SerializeField] private Color32 m_TitleSubTextColor;
|
||||
[SerializeField] private Color32 m_LegendTextColor;
|
||||
[SerializeField] private Color32 m_LegendUnableColor;
|
||||
[SerializeField] private Color32 m_AxisTextColor;
|
||||
[SerializeField] private Color32 m_AxisLineColor;
|
||||
[SerializeField] private Color32 m_AxisSplitLineColor;
|
||||
[SerializeField] private Color32 m_TooltipBackgroundColor;
|
||||
[SerializeField] private Color32 m_TooltipFlagAreaColor;
|
||||
[SerializeField] private Color32 m_TooltipTextColor;
|
||||
[SerializeField] private Color32 m_TooltipLabelColor;
|
||||
[SerializeField] private Color32 m_TooltipLineColor;
|
||||
[SerializeField] private Color32 m_DataZoomTextColor;
|
||||
[SerializeField] private Color32 m_DataZoomLineColor;
|
||||
[SerializeField] private Color32 m_DataZoomSelectedColor;
|
||||
[SerializeField] private Color32[] m_ColorPalette;
|
||||
|
||||
[SerializeField] private Font m_CustomFont;
|
||||
[SerializeField] private Color32 m_CustomBackgroundColor;
|
||||
[FormerlySerializedAs("m_CustomTextColor")]
|
||||
[SerializeField] private Color32 m_CustomTitleTextColor;
|
||||
[SerializeField] private Color32 m_CustomTitleSubTextColor;
|
||||
[SerializeField] private Color32 m_CustomLegendTextColor;
|
||||
[SerializeField] private Color32 m_CustomLegendUnableColor;
|
||||
[SerializeField] private Color32 m_CustomAxisTextColor;
|
||||
[SerializeField] private Color32 m_CustomAxisLineColor;
|
||||
[SerializeField] private Color32 m_CustomAxisSplitLineColor;
|
||||
[SerializeField] private Color32 m_CustomTooltipBackgroundColor;
|
||||
[SerializeField] private Color32 m_CustomTooltipFlagAreaColor;
|
||||
[SerializeField] private Color32 m_CustomTooltipTextColor;
|
||||
[SerializeField] private Color32 m_CustomTooltipLabelColor;
|
||||
[SerializeField] private Color32 m_CustomTooltipLineColor;
|
||||
[SerializeField] private Color32 m_CustomDataZoomTextColor;
|
||||
[SerializeField] private Color32 m_CustomDataZoomLineColor;
|
||||
[SerializeField] private Color32 m_CustomDataZoomSelectedColor;
|
||||
[SerializeField] private List<Color32> m_CustomColorPalette = new List<Color32>(13);
|
||||
/// <summary>
|
||||
/// the theme of chart.
|
||||
/// 主题类型。
|
||||
/// </summary>
|
||||
public Theme theme { get { return m_Theme; } set { m_Theme = value; } }
|
||||
/// <summary>
|
||||
/// the font of chart text。
|
||||
/// 字体。
|
||||
/// </summary>
|
||||
public Font font
|
||||
{
|
||||
get { return m_CustomFont != null ? m_CustomFont : m_Font; }
|
||||
set { m_CustomFont = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the background color of chart.
|
||||
/// 背景颜色。
|
||||
/// </summary>
|
||||
public Color32 backgroundColor
|
||||
{
|
||||
get { return m_CustomBackgroundColor != Color.clear ? m_CustomBackgroundColor : m_BackgroundColor; }
|
||||
set { m_CustomBackgroundColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the main title text color.
|
||||
/// 主标题颜色。
|
||||
/// </summary>
|
||||
public Color32 titleTextColor
|
||||
{
|
||||
get { return m_CustomTitleTextColor != Color.clear ? m_CustomTitleTextColor : m_TitleTextColor; }
|
||||
set { m_CustomTitleTextColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the subtitie text color.
|
||||
/// 副标题颜色。
|
||||
/// </summary>
|
||||
public Color32 titleSubTextColor
|
||||
{
|
||||
get { return m_CustomTitleSubTextColor != Color.clear ? m_CustomTitleSubTextColor : m_TitleSubTextColor; }
|
||||
set { m_CustomTitleSubTextColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the legend text color.
|
||||
/// 图例文字的颜色。
|
||||
/// </summary>
|
||||
public Color32 legendTextColor
|
||||
{
|
||||
get { return m_CustomLegendTextColor != Color.clear ? m_CustomLegendTextColor : m_LegendTextColor; }
|
||||
set { m_CustomLegendTextColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the legend unable text color.
|
||||
/// 图例变为不可用时的按钮颜色。
|
||||
/// </summary>
|
||||
public Color32 legendUnableColor
|
||||
{
|
||||
get { return m_CustomLegendUnableColor != Color.clear ? m_CustomLegendUnableColor : m_LegendUnableColor; }
|
||||
set { m_CustomLegendUnableColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the axis text color.
|
||||
/// 坐标轴上标签的颜色。
|
||||
/// </summary>
|
||||
public Color32 axisTextColor
|
||||
{
|
||||
get { return m_CustomAxisTextColor != Color.clear ? m_CustomAxisTextColor : m_AxisTextColor; }
|
||||
set { m_CustomAxisTextColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of axis line.
|
||||
/// 坐标轴轴线的颜色。
|
||||
/// </summary>
|
||||
public Color32 axisLineColor
|
||||
{
|
||||
get { return m_CustomAxisLineColor != Color.clear ? m_CustomAxisLineColor : m_AxisLineColor; }
|
||||
set { m_CustomAxisLineColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of axis split line.
|
||||
/// 分割线的颜色,默认和坐标轴轴线颜色一致。
|
||||
/// </summary>
|
||||
public Color32 axisSplitLineColor
|
||||
{
|
||||
get { return m_CustomAxisSplitLineColor != Color.clear ? m_CustomAxisSplitLineColor : m_AxisSplitLineColor; }
|
||||
set { m_CustomAxisSplitLineColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the tooltip background color.
|
||||
/// 提示框背景颜色。
|
||||
/// </summary>
|
||||
public Color32 tooltipBackgroundColor
|
||||
{
|
||||
get { return m_CustomTooltipBackgroundColor != Color.clear ? m_CustomTooltipBackgroundColor : m_TooltipBackgroundColor; }
|
||||
set { m_CustomTooltipBackgroundColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of tooltip shadow crosshair indicator.
|
||||
/// 提示框阴影指示器的颜色。
|
||||
/// </summary>
|
||||
public Color32 tooltipFlagAreaColor
|
||||
{
|
||||
get { return m_CustomTooltipFlagAreaColor != Color.clear ? m_CustomTooltipFlagAreaColor : m_TooltipFlagAreaColor; }
|
||||
set { m_CustomTooltipFlagAreaColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of tooltip text.
|
||||
/// 提示框文字颜色。
|
||||
/// </summary>
|
||||
public Color32 tooltipTextColor
|
||||
{
|
||||
get { return m_CustomTooltipTextColor != Color.clear ? m_CustomTooltipTextColor : m_TooltipTextColor; }
|
||||
set { m_CustomTooltipTextColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the background color of tooltip cross indicator's axis label.
|
||||
/// 提示框的十字指示器坐标轴标签的背景颜色。
|
||||
/// </summary>
|
||||
public Color32 tooltipLabelColor
|
||||
{
|
||||
get { return m_CustomTooltipLabelColor != Color.clear ? m_CustomTooltipLabelColor : m_TooltipLabelColor; }
|
||||
set { m_CustomTooltipLabelColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color tooltip indicator line.
|
||||
/// 提示框的指示线的颜色。
|
||||
/// </summary>
|
||||
public Color32 tooltipLineColor
|
||||
{
|
||||
get { return m_CustomTooltipLineColor != Color.clear ? m_CustomTooltipLineColor : m_TooltipLineColor; }
|
||||
set { m_CustomTooltipLineColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of datazoom text.
|
||||
/// 区域缩放的文字颜色。
|
||||
/// </summary>
|
||||
public Color32 dataZoomTextColor
|
||||
{
|
||||
get { return m_CustomDataZoomTextColor != Color.clear ? m_CustomDataZoomTextColor : m_DataZoomTextColor; }
|
||||
set { m_CustomDataZoomTextColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of datazoom line.
|
||||
/// 区域缩放的线条颜色。
|
||||
/// </summary>
|
||||
public Color32 dataZoomLineColor
|
||||
{
|
||||
get { return m_CustomDataZoomLineColor != Color.clear ? m_CustomDataZoomLineColor : m_DataZoomLineColor; }
|
||||
set { m_CustomDataZoomLineColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of datazoom selected area.
|
||||
/// 区域缩放的选中区域颜色。
|
||||
/// </summary>
|
||||
public Color32 dataZoomSelectedColor
|
||||
{
|
||||
get { return m_CustomDataZoomSelectedColor != Color.clear ? m_CustomDataZoomSelectedColor : m_DataZoomSelectedColor; }
|
||||
set { m_CustomDataZoomSelectedColor = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The color list of palette. If no color is set in series, the colors would be adopted sequentially and circularly from this list as the colors of series.
|
||||
/// 调色盘颜色列表。如果系列没有设置颜色,则会依次循环从该列表中取颜色作为系列颜色。
|
||||
/// </summary>
|
||||
public List<Color32> colorPalette { set { m_CustomColorPalette = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color of the specified index from the palette.
|
||||
/// 获得调色盘对应系列索引的颜色值。
|
||||
/// </summary>
|
||||
/// <param name="index">编号索引</param>
|
||||
/// <returns>the color,or Color.clear when failed.颜色值,失败时返回Color.clear</returns>
|
||||
public Color32 GetColor(int index)
|
||||
{
|
||||
if (index < 0) index = 0;
|
||||
if (m_CustomColorPalette.Count > 0)
|
||||
{
|
||||
var customIndex = index < m_CustomColorPalette.Count ? index : index % m_CustomColorPalette.Count;
|
||||
if (customIndex < m_CustomColorPalette.Count && m_CustomColorPalette[customIndex] != Color.clear)
|
||||
{
|
||||
return m_CustomColorPalette[customIndex];
|
||||
}
|
||||
}
|
||||
var newIndex = index < m_ColorPalette.Length ? index : index % m_ColorPalette.Length;
|
||||
if (newIndex < m_ColorPalette.Length)
|
||||
return m_ColorPalette[newIndex];
|
||||
else return Color.clear;
|
||||
}
|
||||
|
||||
Dictionary<int, string> _colorDic = new Dictionary<int, string>();
|
||||
/// <summary>
|
||||
/// Gets the hexadecimal color string of the specified index from the palette.
|
||||
/// 获得指定索引的十六进制颜色值字符串。
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public string GetColorStr(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
index = index % m_ColorPalette.Length;
|
||||
if (_colorDic.ContainsKey(index)) return _colorDic[index];
|
||||
else
|
||||
{
|
||||
_colorDic[index] = ColorUtility.ToHtmlStringRGBA(GetColor(index));
|
||||
return _colorDic[index];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// copy all configurations from theme.
|
||||
/// 复制主题的所有配置。
|
||||
/// </summary>
|
||||
/// <param name="theme"></param>
|
||||
public void Copy(ThemeInfo theme)
|
||||
{
|
||||
m_Theme = theme.theme;
|
||||
m_Font = theme.m_Font;
|
||||
m_BackgroundColor = theme.m_BackgroundColor;
|
||||
m_LegendUnableColor = theme.m_LegendUnableColor;
|
||||
m_TitleTextColor = theme.m_TitleTextColor;
|
||||
m_TitleSubTextColor = theme.m_TitleSubTextColor;
|
||||
m_LegendTextColor = theme.m_LegendTextColor;
|
||||
m_AxisTextColor = theme.m_AxisTextColor;
|
||||
m_AxisLineColor = theme.m_AxisLineColor;
|
||||
m_AxisSplitLineColor = theme.m_AxisSplitLineColor;
|
||||
m_TooltipBackgroundColor = theme.m_TooltipBackgroundColor;
|
||||
m_TooltipTextColor = theme.m_TooltipTextColor;
|
||||
m_TooltipLabelColor = theme.m_TooltipLabelColor;
|
||||
m_TooltipLineColor = theme.m_TooltipLineColor;
|
||||
m_DataZoomLineColor = theme.m_DataZoomLineColor;
|
||||
m_DataZoomSelectedColor = theme.m_DataZoomSelectedColor;
|
||||
m_DataZoomTextColor = theme.m_DataZoomTextColor;
|
||||
m_ColorPalette = new Color32[theme.m_ColorPalette.Length];
|
||||
for (int i = 0; i < theme.m_ColorPalette.Length; i++)
|
||||
{
|
||||
m_ColorPalette[i] = theme.m_ColorPalette[i];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear all custom configurations.
|
||||
/// 重置,清除所有自定义配置。
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
m_Theme = Theme.Default;
|
||||
m_Font = null;
|
||||
m_BackgroundColor = Color.clear;
|
||||
m_LegendUnableColor = Color.clear;
|
||||
m_TitleTextColor = Color.clear;
|
||||
m_TitleSubTextColor = Color.clear;
|
||||
m_LegendTextColor = Color.clear;
|
||||
m_AxisTextColor = Color.clear;
|
||||
m_AxisLineColor = Color.clear;
|
||||
m_AxisSplitLineColor = Color.clear;
|
||||
m_TooltipBackgroundColor = Color.clear;
|
||||
m_TooltipTextColor = Color.clear;
|
||||
m_TooltipLabelColor = Color.clear;
|
||||
m_TooltipLineColor = Color.clear;
|
||||
m_DataZoomLineColor = Color.clear;
|
||||
m_DataZoomSelectedColor = Color.clear;
|
||||
m_DataZoomTextColor = Color.clear;
|
||||
for (int i = 0; i < m_CustomColorPalette.Count; i++)
|
||||
{
|
||||
m_CustomColorPalette[i] = Color.clear;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default theme.
|
||||
/// 默认主题。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public static ThemeInfo Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ThemeInfo()
|
||||
{
|
||||
m_Theme = Theme.Default,
|
||||
m_Font = Resources.GetBuiltinResource<Font>("Arial.ttf"),
|
||||
m_BackgroundColor = new Color32(255, 255, 255, 255),
|
||||
m_LegendUnableColor = GetColor("#cccccc"),
|
||||
m_TitleTextColor = GetColor("#514D4D"),
|
||||
m_TitleSubTextColor = GetColor("#514D4D"),
|
||||
m_LegendTextColor = GetColor("#eee"),
|
||||
m_AxisTextColor = GetColor("#514D4D"),
|
||||
m_AxisLineColor = GetColor("#514D4D"),
|
||||
m_AxisSplitLineColor = GetColor("#51515120"),
|
||||
m_TooltipBackgroundColor = GetColor("#515151C8"),
|
||||
m_TooltipTextColor = GetColor("#FFFFFFFF"),
|
||||
m_TooltipFlagAreaColor = GetColor("#51515120"),
|
||||
m_TooltipLabelColor = GetColor("#292929FF"),
|
||||
m_TooltipLineColor = GetColor("#29292964"),
|
||||
m_DataZoomLineColor = GetColor("#51515120"),
|
||||
m_DataZoomSelectedColor = GetColor("#51515120"),
|
||||
m_DataZoomTextColor = GetColor("#514D4D"),
|
||||
m_ColorPalette = new Color32[]
|
||||
{
|
||||
new Color32(194, 53, 49, 255),
|
||||
new Color32(47, 69, 84, 255),
|
||||
new Color32(97, 160, 168, 255),
|
||||
new Color32(212, 130, 101, 255),
|
||||
new Color32(145, 199, 174, 255),
|
||||
new Color32(116, 159, 131, 255),
|
||||
new Color32(202, 134, 34, 255),
|
||||
new Color32(189, 162, 154, 255),
|
||||
new Color32(110, 112, 116, 255),
|
||||
new Color32(84, 101, 112, 255),
|
||||
new Color32(196, 204, 211, 255)
|
||||
},
|
||||
m_CustomColorPalette = new List<Color32>{
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// light theme.
|
||||
/// 亮主题。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public static ThemeInfo Light
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ThemeInfo()
|
||||
{
|
||||
m_Theme = Theme.Light,
|
||||
m_Font = Resources.GetBuiltinResource<Font>("Arial.ttf"),
|
||||
m_BackgroundColor = new Color32(255, 255, 255, 255),
|
||||
m_LegendUnableColor = GetColor("#cccccc"),
|
||||
m_TitleTextColor = GetColor("#514D4D"),
|
||||
m_TitleSubTextColor = GetColor("#514D4D"),
|
||||
m_LegendTextColor = GetColor("#514D4D"),
|
||||
m_AxisTextColor = GetColor("#514D4D"),
|
||||
m_AxisLineColor = GetColor("#514D4D"),
|
||||
m_AxisSplitLineColor = GetColor("#51515120"),
|
||||
m_TooltipBackgroundColor = GetColor("#515151C8"),
|
||||
m_TooltipTextColor = GetColor("#FFFFFFFF"),
|
||||
m_TooltipFlagAreaColor = GetColor("#51515120"),
|
||||
m_TooltipLabelColor = GetColor("#292929FF"),
|
||||
m_TooltipLineColor = GetColor("#29292964"),
|
||||
m_DataZoomLineColor = GetColor("#51515120"),
|
||||
m_DataZoomSelectedColor = GetColor("#51515120"),
|
||||
m_DataZoomTextColor = GetColor("#514D4D"),
|
||||
m_ColorPalette = new Color32[]
|
||||
{
|
||||
new Color32(55, 162, 218, 255),
|
||||
new Color32(255, 159, 127, 255),
|
||||
new Color32(50, 197, 233, 255),
|
||||
new Color32(251, 114, 147, 255),
|
||||
new Color32(103, 224, 227, 255),
|
||||
new Color32(224, 98, 174, 255),
|
||||
new Color32(159, 230, 184, 255),
|
||||
new Color32(230, 144, 209, 255),
|
||||
new Color32(255, 219, 92, 255),
|
||||
new Color32(230, 188, 243, 255),
|
||||
new Color32(157, 150, 245, 255),
|
||||
new Color32(131, 120, 234, 255),
|
||||
new Color32(150, 191, 255, 255)
|
||||
},
|
||||
m_CustomColorPalette = new List<Color32>{
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// dark theme.
|
||||
/// 暗主题。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public static ThemeInfo Dark
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ThemeInfo()
|
||||
{
|
||||
m_Theme = Theme.Dark,
|
||||
m_Font = Resources.GetBuiltinResource<Font>("Arial.ttf"),
|
||||
m_LegendUnableColor = GetColor("#cccccc"),
|
||||
m_BackgroundColor = new Color32(34, 34, 34, 255),
|
||||
m_TitleTextColor = GetColor("#eee"),
|
||||
m_TitleSubTextColor = GetColor("#eee"),
|
||||
m_LegendTextColor = GetColor("#eee"),
|
||||
m_AxisTextColor = GetColor("#eee"),
|
||||
m_AxisLineColor = GetColor("#eee"),
|
||||
m_AxisSplitLineColor = GetColor("#aaa"),
|
||||
m_TooltipBackgroundColor = GetColor("#515151C8"),
|
||||
m_TooltipTextColor = GetColor("#FFFFFFFF"),
|
||||
m_TooltipFlagAreaColor = GetColor("#51515120"),
|
||||
m_TooltipLabelColor = GetColor("#A7A7A7FF"),
|
||||
m_TooltipLineColor = GetColor("#eee"),
|
||||
m_DataZoomLineColor = GetColor("#FFFFFF45"),
|
||||
m_DataZoomSelectedColor = GetColor("#D0D0D03D"),
|
||||
m_DataZoomTextColor = GetColor("#FFFFFFFF"),
|
||||
m_ColorPalette = new Color32[]
|
||||
{
|
||||
new Color32(221, 107, 102, 255),
|
||||
new Color32(117, 154, 160, 255),
|
||||
new Color32(230, 157, 135, 255),
|
||||
new Color32(141, 193, 169, 255),
|
||||
new Color32(234, 126, 83, 255),
|
||||
new Color32(238, 221, 120, 255),
|
||||
new Color32(115, 163, 115, 255),
|
||||
new Color32(115, 185, 188, 255),
|
||||
new Color32(114, 137, 171, 255),
|
||||
new Color32(145, 202, 140, 255),
|
||||
new Color32(244, 159, 66, 255)
|
||||
},
|
||||
m_CustomColorPalette = new List<Color32>{
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear,
|
||||
Color.clear
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the html string to color.
|
||||
/// 将字符串颜色值转成Color。
|
||||
/// </summary>
|
||||
/// <param name="hexColorStr"></param>
|
||||
/// <returns></returns>
|
||||
public static Color32 GetColor(string hexColorStr)
|
||||
{
|
||||
Color color;
|
||||
ColorUtility.TryParseHtmlString(hexColorStr, out color);
|
||||
return (Color32)color;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is ThemeInfo)
|
||||
{
|
||||
return Equals((ThemeInfo)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(ThemeInfo other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Font == other.m_Font &&
|
||||
ChartHelper.IsValueEqualsColor(m_LegendUnableColor, other.m_LegendUnableColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_BackgroundColor, other.m_BackgroundColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_TitleTextColor, other.m_TitleTextColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_TitleSubTextColor, other.m_TitleSubTextColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_AxisTextColor, other.m_AxisTextColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_AxisLineColor, other.m_AxisLineColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_AxisSplitLineColor, other.m_AxisSplitLineColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_TooltipBackgroundColor, other.m_TooltipBackgroundColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_AxisSplitLineColor, other.m_AxisSplitLineColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_TooltipTextColor, other.m_TooltipTextColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_TooltipFlagAreaColor, other.m_TooltipFlagAreaColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_DataZoomLineColor, other.m_DataZoomLineColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_DataZoomSelectedColor, other.m_DataZoomSelectedColor) &&
|
||||
ChartHelper.IsValueEqualsColor(m_DataZoomTextColor, other.m_DataZoomTextColor) &&
|
||||
m_ColorPalette.Length == other.m_ColorPalette.Length;
|
||||
}
|
||||
|
||||
public static bool operator ==(ThemeInfo left, ThemeInfo right)
|
||||
{
|
||||
if (ReferenceEquals(left, null) && ReferenceEquals(right, null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (ReferenceEquals(left, null) || ReferenceEquals(right, null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(ThemeInfo left, ThemeInfo right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user