mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-06-10 12:33:43 +00:00
Compare commits
1093 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d5f32b55e | ||
|
|
c8cb47da63 | ||
|
|
66d666192a | ||
|
|
2a815e54db | ||
|
|
367844a86c | ||
|
|
910b9194ac | ||
|
|
eb196a237f | ||
|
|
71038a9f88 | ||
|
|
a6ba17ee00 | ||
|
|
9deb120446 | ||
|
|
8df1dbe0fb | ||
|
|
e4fbe5670f | ||
|
|
e0f6b8c2dc | ||
|
|
32b2137b87 | ||
|
|
dc46477c15 | ||
|
|
d6f1c82a08 | ||
|
|
267cb7472c | ||
|
|
6d04cac38b | ||
|
|
0331804a85 | ||
|
|
11eccbc39b | ||
|
|
80d596a721 | ||
|
|
637fde799e | ||
|
|
9a198b35b1 | ||
|
|
3476c56eb6 | ||
|
|
d9e1c1211c | ||
|
|
9fab42a9e7 | ||
|
|
d69327e301 | ||
|
|
2566641b5f | ||
|
|
fea083035f | ||
|
|
938ae62905 | ||
|
|
8eec52939c | ||
|
|
151a2ed01f | ||
|
|
3aa6daf97c | ||
|
|
c3c6eb5719 | ||
|
|
4fde95eab7 | ||
|
|
3d4360a10a | ||
|
|
64187fea3f | ||
|
|
0c187b6ff9 | ||
|
|
71c8bc1499 | ||
|
|
d0d5c2a101 | ||
|
|
95dddd9448 | ||
|
|
9ed80d3b59 | ||
|
|
01a49de373 | ||
|
|
2e2ad0a1f2 | ||
|
|
5356e2304c | ||
|
|
0d1d2460a0 | ||
|
|
f88ac6b4c4 | ||
|
|
9d3d8543a5 | ||
|
|
ea819bfa42 | ||
|
|
618fe0fb01 | ||
|
|
43ba7d47c5 | ||
|
|
e3e01587ab | ||
|
|
f36ca34055 | ||
|
|
0ffc6d7efe | ||
|
|
ec89828c67 | ||
|
|
18c0d3218d | ||
|
|
f867ac7efd | ||
|
|
fc7655fd76 | ||
|
|
0c09d40654 | ||
|
|
758d578ad2 | ||
|
|
318b4146a9 | ||
|
|
ea4dac65e1 | ||
|
|
b27f0ec6ec | ||
|
|
f5e8ba4082 | ||
|
|
816e26f517 | ||
|
|
58d6d52747 | ||
|
|
ccd71710ce | ||
|
|
e103c87d10 | ||
|
|
e515908f9b | ||
|
|
eca0c6ea46 | ||
|
|
1229c1bfa2 | ||
|
|
f678477c88 | ||
|
|
0adc9e71e5 | ||
|
|
bc1596f8d3 | ||
|
|
4a754c0021 | ||
|
|
2c382fda00 | ||
|
|
45159b186f | ||
|
|
00274567cf | ||
|
|
42c2c91f03 | ||
|
|
9c26716e7c | ||
|
|
c8a5560a67 | ||
|
|
ad707ec14d | ||
|
|
b6c0962ff3 | ||
|
|
86e66984d4 | ||
|
|
04d646ed8c | ||
|
|
0f83a70b54 | ||
|
|
6b6bf9d9da | ||
|
|
4c1432a535 | ||
|
|
bab788d4cb | ||
|
|
fab683f5e1 | ||
|
|
29c9f59762 | ||
|
|
c29a22c576 | ||
|
|
5568c2fd76 | ||
|
|
5c231514a5 | ||
|
|
93abffaaaa | ||
|
|
a9c801c077 | ||
|
|
2d35f77740 | ||
|
|
529c784ee2 | ||
|
|
fdd686b038 | ||
|
|
36d629b29a | ||
|
|
59335786df | ||
|
|
0af76517e1 | ||
|
|
674d937104 | ||
|
|
a038317c6e | ||
|
|
5fe12dcde7 | ||
|
|
f00eb2147d | ||
|
|
76238d7d7e | ||
|
|
c53be4b5f9 | ||
|
|
8b320e9bc9 | ||
|
|
5757049e74 | ||
|
|
d196551756 | ||
|
|
d7223f6790 | ||
|
|
a50b58d48e | ||
|
|
a0db57bdf2 | ||
|
|
3dfa5487ee | ||
|
|
bddbe600ce | ||
|
|
3073926d73 | ||
|
|
49e9066334 | ||
|
|
372ed1de58 | ||
|
|
dbb867e0ab | ||
|
|
adbd88c411 | ||
|
|
99b3d24366 | ||
|
|
6f69af3945 | ||
|
|
c6e38f2003 | ||
|
|
e0f4ed946d | ||
|
|
465af108aa | ||
|
|
bf152a3a71 | ||
|
|
64c9b97eb9 | ||
|
|
c42ca0f097 | ||
|
|
8c6d013341 | ||
|
|
398fee2d97 | ||
|
|
33246c2a1f | ||
|
|
b102fed9fe | ||
|
|
9c069296ed | ||
|
|
9f94541b9e | ||
|
|
7a367d24ab | ||
|
|
4964bca341 | ||
|
|
22b167981b | ||
|
|
80d9087084 | ||
|
|
d6630ef5bf | ||
|
|
5e3bc3ff15 | ||
|
|
3d09d82abd | ||
|
|
22715dab95 | ||
|
|
ace8537650 | ||
|
|
d7c6bf59ef | ||
|
|
c9cd4ee38a | ||
|
|
633456ada0 | ||
|
|
7fbaf7af70 | ||
|
|
e90d7d61d9 | ||
|
|
bda6fc7978 | ||
|
|
8288e75445 | ||
|
|
6ace71f8db | ||
|
|
a4aabb5bbe | ||
|
|
d90a0d69b2 | ||
|
|
c17d83ae6d | ||
|
|
317ffc4d99 | ||
|
|
bc6c387db3 | ||
|
|
d9053db2e3 | ||
|
|
d7cfda2521 | ||
|
|
a5aa630b74 | ||
|
|
ce1691e1ce | ||
|
|
a3a25fe7c6 | ||
|
|
d4a3886530 | ||
|
|
927644fb10 | ||
|
|
d67a922a74 | ||
|
|
84a8e6ca19 | ||
|
|
858ad55a35 | ||
|
|
bfc4ff39fb | ||
|
|
7603d60ea0 | ||
|
|
8078e1c54f | ||
|
|
59c9d758e1 | ||
|
|
7ea0fbd66d | ||
|
|
5f11f7d6e3 | ||
|
|
5879c99995 | ||
|
|
4356111e0c | ||
|
|
f2001fbc82 | ||
|
|
906b6ed4c7 | ||
|
|
32f98b6d5a | ||
|
|
b6702be558 | ||
|
|
69db61c7b6 | ||
|
|
da10188c6b | ||
|
|
5593210cc6 | ||
|
|
8abd486fcd | ||
|
|
051dbb50b1 | ||
|
|
30e6e6908c | ||
|
|
be2e8f14cf | ||
|
|
56f0ff64b9 | ||
|
|
8a7f0c6533 | ||
|
|
8c0eb970d3 | ||
|
|
5e234dc408 | ||
|
|
26ef85ce6f | ||
|
|
6d287f6678 | ||
|
|
15eddd21d5 | ||
|
|
29722998e4 | ||
|
|
faa5bc7cd8 | ||
|
|
eb2c3d8560 | ||
|
|
0c91f46aeb | ||
|
|
7d16cb2017 | ||
|
|
bdb171c4e6 | ||
|
|
d7ebfb1f41 | ||
|
|
c9d554d184 | ||
|
|
e0974fffbe | ||
|
|
cc63764eef | ||
|
|
687fc0d495 | ||
|
|
ce4e88c51c | ||
|
|
42a77a9439 | ||
|
|
bbab8d9b75 | ||
|
|
b1eae7045b | ||
|
|
a78eed9c5c | ||
|
|
a9fefae642 | ||
|
|
f6ad852a44 | ||
|
|
53610b53ca | ||
|
|
e1f20e0796 | ||
|
|
ab8ced4aed | ||
|
|
0662f62cd1 | ||
|
|
5ed6ee1d2a | ||
|
|
99769da035 | ||
|
|
75bf6e0e6c | ||
|
|
aec3e59aca | ||
|
|
1141208407 | ||
|
|
a9fe1f53b1 | ||
|
|
7f27325ce1 | ||
|
|
4c89bda4b9 | ||
|
|
bd9a0df52b | ||
|
|
eba8986f18 | ||
|
|
95c0bcdb75 | ||
|
|
4b8ca2e5e1 | ||
|
|
f0d6316c20 | ||
|
|
ae35a4d7e6 | ||
|
|
4e05759c3c | ||
|
|
ba9faa8bc6 | ||
|
|
afbfa20fd9 | ||
|
|
ac7628ce68 | ||
|
|
dd6833d322 | ||
|
|
a5e13794e8 | ||
|
|
16d055abc0 | ||
|
|
83744777c5 | ||
|
|
ccc5110e8e | ||
|
|
ce702fd1e3 | ||
|
|
a44eca0f91 | ||
|
|
8bd0c23e19 | ||
|
|
061ac49670 | ||
|
|
027f5f260c | ||
|
|
5f16685b64 | ||
|
|
6710a52950 | ||
|
|
de16bfad01 | ||
|
|
b01c2e4338 | ||
|
|
6ae4468aa2 | ||
|
|
48686e865c | ||
|
|
a885be625e | ||
|
|
a1d8f34720 | ||
|
|
b2f1fd00b1 | ||
|
|
442a51abc1 | ||
|
|
9552e877ce | ||
|
|
34dd3d1c4e | ||
|
|
9e07fa1db3 | ||
|
|
990c6dad90 | ||
|
|
99dc2af42a | ||
|
|
f32808a36d | ||
|
|
ca5470a351 | ||
|
|
34b132735d | ||
|
|
0f31f057df | ||
|
|
65d32f7aec | ||
|
|
fcc1314f17 | ||
|
|
9981ce2d23 | ||
|
|
f1f2ea78be | ||
|
|
d1f9c77571 | ||
|
|
19914586ae | ||
|
|
e7f19e72a5 | ||
|
|
35220a1026 | ||
|
|
b9812a4f98 | ||
|
|
74b078c926 | ||
|
|
44dc1f7b16 | ||
|
|
cdf0bc81e1 | ||
|
|
5b2b2d4059 | ||
|
|
b3b0c0b3aa | ||
|
|
4f93628667 | ||
|
|
8dde322c04 | ||
|
|
47ee421913 | ||
|
|
0355e3ed46 | ||
|
|
eedafa7011 | ||
|
|
aee49322b7 | ||
|
|
96a49f2b11 | ||
|
|
131aabc76a | ||
|
|
e42afe8d47 | ||
|
|
69243b7cd0 | ||
|
|
12757eb4db | ||
|
|
945a69ba70 | ||
|
|
9aa8431432 | ||
|
|
a499002426 | ||
|
|
4d5e2481b0 | ||
|
|
2248b61d03 | ||
|
|
419715bb2a | ||
|
|
f5c2e73098 | ||
|
|
197402dcb7 | ||
|
|
33fd4aa9f3 | ||
|
|
9b263c883b | ||
|
|
06574a201a | ||
|
|
fbdb51d847 | ||
|
|
47c9b99931 | ||
|
|
bb9f28dd5c | ||
|
|
0f2f55e436 | ||
|
|
6c9528cf19 | ||
|
|
91b9055039 | ||
|
|
564ff2e178 | ||
|
|
2a03e71312 | ||
|
|
0dbcc4ab2b | ||
|
|
f19b61f1f2 | ||
|
|
9a1c76c236 | ||
|
|
7c07499e44 | ||
|
|
8a6253621b | ||
|
|
5bc14dd37a | ||
|
|
b11e8fcb3a | ||
|
|
df0a87c935 | ||
|
|
431cf7de74 | ||
|
|
87049b5170 | ||
|
|
c24d89c8ab | ||
|
|
e8c46b676f | ||
|
|
0880b2f3f9 | ||
|
|
1d1ad6fa57 | ||
|
|
6e87f82131 | ||
|
|
9549159a58 | ||
|
|
e370bedc09 | ||
|
|
5740882d1c | ||
|
|
63166e5cd1 | ||
|
|
6ba6a7929d | ||
|
|
e0a596d02a | ||
|
|
9b7ebea827 | ||
|
|
0ad4a47c36 | ||
|
|
1ac59dff86 | ||
|
|
bafe032bb9 | ||
|
|
003f4da9de | ||
|
|
d77e1c3d91 | ||
|
|
d4b3f5eaa8 | ||
|
|
8a78867961 | ||
|
|
d9266b3c9c | ||
|
|
0801069f72 | ||
|
|
e92afac0de | ||
|
|
d1fd4dcf44 | ||
|
|
43c31405b8 | ||
|
|
4e4d0bc85d | ||
|
|
96b0ec45d2 | ||
|
|
8c02ce14ac | ||
|
|
419c704b23 | ||
|
|
9dedc1db68 | ||
|
|
f11ee84517 | ||
|
|
dfa978afe0 | ||
|
|
4e6658ad70 | ||
|
|
ef5988a851 | ||
|
|
5d6c5b5f79 | ||
|
|
80e4475f65 | ||
|
|
84cf39df4d | ||
|
|
d44bf55a87 | ||
|
|
ad273cf1b1 | ||
|
|
a3d2d3f1d5 | ||
|
|
7ca4ddcb88 | ||
|
|
9a3461084c | ||
|
|
09df6fa73d | ||
|
|
be4ed41ca6 | ||
|
|
e2b0c935e0 | ||
|
|
e4fac71987 | ||
|
|
20825c148f | ||
|
|
5476fa8d09 | ||
|
|
80c77fc69a | ||
|
|
621bc3dcfd | ||
|
|
1ed0ff377a | ||
|
|
426d437e6d | ||
|
|
6c0dcbbcbb | ||
|
|
4ade064266 | ||
|
|
1ad87920d0 | ||
|
|
b784900fda | ||
|
|
acba2f5c1e | ||
|
|
3bccbd0ab2 | ||
|
|
327661bfdd | ||
|
|
ed393ea560 | ||
|
|
3fbf5bc906 | ||
|
|
b7efcf87cf | ||
|
|
1aea9f3cfe | ||
|
|
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 | ||
|
|
1ad3bc8c9f | ||
|
|
0743882076 | ||
|
|
333620d87f | ||
|
|
b7021cb072 | ||
|
|
64614cffb0 | ||
|
|
ba925a809d | ||
|
|
300ed8ca15 | ||
|
|
1412d8c365 | ||
|
|
501d6458f3 | ||
|
|
587cfab8d3 | ||
|
|
916b68441b | ||
|
|
08230727df | ||
|
|
a756f70e74 | ||
|
|
7e5d805037 | ||
|
|
f51c498503 | ||
|
|
51e3707072 | ||
|
|
763c0d9304 | ||
|
|
925e6317bc | ||
|
|
53acc084f8 | ||
|
|
00158aed82 | ||
|
|
ec35122b16 | ||
|
|
ecba7db371 | ||
|
|
d0331456ac | ||
|
|
7a01713842 | ||
|
|
c86747e0ed | ||
|
|
abd6b166c2 | ||
|
|
9f93d71279 | ||
|
|
3c17d7763b | ||
|
|
456d1ff81b | ||
|
|
79541c17a1 | ||
|
|
c0ae5eed32 | ||
|
|
8fadbca405 | ||
|
|
0297702565 | ||
|
|
0cc7da662f | ||
|
|
40d7949588 |
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: ['https://github.com/XCharts-Team/XCharts/blob/master/Documentation~/zh/img/support_alipay.png','https://github.com/XCharts-Team/XCharts/blob/master/Documentation~/zh/img/support_wechat.png']
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,12 +1,6 @@
|
||||
/.vs
|
||||
/.vscode
|
||||
.vs
|
||||
/Library
|
||||
/Temp
|
||||
/UnityPackageManager
|
||||
|
||||
/Assets/XCharts/Demo/demo_test.unity
|
||||
/Assets/XCharts/Demo/demo_test.unity.meta
|
||||
|
||||
*.sln
|
||||
*.csproj
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,158 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XCharts;
|
||||
|
||||
public class Demo : MonoBehaviour
|
||||
{
|
||||
private Theme m_SelectedTheme;
|
||||
private GameObject m_SelectedModule;
|
||||
|
||||
private GameObject m_LineChartModule;
|
||||
private GameObject m_BarChartModule;
|
||||
private GameObject m_PieChartModule;
|
||||
private GameObject m_RadarChartModule;
|
||||
private GameObject m_OtherModule;
|
||||
|
||||
private Button m_DefaultThemeButton;
|
||||
private Button m_LightThemeButton;
|
||||
private Button m_DarkThemeButton;
|
||||
|
||||
private Button m_LineChartButton;
|
||||
private Button m_BarChartButton;
|
||||
private Button m_PieChartButton;
|
||||
private Button m_RadarChartButton;
|
||||
private Button m_OtherButton;
|
||||
|
||||
private Text m_Title;
|
||||
private Color m_NormalColor;
|
||||
private Color m_SelectedColor;
|
||||
private Color m_HighlightColor;
|
||||
|
||||
private ScrollRect m_ScrollRect;
|
||||
private Mask m_Mark;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
m_SelectedTheme = Theme.Default;
|
||||
|
||||
m_NormalColor = ChartHelper.GetColor("#293C55FF");
|
||||
m_SelectedColor = ChartHelper.GetColor("#e43c59ff");
|
||||
m_HighlightColor = ChartHelper.GetColor("#0E151FFF");
|
||||
|
||||
m_ScrollRect = transform.Find("chart_detail").GetComponent<ScrollRect>();
|
||||
|
||||
m_LineChartModule = transform.Find("chart_detail/Viewport/line_chart").gameObject;
|
||||
m_BarChartModule = transform.Find("chart_detail/Viewport/bar_chart").gameObject;
|
||||
m_PieChartModule = transform.Find("chart_detail/Viewport/pie_chart").gameObject;
|
||||
m_RadarChartModule = transform.Find("chart_detail/Viewport/radar_chart").gameObject;
|
||||
m_OtherModule = transform.Find("chart_detail/Viewport/other").gameObject;
|
||||
m_Mark = transform.Find("chart_detail/Viewport").GetComponent<Mask>();
|
||||
m_Mark.enabled = true;
|
||||
|
||||
m_Title = transform.Find("chart_title/Text").GetComponent<Text>();
|
||||
|
||||
InitThemeButton();
|
||||
InitChartButton();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void InitChartButton()
|
||||
{
|
||||
m_LineChartButton = transform.Find("chart_list/btn_linechart").GetComponent<Button>();
|
||||
m_BarChartButton = transform.Find("chart_list/btn_barchart").GetComponent<Button>();
|
||||
m_PieChartButton = transform.Find("chart_list/btn_piechart").GetComponent<Button>();
|
||||
m_RadarChartButton = transform.Find("chart_list/btn_radarchart").GetComponent<Button>();
|
||||
m_OtherButton = transform.Find("chart_list/btn_other").GetComponent<Button>();
|
||||
|
||||
m_LineChartButton.onClick.AddListener(delegate () { SelectedModule(m_LineChartModule); });
|
||||
m_BarChartButton.onClick.AddListener(delegate () { SelectedModule(m_BarChartModule); });
|
||||
m_PieChartButton.onClick.AddListener(delegate () { SelectedModule(m_PieChartModule); });
|
||||
m_RadarChartButton.onClick.AddListener(delegate () { SelectedModule(m_RadarChartModule); });
|
||||
m_OtherButton.onClick.AddListener(delegate () { SelectedModule(m_OtherModule); });
|
||||
|
||||
SelectedModule(m_LineChartModule);
|
||||
}
|
||||
|
||||
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 SelectedModule(GameObject module)
|
||||
{
|
||||
m_SelectedModule = module;
|
||||
m_LineChartModule.SetActive(module == m_LineChartModule);
|
||||
m_BarChartModule.SetActive(module == m_BarChartModule);
|
||||
m_PieChartModule.SetActive(module == m_PieChartModule);
|
||||
m_RadarChartModule.SetActive(module == m_RadarChartModule);
|
||||
m_OtherModule.SetActive(module == m_OtherModule);
|
||||
|
||||
SetButtonColor(m_LineChartButton, m_SelectedModule, m_LineChartModule);
|
||||
SetButtonColor(m_BarChartButton, m_SelectedModule, m_BarChartModule);
|
||||
SetButtonColor(m_PieChartButton, m_SelectedModule, m_PieChartModule);
|
||||
SetButtonColor(m_RadarChartButton, m_SelectedModule, m_RadarChartModule);
|
||||
SetButtonColor(m_OtherButton, m_SelectedModule, m_OtherModule);
|
||||
|
||||
m_ScrollRect.content = m_SelectedModule.GetComponent<RectTransform>();
|
||||
|
||||
if (module == m_LineChartModule)
|
||||
{
|
||||
m_Title.text = "折线图 Line";
|
||||
}
|
||||
else if (module == m_BarChartModule)
|
||||
{
|
||||
m_Title.text = "柱状图 Bar";
|
||||
}
|
||||
else if (module == m_PieChartModule)
|
||||
{
|
||||
m_Title.text = "饼图 Pie";
|
||||
}
|
||||
else if (module == m_RadarChartModule)
|
||||
{
|
||||
m_Title.text = "雷达图 Radar";
|
||||
}
|
||||
else if (module == m_OtherModule)
|
||||
{
|
||||
m_Title.text = "其他";
|
||||
}
|
||||
SelecteTheme(m_SelectedTheme);
|
||||
}
|
||||
|
||||
void SetButtonColor(Button btn, GameObject selected, GameObject module)
|
||||
{
|
||||
var block = btn.colors;
|
||||
block.highlightedColor = selected == module ? m_SelectedColor : m_HighlightColor;
|
||||
block.normalColor = selected == module ? m_SelectedColor : m_NormalColor;
|
||||
btn.colors = block;
|
||||
}
|
||||
|
||||
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,56 +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.xAxis.ClearData();
|
||||
chart.series.ClearData();
|
||||
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);
|
||||
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
||||
chart.AddData(0, UnityEngine.Random.Range(60, 150));
|
||||
initCount++;
|
||||
if (initCount > maxCacheDataNumber) break;
|
||||
}
|
||||
chart.RefreshChart();
|
||||
}
|
||||
updateTime += Time.deltaTime;
|
||||
if (updateTime >= 1)
|
||||
{
|
||||
updateTime = 0;
|
||||
count++;
|
||||
chart.AddXAxisData(DateTime.Now.ToString("hh:mm:ss"));
|
||||
chart.AddData(0, UnityEngine.Random.Range(60, 150));
|
||||
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,70 +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.xAxis.ClearData();
|
||||
chart.series.ClearData();
|
||||
chart.maxCacheDataNumber = maxCacheDataNumber;
|
||||
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);
|
||||
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
||||
chart.AddData(0, UnityEngine.Random.Range(60, 150));
|
||||
initCount++;
|
||||
if (initCount > maxCacheDataNumber) break;
|
||||
}
|
||||
chart.RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateData(int count, CoordinateChart chart)
|
||||
{
|
||||
var baseValue = Random.Range(0, 1000);
|
||||
var time = new System.DateTime(2011, 1, 1);
|
||||
var smallBaseValue = 0;
|
||||
|
||||
chart.xAxis.ClearData();
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
chart.AddXAxisData(time.ToString("hh:mm:ss"));
|
||||
|
||||
smallBaseValue = i % 30 == 0
|
||||
? Random.Range(0, 700)
|
||||
: (smallBaseValue + Random.Range(0, 500) - 250);
|
||||
baseValue += Random.Range(0, 20) - 10;
|
||||
float value = Mathf.Max(
|
||||
0,
|
||||
Mathf.Round(baseValue + smallBaseValue) + 3000
|
||||
);
|
||||
//var index = i % 100;
|
||||
//var value = (Mathf.Sin(index / 5) * (index / 5 - 10) + index / 6) * 5;
|
||||
value = Mathf.Abs(value);
|
||||
chart.AddData(0, value);
|
||||
time = time.AddSeconds(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("time" + count, Random.Range(10, 100));
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = count % 5;
|
||||
chart.UpdateData("time" + index, Random.Range(10, 100));
|
||||
}
|
||||
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:
|
||||
@@ -1,30 +0,0 @@
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
//[RequireComponent(typeof(CoordinateChart))]
|
||||
public class Demo_Test : MonoBehaviour
|
||||
{
|
||||
private CoordinateChart chart;
|
||||
private float time;
|
||||
private int count;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponentInChildren<CoordinateChart>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time >= 1)
|
||||
{
|
||||
time = 0;
|
||||
count++;
|
||||
chart.UpdateData(0, Random.Range(60, 150));
|
||||
chart.AddXAxisData("time" + count);
|
||||
chart.AddData(0, Random.Range(60, 150));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79b834e804f7aa844bc2ad80cf2bda9f
|
||||
timeCreated: 1557366438
|
||||
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,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,116 +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_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_ThemeModuleToggle = false;
|
||||
private bool m_BaseModuleToggle = false;
|
||||
|
||||
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Target = (BaseChart)target;
|
||||
m_Script = serializedObject.FindProperty("m_Script");
|
||||
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.BeginHorizontal();
|
||||
EditorGUIUtility.fieldWidth = EditorGUIUtility.labelWidth - 5;
|
||||
m_ThemeModuleToggle = EditorGUILayout.Foldout(m_ThemeModuleToggle, "Theme",
|
||||
ChartEditorHelper.foldoutStyle);
|
||||
EditorGUILayout.PropertyField(m_Theme, GUIContent.none);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUIUtility.labelWidth = m_DefaultLabelWidth;
|
||||
EditorGUIUtility.fieldWidth = m_DefaultFieldWidth;
|
||||
if (m_ThemeModuleToggle)
|
||||
{
|
||||
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, "Base",
|
||||
ChartEditorHelper.foldoutStyle);
|
||||
if (m_BaseModuleToggle)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(m_Large, true);
|
||||
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,36 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI CoordinateChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(CoordinateChart), false)]
|
||||
public class CoordinateChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Coordinate;
|
||||
protected SerializedProperty m_XAxis;
|
||||
protected SerializedProperty m_YAxis;
|
||||
protected SerializedProperty m_DataZoom;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (CoordinateChart)target;
|
||||
m_Coordinate = serializedObject.FindProperty("m_Coordinate");
|
||||
m_XAxis = serializedObject.FindProperty("m_XAxis");
|
||||
m_YAxis = serializedObject.FindProperty("m_YAxis");
|
||||
m_DataZoom = serializedObject.FindProperty("m_DataZoom");
|
||||
}
|
||||
|
||||
protected override void OnStartInspectorGUI()
|
||||
{
|
||||
base.OnStartInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_DataZoom);
|
||||
EditorGUILayout.PropertyField(m_Coordinate);
|
||||
EditorGUILayout.PropertyField(m_XAxis);
|
||||
EditorGUILayout.PropertyField(m_YAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,193 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis), true)]
|
||||
public class AxisDrawer : PropertyDrawer
|
||||
{
|
||||
private ReorderableList m_DataList;
|
||||
private bool m_DataFoldout = false;
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_AxisModuleToggle = false;
|
||||
|
||||
private void InitReorderableList(SerializedProperty prop)
|
||||
{
|
||||
if (m_DataList == null)
|
||||
{
|
||||
SerializedProperty data = prop.FindPropertyRelative("m_Data");
|
||||
m_DataList = new ReorderableList(data.serializedObject, data, false, false, true, true);
|
||||
m_DataList.elementHeight = EditorGUIUtility.singleLineHeight;
|
||||
m_DataList.drawHeaderCallback += delegate (Rect rect)
|
||||
{
|
||||
EditorGUI.LabelField(rect, data.displayName);
|
||||
};
|
||||
|
||||
m_DataList.drawElementCallback = delegate (Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
EditorGUI.PropertyField(rect, data.GetArrayElementAtIndex(index), true);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisModuleToggle, prop.displayName, m_Show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisModuleToggle)
|
||||
{
|
||||
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 = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop);
|
||||
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)
|
||||
{
|
||||
if (!m_AxisModuleToggle)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,57 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis.AxisLabel), true)]
|
||||
public class AxisLabelDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_AxisLabelToggle = 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_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, "Axis Label", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisLabelToggle)
|
||||
{
|
||||
++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 (m_AxisLabelToggle)
|
||||
{
|
||||
height += 8 * EditorGUIUtility.singleLineHeight + 7 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis.AxisLine), true)]
|
||||
public class AxisLineDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_AxisLineToggle = 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_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, "Axis Line", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisLineToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
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 (m_AxisLineToggle)
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis.AxisName), true)]
|
||||
public class AxisNameDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_AxisNameToggle = 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_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, "Axis Name", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_AxisNameToggle)
|
||||
{
|
||||
++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 (m_AxisNameToggle)
|
||||
{
|
||||
height += 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis.SplitArea), true)]
|
||||
public class AxisSplitAreaDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_ColorFoldout = false;
|
||||
private int m_ColorSize = 0;
|
||||
private bool m_SplitAreaToggle = 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_Color = prop.FindPropertyRelative("m_Color");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SplitAreaToggle, "Split Area", show, false);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_SplitAreaToggle)
|
||||
{
|
||||
++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 (m_SplitAreaToggle)
|
||||
{
|
||||
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,45 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Axis.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(BarChart.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,53 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Coordinate), true)]
|
||||
public class CoordinateDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_CoordinateModuleToggle = false;
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
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_Tickness = prop.FindPropertyRelative("m_Tickness");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_CoordinateModuleToggle, "Coordinate");
|
||||
EditorGUI.LabelField(drawRect, "Coordinate", EditorStyles.boldLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_CoordinateModuleToggle)
|
||||
{
|
||||
++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_Tickness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_CoordinateModuleToggle)
|
||||
return 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38e8e72dd7107db429232ccab308e27c
|
||||
timeCreated: 1554506762
|
||||
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,82 +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 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, 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);
|
||||
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 += 5 * EditorGUIUtility.singleLineHeight + 4 * 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 * 3 + 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,112 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Line), true)]
|
||||
public class LineDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Tickness;
|
||||
SerializedProperty m_Point;
|
||||
SerializedProperty m_PointWidth;
|
||||
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_Point = prop.FindPropertyRelative("m_Point");
|
||||
m_PointWidth = prop.FindPropertyRelative("m_PointWidth");
|
||||
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_Point);
|
||||
if (m_Point.boolValue)
|
||||
{
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 15;
|
||||
EditorGUI.LabelField(drawRect, "Width");
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 65;
|
||||
float tempWidth = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||
if (tempWidth < 20) tempWidth = 20;
|
||||
drawRect.width = tempWidth;
|
||||
EditorGUI.PropertyField(drawRect, m_PointWidth, 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_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)
|
||||
{
|
||||
if (m_LineModuleToggle)
|
||||
{
|
||||
return 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
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,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 + 0 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case Location.Align.TopCenter:
|
||||
case Location.Align.BottomCenter:
|
||||
case Location.Align.CenterLeft:
|
||||
case Location.Align.CenterRight:
|
||||
return 2 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
default:
|
||||
return 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +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_Name = prop.FindPropertyRelative("m_Name");
|
||||
m_InsideRadius = prop.FindPropertyRelative("m_InsideRadius");
|
||||
m_OutsideRadius = prop.FindPropertyRelative("m_OutsideRadius");
|
||||
m_TooltipExtraRadius = prop.FindPropertyRelative("m_TooltipExtraRadius");
|
||||
m_Rose = prop.FindPropertyRelative("m_Rose");
|
||||
m_Space = prop.FindPropertyRelative("m_Space");
|
||||
m_Left = prop.FindPropertyRelative("m_Left");
|
||||
m_Right = prop.FindPropertyRelative("m_Right");
|
||||
m_Top = prop.FindPropertyRelative("m_Top");
|
||||
m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
m_Selected = prop.FindPropertyRelative("m_Selected");
|
||||
m_SelectedIndex = prop.FindPropertyRelative("m_SelectedIndex");
|
||||
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_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_InsideRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_OutsideRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipExtraRadius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Selected);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedIndex);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SelectedOffset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Rose);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Space);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
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.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_PieModuleToggle)
|
||||
return 14 * EditorGUIUtility.singleLineHeight + 13 * 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,161 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar), true)]
|
||||
public class RadarDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Cricle;
|
||||
SerializedProperty m_Area;
|
||||
SerializedProperty m_Radius;
|
||||
SerializedProperty m_SplitNumber;
|
||||
SerializedProperty m_Left;
|
||||
SerializedProperty m_Right;
|
||||
SerializedProperty m_Top;
|
||||
SerializedProperty m_Bottom;
|
||||
SerializedProperty m_LineTickness;
|
||||
SerializedProperty m_LinePointSize;
|
||||
SerializedProperty m_BackgroundColorList;
|
||||
SerializedProperty m_LineColor;
|
||||
SerializedProperty m_AreaAlpha;
|
||||
SerializedProperty m_Indicator;
|
||||
SerializedProperty m_IndicatorList;
|
||||
|
||||
private bool m_RadarModuleToggle = false;
|
||||
private bool m_IndicatorToggle = false;
|
||||
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_Cricle = prop.FindPropertyRelative("m_Cricle");
|
||||
m_Area = prop.FindPropertyRelative("m_Area");
|
||||
m_Radius = prop.FindPropertyRelative("m_Radius");
|
||||
m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
|
||||
m_Left = prop.FindPropertyRelative("m_Left");
|
||||
m_Right = prop.FindPropertyRelative("m_Right");
|
||||
m_Top = prop.FindPropertyRelative("m_Top");
|
||||
m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
m_LineTickness = prop.FindPropertyRelative("m_LineTickness");
|
||||
m_LinePointSize = prop.FindPropertyRelative("m_LinePointSize");
|
||||
m_LineColor = prop.FindPropertyRelative("m_LineColor");
|
||||
m_AreaAlpha = prop.FindPropertyRelative("m_AreaAlpha");
|
||||
m_BackgroundColorList = prop.FindPropertyRelative("m_BackgroundColorList");
|
||||
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;
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, "Radar");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUIUtility.fieldWidth = 10;
|
||||
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
drawRect.width = 60;
|
||||
EditorGUI.PropertyField(drawRect, m_Cricle);
|
||||
|
||||
EditorGUIUtility.labelWidth = 45;
|
||||
drawRect.x += 60;
|
||||
EditorGUI.PropertyField(drawRect, m_Area);
|
||||
|
||||
EditorGUIUtility.labelWidth = 70;
|
||||
drawRect.x += 55;
|
||||
drawRect.width = 80;
|
||||
EditorGUI.PropertyField(drawRect, m_Indicator);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.x = pos.x;
|
||||
drawRect.width = pos.width;
|
||||
EditorGUIUtility.labelWidth = defaultLabelWidth;
|
||||
EditorGUIUtility.fieldWidth = defaultFieldWidth;
|
||||
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_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_LineTickness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LinePointSize);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AreaAlpha);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
m_BackgroundColorToggle = EditorGUI.Foldout(drawRect, m_BackgroundColorToggle, "BackgroundColors");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.width = pos.width;
|
||||
if (m_BackgroundColorToggle)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_BackgroundColorSize, m_BackgroundColorList);
|
||||
}
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_IndicatorToggle = EditorGUI.Foldout(drawRect, m_IndicatorToggle, "Indicators");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_IndicatorJsonAreaToggle, ref m_IndicatorJsonAreaText, prop);
|
||||
drawRect.width = pos.width;
|
||||
if (m_IndicatorToggle)
|
||||
{
|
||||
ChartEditorHelper.MakeList(ref drawRect, ref m_IndicatorSize, m_IndicatorList);
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int propNum = 1;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
propNum += 13;
|
||||
|
||||
if (m_BackgroundColorToggle)
|
||||
{
|
||||
m_BackgroundColorList = prop.FindPropertyRelative("m_BackgroundColorList");
|
||||
propNum += 2;
|
||||
propNum += m_BackgroundColorList.arraySize;
|
||||
}
|
||||
if (m_IndicatorJsonAreaToggle) propNum += 4;
|
||||
|
||||
|
||||
float height = propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
if (m_IndicatorToggle)
|
||||
{
|
||||
m_IndicatorList = prop.FindPropertyRelative("m_IndicatorList");
|
||||
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
for (int i = 0; i < m_IndicatorSize; 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,57 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Radar.Indicator), true)]
|
||||
public class RadarIndicatorDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_Name;
|
||||
SerializedProperty m_Max;
|
||||
|
||||
private bool m_RadarModuleToggle = false;
|
||||
|
||||
private void InitProperty(SerializedProperty prop)
|
||||
{
|
||||
m_Name = prop.FindPropertyRelative("m_Name");
|
||||
m_Max = prop.FindPropertyRelative("m_Max");
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
m_RadarModuleToggle = EditorGUI.Foldout(drawRect, m_RadarModuleToggle, "Indicator");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
EditorGUI.PropertyField(drawRect, m_Name);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Max);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
int propNum = 1;
|
||||
if (m_RadarModuleToggle)
|
||||
{
|
||||
propNum += 2;
|
||||
return propNum * EditorGUIUtility.singleLineHeight + (propNum - 1) * 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,76 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Serie), true)]
|
||||
public class SerieDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_DataFoldout = false;
|
||||
private int m_DataSize = 0;
|
||||
private bool m_ShowJsonDataArea = false;
|
||||
private string m_JsonDataAreaText;
|
||||
private bool m_SerieModuleToggle = 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");
|
||||
SerializedProperty name = prop.FindPropertyRelative("m_Name");
|
||||
SerializedProperty stack = prop.FindPropertyRelative("m_Stack");
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
|
||||
string moduleName = "Serie " + prop.displayName.Split(' ')[1];
|
||||
if (!string.IsNullOrEmpty(name.stringValue))
|
||||
moduleName += ":" + name.stringValue;
|
||||
m_SerieModuleToggle = EditorGUI.Foldout(drawRect, m_SerieModuleToggle, "Serie");
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_SerieModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, show);
|
||||
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;
|
||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||
m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data");
|
||||
ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop);
|
||||
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_SerieModuleToggle)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
height += 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_DataFoldout)
|
||||
{
|
||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||
int num = m_Data.arraySize + 1;
|
||||
if (num > 50) num = 13;
|
||||
height += num * EditorGUIUtility.singleLineHeight + (num - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (m_ShowJsonDataArea)
|
||||
{
|
||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,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,125 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ThemeInfo), true)]
|
||||
public class ThemeInfoDrawer : PropertyDrawer
|
||||
{
|
||||
ReorderableList m_ColorPaletteList;
|
||||
bool m_ColorPaletteFoldout;
|
||||
|
||||
private void InitReorderableList(SerializedProperty prop)
|
||||
{
|
||||
if (m_ColorPaletteList == null)
|
||||
{
|
||||
SerializedProperty colorPalette = prop.FindPropertyRelative("m_ColorPalette");
|
||||
m_ColorPaletteList = new ReorderableList(colorPalette.serializedObject, colorPalette, false, false, true, true);
|
||||
m_ColorPaletteList.elementHeight = EditorGUIUtility.singleLineHeight;
|
||||
m_ColorPaletteList.drawHeaderCallback += delegate (Rect rect)
|
||||
{
|
||||
EditorGUI.LabelField(rect, colorPalette.displayName);
|
||||
};
|
||||
|
||||
m_ColorPaletteList.drawElementCallback = delegate (Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
EditorGUI.PropertyField(rect, colorPalette.GetArrayElementAtIndex(index), true);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
Rect drawRect = pos;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
SerializedProperty m_Font = prop.FindPropertyRelative("m_Font");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_TextColor = prop.FindPropertyRelative("m_TextColor");
|
||||
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");
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Font);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_SubTextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LegendTextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LegendUnableColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AxisTextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AxisLineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AxisSplitLineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipBackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipFlagAreaColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipTextColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipLabelColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_TooltipLineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_DataZoomLineColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_DataZoomSelectedColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_DataZoomTextColor);
|
||||
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++)
|
||||
{
|
||||
SerializedProperty element = m_ColorPalette.GetArrayElementAtIndex(i);
|
||||
EditorGUI.PropertyField(drawRect, element);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
float height = 0;
|
||||
int propertyCount = 17;
|
||||
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 crossLabel = prop.FindPropertyRelative("m_CrossLabel");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_TooltipModuleToggle, "Tooltip", show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_TooltipModuleToggle)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, crossLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_TooltipModuleToggle)
|
||||
return 2 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
|
||||
else
|
||||
return 1 * (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,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 bool m_RadarModuleToggle = false;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (RadarChart)target;
|
||||
m_Radar = serializedObject.FindProperty("m_Radar");
|
||||
}
|
||||
|
||||
protected override void OnEndInspectorGUI()
|
||||
{
|
||||
base.OnEndInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_Radar, 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,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb0b30c9bc2c84f46a99514a69d7e462
|
||||
folderAsset: yes
|
||||
timeCreated: 1555303340
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,113 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
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)
|
||||
{
|
||||
SerializedProperty stringDataProp = prop.FindPropertyRelative("m_JsonData");
|
||||
SerializedProperty needParseProp = prop.FindPropertyRelative("m_DataFromJson");
|
||||
float defalutX = drawRect.x;
|
||||
drawRect.x = EditorGUIUtility.labelWidth + 40;
|
||||
drawRect.width = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 60;
|
||||
if (GUI.Button(drawRect, new GUIContent("Parse Json", "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 = EditorGUIUtility.currentViewWidth - drawRect.x - 20;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight * 3;
|
||||
inputString = EditorGUI.TextArea(drawRect, inputString);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public static void 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 = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 70;
|
||||
if (prop != null)
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
|
||||
}
|
||||
drawRect.width = defaultWidth;
|
||||
drawRect.x = defaultX;
|
||||
}
|
||||
|
||||
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 > 50)
|
||||
{
|
||||
SerializedProperty element;
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
element = listProp.GetArrayElementAtIndex(i);
|
||||
EditorGUI.PropertyField(drawRect, element);
|
||||
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);
|
||||
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);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3f125a3accd30240b3ca251090f11b4
|
||||
folderAsset: yes
|
||||
timeCreated: 1554216875
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,196 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[AddComponentMenu("XCharts/BarChart", 13)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[DisallowMultipleComponent]
|
||||
public class BarChart : CoordinateChart
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Bar
|
||||
{
|
||||
[SerializeField] private bool m_InSameBar;
|
||||
[SerializeField] private float m_BarWidth = 0.7f;
|
||||
[SerializeField] private float m_Space;
|
||||
|
||||
public bool inSameBar { get { return m_InSameBar; } set { m_InSameBar = value; } }
|
||||
public float barWidth { get { return m_BarWidth; } set { m_BarWidth = value; } }
|
||||
public float space { get { return m_Space; } set { m_Space = value; } }
|
||||
}
|
||||
|
||||
[SerializeField] private Bar m_Bar = new Bar();
|
||||
|
||||
public Bar bar { get { return m_Bar; } }
|
||||
|
||||
protected override void DrawChart(VertexHelper vh)
|
||||
{
|
||||
base.DrawChart(vh);
|
||||
if (m_YAxis.type == Axis.AxisType.Category)
|
||||
{
|
||||
var stackSeries = m_Series.GetStackSeries();
|
||||
int seriesCount = stackSeries.Count;
|
||||
float scaleWid = m_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 * (seriesCount - 1)) / 2 :
|
||||
(scaleWid - barWid * seriesCount - m_Bar.space * (seriesCount - 1)) / 2;
|
||||
int serieCount = 0;
|
||||
for (int j = 0; j < seriesCount; j++)
|
||||
{
|
||||
var seriesCurrHig = new Dictionary<int, float>();
|
||||
var serieList = stackSeries[j];
|
||||
for (int n = 0; n < serieList.Count; n++)
|
||||
{
|
||||
Serie serie = serieList[n];
|
||||
if (!m_Legend.IsActive(serie.name)) continue;
|
||||
Color color = m_ThemeInfo.GetColor(serieCount);
|
||||
int maxCount = maxShowDataNumber > 0 ?
|
||||
(maxShowDataNumber > serie.data.Count ? serie.data.Count : maxShowDataNumber)
|
||||
: serie.data.Count;
|
||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||
{
|
||||
if (!seriesCurrHig.ContainsKey(i))
|
||||
{
|
||||
seriesCurrHig[i] = 0;
|
||||
}
|
||||
float value = serie.data[i];
|
||||
float pX = seriesCurrHig[i] + zeroX + m_Coordinate.tickness;
|
||||
float pY = coordinateY + i * scaleWid;
|
||||
if (!m_YAxis.boundaryGap) pY -= scaleWid / 2;
|
||||
float barHig = (minValue > 0 ? value - minValue : value)
|
||||
/ (maxValue - minValue) * coordinateWid;
|
||||
float space = m_Bar.inSameBar ? offset :
|
||||
offset + j * (barWid + m_Bar.space);
|
||||
seriesCurrHig[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 (serie.show)
|
||||
{
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, color);
|
||||
}
|
||||
}
|
||||
if (serie.show)
|
||||
{
|
||||
serieCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Tooltip.show && m_Tooltip.dataIndex > 0)
|
||||
{
|
||||
if (m_Tooltip.crossLabel)
|
||||
{
|
||||
Vector3 sp = new Vector2(m_Tooltip.pointerPos.x, zeroY);
|
||||
Vector3 ep = new Vector2(m_Tooltip.pointerPos.x, zeroY + coordinateHig);
|
||||
DrawSplitLine(vh, false, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||
float splitWidth = m_YAxis.GetSplitWidth(coordinateHig, m_DataZoom);
|
||||
float pY = zeroY + (m_Tooltip.dataIndex - 1) * splitWidth +
|
||||
(m_YAxis.boundaryGap ? splitWidth / 2 : 0);
|
||||
sp = new Vector2(coordinateX, pY);
|
||||
ep = new Vector2(coordinateX + coordinateWid, pY);
|
||||
DrawSplitLine(vh, true, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
float tooltipSplitWid = scaleWid < 1 ? 1 : scaleWid;
|
||||
float pX = coordinateX + coordinateWid;
|
||||
float pY = coordinateY + scaleWid * (m_Tooltip.dataIndex - 1) -
|
||||
(m_YAxis.boundaryGap ? 0 : scaleWid / 2);
|
||||
Vector3 p1 = new Vector3(coordinateX, pY);
|
||||
Vector3 p2 = new Vector3(coordinateX, pY + tooltipSplitWid);
|
||||
Vector3 p3 = new Vector3(pX, pY + tooltipSplitWid);
|
||||
Vector3 p4 = new Vector3(pX, pY);
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, m_ThemeInfo.tooltipFlagAreaColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var stackSeries = m_Series.GetStackSeries();
|
||||
int seriesCount = stackSeries.Count;
|
||||
float scaleWid = m_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 * (seriesCount - 1)) / 2 :
|
||||
(scaleWid - barWid * seriesCount - m_Bar.space * (seriesCount - 1)) / 2;
|
||||
int serieCount = 0;
|
||||
for (int j = 0; j < seriesCount; j++)
|
||||
{
|
||||
var seriesCurrHig = new Dictionary<int, float>();
|
||||
var serieList = stackSeries[j];
|
||||
for (int n = 0; n < serieList.Count; n++)
|
||||
{
|
||||
Serie serie = serieList[n];
|
||||
if (!m_Legend.IsActive(serie.name)) continue;
|
||||
Color color = m_ThemeInfo.GetColor(serieCount);
|
||||
List<float> showData = serie.GetData(m_DataZoom);
|
||||
int maxCount = maxShowDataNumber > 0 ?
|
||||
(maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
|
||||
: showData.Count;
|
||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||
{
|
||||
if (!seriesCurrHig.ContainsKey(i))
|
||||
{
|
||||
seriesCurrHig[i] = 0;
|
||||
}
|
||||
float value = showData[i];
|
||||
float pX = zeroX + i * scaleWid;
|
||||
if (!m_XAxis.boundaryGap) pX -= scaleWid / 2;
|
||||
float pY = seriesCurrHig[i] + zeroY + m_Coordinate.tickness;
|
||||
float barHig = (minValue > 0 ? value - minValue : value)
|
||||
/ (maxValue - minValue) * coordinateHig;
|
||||
seriesCurrHig[i] += barHig;
|
||||
float space = m_Bar.inSameBar ? offset :
|
||||
offset + j * (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 (serie.show)
|
||||
{
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, color);
|
||||
}
|
||||
}
|
||||
if (serie.show)
|
||||
{
|
||||
serieCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Tooltip.show && m_Tooltip.dataIndex > 0)
|
||||
{
|
||||
if (m_Tooltip.crossLabel)
|
||||
{
|
||||
Vector3 sp = new Vector2(zeroX, m_Tooltip.pointerPos.y);
|
||||
Vector3 ep = new Vector2(zeroX + coordinateWid, m_Tooltip.pointerPos.y);
|
||||
DrawSplitLine(vh, true, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||
|
||||
float splitWidth = m_XAxis.GetSplitWidth(coordinateWid, m_DataZoom);
|
||||
float px = zeroX + (m_Tooltip.dataIndex - 1) * splitWidth
|
||||
+ (m_XAxis.boundaryGap ? splitWidth / 2 : 0);
|
||||
sp = new Vector2(px, coordinateY);
|
||||
ep = new Vector2(px, coordinateY + coordinateHig);
|
||||
DrawSplitLine(vh, false, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
float tooltipSplitWid = scaleWid < 1 ? 1 : scaleWid;
|
||||
float pX = coordinateX + scaleWid * (m_Tooltip.dataIndex - 1) -
|
||||
(m_XAxis.boundaryGap ? 0 : scaleWid / 2);
|
||||
float pY = coordinateY + coordinateHig;
|
||||
Vector3 p1 = new Vector3(pX, coordinateY);
|
||||
Vector3 p2 = new Vector3(pX, pY);
|
||||
Vector3 p3 = new Vector3(pX + tooltipSplitWid, pY);
|
||||
Vector3 p4 = new Vector3(pX + tooltipSplitWid, coordinateY);
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, m_ThemeInfo.tooltipFlagAreaColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 253203a243755c744880211dbbc988a2
|
||||
folderAsset: yes
|
||||
timeCreated: 1554979427
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace XCharts
|
||||
{
|
||||
public interface IJsonData
|
||||
{
|
||||
void ParseJsonData(string json);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9132f4c137015247b44450c2cb23606
|
||||
timeCreated: 1555379601
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace XCharts
|
||||
{
|
||||
public interface IPropertyChanged
|
||||
{
|
||||
void OnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,612 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Axis : JsonDataSupport, IEquatable<Axis>
|
||||
{
|
||||
public enum AxisType
|
||||
{
|
||||
Value,
|
||||
Category,
|
||||
//Time,
|
||||
//Log
|
||||
}
|
||||
|
||||
public enum AxisMinMaxType
|
||||
{
|
||||
Default,
|
||||
MinMax,
|
||||
Custom
|
||||
}
|
||||
|
||||
public enum SplitLineType
|
||||
{
|
||||
None,
|
||||
Solid,
|
||||
Dashed,
|
||||
Dotted
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class AxisTick
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private bool m_AlignWithLabel;
|
||||
[SerializeField] private bool m_Inside;
|
||||
[SerializeField] private float m_Length;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public bool alignWithLabel { get { return m_AlignWithLabel; } set { m_AlignWithLabel = value; } }
|
||||
public bool inside { get { return m_Inside; } set { m_Inside = value; } }
|
||||
public float length { get { return m_Length; } set { m_Length = value; } }
|
||||
|
||||
public static AxisTick defaultTick
|
||||
{
|
||||
get
|
||||
{
|
||||
var tick = new AxisTick
|
||||
{
|
||||
m_Show = true,
|
||||
m_AlignWithLabel = false,
|
||||
m_Inside = false,
|
||||
m_Length = 5f
|
||||
};
|
||||
return tick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class AxisLine
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private bool m_Symbol;
|
||||
[SerializeField] private float m_SymbolWidth;
|
||||
[SerializeField] private float m_SymbolHeight;
|
||||
[SerializeField] private float m_SymbolOffset;
|
||||
[SerializeField] private float m_SymbolDent;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public bool symbol { get { return m_Symbol; } set { m_Symbol = value; } }
|
||||
public float symbolWidth { get { return m_SymbolWidth; } set { m_SymbolWidth = value; } }
|
||||
public float symbolHeight { get { return m_SymbolHeight; } set { m_SymbolHeight = value; } }
|
||||
public float symbolOffset { get { return m_SymbolOffset; } set { m_SymbolOffset = value; } }
|
||||
public float symbolDent { get { return m_SymbolDent; } set { m_SymbolDent = value; } }
|
||||
|
||||
public static AxisLine defaultAxisLine
|
||||
{
|
||||
get
|
||||
{
|
||||
var axisLine = new AxisLine
|
||||
{
|
||||
m_Show = true,
|
||||
m_Symbol = false,
|
||||
m_SymbolWidth = 10,
|
||||
m_SymbolHeight = 15,
|
||||
m_SymbolOffset = 0,
|
||||
m_SymbolDent = 3,
|
||||
};
|
||||
return axisLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class AxisName
|
||||
{
|
||||
[Serializable]
|
||||
public enum Location
|
||||
{
|
||||
Start,
|
||||
Middle,
|
||||
End
|
||||
}
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private Location m_Location;
|
||||
[SerializeField] private float m_Gap;
|
||||
[SerializeField] private float m_Rotate;
|
||||
[SerializeField] private Color m_Color;
|
||||
[SerializeField] private int m_FontSize;
|
||||
[SerializeField] private FontStyle m_FontStyle;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
public Location location { get { return m_Location; } set { m_Location = value; } }
|
||||
public float gap { get { return m_Gap; } set { m_Gap = value; } }
|
||||
public float rotate { get { return m_Rotate; } set { m_Rotate = value; } }
|
||||
public Color color { get { return m_Color; } set { m_Color = value; } }
|
||||
public int fontSize { get { return m_FontSize; } set { m_FontSize = value; } }
|
||||
public FontStyle fontStyle { get { return m_FontStyle; } set { m_FontStyle = value; } }
|
||||
|
||||
public static AxisName defaultAxisName
|
||||
{
|
||||
get
|
||||
{
|
||||
return new AxisName()
|
||||
{
|
||||
m_Show = false,
|
||||
m_Name = "axisName",
|
||||
m_Location = Location.End,
|
||||
m_Gap = 5,
|
||||
m_Rotate = 0,
|
||||
m_Color = Color.clear,
|
||||
m_FontSize = 18,
|
||||
m_FontStyle = FontStyle.Normal
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void Copy(AxisName other)
|
||||
{
|
||||
m_Show = other.show;
|
||||
m_Name = other.name;
|
||||
m_Location = other.location;
|
||||
m_Gap = other.gap;
|
||||
m_Rotate = other.rotate;
|
||||
m_Color = other.color;
|
||||
m_FontSize = other.fontSize;
|
||||
m_FontStyle = other.fontStyle;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var other = (AxisName)obj;
|
||||
return m_Show == other.show &&
|
||||
m_Name.Equals(other.name) &&
|
||||
m_Location == other.location &&
|
||||
m_Gap == other.gap &&
|
||||
m_Rotate == other.rotate &&
|
||||
m_Color == other.color &&
|
||||
m_FontSize == other.fontSize &&
|
||||
m_FontStyle == other.fontStyle;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Split area of axis in grid area, not shown by default.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SplitArea
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private List<Color> m_Color;
|
||||
|
||||
/// <summary>
|
||||
/// Set this to true to show the splitArea.
|
||||
/// </summary>
|
||||
/// <value>false</value>
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
/// <summary>
|
||||
/// Color of split area. SplitArea color could also be set in color array,
|
||||
/// which the split lines would take as their colors in turns.
|
||||
/// Dark and light colors in turns are used by default.
|
||||
/// </summary>
|
||||
/// <value>['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)']</value>
|
||||
public List<Color> color { get { return m_Color; } set { m_Color = value; } }
|
||||
|
||||
public static SplitArea defaultSplitArea
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SplitArea()
|
||||
{
|
||||
m_Show = false,
|
||||
m_Color = new List<Color>(){
|
||||
new Color32(250,250,250,77),
|
||||
new Color32(200,200,200,77)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Color getColor(int index)
|
||||
{
|
||||
var i = index % color.Count;
|
||||
return color[i];
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class AxisLabel
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private int m_Interval;
|
||||
[SerializeField] private bool m_Inside;
|
||||
[SerializeField] private float m_Rotate;
|
||||
[SerializeField] private float m_Margin;
|
||||
[SerializeField] private Color m_Color;
|
||||
[SerializeField] private int m_FontSize;
|
||||
[SerializeField] private FontStyle m_FontStyle;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public int interval { get { return m_Interval; } set { m_Interval = value; } }
|
||||
public bool inside { get { return m_Inside; } set { m_Inside = value; } }
|
||||
public float rotate { get { return m_Rotate; } set { m_Rotate = value; } }
|
||||
public float margin { get { return m_Margin; } set { m_Margin = value; } }
|
||||
public Color color { get { return m_Color; } set { m_Color = value; } }
|
||||
public int fontSize { get { return m_FontSize; } set { m_FontSize = value; } }
|
||||
public FontStyle fontStyle { get { return m_FontStyle; } set { m_FontStyle = value; } }
|
||||
|
||||
public static AxisLabel defaultAxisLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
return new AxisLabel()
|
||||
{
|
||||
m_Show = true,
|
||||
m_Interval = 0,
|
||||
m_Inside = false,
|
||||
m_Rotate = 0,
|
||||
m_Margin = 8,
|
||||
m_Color = Color.clear,
|
||||
m_FontSize = 18,
|
||||
m_FontStyle = FontStyle.Normal
|
||||
};
|
||||
}
|
||||
}
|
||||
public void Copy(AxisLabel other)
|
||||
{
|
||||
m_Show = other.show;
|
||||
m_Interval = other.interval;
|
||||
m_Inside = other.inside;
|
||||
m_Rotate = other.rotate;
|
||||
m_Margin = other.margin;
|
||||
m_Color = other.color;
|
||||
m_FontSize = other.fontSize;
|
||||
m_FontStyle = other.fontStyle;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var other = (AxisLabel)obj;
|
||||
return m_Show == other.show &&
|
||||
m_Interval.Equals(other.interval) &&
|
||||
m_Inside == other.inside &&
|
||||
m_Rotate == other.rotate &&
|
||||
m_Margin == other.margin &&
|
||||
m_Color == other.color &&
|
||||
m_FontSize == other.fontSize &&
|
||||
m_FontStyle == other.fontStyle;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
[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 SplitArea m_SplitArea = SplitArea.defaultSplitArea;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public AxisType type { get { return m_Type; } set { m_Type = value; } }
|
||||
public AxisMinMaxType minMaxType { get { return m_MinMaxType; } set { m_MinMaxType = value; } }
|
||||
public int min { get { return m_Min; } set { m_Min = value; } }
|
||||
public int max { get { return m_Max; } set { m_Max = value; } }
|
||||
public int splitNumber { get { return m_SplitNumber; } set { m_SplitNumber = value; } }
|
||||
public bool showSplitLine { get { return m_ShowSplitLine; } set { m_ShowSplitLine = value; } }
|
||||
public SplitLineType splitLineType { get { return m_SplitLineType; } set { m_SplitLineType = value; } }
|
||||
public bool boundaryGap { get { return m_BoundaryGap; } set { m_BoundaryGap = value; } }
|
||||
public List<string> data { get { return m_Data; } }
|
||||
|
||||
public AxisLine axisLine { get { return m_AxisLine; } set { m_AxisLine = value; } }
|
||||
public AxisName axisName { get { return m_AxisName; } set { m_AxisName = value; } }
|
||||
public AxisTick axisTick { get { return m_AxisTick; } set { m_AxisTick = value; } }
|
||||
public AxisLabel axisLabel { get { return m_AxisLabel; } set { m_AxisLabel = value; } }
|
||||
public SplitArea splitArea { get { return m_SplitArea; } set { m_SplitArea = value; } }
|
||||
|
||||
public int filterStart { get; set; }
|
||||
public int filterEnd { get; set; }
|
||||
public List<string> filterData { get; set; }
|
||||
|
||||
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();
|
||||
foreach (var d in other.data) m_Data.Add(d);
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
public void AddData(string category, int maxDataNumber)
|
||||
{
|
||||
if (maxDataNumber > 0)
|
||||
{
|
||||
while (m_Data.Count > maxDataNumber) m_Data.RemoveAt(0);
|
||||
}
|
||||
m_Data.Add(category);
|
||||
}
|
||||
|
||||
public string GetData(int index, DataZoom dataZoom)
|
||||
{
|
||||
var showData = GetData(dataZoom);
|
||||
if (index >= 0 && index < showData.Count)
|
||||
return showData[index];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public List<string> GetData(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;
|
||||
}
|
||||
}
|
||||
|
||||
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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetSplitNumber(DataZoom dataZoom)
|
||||
{
|
||||
if (type == AxisType.Value) return m_SplitNumber;
|
||||
int dataCount = GetData(dataZoom).Count;
|
||||
if (dataCount > 2 * m_SplitNumber || dataCount <= 0)
|
||||
return m_SplitNumber;
|
||||
else
|
||||
return dataCount;
|
||||
}
|
||||
|
||||
public float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
return coordinateWidth / (m_BoundaryGap ? GetSplitNumber(dataZoom) : GetSplitNumber(dataZoom) - 1);
|
||||
}
|
||||
|
||||
public int GetDataNumber(DataZoom dataZoom)
|
||||
{
|
||||
return GetData(dataZoom).Count;
|
||||
}
|
||||
|
||||
public float GetDataWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
var dataCount = GetDataNumber(dataZoom);
|
||||
return coordinateWidth / (m_BoundaryGap ? dataCount : dataCount - 1);
|
||||
}
|
||||
|
||||
public string GetScaleName(int index, float minValue, float maxValue, DataZoom dataZoom)
|
||||
{
|
||||
if (m_Type == AxisType.Value)
|
||||
{
|
||||
float value = (minValue + (maxValue - minValue) * index / (GetSplitNumber(dataZoom) - 1));
|
||||
if (value - (int)value == 0)
|
||||
return (value).ToString();
|
||||
else
|
||||
return (value).ToString("f1");
|
||||
}
|
||||
var showData = GetData(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];
|
||||
}
|
||||
}
|
||||
|
||||
public int GetScaleNumber(DataZoom dataZoom)
|
||||
{
|
||||
if (type == AxisType.Value)
|
||||
{
|
||||
return m_BoundaryGap ? m_SplitNumber + 1 : m_SplitNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
var showData = GetData(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;
|
||||
}
|
||||
}
|
||||
|
||||
public float GetScaleWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
int num = GetScaleNumber(dataZoom) - 1;
|
||||
if (num <= 0) num = 1;
|
||||
return coordinateWidth / num;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class XAxis : 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class YAxis : 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 = false,
|
||||
m_SplitLineType = SplitLineType.Dashed,
|
||||
m_BoundaryGap = false,
|
||||
m_Data = new List<string>(5),
|
||||
};
|
||||
return axis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84f640465300fb34facae554552063b9
|
||||
timeCreated: 1554422468
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,488 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public enum Orient
|
||||
{
|
||||
Horizonal,
|
||||
Vertical
|
||||
}
|
||||
|
||||
public class BaseChart : MaskableGraphic, IPointerDownHandler, IPointerUpHandler,
|
||||
IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler,
|
||||
IDragHandler, IEndDragHandler, IScrollHandler
|
||||
{
|
||||
private static readonly string s_TitleObjectName = "title";
|
||||
private static readonly string s_LegendObjectName = "legend";
|
||||
|
||||
[SerializeField] protected Theme m_Theme = Theme.Default;
|
||||
[SerializeField] protected ThemeInfo m_ThemeInfo;
|
||||
[SerializeField] protected Title m_Title = Title.defaultTitle;
|
||||
[SerializeField] protected Legend m_Legend = Legend.defaultLegend;
|
||||
[SerializeField] protected Tooltip m_Tooltip = Tooltip.defaultTooltip;
|
||||
[SerializeField] protected Series m_Series;
|
||||
|
||||
[SerializeField] protected bool m_Large;
|
||||
[SerializeField] protected int m_MinShowDataNumber;
|
||||
[SerializeField] protected int m_MaxShowDataNumber;
|
||||
[SerializeField] protected int m_MaxCacheDataNumber;
|
||||
|
||||
[NonSerialized] private Theme m_CheckTheme = 0;
|
||||
[NonSerialized] private Title m_CheckTitle = Title.defaultTitle;
|
||||
[NonSerialized] private Legend m_CheckLegend = Legend.defaultLegend;
|
||||
[NonSerialized] private float m_CheckWidth = 0;
|
||||
[NonSerialized] private float m_CheckHeight = 0;
|
||||
[NonSerialized] private bool m_RefreshChart = false;
|
||||
[NonSerialized] protected List<Text> m_LegendTextList = new List<Text>();
|
||||
|
||||
protected float chartWidth { get { return rectTransform.sizeDelta.x; } }
|
||||
protected float chartHeight { get { return rectTransform.sizeDelta.y; } }
|
||||
protected Vector2 chartAnchorMax { get { return rectTransform.anchorMax; } }
|
||||
protected Vector2 chartAnchorMin { get { return rectTransform.anchorMin; } }
|
||||
protected Vector2 chartPivot { get { return rectTransform.pivot; } }
|
||||
|
||||
public Title title { get { return m_Title; } }
|
||||
public Legend legend { get { return m_Legend; } }
|
||||
public Tooltip tooltip { get { return m_Tooltip; } }
|
||||
public Series series { get { return m_Series; } }
|
||||
|
||||
public bool large { get { return m_Large; } set { m_Large = value; } }
|
||||
public int minShowDataNumber
|
||||
{
|
||||
get { return m_MinShowDataNumber; }
|
||||
set { m_MinShowDataNumber = value; if (m_MinShowDataNumber < 0) m_MinShowDataNumber = 0; }
|
||||
}
|
||||
public int maxShowDataNumber
|
||||
{
|
||||
get { return m_MaxShowDataNumber; }
|
||||
set { m_MaxShowDataNumber = value; if (m_MaxShowDataNumber < 0) m_MaxShowDataNumber = 0; }
|
||||
}
|
||||
public int maxCacheDataNumber
|
||||
{
|
||||
get { return m_MaxCacheDataNumber; }
|
||||
set { m_MaxCacheDataNumber = value; if (m_MaxCacheDataNumber < 0) m_MaxCacheDataNumber = 0; }
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
if (m_ThemeInfo == null)
|
||||
{
|
||||
m_ThemeInfo = ThemeInfo.Default;
|
||||
}
|
||||
raycastTarget = false;
|
||||
rectTransform.anchorMax = Vector2.zero;
|
||||
rectTransform.anchorMin = Vector2.zero;
|
||||
rectTransform.pivot = Vector2.zero;
|
||||
m_CheckWidth = chartWidth;
|
||||
m_CheckHeight = chartHeight;
|
||||
m_CheckTheme = m_Theme;
|
||||
InitTitle();
|
||||
InitLegend();
|
||||
InitTooltip();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
CheckSize();
|
||||
CheckTheme();
|
||||
CheckTile();
|
||||
CheckLegend();
|
||||
CheckTooltip();
|
||||
CheckRefreshChart();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
{
|
||||
ChartHelper.DestoryAllChilds(transform);
|
||||
m_ThemeInfo = ThemeInfo.Default;
|
||||
m_Title = Title.defaultTitle;
|
||||
m_Legend = Legend.defaultLegend;
|
||||
m_Tooltip = Tooltip.defaultTooltip;
|
||||
m_Series = Series.defaultSeries;
|
||||
Awake();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
for (int i = transform.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
DestroyImmediate(transform.GetChild(i).gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
m_Series.ClearData();
|
||||
m_Legend.ClearData();
|
||||
}
|
||||
|
||||
public virtual void AddData(string legend, float value)
|
||||
{
|
||||
m_Legend.AddData(legend);
|
||||
m_Series.AddData(legend, value, m_MaxCacheDataNumber);
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public virtual void AddData(int legend, float value)
|
||||
{
|
||||
m_Series.AddData(legend, value, m_MaxCacheDataNumber);
|
||||
}
|
||||
|
||||
public virtual void UpdateData(string legend, float value, int dataIndex = 0)
|
||||
{
|
||||
m_Series.UpdateData(legend, value, dataIndex);
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public virtual void UpdateData(int legendIndex, float value, int dataIndex = 0)
|
||||
{
|
||||
m_Series.UpdateData(legendIndex, value, dataIndex);
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public virtual void SetActive(string legend, bool active)
|
||||
{
|
||||
m_Legend.SetActive(legend, active);
|
||||
m_Series.SetActive(legend, active);
|
||||
}
|
||||
|
||||
public virtual void SetActive(int index, bool active)
|
||||
{
|
||||
m_Legend.SetActive(index, active);
|
||||
m_Series.SetActive(index, active);
|
||||
}
|
||||
|
||||
public virtual bool IsActive(string name)
|
||||
{
|
||||
return m_Legend.IsActive(name) || m_Series.IsActive(name);
|
||||
}
|
||||
|
||||
public virtual bool IsActive(int index)
|
||||
{
|
||||
return m_Legend.IsActive(index) || m_Series.IsActive(index);
|
||||
}
|
||||
|
||||
public virtual void RemoveData(string legend)
|
||||
{
|
||||
m_Legend.RemoveData(legend);
|
||||
m_Series.RemoveData(legend);
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public void UpdateTheme(Theme theme)
|
||||
{
|
||||
this.m_Theme = theme;
|
||||
OnThemeChanged();
|
||||
SetAllDirty();
|
||||
}
|
||||
|
||||
private void InitTitle()
|
||||
{
|
||||
m_Title.OnChanged();
|
||||
TextAnchor anchor = m_Title.location.textAnchor;
|
||||
Vector2 anchorMin = m_Title.location.anchorMin;
|
||||
Vector2 anchorMax = m_Title.location.anchorMax;
|
||||
Vector2 pivot = m_Title.location.pivot;
|
||||
Vector3 titlePosition = m_Title.location.GetPosition(chartWidth, chartHeight);
|
||||
Vector3 subTitlePosition = -new Vector3(0, m_Title.textFontSize + m_Title.itemGap, 0);
|
||||
float titleWid = chartWidth;
|
||||
|
||||
var titleObject = ChartHelper.AddObject(s_TitleObjectName, transform, anchorMin, anchorMax,
|
||||
pivot, new Vector2(chartWidth, chartHeight));
|
||||
titleObject.transform.localPosition = titlePosition;
|
||||
ChartHelper.HideAllObject(titleObject, s_TitleObjectName);
|
||||
|
||||
Text titleText = ChartHelper.AddTextObject(s_TitleObjectName, titleObject.transform,
|
||||
m_ThemeInfo.font, m_ThemeInfo.textColor, anchor, anchorMin, anchorMax, pivot,
|
||||
new Vector2(titleWid, m_Title.textFontSize), m_Title.textFontSize);
|
||||
|
||||
titleText.alignment = anchor;
|
||||
titleText.gameObject.SetActive(m_Title.show);
|
||||
titleText.transform.localPosition = Vector2.zero;
|
||||
titleText.text = m_Title.text;
|
||||
|
||||
Text subText = ChartHelper.AddTextObject(s_TitleObjectName + "_sub", titleObject.transform,
|
||||
m_ThemeInfo.font, m_ThemeInfo.textColor, anchor, anchorMin, anchorMax, pivot,
|
||||
new Vector2(titleWid, m_Title.subTextFontSize), m_Title.subTextFontSize);
|
||||
|
||||
subText.alignment = anchor;
|
||||
subText.gameObject.SetActive(m_Title.show && !string.IsNullOrEmpty(m_Title.subText));
|
||||
subText.transform.localPosition = subTitlePosition;
|
||||
subText.text = m_Title.subText;
|
||||
}
|
||||
|
||||
private void InitLegend()
|
||||
{
|
||||
m_Legend.OnChanged();
|
||||
ChartHelper.HideAllObject(transform, s_LegendObjectName);
|
||||
TextAnchor anchor = m_Legend.location.textAnchor;
|
||||
Vector2 anchorMin = m_Legend.location.anchorMin;
|
||||
Vector2 anchorMax = m_Legend.location.anchorMax;
|
||||
Vector2 pivot = m_Legend.location.pivot;
|
||||
|
||||
var legendObject = ChartHelper.AddObject(s_LegendObjectName, transform, anchorMin, anchorMax,
|
||||
pivot, new Vector2(chartWidth, chartHeight));
|
||||
legendObject.transform.localPosition = m_Legend.location.GetPosition(chartWidth, chartHeight);
|
||||
ChartHelper.HideAllObject(legendObject, s_LegendObjectName);
|
||||
|
||||
for (int i = 0; i < m_Legend.data.Count; i++)
|
||||
{
|
||||
Button btn = ChartHelper.AddButtonObject(s_LegendObjectName + "_" + i, legendObject.transform,
|
||||
m_ThemeInfo.font, m_Legend.itemFontSize, m_ThemeInfo.legendTextColor, anchor,
|
||||
anchorMin, anchorMax, pivot, new Vector2(m_Legend.itemWidth, m_Legend.itemHeight));
|
||||
|
||||
m_Legend.SetButton(i, btn);
|
||||
m_Legend.SetActive(i, IsActive(i));
|
||||
m_Legend.UpdateButtonColor(i, m_ThemeInfo.GetColor(i), m_ThemeInfo.legendUnableColor);
|
||||
btn.GetComponentInChildren<Text>().text = m_Legend.data[i];
|
||||
ChartHelper.AddEventListener(btn.gameObject, EventTriggerType.PointerDown, (data) =>
|
||||
{
|
||||
int count = (data as PointerEventData).clickCount;
|
||||
int index = int.Parse(data.selectedObject.name.Split('_')[1]);
|
||||
SetActive(index, !m_Legend.IsActive(index));
|
||||
m_Legend.UpdateButtonColor(index, m_ThemeInfo.GetColor(index),
|
||||
m_ThemeInfo.legendUnableColor);
|
||||
OnYMaxValueChanged();
|
||||
OnLegendButtonClicked();
|
||||
RefreshChart();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void InitTooltip()
|
||||
{
|
||||
var tooltipObject = ChartHelper.AddObject("tooltip", transform, chartAnchorMin,
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
tooltipObject.transform.localPosition = Vector3.zero;
|
||||
DestroyImmediate(tooltipObject.GetComponent<Image>());
|
||||
var parent = tooltipObject.transform;
|
||||
ChartHelper.HideAllObject(tooltipObject.transform);
|
||||
GameObject content = ChartHelper.AddTooltipContent("content", parent, m_ThemeInfo.font);
|
||||
GameObject labelX = ChartHelper.AddTooltipLabel("label_x", parent, m_ThemeInfo.font, new Vector2(0.5f, 1));
|
||||
GameObject labelY = ChartHelper.AddTooltipLabel("label_y", parent, m_ThemeInfo.font, new Vector2(1, 0.5f));
|
||||
m_Tooltip.SetObj(tooltipObject);
|
||||
m_Tooltip.SetContentObj(content);
|
||||
m_Tooltip.SetLabelObj(labelX, labelY);
|
||||
m_Tooltip.SetContentBackgroundColor(m_ThemeInfo.tooltipBackgroundColor);
|
||||
m_Tooltip.SetContentTextColor(m_ThemeInfo.tooltipTextColor);
|
||||
m_Tooltip.SetLabelBackgroundColor(m_ThemeInfo.tooltipLabelColor);
|
||||
m_Tooltip.SetLabelTextColor(m_ThemeInfo.tooltipTextColor);
|
||||
m_Tooltip.SetActive(false);
|
||||
}
|
||||
|
||||
private Vector3 GetLegendPosition(int i)
|
||||
{
|
||||
return m_Legend.location.GetPosition(chartWidth, chartHeight);
|
||||
}
|
||||
|
||||
protected float GetMaxValue(int index)
|
||||
{
|
||||
if (m_Series == null) return 100;
|
||||
else return m_Series.GetMaxValue(index);
|
||||
}
|
||||
|
||||
private void CheckSize()
|
||||
{
|
||||
if (m_CheckWidth != chartWidth || m_CheckHeight != chartHeight)
|
||||
{
|
||||
m_CheckWidth = chartWidth;
|
||||
m_CheckHeight = chartHeight;
|
||||
OnSizeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckTheme()
|
||||
{
|
||||
if (m_CheckTheme != m_Theme)
|
||||
{
|
||||
m_CheckTheme = m_Theme;
|
||||
OnThemeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckTile()
|
||||
{
|
||||
if (!m_CheckTitle.Equals(m_Title))
|
||||
{
|
||||
m_CheckTitle.Copy(m_Title);
|
||||
OnTitleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckLegend()
|
||||
{
|
||||
if (m_CheckLegend != m_Legend)
|
||||
{
|
||||
m_CheckLegend.Copy(m_Legend);
|
||||
OnLegendChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckTooltip()
|
||||
{
|
||||
if (!m_Tooltip.show || !m_Tooltip.isInited)
|
||||
{
|
||||
if (m_Tooltip.dataIndex != 0)
|
||||
{
|
||||
m_Tooltip.dataIndex = 0;
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
}
|
||||
return;
|
||||
}
|
||||
m_Tooltip.SetLabelActive(m_Tooltip.crossLabel);
|
||||
m_Tooltip.dataIndex = 0;
|
||||
|
||||
Vector2 local;
|
||||
|
||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
||||
Input.mousePosition, canvas.worldCamera, out local))
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
return;
|
||||
}
|
||||
if (local.x < 0 || local.x > chartWidth ||
|
||||
local.y < 0 || local.y > chartHeight)
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
RefreshChart();
|
||||
return;
|
||||
}
|
||||
m_Tooltip.pointerPos = local;
|
||||
CheckTootipArea(local);
|
||||
}
|
||||
|
||||
protected virtual void CheckTootipArea(Vector2 localPostion)
|
||||
{
|
||||
}
|
||||
|
||||
protected void CheckRefreshChart()
|
||||
{
|
||||
if (m_RefreshChart)
|
||||
{
|
||||
int tempWid = (int)chartWidth;
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, tempWid - 1);
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, tempWid);
|
||||
m_RefreshChart = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnSizeChanged()
|
||||
{
|
||||
InitTitle();
|
||||
InitLegend();
|
||||
}
|
||||
|
||||
protected virtual void OnThemeChanged()
|
||||
{
|
||||
switch (m_Theme)
|
||||
{
|
||||
case Theme.Dark:
|
||||
m_ThemeInfo.Copy(ThemeInfo.Dark);
|
||||
break;
|
||||
case Theme.Default:
|
||||
m_ThemeInfo.Copy(ThemeInfo.Default);
|
||||
break;
|
||||
case Theme.Light:
|
||||
m_ThemeInfo.Copy(ThemeInfo.Light);
|
||||
break;
|
||||
}
|
||||
InitTitle();
|
||||
InitLegend();
|
||||
InitTooltip();
|
||||
}
|
||||
|
||||
protected virtual void OnTitleChanged()
|
||||
{
|
||||
InitTitle();
|
||||
}
|
||||
|
||||
protected virtual void OnLegendChanged()
|
||||
{
|
||||
InitLegend();
|
||||
}
|
||||
|
||||
protected virtual void OnYMaxValueChanged()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnLegendButtonClicked()
|
||||
{
|
||||
}
|
||||
|
||||
public void RefreshChart()
|
||||
{
|
||||
m_RefreshChart = true;
|
||||
}
|
||||
|
||||
protected virtual void RefreshTooltip()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnPopulateMesh(VertexHelper vh)
|
||||
{
|
||||
vh.Clear();
|
||||
DrawBackground(vh);
|
||||
DrawChart(vh);
|
||||
DrawTooltip(vh);
|
||||
}
|
||||
|
||||
protected virtual void DrawChart(VertexHelper vh)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void DrawTooltip(VertexHelper vh)
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawBackground(VertexHelper vh)
|
||||
{
|
||||
// draw bg
|
||||
Vector3 p1 = new Vector3(0, chartHeight);
|
||||
Vector3 p2 = new Vector3(chartWidth, chartHeight);
|
||||
Vector3 p3 = new Vector3(chartWidth, 0);
|
||||
Vector3 p4 = new Vector3(0, 0);
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, m_ThemeInfo.backgroundColor);
|
||||
}
|
||||
|
||||
public virtual void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnScroll(PointerEventData eventData)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[Serializable]
|
||||
public class Coordinate : IEquatable<Coordinate>
|
||||
{
|
||||
[SerializeField] private float m_Left;
|
||||
[SerializeField] private float m_Right;
|
||||
[SerializeField] private float m_Top;
|
||||
[SerializeField] private float m_Bottom;
|
||||
[SerializeField] private float m_Tickness;
|
||||
[SerializeField] private int m_FontSize;
|
||||
|
||||
public float left { get { return m_Left; } set { m_Left = value; } }
|
||||
public float right { get { return m_Right; } set { m_Right = value; } }
|
||||
public float top { get { return m_Top; } set { m_Top = value; } }
|
||||
public float bottom { get { return m_Bottom; } set { m_Bottom = value; } }
|
||||
public float tickness { get { return m_Tickness; } set { m_Tickness = value; } }
|
||||
public int fontSize { get { return m_FontSize; } set { m_FontSize = value; } }
|
||||
|
||||
public static Coordinate defaultCoordinate
|
||||
{
|
||||
get
|
||||
{
|
||||
var coordinate = new Coordinate
|
||||
{
|
||||
m_Left = 40f,
|
||||
m_Right = 80f,
|
||||
m_Top = 40f,
|
||||
m_Bottom = 25f,
|
||||
m_Tickness = 0.6f,
|
||||
m_FontSize = 16,
|
||||
};
|
||||
return coordinate;
|
||||
}
|
||||
}
|
||||
public void Copy(Coordinate other)
|
||||
{
|
||||
m_Left = other.left;
|
||||
m_Right = other.right;
|
||||
m_Top = other.top;
|
||||
m_Bottom = other.bottom;
|
||||
m_Tickness = other.tickness;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Coordinate)
|
||||
{
|
||||
return Equals((Coordinate)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Coordinate other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Left == other.left &&
|
||||
m_Right == other.right &&
|
||||
m_Top == other.top &&
|
||||
m_Bottom == other.bottom &&
|
||||
m_Tickness == other.tickness &&
|
||||
m_FontSize == other.fontSize;
|
||||
}
|
||||
|
||||
public static bool operator ==(Coordinate left, Coordinate 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 !=(Coordinate left, Coordinate right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7dea6e12aeb93945888247ea97dbd13
|
||||
timeCreated: 1554422468
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,991 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class CoordinateChart : BaseChart
|
||||
{
|
||||
private static readonly string s_DefaultAxisY = "axis_y";
|
||||
private static readonly string s_DefaultAxisX = "axis_x";
|
||||
private static readonly string s_DefaultDataZoom = "datazoom";
|
||||
|
||||
[SerializeField] protected Coordinate m_Coordinate = Coordinate.defaultCoordinate;
|
||||
[SerializeField] protected XAxis m_XAxis = XAxis.defaultXAxis;
|
||||
[SerializeField] protected YAxis m_YAxis = YAxis.defaultYAxis;
|
||||
[SerializeField] protected DataZoom m_DataZoom = DataZoom.defaultDataZoom;
|
||||
|
||||
private float m_ZeroXOffset;
|
||||
private float m_ZeroYOffset;
|
||||
private bool m_DataZoomDrag;
|
||||
private bool m_DataZoomStartDrag;
|
||||
private bool m_DataZoomEndDrag;
|
||||
private float m_DataZoomLastStartIndex;
|
||||
private float m_DataZoomLastEndIndex;
|
||||
|
||||
private XAxis m_CheckXAxis = XAxis.defaultXAxis;
|
||||
private YAxis m_CheckYAxis = YAxis.defaultYAxis;
|
||||
private Coordinate m_CheckCoordinate = Coordinate.defaultCoordinate;
|
||||
private List<Text> m_AxisLabelYTextList = new List<Text>();
|
||||
private List<Text> m_SplitXTextList = new List<Text>();
|
||||
|
||||
public int minValue { get; private set; }
|
||||
public int maxValue { get; private set; }
|
||||
public float zeroX { get { return coordinateX + m_ZeroXOffset; } }
|
||||
public float zeroY { get { return coordinateY + m_ZeroYOffset; } }
|
||||
public float coordinateX { get { return m_Coordinate.left; } }
|
||||
public float coordinateY { get { return m_Coordinate.bottom; } }
|
||||
public float coordinateWid { get { return chartWidth - m_Coordinate.left - m_Coordinate.right; } }
|
||||
public float coordinateHig { get { return chartHeight - m_Coordinate.top - m_Coordinate.bottom; } }
|
||||
public Axis xAxis { get { return m_XAxis; } }
|
||||
public Axis yAxis { get { return m_YAxis; } }
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
CheckMinMaxValue();
|
||||
InitDataZoom();
|
||||
InitAxisX();
|
||||
InitAxisY();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
CheckYAxis();
|
||||
CheckXAxis();
|
||||
CheckMinMaxValue();
|
||||
CheckCoordinate();
|
||||
CheckDataZoom();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
m_Coordinate = Coordinate.defaultCoordinate;
|
||||
m_XAxis = XAxis.defaultXAxis;
|
||||
m_YAxis = YAxis.defaultYAxis;
|
||||
InitAxisX();
|
||||
InitAxisY();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void DrawChart(VertexHelper vh)
|
||||
{
|
||||
base.DrawChart(vh);
|
||||
DrawCoordinate(vh);
|
||||
DrawDataZoom(vh);
|
||||
}
|
||||
|
||||
protected override void CheckTootipArea(Vector2 local)
|
||||
{
|
||||
if (local.x < coordinateX || local.x > coordinateX + coordinateWid ||
|
||||
local.y < coordinateY || local.y > coordinateY + coordinateHig)
|
||||
{
|
||||
m_Tooltip.dataIndex = 0;
|
||||
RefreshTooltip();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_XAxis.type == Axis.AxisType.Value)
|
||||
{
|
||||
float splitWid = m_YAxis.GetDataWidth(coordinateHig, m_DataZoom);
|
||||
for (int i = 0; i < m_YAxis.GetDataNumber(m_DataZoom); i++)
|
||||
{
|
||||
float pY = zeroY + i * splitWid;
|
||||
if (m_YAxis.boundaryGap)
|
||||
{
|
||||
if (local.y > pY && local.y <= pY + splitWid)
|
||||
{
|
||||
m_Tooltip.dataIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)
|
||||
{
|
||||
m_Tooltip.dataIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float splitWid = m_XAxis.GetDataWidth(coordinateWid, m_DataZoom);
|
||||
for (int i = 0; i < m_XAxis.GetDataNumber(m_DataZoom); i++)
|
||||
{
|
||||
float pX = zeroX + i * splitWid;
|
||||
if (m_XAxis.boundaryGap)
|
||||
{
|
||||
if (local.x > pX && local.x <= pX + splitWid)
|
||||
{
|
||||
m_Tooltip.dataIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)
|
||||
{
|
||||
m_Tooltip.dataIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Tooltip.dataIndex > 0)
|
||||
{
|
||||
m_Tooltip.UpdateContentPos(new Vector2(local.x + 18, local.y - 25));
|
||||
RefreshTooltip();
|
||||
if (m_Tooltip.lastDataIndex != m_Tooltip.dataIndex || m_Tooltip.crossLabel)
|
||||
{
|
||||
RefreshChart();
|
||||
}
|
||||
m_Tooltip.lastDataIndex = m_Tooltip.dataIndex;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RefreshTooltip()
|
||||
{
|
||||
base.RefreshTooltip();
|
||||
int index = m_Tooltip.dataIndex - 1;
|
||||
Axis tempAxis = m_XAxis.type == Axis.AxisType.Value ? (Axis)m_YAxis : (Axis)m_XAxis;
|
||||
if (index < 0)
|
||||
{
|
||||
m_Tooltip.SetActive(false);
|
||||
return;
|
||||
}
|
||||
if (m_Series.Count == 1)
|
||||
{
|
||||
float value = m_Series.GetData(0, index);
|
||||
string txt = tempAxis.GetData(index, m_DataZoom) + ": " + value;
|
||||
m_Tooltip.UpdateContentText(txt);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(tempAxis.GetData(index, m_DataZoom));
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
if (m_Series.series[i].show)
|
||||
{
|
||||
string strColor = ColorUtility.ToHtmlStringRGBA(m_ThemeInfo.GetColor(i));
|
||||
string key = m_Series.series[i].name;
|
||||
float value = m_Series.series[i].GetData(index, m_DataZoom);
|
||||
sb.Append("\n");
|
||||
sb.AppendFormat("<color=#{0}>● </color>", strColor);
|
||||
sb.AppendFormat("{0}: {1}", key, value);
|
||||
}
|
||||
|
||||
}
|
||||
m_Tooltip.UpdateContentText(sb.ToString());
|
||||
}
|
||||
if (m_XAxis.type == Axis.AxisType.Value)
|
||||
{
|
||||
float hig = (maxValue - minValue) * (m_Tooltip.pointerPos.x - zeroX) / coordinateWid;
|
||||
m_Tooltip.UpdateLabelText(hig.ToString("f2"), tempAxis.GetData(index, m_DataZoom));
|
||||
float splitWidth = m_YAxis.GetSplitWidth(coordinateHig, m_DataZoom);
|
||||
float py = zeroY + (m_Tooltip.dataIndex - 1) * splitWidth
|
||||
+ (m_YAxis.boundaryGap ? splitWidth / 2 : 0);
|
||||
Vector2 xLabelPos = new Vector2(m_Tooltip.pointerPos.x, coordinateY - 4 * m_Coordinate.tickness);
|
||||
Vector2 yLabelPos = new Vector2(coordinateX - 6 * m_Coordinate.tickness, py);
|
||||
m_Tooltip.UpdateLabelPos(xLabelPos, yLabelPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
float hig = (maxValue - minValue) * (m_Tooltip.pointerPos.y - zeroY) / coordinateHig;
|
||||
m_Tooltip.UpdateLabelText(tempAxis.GetData(index, m_DataZoom), hig.ToString("f2"));
|
||||
float splitWidth = m_XAxis.GetSplitWidth(coordinateWid, m_DataZoom);
|
||||
float px = zeroX + (m_Tooltip.dataIndex - 1) * splitWidth
|
||||
+ (m_XAxis.boundaryGap ? splitWidth / 2 : 0);
|
||||
Vector2 xLabelPos = new Vector2(px, coordinateY - 6 * m_Coordinate.tickness);
|
||||
Vector2 yLabelPos = new Vector2(coordinateX - 4 * m_Coordinate.tickness, m_Tooltip.pointerPos.y);
|
||||
m_Tooltip.UpdateLabelPos(xLabelPos, yLabelPos);
|
||||
}
|
||||
|
||||
|
||||
var pos = m_Tooltip.GetContentPos();
|
||||
if (pos.x + m_Tooltip.width > chartWidth)
|
||||
{
|
||||
pos.x = chartWidth - m_Tooltip.width;
|
||||
}
|
||||
if (pos.y - m_Tooltip.height < 0)
|
||||
{
|
||||
pos.y = m_Tooltip.height;
|
||||
}
|
||||
m_Tooltip.UpdateContentPos(pos);
|
||||
m_Tooltip.SetActive(true);
|
||||
}
|
||||
|
||||
protected override void OnThemeChanged()
|
||||
{
|
||||
base.OnThemeChanged();
|
||||
InitDataZoom();
|
||||
InitAxisX();
|
||||
InitAxisY();
|
||||
}
|
||||
|
||||
public void AddXAxisData(string category)
|
||||
{
|
||||
m_XAxis.AddData(category, m_MaxCacheDataNumber);
|
||||
OnXAxisChanged();
|
||||
}
|
||||
|
||||
public void AddYAxisData(string category)
|
||||
{
|
||||
m_YAxis.AddData(category, m_MaxCacheDataNumber);
|
||||
OnYAxisChanged();
|
||||
}
|
||||
|
||||
private void InitAxisY()
|
||||
{
|
||||
m_AxisLabelYTextList.Clear();
|
||||
ChartHelper.HideAllObject(gameObject, "split_y");//old name
|
||||
float labelWidth = m_YAxis.GetScaleWidth(coordinateHig, m_DataZoom);
|
||||
|
||||
var axisObj = ChartHelper.AddObject(s_DefaultAxisY, transform, chartAnchorMin,
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
axisObj.transform.localPosition = Vector3.zero;
|
||||
axisObj.SetActive(m_YAxis.axisLabel.show);
|
||||
ChartHelper.HideAllObject(axisObj, s_DefaultAxisY);
|
||||
|
||||
var labelColor = m_YAxis.axisLabel.color == Color.clear ?
|
||||
(Color)m_ThemeInfo.axisTextColor :
|
||||
m_YAxis.axisLabel.color;
|
||||
for (int i = 0; i < m_YAxis.GetSplitNumber(m_DataZoom); i++)
|
||||
{
|
||||
Text txt;
|
||||
if (m_YAxis.axisLabel.inside)
|
||||
{
|
||||
txt = ChartHelper.AddTextObject(s_DefaultAxisY + i, axisObj.transform,
|
||||
m_ThemeInfo.font, labelColor, TextAnchor.MiddleLeft, Vector2.zero,
|
||||
Vector2.zero, new Vector2(0, 0.5f), new Vector2(m_Coordinate.left, 20),
|
||||
m_YAxis.axisLabel.fontSize, m_YAxis.axisLabel.rotate, m_YAxis.axisLabel.fontStyle);
|
||||
}
|
||||
else
|
||||
{
|
||||
txt = ChartHelper.AddTextObject(s_DefaultAxisY + i, axisObj.transform,
|
||||
m_ThemeInfo.font, labelColor, TextAnchor.MiddleRight, Vector2.zero,
|
||||
Vector2.zero, new Vector2(1, 0.5f), new Vector2(m_Coordinate.left, 20),
|
||||
m_YAxis.axisLabel.fontSize, m_YAxis.axisLabel.rotate, m_YAxis.axisLabel.fontStyle);
|
||||
}
|
||||
|
||||
txt.transform.localPosition = GetLabelYPosition(labelWidth, i, m_YAxis.axisLabel.inside);
|
||||
txt.text = m_YAxis.GetScaleName(i, minValue, maxValue, m_DataZoom);
|
||||
txt.gameObject.SetActive(m_YAxis.show &&
|
||||
(m_YAxis.axisLabel.interval == 0 || i % (m_YAxis.axisLabel.interval + 1) == 0));
|
||||
m_AxisLabelYTextList.Add(txt);
|
||||
}
|
||||
if (m_YAxis.axisName.show)
|
||||
{
|
||||
var color = m_YAxis.axisName.color == Color.clear ? (Color)m_ThemeInfo.axisTextColor :
|
||||
m_YAxis.axisName.color;
|
||||
var fontSize = m_YAxis.axisName.fontSize;
|
||||
var gap = m_YAxis.axisName.gap;
|
||||
Text axisName;
|
||||
switch (m_YAxis.axisName.location)
|
||||
{
|
||||
case Axis.AxisName.Location.Start:
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisX + "_name", axisObj.transform,
|
||||
m_ThemeInfo.font, color, TextAnchor.MiddleCenter, new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), fontSize,
|
||||
m_YAxis.axisName.rotate, m_YAxis.axisName.fontStyle);
|
||||
axisName.transform.localPosition = new Vector2(coordinateX, coordinateY - gap);
|
||||
break;
|
||||
case Axis.AxisName.Location.Middle:
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisX + "_name", axisObj.transform,
|
||||
m_ThemeInfo.font, color, TextAnchor.MiddleRight, new Vector2(1, 0.5f),
|
||||
new Vector2(1, 0.5f), new Vector2(1, 0.5f), new Vector2(100, 20), fontSize,
|
||||
m_YAxis.axisName.rotate, m_YAxis.axisName.fontStyle);
|
||||
axisName.transform.localPosition = new Vector2(coordinateX - gap,
|
||||
coordinateY + coordinateHig / 2);
|
||||
break;
|
||||
case Axis.AxisName.Location.End:
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisX + "_name", axisObj.transform,
|
||||
m_ThemeInfo.font, color, TextAnchor.MiddleCenter, new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), fontSize,
|
||||
m_YAxis.axisName.rotate, m_YAxis.axisName.fontStyle);
|
||||
axisName.transform.localPosition = new Vector2(coordinateX,
|
||||
coordinateY + coordinateHig + gap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitAxisX()
|
||||
{
|
||||
m_SplitXTextList.Clear();
|
||||
ChartHelper.HideAllObject(gameObject, "split_x");//old name
|
||||
float labelWidth = m_XAxis.GetScaleWidth(coordinateWid, m_DataZoom);
|
||||
|
||||
var axisObj = ChartHelper.AddObject(s_DefaultAxisX, transform, chartAnchorMin,
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
axisObj.transform.localPosition = Vector3.zero;
|
||||
axisObj.SetActive(m_XAxis.axisLabel.show);
|
||||
ChartHelper.HideAllObject(axisObj, s_DefaultAxisX);
|
||||
var labelColor = m_XAxis.axisLabel.color == Color.clear ?
|
||||
(Color)m_ThemeInfo.axisTextColor :
|
||||
m_XAxis.axisLabel.color;
|
||||
for (int i = 0; i < m_XAxis.GetSplitNumber(m_DataZoom); i++)
|
||||
{
|
||||
Text txt = ChartHelper.AddTextObject(s_DefaultAxisX + i, axisObj.transform,
|
||||
m_ThemeInfo.font, labelColor, TextAnchor.MiddleCenter, new Vector2(0, 1),
|
||||
new Vector2(0, 1), new Vector2(1, 0.5f), new Vector2(labelWidth, 20),
|
||||
m_XAxis.axisLabel.fontSize, m_XAxis.axisLabel.rotate, m_XAxis.axisLabel.fontStyle);
|
||||
|
||||
txt.transform.localPosition = GetLabelXPosition(labelWidth, i, m_XAxis.axisLabel.inside);
|
||||
txt.text = m_XAxis.GetScaleName(i, minValue, maxValue, m_DataZoom);
|
||||
txt.gameObject.SetActive(m_XAxis.show &&
|
||||
(m_XAxis.axisLabel.interval == 0 || i % (m_XAxis.axisLabel.interval + 1) == 0));
|
||||
m_SplitXTextList.Add(txt);
|
||||
}
|
||||
if (m_XAxis.axisName.show)
|
||||
{
|
||||
var color = m_XAxis.axisName.color == Color.clear ? (Color)m_ThemeInfo.axisTextColor :
|
||||
m_XAxis.axisName.color;
|
||||
var fontSize = m_XAxis.axisName.fontSize;
|
||||
var gap = m_XAxis.axisName.gap;
|
||||
Text axisName;
|
||||
switch (m_XAxis.axisName.location)
|
||||
{
|
||||
case Axis.AxisName.Location.Start:
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisX + "_name", axisObj.transform,
|
||||
m_ThemeInfo.font, color, TextAnchor.MiddleRight, new Vector2(1, 0.5f),
|
||||
new Vector2(1, 0.5f), new Vector2(1, 0.5f), new Vector2(100, 20), fontSize,
|
||||
m_XAxis.axisName.rotate, m_XAxis.axisName.fontStyle);
|
||||
axisName.transform.localPosition = new Vector2(coordinateX - gap, coordinateY);
|
||||
break;
|
||||
case Axis.AxisName.Location.Middle:
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisX + "_name", axisObj.transform,
|
||||
m_ThemeInfo.font, color, TextAnchor.MiddleCenter, new Vector2(0.5f, 0.5f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(100, 20), fontSize,
|
||||
m_XAxis.axisName.rotate, m_XAxis.axisName.fontStyle);
|
||||
axisName.transform.localPosition = new Vector2(coordinateX + coordinateWid / 2,
|
||||
coordinateY - gap);
|
||||
break;
|
||||
case Axis.AxisName.Location.End:
|
||||
axisName = ChartHelper.AddTextObject(s_DefaultAxisX + "_name", axisObj.transform,
|
||||
m_ThemeInfo.font, color, TextAnchor.MiddleLeft, new Vector2(0, 0.5f),
|
||||
new Vector2(0, 0.5f), new Vector2(0, 0.5f), new Vector2(100, 20), fontSize,
|
||||
m_XAxis.axisName.rotate, m_XAxis.axisName.fontStyle);
|
||||
axisName.transform.localPosition = new Vector2(coordinateX + coordinateWid + gap,
|
||||
coordinateY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitDataZoom()
|
||||
{
|
||||
var dataZoomObject = ChartHelper.AddObject(s_DefaultDataZoom, transform, chartAnchorMin,
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
dataZoomObject.transform.localPosition = Vector3.zero;
|
||||
ChartHelper.HideAllObject(dataZoomObject, s_DefaultDataZoom);
|
||||
m_DataZoom.startLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "start",
|
||||
dataZoomObject.transform, m_ThemeInfo.font, m_ThemeInfo.dataZoomTextColor, TextAnchor.MiddleRight,
|
||||
Vector2.zero, Vector2.zero, new Vector2(1, 0.5f), new Vector2(200, 20));
|
||||
m_DataZoom.endLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "end",
|
||||
dataZoomObject.transform, m_ThemeInfo.font, m_ThemeInfo.dataZoomTextColor, TextAnchor.MiddleLeft,
|
||||
Vector2.zero, Vector2.zero, new Vector2(0, 0.5f), new Vector2(200, 20));
|
||||
m_DataZoom.SetLabelActive(false);
|
||||
if (m_XAxis != null)
|
||||
{
|
||||
m_XAxis.UpdateFilterData(m_DataZoom);
|
||||
}
|
||||
if (m_Series != null)
|
||||
{
|
||||
m_Series.UpdateFilterData(m_DataZoom);
|
||||
}
|
||||
raycastTarget = m_DataZoom.show;
|
||||
}
|
||||
|
||||
private Vector3 GetLabelYPosition(float scaleWid, int i, bool inside)
|
||||
{
|
||||
var posX = inside ?
|
||||
coordinateX + m_YAxis.axisLabel.margin :
|
||||
coordinateX - m_YAxis.axisLabel.margin;
|
||||
if (m_YAxis.boundaryGap)
|
||||
{
|
||||
return new Vector3(posX, coordinateY + (i + 0.5f) * scaleWid, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Vector3(posX, coordinateY + i * scaleWid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3 GetLabelXPosition(float scaleWid, int i, bool inside)
|
||||
{
|
||||
var posY = inside ?
|
||||
coordinateY + m_XAxis.axisLabel.margin + m_XAxis.axisLabel.fontSize / 2 :
|
||||
coordinateY - m_XAxis.axisLabel.margin - m_XAxis.axisLabel.fontSize / 2;
|
||||
if (m_XAxis.boundaryGap)
|
||||
{
|
||||
return new Vector3(coordinateX + (i + 1) * scaleWid, posY);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Vector3(coordinateX + (i + 1 - 0.5f) * scaleWid, posY);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckCoordinate()
|
||||
{
|
||||
if (m_CheckCoordinate != m_Coordinate)
|
||||
{
|
||||
m_CheckCoordinate.Copy(m_Coordinate);
|
||||
OnCoordinateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckYAxis()
|
||||
{
|
||||
if (m_CheckYAxis != m_YAxis)
|
||||
{
|
||||
m_CheckYAxis.Copy(m_YAxis);
|
||||
OnYAxisChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckXAxis()
|
||||
{
|
||||
if (m_CheckXAxis != m_XAxis)
|
||||
{
|
||||
m_CheckXAxis.Copy(m_XAxis);
|
||||
OnXAxisChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckMinMaxValue()
|
||||
{
|
||||
int tempMinValue = 0;
|
||||
int tempMaxValue = 100;
|
||||
if (m_Series != null)
|
||||
{
|
||||
m_Series.GetMinMaxValue(m_DataZoom, out tempMinValue, out tempMaxValue);
|
||||
}
|
||||
Axis axis;
|
||||
if (m_XAxis.type == Axis.AxisType.Value) axis = m_XAxis;
|
||||
else axis = m_YAxis;
|
||||
switch (axis.minMaxType)
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
if (tempMinValue > 0 && tempMaxValue > 0)
|
||||
{
|
||||
tempMinValue = 0;
|
||||
tempMaxValue = ChartHelper.GetMaxDivisibleValue(tempMaxValue);
|
||||
}
|
||||
else if (tempMinValue < 0 && tempMaxValue < 0)
|
||||
{
|
||||
tempMinValue = ChartHelper.GetMinDivisibleValue(tempMinValue);
|
||||
tempMaxValue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tempMinValue = ChartHelper.GetMinDivisibleValue(tempMinValue);
|
||||
tempMaxValue = ChartHelper.GetMaxDivisibleValue(tempMaxValue);
|
||||
}
|
||||
break;
|
||||
case Axis.AxisMinMaxType.MinMax:
|
||||
tempMinValue = ChartHelper.GetMinDivisibleValue(tempMinValue);
|
||||
tempMaxValue = ChartHelper.GetMaxDivisibleValue(tempMaxValue);
|
||||
break;
|
||||
case Axis.AxisMinMaxType.Custom:
|
||||
if (axis.min != 0 || axis.max != 0)
|
||||
{
|
||||
tempMinValue = axis.min;
|
||||
tempMaxValue = axis.max;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (tempMinValue != minValue || tempMaxValue != maxValue)
|
||||
{
|
||||
minValue = tempMinValue;
|
||||
maxValue = tempMaxValue;
|
||||
if (m_XAxis.type == Axis.AxisType.Value)
|
||||
{
|
||||
m_ZeroXOffset = minValue > 0 ? 0 :
|
||||
maxValue < 0 ? coordinateWid :
|
||||
Mathf.Abs(minValue) * (coordinateWid / (Mathf.Abs(minValue) + Mathf.Abs(maxValue)));
|
||||
OnXMaxValueChanged();
|
||||
}
|
||||
else if (m_YAxis.type == Axis.AxisType.Value)
|
||||
{
|
||||
m_ZeroYOffset = minValue > 0 ? 0 :
|
||||
maxValue < 0 ? coordinateHig :
|
||||
Mathf.Abs(minValue) * (coordinateHig / (Mathf.Abs(minValue) + Mathf.Abs(maxValue)));
|
||||
OnYMaxValueChanged();
|
||||
}
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnCoordinateChanged()
|
||||
{
|
||||
InitAxisX();
|
||||
InitAxisY();
|
||||
}
|
||||
|
||||
protected virtual void OnYAxisChanged()
|
||||
{
|
||||
InitAxisY();
|
||||
}
|
||||
|
||||
protected virtual void OnXAxisChanged()
|
||||
{
|
||||
InitAxisX();
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged()
|
||||
{
|
||||
base.OnSizeChanged();
|
||||
minValue = 0;
|
||||
maxValue = 100;
|
||||
InitAxisX();
|
||||
InitAxisY();
|
||||
}
|
||||
|
||||
protected override void OnYMaxValueChanged()
|
||||
{
|
||||
for (int i = 0; i < m_AxisLabelYTextList.Count; i++)
|
||||
{
|
||||
m_AxisLabelYTextList[i].text = m_YAxis.GetScaleName(i, minValue, maxValue, m_DataZoom);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnXMaxValueChanged()
|
||||
{
|
||||
for (int i = 0; i < m_SplitXTextList.Count; i++)
|
||||
{
|
||||
m_SplitXTextList[i].text = m_XAxis.GetScaleName(i, minValue, maxValue, m_DataZoom);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCoordinate(VertexHelper vh)
|
||||
{
|
||||
#region draw tick and splitline
|
||||
if (m_YAxis.show)
|
||||
{
|
||||
var scaleWidth = m_YAxis.GetScaleWidth(coordinateHig, m_DataZoom);
|
||||
var size = m_YAxis.GetScaleNumber(m_DataZoom);
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
float pX = 0;
|
||||
float pY = coordinateY + i * scaleWidth;
|
||||
if (m_YAxis.boundaryGap && m_YAxis.axisTick.alignWithLabel)
|
||||
{
|
||||
pY -= scaleWidth / 2;
|
||||
}
|
||||
if (m_YAxis.splitArea.show && i < size - 1)
|
||||
{
|
||||
ChartHelper.DrawPolygon(vh, new Vector2(coordinateX, pY),
|
||||
new Vector2(coordinateX + coordinateWid, pY),
|
||||
new Vector2(coordinateX + coordinateWid, pY + scaleWidth),
|
||||
new Vector2(coordinateX, pY + scaleWidth),
|
||||
m_YAxis.splitArea.getColor(i));
|
||||
}
|
||||
if (m_YAxis.axisTick.show)
|
||||
{
|
||||
pX += zeroX - (m_YAxis.axisTick.inside ? -m_YAxis.axisTick.length :
|
||||
m_YAxis.axisTick.length);
|
||||
ChartHelper.DrawLine(vh, new Vector3(zeroX, pY), new Vector3(pX, pY),
|
||||
m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
|
||||
}
|
||||
if (m_YAxis.showSplitLine)
|
||||
{
|
||||
DrawSplitLine(vh, true, m_YAxis.splitLineType, new Vector3(coordinateX, pY),
|
||||
new Vector3(coordinateX + coordinateWid, pY), m_ThemeInfo.axisSplitLineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_XAxis.show)
|
||||
{
|
||||
var scaleWidth = m_XAxis.GetScaleWidth(coordinateWid, m_DataZoom);
|
||||
var size = m_XAxis.GetScaleNumber(m_DataZoom);
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
float pX = coordinateX + i * scaleWidth;
|
||||
float pY = 0;
|
||||
if (m_XAxis.boundaryGap && m_XAxis.axisTick.alignWithLabel)
|
||||
{
|
||||
pX -= scaleWidth / 2;
|
||||
}
|
||||
if (m_XAxis.splitArea.show && i < size - 1)
|
||||
{
|
||||
ChartHelper.DrawPolygon(vh, new Vector2(pX, coordinateY),
|
||||
new Vector2(pX, coordinateY + coordinateHig),
|
||||
new Vector2(pX + scaleWidth, coordinateY + coordinateHig),
|
||||
new Vector2(pX + scaleWidth, coordinateY),
|
||||
m_XAxis.splitArea.getColor(i));
|
||||
}
|
||||
if (m_XAxis.axisTick.show)
|
||||
{
|
||||
pY += zeroY + (m_XAxis.axisTick.inside ? m_XAxis.axisTick.length :
|
||||
-m_XAxis.axisTick.length);
|
||||
ChartHelper.DrawLine(vh, new Vector3(pX, zeroY), new Vector3(pX, pY),
|
||||
m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
|
||||
}
|
||||
if (m_XAxis.showSplitLine)
|
||||
{
|
||||
DrawSplitLine(vh, false, m_XAxis.splitLineType, new Vector3(pX, coordinateY),
|
||||
new Vector3(pX, coordinateY + coordinateHig), m_ThemeInfo.axisSplitLineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
DrawXAxisLine(vh);
|
||||
DrawYAxisLine(vh);
|
||||
}
|
||||
|
||||
private void DrawXAxisLine(VertexHelper vh)
|
||||
{
|
||||
if (m_XAxis.show && m_XAxis.axisLine.show)
|
||||
{
|
||||
var lineY = zeroY;
|
||||
if (m_XAxis.type == Axis.AxisType.Value)
|
||||
{
|
||||
lineY = coordinateY;
|
||||
}
|
||||
var top = new Vector3(coordinateX + coordinateWid + m_Coordinate.tickness, lineY);
|
||||
ChartHelper.DrawLine(vh, new Vector3(coordinateX - m_Coordinate.tickness, lineY),
|
||||
top, m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
|
||||
if (m_XAxis.axisLine.symbol)
|
||||
{
|
||||
var axisLine = m_XAxis.axisLine;
|
||||
top.x += m_XAxis.axisLine.symbolOffset;
|
||||
var middle = new Vector3(top.x - axisLine.symbolHeight + axisLine.symbolDent, lineY);
|
||||
var left = new Vector3(top.x - axisLine.symbolHeight, lineY - axisLine.symbolWidth / 2);
|
||||
var right = new Vector3(top.x - axisLine.symbolHeight, lineY + axisLine.symbolWidth / 2);
|
||||
ChartHelper.DrawTriangle(vh, middle, top, left, m_ThemeInfo.axisLineColor);
|
||||
ChartHelper.DrawTriangle(vh, middle, top, right, m_ThemeInfo.axisLineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawYAxisLine(VertexHelper vh)
|
||||
{
|
||||
if (m_YAxis.show && m_YAxis.axisLine.show)
|
||||
{
|
||||
var lineX = zeroX;
|
||||
if (m_YAxis.type == Axis.AxisType.Value)
|
||||
{
|
||||
lineX = coordinateX;
|
||||
}
|
||||
var top = new Vector3(lineX, coordinateY + coordinateHig + m_Coordinate.tickness);
|
||||
ChartHelper.DrawLine(vh, new Vector3(lineX, coordinateY - m_Coordinate.tickness),
|
||||
top, m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
|
||||
if (m_YAxis.axisLine.symbol)
|
||||
{
|
||||
var axisLine = m_YAxis.axisLine;
|
||||
top.y += m_YAxis.axisLine.symbolOffset;
|
||||
var middle = new Vector3(lineX, top.y - axisLine.symbolHeight + axisLine.symbolDent);
|
||||
var left = new Vector3(lineX - axisLine.symbolWidth / 2, top.y - axisLine.symbolHeight);
|
||||
var right = new Vector3(lineX + axisLine.symbolWidth / 2, top.y - axisLine.symbolHeight);
|
||||
ChartHelper.DrawTriangle(vh, middle, top, left, m_ThemeInfo.axisLineColor);
|
||||
ChartHelper.DrawTriangle(vh, middle, top, right, m_ThemeInfo.axisLineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDataZoom(VertexHelper vh)
|
||||
{
|
||||
if (!m_DataZoom.show) return;
|
||||
var p1 = new Vector2(coordinateX, m_DataZoom.bottom);
|
||||
var p2 = new Vector2(coordinateX, m_DataZoom.bottom + m_DataZoom.height);
|
||||
var p3 = new Vector2(coordinateX + coordinateWid, m_DataZoom.bottom + m_DataZoom.height);
|
||||
var p4 = new Vector2(coordinateX + coordinateWid, m_DataZoom.bottom);
|
||||
ChartHelper.DrawLine(vh, p1, p2, m_Coordinate.tickness, m_ThemeInfo.dataZoomLineColor);
|
||||
ChartHelper.DrawLine(vh, p2, p3, m_Coordinate.tickness, m_ThemeInfo.dataZoomLineColor);
|
||||
ChartHelper.DrawLine(vh, p3, p4, m_Coordinate.tickness, m_ThemeInfo.dataZoomLineColor);
|
||||
ChartHelper.DrawLine(vh, p4, p1, m_Coordinate.tickness, m_ThemeInfo.dataZoomLineColor);
|
||||
if (m_DataZoom.showDataShadow && m_Series.Count > 0)
|
||||
{
|
||||
Serie serie = m_Series.series[0];
|
||||
float scaleWid = coordinateWid / (serie.data.Count - 1);
|
||||
Vector3 lp = Vector3.zero;
|
||||
Vector3 np = Vector3.zero;
|
||||
for (int i = 0; i < serie.data.Count; i++)
|
||||
{
|
||||
float value = serie.data[i];
|
||||
float pX = zeroX + i * scaleWid;
|
||||
float dataHig = value / (maxValue - minValue) * m_DataZoom.height;
|
||||
np = new Vector3(pX, m_DataZoom.bottom + dataHig);
|
||||
if (i > 0)
|
||||
{
|
||||
Color color = m_ThemeInfo.dataZoomLineColor;
|
||||
ChartHelper.DrawLine(vh, lp, np, m_Coordinate.tickness, color);
|
||||
Vector3 alp = new Vector3(lp.x, lp.y - m_Coordinate.tickness);
|
||||
Vector3 anp = new Vector3(np.x, np.y - m_Coordinate.tickness);
|
||||
Color areaColor = new Color(color.r, color.g, color.b, color.a * 0.75f);
|
||||
Vector3 tnp = new Vector3(np.x, m_DataZoom.bottom + m_Coordinate.tickness);
|
||||
Vector3 tlp = new Vector3(lp.x, m_DataZoom.bottom + m_Coordinate.tickness);
|
||||
ChartHelper.DrawPolygon(vh, alp, anp, tnp, tlp, areaColor);
|
||||
}
|
||||
lp = np;
|
||||
}
|
||||
}
|
||||
switch (m_DataZoom.rangeMode)
|
||||
{
|
||||
case DataZoom.RangeMode.Percent:
|
||||
var start = coordinateX + coordinateWid * m_DataZoom.start / 100;
|
||||
var end = coordinateX + coordinateWid * m_DataZoom.end / 100;
|
||||
p1 = new Vector2(start, m_DataZoom.bottom);
|
||||
p2 = new Vector2(start, m_DataZoom.bottom + m_DataZoom.height);
|
||||
p3 = new Vector2(end, m_DataZoom.bottom + m_DataZoom.height);
|
||||
p4 = new Vector2(end, m_DataZoom.bottom);
|
||||
ChartHelper.DrawPolygon(vh, p1, p2, p3, p4, m_ThemeInfo.dataZoomSelectedColor);
|
||||
ChartHelper.DrawLine(vh, p1, p2, m_Coordinate.tickness, m_ThemeInfo.dataZoomSelectedColor);
|
||||
ChartHelper.DrawLine(vh, p3, p4, m_Coordinate.tickness, m_ThemeInfo.dataZoomSelectedColor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void DrawSplitLine(VertexHelper vh, bool isYAxis, Axis.SplitLineType type,
|
||||
Vector3 startPos, Vector3 endPos, Color color)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Axis.SplitLineType.Dashed:
|
||||
case Axis.SplitLineType.Dotted:
|
||||
var startX = startPos.x;
|
||||
var startY = startPos.y;
|
||||
var dashLen = type == Axis.SplitLineType.Dashed ? 6 : 2.5f;
|
||||
var count = isYAxis ? (endPos.x - startPos.x) / (dashLen * 2) :
|
||||
(endPos.y - startPos.y) / (dashLen * 2);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (isYAxis)
|
||||
{
|
||||
var toX = startX + dashLen;
|
||||
ChartHelper.DrawLine(vh, new Vector3(startX, startY), new Vector3(toX, startY),
|
||||
m_Coordinate.tickness, color);
|
||||
startX += dashLen * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
var toY = startY + dashLen;
|
||||
ChartHelper.DrawLine(vh, new Vector3(startX, startY), new Vector3(startX, toY),
|
||||
m_Coordinate.tickness, color);
|
||||
startY += dashLen * 2;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case Axis.SplitLineType.Solid:
|
||||
ChartHelper.DrawLine(vh, startPos, endPos, m_Coordinate.tickness, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckDataZoom()
|
||||
{
|
||||
if (raycastTarget != m_DataZoom.show)
|
||||
{
|
||||
raycastTarget = m_DataZoom.show;
|
||||
}
|
||||
if (!m_DataZoom.show) return;
|
||||
if (m_DataZoom.showDetail)
|
||||
{
|
||||
Vector2 local;
|
||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
||||
Input.mousePosition, null, out local))
|
||||
{
|
||||
m_DataZoom.SetLabelActive(false);
|
||||
return;
|
||||
}
|
||||
if (m_DataZoom.IsInSelectedZoom(local, coordinateX, coordinateWid)
|
||||
|| m_DataZoom.IsInStartZoom(local, coordinateX, coordinateWid)
|
||||
|| m_DataZoom.IsInEndZoom(local, coordinateX, coordinateWid))
|
||||
{
|
||||
m_DataZoom.SetLabelActive(true);
|
||||
RefreshDataZoomLabel();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DataZoom.SetLabelActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
var pos = transform.InverseTransformPoint(eventData.position);
|
||||
if (m_DataZoom.IsInStartZoom(pos, coordinateX, coordinateWid))
|
||||
{
|
||||
m_DataZoom.isDraging = true;
|
||||
m_DataZoomStartDrag = true;
|
||||
}
|
||||
else if (m_DataZoom.IsInEndZoom(pos, coordinateX, coordinateWid))
|
||||
{
|
||||
m_DataZoom.isDraging = true;
|
||||
m_DataZoomEndDrag = true;
|
||||
}
|
||||
else if (m_DataZoom.IsInSelectedZoom(pos, coordinateX, coordinateWid))
|
||||
{
|
||||
m_DataZoom.isDraging = true;
|
||||
m_DataZoomDrag = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
//Debug.LogError("drag");
|
||||
float deltaX = eventData.delta.x;
|
||||
float deltaPercent = deltaX / coordinateWid * 100;
|
||||
if (m_DataZoomStartDrag)
|
||||
{
|
||||
m_DataZoom.start += deltaPercent;
|
||||
if (m_DataZoom.start < 0)
|
||||
{
|
||||
m_DataZoom.start = 0;
|
||||
}
|
||||
else if (m_DataZoom.start > m_DataZoom.end)
|
||||
{
|
||||
m_DataZoom.start = m_DataZoom.end;
|
||||
m_DataZoomEndDrag = true;
|
||||
m_DataZoomStartDrag = false;
|
||||
}
|
||||
RefreshDataZoomLabel();
|
||||
RefreshChart();
|
||||
}
|
||||
else if (m_DataZoomEndDrag)
|
||||
{
|
||||
m_DataZoom.end += deltaPercent;
|
||||
if (m_DataZoom.end > 100)
|
||||
{
|
||||
m_DataZoom.end = 100;
|
||||
}
|
||||
else if (m_DataZoom.end < m_DataZoom.start)
|
||||
{
|
||||
m_DataZoom.end = m_DataZoom.start;
|
||||
m_DataZoomStartDrag = true;
|
||||
m_DataZoomEndDrag = false;
|
||||
}
|
||||
RefreshDataZoomLabel();
|
||||
RefreshChart();
|
||||
}
|
||||
else if (m_DataZoomDrag)
|
||||
{
|
||||
if (deltaPercent > 0)
|
||||
{
|
||||
if (m_DataZoom.end + deltaPercent > 100)
|
||||
{
|
||||
deltaPercent = 100 - m_DataZoom.end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_DataZoom.start + deltaPercent < 0)
|
||||
{
|
||||
deltaPercent = -m_DataZoom.start;
|
||||
}
|
||||
}
|
||||
m_DataZoom.start += deltaPercent;
|
||||
m_DataZoom.end += deltaPercent;
|
||||
RefreshDataZoomLabel();
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshDataZoomLabel()
|
||||
{
|
||||
var startIndex = (int)((xAxis.data.Count - 1) * m_DataZoom.start / 100);
|
||||
var endIndex = (int)((xAxis.data.Count - 1) * m_DataZoom.end / 100);
|
||||
if (m_DataZoomLastStartIndex != startIndex || m_DataZoomLastEndIndex != endIndex)
|
||||
{
|
||||
m_DataZoomLastStartIndex = startIndex;
|
||||
m_DataZoomLastEndIndex = endIndex;
|
||||
if (xAxis.data.Count > 0)
|
||||
{
|
||||
m_DataZoom.SetStartLabelText(xAxis.data[startIndex]);
|
||||
m_DataZoom.SetEndLabelText(xAxis.data[endIndex]);
|
||||
}
|
||||
InitAxisX();
|
||||
}
|
||||
|
||||
var start = coordinateX + coordinateWid * m_DataZoom.start / 100;
|
||||
var end = coordinateX + coordinateWid * m_DataZoom.end / 100;
|
||||
m_DataZoom.startLabel.transform.localPosition =
|
||||
new Vector3(start - 10, m_DataZoom.bottom + m_DataZoom.height / 2);
|
||||
m_DataZoom.endLabel.transform.localPosition =
|
||||
new Vector3(end + 10, m_DataZoom.bottom + m_DataZoom.height / 2);
|
||||
}
|
||||
|
||||
public override void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
if (m_DataZoomDrag || m_DataZoomStartDrag || m_DataZoomEndDrag)
|
||||
{
|
||||
RefreshChart();
|
||||
}
|
||||
m_DataZoomDrag = false;
|
||||
m_DataZoomStartDrag = false;
|
||||
m_DataZoomEndDrag = false;
|
||||
m_DataZoom.isDraging = false;
|
||||
}
|
||||
|
||||
public override void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
var localPos = transform.InverseTransformPoint(eventData.position);
|
||||
if (m_DataZoom.IsInStartZoom(localPos, coordinateX, coordinateWid) ||
|
||||
m_DataZoom.IsInEndZoom(localPos, coordinateX, coordinateWid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_DataZoom.IsInZoom(localPos, coordinateX, coordinateWid)
|
||||
&& !m_DataZoom.IsInSelectedZoom(localPos, coordinateX, coordinateWid))
|
||||
{
|
||||
var pointerX = localPos.x;
|
||||
var selectWidth = coordinateWid * (m_DataZoom.end - m_DataZoom.start) / 100;
|
||||
var startX = pointerX - selectWidth / 2;
|
||||
var endX = pointerX + selectWidth / 2;
|
||||
if (startX < coordinateX)
|
||||
{
|
||||
startX = coordinateX;
|
||||
endX = coordinateX + selectWidth;
|
||||
}
|
||||
else if (endX > coordinateX + coordinateWid)
|
||||
{
|
||||
endX = coordinateX + coordinateWid;
|
||||
startX = coordinateX + coordinateWid - selectWidth;
|
||||
}
|
||||
m_DataZoom.start = (startX - coordinateX) / coordinateWid * 100;
|
||||
m_DataZoom.end = (endX - coordinateX) / coordinateWid * 100;
|
||||
RefreshDataZoomLabel();
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnScroll(PointerEventData eventData)
|
||||
{
|
||||
if (!m_DataZoom.show || m_DataZoom.zoomLock) return;
|
||||
float deltaPercent = Mathf.Abs(eventData.scrollDelta.y *
|
||||
m_DataZoom.scrollSensitivity / coordinateWid * 100);
|
||||
if (eventData.scrollDelta.y > 0)
|
||||
{
|
||||
if (m_DataZoom.end <= m_DataZoom.start) return;
|
||||
m_DataZoom.end -= deltaPercent;
|
||||
m_DataZoom.start += deltaPercent;
|
||||
if (m_DataZoom.end <= m_DataZoom.start)
|
||||
{
|
||||
m_DataZoom.end = m_DataZoom.start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DataZoom.end += deltaPercent;
|
||||
m_DataZoom.start -= deltaPercent;
|
||||
if (m_DataZoom.end > 100) m_DataZoom.end = 100;
|
||||
if (m_DataZoom.start < 0) m_DataZoom.start = 0;
|
||||
}
|
||||
RefreshDataZoomLabel();
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c20b1e83703d1084c899f1f1b605c278
|
||||
timeCreated: 1538087401
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,232 +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.
|
||||
/// </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
|
||||
/// </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
|
||||
}
|
||||
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 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;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public DataZoomType type { get { return m_Type; } set { m_Type = value; } }
|
||||
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>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public bool showDetail { get { return m_ShowDetail; } set { m_ShowDetail = value; } }
|
||||
/// <summary>
|
||||
/// Specify whether to lock the size of window (selected area).
|
||||
/// default:false
|
||||
/// </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
|
||||
/// </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
|
||||
/// </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
|
||||
/// </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,
|
||||
showDataShadow = true,
|
||||
showDetail = false,
|
||||
zoomLock = false,
|
||||
realtime = true,
|
||||
m_Height = 50,
|
||||
m_Bottom = 10,
|
||||
rangeMode = RangeMode.Percent,
|
||||
start = 30,
|
||||
end = 70,
|
||||
m_ScrollSensitivity = 10,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStartLabelText(string text)
|
||||
{
|
||||
if (startLabel) startLabel.text = text;
|
||||
}
|
||||
|
||||
public void SetEndLabelText(string text)
|
||||
{
|
||||
if (endLabel) endLabel.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55000eccffd85064ea6a4d1d39ff63bb
|
||||
timeCreated: 1559526210
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,31 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class JsonDataSupport : IJsonData, ISerializationCallbackReceiver
|
||||
{
|
||||
[SerializeField] protected string m_JsonData;
|
||||
[SerializeField] protected bool m_DataFromJson;
|
||||
|
||||
public string jsonData { get { return m_JsonData; } set { m_JsonData = value; ParseJsonData(value); } }
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
if (m_DataFromJson)
|
||||
{
|
||||
ParseJsonData(m_JsonData);
|
||||
m_DataFromJson = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ParseJsonData(string json)
|
||||
{
|
||||
throw new Exception("no support yet");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73e326ed8a76f90408bfa9feb1797433
|
||||
timeCreated: 1555379601
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,281 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Legend : JsonDataSupport, IPropertyChanged, IEquatable<Legend>
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[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>();
|
||||
|
||||
[NonSerialized] private List<bool> m_DataActiveList = new List<bool>();
|
||||
[NonSerialized] private List<Button> m_DataBtnList = new List<Button>();
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
|
||||
public Orient orient { get { return m_Orient; } set { m_Orient = value; } }
|
||||
|
||||
public Location location { get { return m_Location; } set { m_Location = value; } }
|
||||
|
||||
public float itemWidth { get { return m_ItemWidth; } set { m_ItemWidth = value; } }
|
||||
|
||||
public float itemHeight { get { return m_ItemHeight; } set { m_ItemHeight = value; } }
|
||||
|
||||
public float itemGap { get { return m_ItemGap; } set { m_ItemGap = value; } }
|
||||
|
||||
public int itemFontSize { get { return m_ItemFontSize; } set { m_ItemFontSize = value; } }
|
||||
|
||||
public List<string> data { get { return m_Data; } }
|
||||
|
||||
public static Legend defaultLegend
|
||||
{
|
||||
get
|
||||
{
|
||||
var legend = new Legend
|
||||
{
|
||||
m_Show = true,
|
||||
m_Orient = Orient.Horizonal,
|
||||
m_Location = Location.defaultRight,
|
||||
m_ItemWidth = 60.0f,
|
||||
m_ItemHeight = 20.0f,
|
||||
m_ItemGap = 5,
|
||||
m_ItemFontSize = 16,
|
||||
m_Data = new List<string>()
|
||||
{
|
||||
"Legend"
|
||||
}
|
||||
};
|
||||
return legend;
|
||||
}
|
||||
}
|
||||
public void Copy(Legend legend)
|
||||
{
|
||||
m_Show = legend.show;
|
||||
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 &&
|
||||
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();
|
||||
}
|
||||
|
||||
public bool IsActive(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) return true;
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
if (data[i].Equals(name)) return m_DataActiveList[i];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsActive(int seriesIndex)
|
||||
{
|
||||
if (seriesIndex < 0 || seriesIndex > data.Count - 1) seriesIndex = 0;
|
||||
if (seriesIndex >= data.Count) return true;
|
||||
if (seriesIndex < 0 || seriesIndex > m_DataActiveList.Count - 1)
|
||||
return true;
|
||||
else
|
||||
return m_DataActiveList[seriesIndex];
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
public bool ContainsData(string name)
|
||||
{
|
||||
return m_Data.Contains(name);
|
||||
}
|
||||
|
||||
public void RemoveData(string name)
|
||||
{
|
||||
if (m_Data.Contains(name))
|
||||
{
|
||||
m_Data.Remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddData(string name)
|
||||
{
|
||||
if (!m_Data.Contains(name))
|
||||
{
|
||||
m_Data.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetActive(int index, bool flag)
|
||||
{
|
||||
m_DataActiveList[index] = flag;
|
||||
}
|
||||
|
||||
public void SetActive(string name, bool flag)
|
||||
{
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
if (data[i].Equals(name))
|
||||
{
|
||||
m_DataActiveList[i] = flag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetButton(int index, Button btn)
|
||||
{
|
||||
btn.transform.localPosition = GetButtonLocationPosition(index);
|
||||
if (index < 0 || index > m_DataBtnList.Count - 1)
|
||||
{
|
||||
m_DataBtnList.Add(btn);
|
||||
m_DataActiveList.Add(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DataBtnList[index] = btn;
|
||||
}
|
||||
btn.gameObject.SetActive(show);
|
||||
btn.GetComponentInChildren<Text>().text = data[index];
|
||||
}
|
||||
|
||||
public void UpdateButtonColor(int index, Color ableColor, Color unableColor)
|
||||
{
|
||||
if (IsActive(index))
|
||||
{
|
||||
m_DataBtnList[index].GetComponent<Image>().color = ableColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DataBtnList[index].GetComponent<Image>().color = unableColor;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnChanged()
|
||||
{
|
||||
m_Location.OnChanged();
|
||||
}
|
||||
|
||||
private Vector2 GetButtonLocationPosition(int index)
|
||||
{
|
||||
int size = m_Data.Count;
|
||||
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;
|
||||
}
|
||||
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(jsonData) || !m_DataFromJson) return;
|
||||
m_Data = ChartHelper.ParseStringFromString(jsonData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fba76b49d7dd644cb3953355d6caae4
|
||||
timeCreated: 1554222818
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,51 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Line
|
||||
{
|
||||
public enum StepType
|
||||
{
|
||||
Start,
|
||||
Middle,
|
||||
End
|
||||
}
|
||||
[SerializeField] private float m_Tickness;
|
||||
[SerializeField] private bool m_Point;
|
||||
[SerializeField] private float m_PointWidth;
|
||||
[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;
|
||||
|
||||
public float tickness { get { return m_Tickness; } set { m_Tickness = value; } }
|
||||
public bool point { get { return m_Point; } set { m_Point = value; } }
|
||||
public float pointWidth { get { return m_PointWidth; } set { m_PointWidth = value; } }
|
||||
public bool smooth { get { return m_Smooth; } set { m_Smooth = value; } }
|
||||
public float smoothStyle { get { return m_SmoothStyle; } set { m_SmoothStyle = value; } }
|
||||
public bool area { get { return m_Area; } set { m_Area = value; } }
|
||||
public bool step { get { return m_Step; } set { m_Step = value; } }
|
||||
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_Point = true,
|
||||
m_PointWidth = 2.5f,
|
||||
m_Smooth = false,
|
||||
m_SmoothStyle = 2f,
|
||||
m_Area = false,
|
||||
m_Step = false,
|
||||
m_StepType = StepType.Middle
|
||||
};
|
||||
return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86acdbfd671c43949bf0cc4880a4ccb7
|
||||
timeCreated: 1555671450
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,260 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[Serializable]
|
||||
public class Location : IPropertyChanged, IEquatable<Location>
|
||||
{
|
||||
public enum Align
|
||||
{
|
||||
TopLeft,
|
||||
TopRight,
|
||||
TopCenter,
|
||||
BottomLeft,
|
||||
BottomRight,
|
||||
BottomCenter,
|
||||
Center,
|
||||
CenterLeft,
|
||||
CenterRight
|
||||
}
|
||||
|
||||
[SerializeField] private Align m_Align = Align.TopCenter;
|
||||
[SerializeField] private float m_Left;
|
||||
[SerializeField] private float m_Right;
|
||||
[SerializeField] private float m_Top;
|
||||
[SerializeField] private float m_Bottom;
|
||||
|
||||
private TextAnchor m_TextAnchor;
|
||||
private Vector2 m_AnchorMin;
|
||||
private Vector2 m_AnchorMax;
|
||||
private Vector2 m_Pivot;
|
||||
|
||||
public Align align { get { return m_Align; } set { m_Align = value; UpdateAlign(); } }
|
||||
public float left { get { return m_Left; } set { m_Left = value; UpdateAlign(); } }
|
||||
public float right { get { return m_Right; } set { m_Right = value; UpdateAlign(); } }
|
||||
public float top { get { return m_Top; } set { m_Top = value; UpdateAlign(); } }
|
||||
public float bottom { get { return m_Bottom; } set { m_Bottom = value; UpdateAlign(); } }
|
||||
|
||||
public TextAnchor textAnchor { get { return m_TextAnchor; } }
|
||||
public Vector2 anchorMin { get { return m_AnchorMin; } }
|
||||
public Vector2 anchorMax { get { return m_AnchorMax; } }
|
||||
public Vector2 pivot { get { return m_Pivot; } }
|
||||
|
||||
public static Location defaultLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Location()
|
||||
{
|
||||
align = Align.CenterRight,
|
||||
left = 5,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static Location defaultRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Location()
|
||||
{
|
||||
align = Align.CenterRight,
|
||||
left = 0,
|
||||
right = 5,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static Location defaultTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Location()
|
||||
{
|
||||
align = Align.TopCenter,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 5,
|
||||
bottom = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static Location defaultBottom
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Location()
|
||||
{
|
||||
align = Align.BottomCenter,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 5
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAlign()
|
||||
{
|
||||
switch (m_Align)
|
||||
{
|
||||
case Align.BottomCenter:
|
||||
m_TextAnchor = TextAnchor.LowerCenter;
|
||||
m_AnchorMin = new Vector2(0.5f, 0);
|
||||
m_AnchorMax = new Vector2(0.5f, 0);
|
||||
m_Pivot = new Vector2(0.5f, 0);
|
||||
break;
|
||||
case Align.BottomLeft:
|
||||
m_TextAnchor = TextAnchor.LowerLeft;
|
||||
m_AnchorMin = new Vector2(0, 0);
|
||||
m_AnchorMax = new Vector2(0, 0);
|
||||
m_Pivot = new Vector2(0, 0);
|
||||
break;
|
||||
case Align.BottomRight:
|
||||
m_TextAnchor = TextAnchor.LowerRight;
|
||||
m_AnchorMin = new Vector2(1, 0);
|
||||
m_AnchorMax = new Vector2(1, 0);
|
||||
m_Pivot = new Vector2(1, 0);
|
||||
break;
|
||||
case Align.Center:
|
||||
m_TextAnchor = TextAnchor.MiddleCenter;
|
||||
m_AnchorMin = new Vector2(0.5f, 0.5f);
|
||||
m_AnchorMax = new Vector2(0.5f, 0.5f);
|
||||
m_Pivot = new Vector2(0.5f, 0.5f);
|
||||
break;
|
||||
case Align.CenterLeft:
|
||||
m_TextAnchor = TextAnchor.MiddleLeft;
|
||||
m_AnchorMin = new Vector2(0, 0.5f);
|
||||
m_AnchorMax = new Vector2(0, 0.5f);
|
||||
m_Pivot = new Vector2(0, 0.5f);
|
||||
break;
|
||||
case Align.CenterRight:
|
||||
m_TextAnchor = TextAnchor.MiddleRight;
|
||||
m_AnchorMin = new Vector2(1, 0.5f);
|
||||
m_AnchorMax = new Vector2(1, 0.5f);
|
||||
m_Pivot = new Vector2(1, 0.5f);
|
||||
break;
|
||||
case Align.TopCenter:
|
||||
m_TextAnchor = TextAnchor.UpperCenter;
|
||||
m_AnchorMin = new Vector2(0.5f, 1);
|
||||
m_AnchorMax = new Vector2(0.5f, 1);
|
||||
m_Pivot = new Vector2(0.5f, 1);
|
||||
break;
|
||||
case Align.TopLeft:
|
||||
m_TextAnchor = TextAnchor.UpperLeft;
|
||||
m_AnchorMin = new Vector2(0, 1);
|
||||
m_AnchorMax = new Vector2(0, 1);
|
||||
m_Pivot = new Vector2(0, 1);
|
||||
break;
|
||||
case Align.TopRight:
|
||||
m_TextAnchor = TextAnchor.UpperRight;
|
||||
m_AnchorMin = new Vector2(1, 1);
|
||||
m_AnchorMax = new Vector2(1, 1);
|
||||
m_Pivot = new Vector2(1, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 GetPosition(float chartWidht, float chartHeight)
|
||||
{
|
||||
switch (align)
|
||||
{
|
||||
case Align.BottomCenter:
|
||||
return new Vector2(chartWidht / 2, bottom);
|
||||
case Align.BottomLeft:
|
||||
return new Vector2(left, bottom);
|
||||
case Align.BottomRight:
|
||||
return new Vector2(chartWidht - right, bottom);
|
||||
case Align.Center:
|
||||
return new Vector2(chartWidht / 2, chartHeight / 2);
|
||||
case Align.CenterLeft:
|
||||
return new Vector2(left, chartHeight / 2);
|
||||
case Align.CenterRight:
|
||||
return new Vector2(chartWidht - right, chartHeight / 2);
|
||||
case Align.TopCenter:
|
||||
return new Vector2(chartWidht / 2, chartHeight - top);
|
||||
case Align.TopLeft:
|
||||
return new Vector2(left, chartHeight - top);
|
||||
case Align.TopRight:
|
||||
return new Vector2(chartWidht - right, chartHeight - top);
|
||||
default:
|
||||
return Vector2.zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void Copy(Location location)
|
||||
{
|
||||
m_Align = location.align;
|
||||
m_Left = location.left;
|
||||
m_Right = location.right;
|
||||
m_Top = location.top;
|
||||
m_Bottom = location.bottom;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Location)
|
||||
{
|
||||
return Equals((Location)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Location other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return align == other.align &&
|
||||
left == other.left &&
|
||||
right == other.right &&
|
||||
top == other.top &&
|
||||
bottom == other.bottom;
|
||||
}
|
||||
|
||||
public static bool operator ==(Location left, Location 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 !=(Location left, Location right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public void OnChanged()
|
||||
{
|
||||
UpdateAlign();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 453c586e78719f046a387172174edb36
|
||||
timeCreated: 1554306777
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,54 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Pie
|
||||
{
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private float m_InsideRadius;
|
||||
[SerializeField] private float m_OutsideRadius;
|
||||
[SerializeField] private float m_TooltipExtraRadius;
|
||||
[SerializeField] private bool m_Selected;
|
||||
[SerializeField] private int m_SelectedIndex;
|
||||
[SerializeField] private float m_SelectedOffset;
|
||||
[SerializeField] private bool m_Rose;
|
||||
[SerializeField] private float m_Space;
|
||||
[SerializeField] private float m_Left;
|
||||
[SerializeField] private float m_Right;
|
||||
[SerializeField] private float m_Top;
|
||||
[SerializeField] private float m_Bottom;
|
||||
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
public float insideRadius { get { return m_InsideRadius; } set { m_InsideRadius = value; } }
|
||||
public float outsideRadius { get { return m_OutsideRadius; } set { m_OutsideRadius = value; } }
|
||||
public float tooltipExtraRadius { get { return m_TooltipExtraRadius; } set { m_TooltipExtraRadius = value; } }
|
||||
public bool selected { get { return m_Selected; } set { m_Selected = value; } }
|
||||
public int selectedIndex { get { return m_SelectedIndex; } set { m_SelectedIndex = value; } }
|
||||
public float selectedOffset { get { return m_SelectedOffset; } set { m_SelectedOffset = value; } }
|
||||
public bool rose { get { return m_Rose; } set { m_Rose = value; } }
|
||||
public float space { get { return m_Space; } set { m_Space = value; } }
|
||||
public float left { get { return m_Left; } set { m_Left = value; } }
|
||||
public float right { get { return m_Right; } set { m_Right = value; } }
|
||||
public float top { get { return m_Top; } set { m_Top = value; } }
|
||||
public float bottom { get { return m_Bottom; } set { m_Bottom = value; } }
|
||||
|
||||
public static Pie defaultPie
|
||||
{
|
||||
get
|
||||
{
|
||||
var pie = new Pie
|
||||
{
|
||||
m_Name = "Pie",
|
||||
m_InsideRadius = 0f,
|
||||
m_OutsideRadius = 80f,
|
||||
m_TooltipExtraRadius = 10f,
|
||||
m_Rose = false,
|
||||
m_Selected = false,
|
||||
m_SelectedOffset = 10,
|
||||
};
|
||||
return pie;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f38ef4633bae5247a8c382a4d20fc39
|
||||
timeCreated: 1555671161
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,217 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Radar : JsonDataSupport, IEquatable<Radar>
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Indicator : IEquatable<Indicator>
|
||||
{
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private float m_Max;
|
||||
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
public float max { get { return m_Max; } set { m_Max = value; } }
|
||||
|
||||
public Indicator Clone()
|
||||
{
|
||||
return new Indicator()
|
||||
{
|
||||
name = name,
|
||||
max = max
|
||||
};
|
||||
}
|
||||
|
||||
public bool Equals(Indicator other)
|
||||
{
|
||||
return name.Equals(other.name);
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Cricle;
|
||||
[SerializeField] private bool m_Area;
|
||||
|
||||
[SerializeField] private float m_Radius = 100;
|
||||
[SerializeField] private int m_SplitNumber = 5;
|
||||
|
||||
[SerializeField] private float m_Left;
|
||||
[SerializeField] private float m_Right;
|
||||
[SerializeField] private float m_Top;
|
||||
[SerializeField] private float m_Bottom;
|
||||
|
||||
[SerializeField] private float m_LineTickness = 1f;
|
||||
[SerializeField] private float m_LinePointSize = 5f;
|
||||
[SerializeField] private Color m_LineColor = Color.grey;
|
||||
[Range(0, 255)]
|
||||
[SerializeField] private int m_AreaAlpha;
|
||||
|
||||
[SerializeField] private List<Color> m_BackgroundColorList = new List<Color>();
|
||||
[SerializeField] private bool m_Indicator = true;
|
||||
[SerializeField] private List<Indicator> m_IndicatorList = new List<Indicator>();
|
||||
|
||||
public bool cricle { get { return m_Cricle; } set { m_Cricle = value; } }
|
||||
public bool area { get { return m_Area; } set { m_Area = value; } }
|
||||
|
||||
public float radius { get { return m_Radius; } set { m_Radius = value; } }
|
||||
public int splitNumber { get { return m_SplitNumber; } set { m_SplitNumber = value; } }
|
||||
|
||||
public float left { get { return m_Left; } set { m_Left = value; } }
|
||||
public float right { get { return m_Right; } set { m_Right = value; } }
|
||||
public float top { get { return m_Top; } set { m_Top = value; } }
|
||||
public float bottom { get { return m_Bottom; } set { m_Bottom = value; } }
|
||||
|
||||
public float lineTickness { get { return m_LineTickness; } set { m_LineTickness = value; } }
|
||||
public float linePointSize { get { return m_LinePointSize; } set { m_LinePointSize = value; } }
|
||||
public Color lineColor { get { return m_LineColor; } set { m_LineColor = value; } }
|
||||
public int areaAipha { get { return m_AreaAlpha; } set { m_AreaAlpha = value; } }
|
||||
public List<Color> backgroundColorList { get { return m_BackgroundColorList; } }
|
||||
public bool indicator { get { return m_Indicator; } set { m_Indicator = value; } }
|
||||
public List<Indicator> indicatorList { get { return m_IndicatorList; } }
|
||||
|
||||
public static Radar defaultRadar
|
||||
{
|
||||
get
|
||||
{
|
||||
var radar = new Radar
|
||||
{
|
||||
m_Cricle = false,
|
||||
m_Area = false,
|
||||
m_Radius = 100,
|
||||
m_SplitNumber = 5,
|
||||
m_Left = 0,
|
||||
m_Right = 0,
|
||||
m_Top = 0,
|
||||
m_Bottom = 0,
|
||||
m_LineTickness = 1f,
|
||||
m_LinePointSize = 5f,
|
||||
m_AreaAlpha = 150,
|
||||
m_LineColor = Color.grey,
|
||||
m_Indicator = true,
|
||||
m_BackgroundColorList = new List<Color> {
|
||||
new Color32(194, 53, 49, 255),
|
||||
new Color32(47, 69, 84, 255)
|
||||
},
|
||||
m_IndicatorList = new List<Indicator>(5)
|
||||
};
|
||||
return radar;
|
||||
}
|
||||
}
|
||||
|
||||
public void Copy(Radar other)
|
||||
{
|
||||
m_Radius = other.radius;
|
||||
m_SplitNumber = other.splitNumber;
|
||||
m_Left = other.left;
|
||||
m_Right = other.right;
|
||||
m_Top = other.top;
|
||||
m_Bottom = other.bottom;
|
||||
m_Indicator = other.indicator;
|
||||
m_AreaAlpha = other.areaAipha;
|
||||
indicatorList.Clear();
|
||||
foreach (var d in other.indicatorList) indicatorList.Add(d.Clone());
|
||||
}
|
||||
|
||||
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 &&
|
||||
splitNumber == other.splitNumber &&
|
||||
left == other.left &&
|
||||
right == other.right &&
|
||||
top == other.top &&
|
||||
bottom == other.bottom &&
|
||||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3a368484f9598e4eb9dfce2471d34da
|
||||
timeCreated: 1555562622
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,166 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Serie : JsonDataSupport
|
||||
{
|
||||
public enum SerieType
|
||||
{
|
||||
Line,
|
||||
Bar
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private SerieType m_Type;
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private string m_Stack;
|
||||
[SerializeField] private List<float> m_Data = new List<float>();
|
||||
[SerializeField] private bool m_Flodout;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public SerieType type { get { return m_Type; } set { m_Type = value; } }
|
||||
public string name { get { return m_Name; } set { m_Name = value; } }
|
||||
public string stack { get { return m_Stack; } set { m_Stack = value; } }
|
||||
public List<float> data { get { return m_Data; } set { m_Data = value; } }
|
||||
|
||||
public int filterStart { get; set; }
|
||||
public int filterEnd { get; set; }
|
||||
public List<float> filterData { get; set; }
|
||||
|
||||
public float Max
|
||||
{
|
||||
get
|
||||
{
|
||||
float max = int.MinValue;
|
||||
foreach (var data in data)
|
||||
{
|
||||
if (data > max)
|
||||
{
|
||||
max = data;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
public float Min
|
||||
{
|
||||
get
|
||||
{
|
||||
float min = int.MaxValue;
|
||||
foreach (var data in data)
|
||||
{
|
||||
if (data < min)
|
||||
{
|
||||
min = data;
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
}
|
||||
|
||||
public float Total
|
||||
{
|
||||
get
|
||||
{
|
||||
float total = 0;
|
||||
foreach (var data in data)
|
||||
{
|
||||
total += data;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
public void RemoveData(int index)
|
||||
{
|
||||
m_Data.RemoveAt(index);
|
||||
}
|
||||
|
||||
public void AddData(float value, int maxDataNumber = 0)
|
||||
{
|
||||
if (maxDataNumber > 0)
|
||||
{
|
||||
while (m_Data.Count > maxDataNumber) m_Data.RemoveAt(0);
|
||||
}
|
||||
m_Data.Add(value);
|
||||
}
|
||||
|
||||
public float GetData(int index, DataZoom dataZoom = null)
|
||||
{
|
||||
var showData = GetData(dataZoom);
|
||||
if (index >= 0 && index <= showData.Count - 1)
|
||||
{
|
||||
return showData[index];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public List<float> GetData(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;
|
||||
}
|
||||
}
|
||||
|
||||
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<float>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateData(int index, float value)
|
||||
{
|
||||
if (index >= 0 && index <= m_Data.Count - 1)
|
||||
{
|
||||
m_Data[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(jsonData) || !m_DataFromJson) return;
|
||||
m_Data = ChartHelper.ParseFloatFromString(jsonData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bde61eb0785bad4d91d84d5511514ba
|
||||
timeCreated: 1554222818
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,316 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Series : JsonDataSupport
|
||||
{
|
||||
[SerializeField] protected List<Serie> m_Series;
|
||||
|
||||
public List<Serie> series { get { return m_Series; } }
|
||||
|
||||
public int Count { get { return m_Series.Count; } }
|
||||
|
||||
public static Series defaultSeries
|
||||
{
|
||||
get
|
||||
{
|
||||
var series = new Series
|
||||
{
|
||||
m_Series = new List<Serie>()
|
||||
};
|
||||
return series;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
serie.ClearData();
|
||||
}
|
||||
}
|
||||
|
||||
public float GetData(int serieIndex, int dataIndex)
|
||||
{
|
||||
if (serieIndex >= 0 && serieIndex < Count)
|
||||
{
|
||||
return m_Series[serieIndex].GetData(dataIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Serie GetSerie(string name)
|
||||
{
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
if (name.Equals(m_Series[i].name))
|
||||
{
|
||||
return m_Series[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Serie GetSerie(int index)
|
||||
{
|
||||
if (index >= 0 && index < m_Series.Count)
|
||||
{
|
||||
return m_Series[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void RemoveData(string name)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
if (serie != null)
|
||||
{
|
||||
m_Series.Remove(serie);
|
||||
}
|
||||
}
|
||||
|
||||
public Serie AddData(string name, float value, int maxDataNumber = 0)
|
||||
{
|
||||
if (m_Series == null)
|
||||
{
|
||||
m_Series = new List<Serie>();
|
||||
}
|
||||
var serie = GetSerie(name);
|
||||
if (serie == null)
|
||||
{
|
||||
serie = new Serie();
|
||||
serie.name = name;
|
||||
serie.data = new List<float>();
|
||||
m_Series.Add(serie);
|
||||
}
|
||||
serie.AddData(value, maxDataNumber);
|
||||
return serie;
|
||||
}
|
||||
|
||||
public Serie AddData(int index, float value, int maxDataNumber = 0)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.AddData(value, maxDataNumber);
|
||||
}
|
||||
return serie;
|
||||
}
|
||||
|
||||
public void UpdateData(string name, float value, int dataIndex = 0)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.UpdateData(dataIndex, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateData(int index, float value, int dataIndex = 0)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.UpdateData(dataIndex, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateFilterData(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.show)
|
||||
{
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
m_Series[i].UpdateFilterData(dataZoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsActive(string name)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
return serie == null ? false : serie.show;
|
||||
}
|
||||
|
||||
public bool IsActive(int index)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
return serie == null ? false : serie.show;
|
||||
}
|
||||
|
||||
public void SetActive(string name, bool active)
|
||||
{
|
||||
var serie = GetSerie(name);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.show = active;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetActive(int index, bool active)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.show = active;
|
||||
}
|
||||
}
|
||||
|
||||
public void GetMinMaxValue(DataZoom dataZoom, out int minVaule, out int maxValue)
|
||||
{
|
||||
float min = int.MaxValue;
|
||||
float max = int.MinValue;
|
||||
if (IsStack())
|
||||
{
|
||||
var stackSeries = GetStackSeries();
|
||||
foreach (var ss in stackSeries)
|
||||
{
|
||||
var seriesTotalValue = new Dictionary<int, float>();
|
||||
for (int i = 0; i < ss.Value.Count; i++)
|
||||
{
|
||||
var serie = ss.Value[i];
|
||||
var showData = serie.GetData(dataZoom);
|
||||
for (int j = 0; j < showData.Count; j++)
|
||||
{
|
||||
if (!seriesTotalValue.ContainsKey(j))
|
||||
seriesTotalValue[j] = 0;
|
||||
seriesTotalValue[j] = seriesTotalValue[j] + showData[j];
|
||||
}
|
||||
}
|
||||
float tmax = int.MinValue;
|
||||
float tmin = int.MaxValue;
|
||||
foreach (var tt in seriesTotalValue)
|
||||
{
|
||||
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 (IsActive(i))
|
||||
{
|
||||
if (dataZoom != null && dataZoom.show)
|
||||
{
|
||||
var showData = m_Series[i].GetData(dataZoom);
|
||||
foreach (var data in showData)
|
||||
{
|
||||
if (data > max) max = data;
|
||||
if (data < min) min = data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Series[i].Max > max) max = m_Series[i].Max;
|
||||
if (m_Series[i].Min < min) min = m_Series[i].Min;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (max == int.MinValue && min == int.MaxValue)
|
||||
{
|
||||
minVaule = 0;
|
||||
maxValue = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
minVaule = Mathf.FloorToInt(min);
|
||||
maxValue = Mathf.CeilToInt(max);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetMaxValue(int index)
|
||||
{
|
||||
float max = int.MinValue;
|
||||
float min = int.MaxValue;
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
var showData = m_Series[i].data;
|
||||
if (showData[index] > max)
|
||||
{
|
||||
max = Mathf.Ceil(showData[index]);
|
||||
}
|
||||
if (showData[index] < min)
|
||||
{
|
||||
min = Mathf.Ceil(showData[index]);
|
||||
}
|
||||
}
|
||||
if (max < 1 && max > -1) return max;
|
||||
if (max < 0 && min < 0) max = min;
|
||||
return ChartHelper.GetMaxDivisibleValue(max);
|
||||
}
|
||||
|
||||
public bool IsStack()
|
||||
{
|
||||
HashSet<string> sets = new HashSet<string>();
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serie.stack)) continue;
|
||||
if (sets.Contains(serie.stack)) return true;
|
||||
else
|
||||
{
|
||||
sets.Add(serie.stack);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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>>();
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
public override void ParseJsonData(string jsonData)
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 137f78d348f866943a9fb8c1c8eaceef
|
||||
timeCreated: 1556016849
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,285 +0,0 @@
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public enum Theme
|
||||
{
|
||||
Default = 1,
|
||||
Light,
|
||||
Dark
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ThemeInfo : IEquatable<ThemeInfo>
|
||||
{
|
||||
[SerializeField] private Font m_Font;
|
||||
[SerializeField] private Color32 m_BackgroundColor;
|
||||
[SerializeField] private Color32 m_TextColor;
|
||||
[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;
|
||||
|
||||
public Font font { get { return m_Font; } set { m_Font = value; } }
|
||||
public Color32 backgroundColor { get { return m_BackgroundColor; } set { m_BackgroundColor = value; } }
|
||||
public Color32 textColor { get { return m_TextColor; } set { m_TextColor = value; } }
|
||||
public Color32 titleSubTextColor { get { return m_TitleSubTextColor; } set { m_TitleSubTextColor = value; } }
|
||||
public Color32 legendTextColor { get { return m_LegendTextColor; } set { m_LegendTextColor = value; } }
|
||||
public Color32 legendUnableColor { get { return m_LegendUnableColor; } set { m_LegendUnableColor = value; } }
|
||||
public Color32 axisTextColor { get { return m_AxisTextColor; } set { m_AxisTextColor = value; } }
|
||||
public Color32 axisLineColor { get { return m_AxisLineColor; } set { m_AxisLineColor = value; } }
|
||||
public Color32 axisSplitLineColor { get { return m_AxisSplitLineColor; } set { m_AxisSplitLineColor = value; } }
|
||||
public Color32 tooltipBackgroundColor { get { return m_TooltipBackgroundColor; } set { m_TooltipBackgroundColor = value; } }
|
||||
public Color32 tooltipFlagAreaColor { get { return m_TooltipFlagAreaColor; } set { m_TooltipFlagAreaColor = value; } }
|
||||
public Color32 tooltipTextColor { get { return m_TooltipTextColor; } set { m_TooltipTextColor = value; } }
|
||||
public Color32 tooltipLabelColor { get { return m_TooltipLabelColor; } set { m_TooltipLabelColor = value; } }
|
||||
public Color32 tooltipLineColor { get { return m_TooltipLineColor; } set { m_TooltipLineColor = value; } }
|
||||
public Color32 dataZoomTextColor { get { return m_DataZoomTextColor; } set { m_DataZoomTextColor = value; } }
|
||||
public Color32 dataZoomLineColor { get { return m_DataZoomLineColor; } set { m_DataZoomLineColor = value; } }
|
||||
public Color32 dataZoomSelectedColor { get { return m_DataZoomSelectedColor; } set { m_DataZoomSelectedColor = value; } }
|
||||
public Color32[] colorPalette { get { return m_ColorPalette; } set { m_ColorPalette = value; } }
|
||||
|
||||
public Color32 GetColor(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
index = index % m_ColorPalette.Length;
|
||||
return m_ColorPalette[index];
|
||||
}
|
||||
|
||||
public void Copy(ThemeInfo theme)
|
||||
{
|
||||
m_Font = theme.m_Font;
|
||||
m_BackgroundColor = theme.m_BackgroundColor;
|
||||
m_LegendUnableColor = theme.m_LegendUnableColor;
|
||||
m_TextColor = theme.m_TextColor;
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
public static ThemeInfo Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ThemeInfo()
|
||||
{
|
||||
m_Font = Resources.GetBuiltinResource<Font>("Arial.ttf"),
|
||||
m_BackgroundColor = new Color32(255, 255, 255, 255),
|
||||
m_LegendUnableColor = GetColor("#cccccc"),
|
||||
m_TextColor = 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("#515151B5"),
|
||||
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)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static ThemeInfo Light
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ThemeInfo()
|
||||
{
|
||||
m_Font = Resources.GetBuiltinResource<Font>("Arial.ttf"),
|
||||
m_BackgroundColor = new Color32(255, 255, 255, 255),
|
||||
m_LegendUnableColor = GetColor("#cccccc"),
|
||||
m_TextColor = 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("#515151B5"),
|
||||
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)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static ThemeInfo Dark
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ThemeInfo()
|
||||
{
|
||||
m_Font = Resources.GetBuiltinResource<Font>("Arial.ttf"),
|
||||
m_LegendUnableColor = GetColor("#cccccc"),
|
||||
m_BackgroundColor = new Color32(34, 34, 34, 255),
|
||||
m_TextColor = 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("#515151B5"),
|
||||
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)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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_TextColor, other.m_TextColor) &&
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 337565e835799d44bb794677abf84498
|
||||
timeCreated: 1554221927
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,112 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[Serializable]
|
||||
public class Title : IPropertyChanged, IEquatable<Title>
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private string m_Text;
|
||||
[SerializeField] private int m_TextFontSize;
|
||||
[SerializeField] private string m_SubText;
|
||||
[SerializeField] private int m_SubTextFontSize;
|
||||
[SerializeField] private float m_ItemGap;
|
||||
[SerializeField] private Location m_Location;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; } }
|
||||
public string text { get { return m_Text; } set { m_Text = value; } }
|
||||
public int textFontSize { get { return m_TextFontSize; } set { m_TextFontSize = value; } }
|
||||
public string subText { get { return m_SubText; } set { m_Text = value; } }
|
||||
public int subTextFontSize { get { return m_SubTextFontSize; } set { m_SubTextFontSize = value; } }
|
||||
public float itemGap { get { return m_ItemGap; } set { m_ItemGap = value; } }
|
||||
public Location location { get { return m_Location; } set { m_Location = value; } }
|
||||
|
||||
public static Title defaultTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
var title = new Title
|
||||
{
|
||||
m_Show = true,
|
||||
m_Text = "Chart Title",
|
||||
m_TextFontSize = 16,
|
||||
m_SubText = "",
|
||||
m_SubTextFontSize = 14,
|
||||
m_ItemGap = 14,
|
||||
m_Location = Location.defaultTop
|
||||
};
|
||||
return title;
|
||||
}
|
||||
}
|
||||
public void Copy(Title title)
|
||||
{
|
||||
m_Show = title.show;
|
||||
m_Text = title.text;
|
||||
m_TextFontSize = title.textFontSize;
|
||||
m_SubText = title.subText;
|
||||
m_SubTextFontSize = title.subTextFontSize;
|
||||
m_ItemGap = title.itemGap;
|
||||
m_Location.Copy(title.location);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj is Title)
|
||||
{
|
||||
return Equals((Title)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Title other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_Show == other.show &&
|
||||
m_Text.Equals(other.text) &&
|
||||
m_TextFontSize == other.textFontSize &&
|
||||
m_SubText.Equals(other.subText) &&
|
||||
m_SubTextFontSize == other.subTextFontSize &&
|
||||
m_ItemGap == other.itemGap &&
|
||||
m_Location.Equals(other.location);
|
||||
}
|
||||
|
||||
public static bool operator ==(Title left, Title 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 !=(Title left, Title right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public void OnChanged()
|
||||
{
|
||||
m_Location.OnChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e41a7f82b5a931408f301257fbc09e2
|
||||
timeCreated: 1554222818
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,162 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Tooltip
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private bool m_CrossLabel;
|
||||
|
||||
[NonSerialized] private GameObject m_GameObject;
|
||||
[NonSerialized] private GameObject m_Content;
|
||||
[NonSerialized] private GameObject m_LabelX;
|
||||
[NonSerialized] private GameObject m_LabelY;
|
||||
[NonSerialized] private Text m_ContentText;
|
||||
[NonSerialized] private Text m_LabelTextX;
|
||||
[NonSerialized] private Text m_LabelTextY;
|
||||
[NonSerialized] private RectTransform m_ContentRect;
|
||||
[NonSerialized] private RectTransform m_LabelRectX;
|
||||
[NonSerialized] private RectTransform m_LabelRectY;
|
||||
|
||||
public bool show { get { return m_Show; } set { m_Show = value; SetActive(value); } }
|
||||
public bool crossLabel { get { return m_CrossLabel; } set { m_CrossLabel = value; } }
|
||||
|
||||
public int dataIndex { get; set; }
|
||||
public int lastDataIndex { get; set; }
|
||||
public Vector2 pointerPos { get; set; }
|
||||
public float width { get { return m_ContentRect.sizeDelta.x; } }
|
||||
public float height { get { return m_ContentRect.sizeDelta.y; } }
|
||||
public bool isInited { get { return m_GameObject != null; } }
|
||||
|
||||
public static Tooltip defaultTooltip
|
||||
{
|
||||
get
|
||||
{
|
||||
var tooltip = new Tooltip
|
||||
{
|
||||
m_Show = true,
|
||||
m_CrossLabel = false
|
||||
};
|
||||
return tooltip;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetObj(GameObject obj)
|
||||
{
|
||||
m_GameObject = obj;
|
||||
m_GameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetContentObj(GameObject content)
|
||||
{
|
||||
m_Content = content;
|
||||
m_ContentRect = m_Content.GetComponent<RectTransform>();
|
||||
m_ContentText = m_Content.GetComponentInChildren<Text>();
|
||||
}
|
||||
|
||||
public void SetLabelObj(GameObject labelX, GameObject labelY)
|
||||
{
|
||||
m_LabelX = labelX;
|
||||
m_LabelRectX = labelX.GetComponent<RectTransform>();
|
||||
m_LabelTextX = labelX.GetComponentInChildren<Text>();
|
||||
m_LabelY = labelY;
|
||||
m_LabelRectY = labelY.GetComponent<RectTransform>();
|
||||
m_LabelTextY = labelY.GetComponentInChildren<Text>();
|
||||
m_LabelX.SetActive(false);
|
||||
m_LabelY.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetContentBackgroundColor(Color color)
|
||||
{
|
||||
m_Content.GetComponent<Image>().color = color;
|
||||
}
|
||||
|
||||
public void SetContentTextColor(Color color)
|
||||
{
|
||||
if (m_ContentText)
|
||||
{
|
||||
m_ContentText.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLabelBackgroundColor(Color color)
|
||||
{
|
||||
m_LabelX.GetComponent<Image>().color = color;
|
||||
m_LabelY.GetComponent<Image>().color = color;
|
||||
}
|
||||
|
||||
public void SetLabelTextColor(Color color)
|
||||
{
|
||||
m_LabelTextX.color = color;
|
||||
m_LabelTextY.color = color;
|
||||
}
|
||||
|
||||
public void UpdateContentText(string txt)
|
||||
{
|
||||
if (m_ContentText)
|
||||
{
|
||||
m_ContentText.text = txt;
|
||||
m_ContentRect.sizeDelta = new Vector2(m_ContentText.preferredWidth + 8,
|
||||
m_ContentText.preferredHeight + 8);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateLabelText(string labelX, string labelY)
|
||||
{
|
||||
if (m_LabelTextX)
|
||||
{
|
||||
m_LabelTextX.text = labelX;
|
||||
m_LabelRectX.sizeDelta = new Vector2(m_LabelTextX.preferredWidth + 8,
|
||||
m_LabelTextX.preferredHeight + 8);
|
||||
}
|
||||
if (m_LabelTextY)
|
||||
{
|
||||
m_LabelTextY.text = labelY;
|
||||
m_LabelRectY.sizeDelta = new Vector2(m_LabelTextY.preferredWidth + 8,
|
||||
m_LabelTextY.preferredHeight + 8);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetActive(bool flag)
|
||||
{
|
||||
lastDataIndex = 0;
|
||||
if (m_GameObject && m_GameObject.activeInHierarchy != flag)
|
||||
m_GameObject.SetActive(flag);
|
||||
}
|
||||
|
||||
public void SetLabelActive(bool flag)
|
||||
{
|
||||
if (m_LabelX && m_LabelX.activeInHierarchy != flag) m_LabelX.SetActive(flag);
|
||||
if (m_LabelY && m_LabelY.activeInHierarchy != flag) m_LabelY.SetActive(flag);
|
||||
}
|
||||
|
||||
public void UpdateContentPos(Vector2 pos)
|
||||
{
|
||||
if (m_Content)
|
||||
m_Content.transform.localPosition = pos;
|
||||
}
|
||||
|
||||
public void UpdateLabelPos(Vector2 xLabelPos, Vector2 yLabelPos)
|
||||
{
|
||||
if (m_LabelX)
|
||||
{
|
||||
m_LabelX.transform.localPosition = xLabelPos;
|
||||
}
|
||||
if (m_LabelY)
|
||||
{
|
||||
m_LabelY.transform.localPosition = yLabelPos;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 GetContentPos()
|
||||
{
|
||||
if (m_Content)
|
||||
return m_Content.transform.localPosition;
|
||||
else
|
||||
return Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user