Compare commits

...

228 Commits

Author SHA1 Message Date
monitor1394
6e87f82131 3.0 2022-06-01 07:59:00 +08:00
monitor1394
9549159a58 3.0 2022-05-31 08:33:54 +08:00
monitor1394
e370bedc09 3.0 2022-05-31 08:17:54 +08:00
monitor1394
5740882d1c 3.0 2022-05-29 17:25:45 +08:00
monitor1394
63166e5cd1 3.0 2022-05-26 21:33:05 +08:00
monitor1394
6ba6a7929d 3.0 2022-05-24 13:43:15 +08:00
monitor1394
e0a596d02a 3.0 2022-05-24 13:39:19 +08:00
monitor1394
9b7ebea827 3.0 2022-05-24 13:36:23 +08:00
monitor1394
0ad4a47c36 3.0 2022-05-23 08:23:58 +08:00
monitor1394
1ac59dff86 3.0 2022-05-22 22:27:20 +08:00
monitor1394
bafe032bb9 3.0 2022-05-22 22:17:38 +08:00
monitor1394
003f4da9de [bug] fix create chart error 2022-05-06 13:07:50 +08:00
monitor1394
d77e1c3d91 v3.0.0-preivew9 2022-05-06 08:14:49 +08:00
monitor1394
d4b3f5eaa8 3.0.0-preview9 2022-05-06 08:12:15 +08:00
monitor1394
8a78867961 [doc] update doc 2022-05-05 13:23:33 +08:00
monitor1394
d9266b3c9c [refactor][optimize] item color 2022-05-05 13:10:04 +08:00
monitor1394
0801069f72 [add][line] line support dash (#197) 2022-05-04 20:47:02 +08:00
monitor1394
e92afac0de [add][legend] add the delegate callback for legend 2022-05-04 09:19:45 +08:00
monitor1394
d1fd4dcf44 [refactor] refactor symbol and label 2022-05-04 08:45:19 +08:00
monitor1394
43c31405b8 [bug][ring] fix ring label formatter (#195) 2022-05-01 10:54:14 +08:00
monitor1394
4e4d0bc85d [optimize][bar] bar support clip and min-max (#196) 2022-05-01 10:30:58 +08:00
monitor1394
96b0ec45d2 [optimize][tooltip] support background image 2022-04-29 15:54:47 +08:00
monitor1394
8c02ce14ac [bug] fix change color in runtime did not refresh 2022-04-27 08:26:05 +08:00
monitor1394
419c704b23 v3.0.0-preivew8 2022-04-26 08:26:37 +08:00
monitor1394
9dedc1db68 v3.0.0-preivew8 2022-04-26 08:24:45 +08:00
monitor1394
f11ee84517 [optimize][label] support label rotate 2022-04-19 13:30:24 +08:00
monitor1394
dfa978afe0 [optimize][visualmap] support horizontal gradient 2022-04-19 07:22:47 +08:00
monitor1394
4e6658ad70 [optimize][bar] optimize border and capsule 2022-04-18 08:20:16 +08:00
monitor1394
ef5988a851 [enhancement][liquid] support round rect vessel 2022-04-15 13:12:19 +08:00
monitor1394
5d6c5b5f79 [doc] update api doc 2022-04-14 21:42:40 +08:00
monitor1394
80e4475f65 [enhancement][line] line support end label 2022-04-14 21:32:44 +08:00
monitor1394
84cf39df4d [doc] update doc 2022-04-13 22:04:45 +08:00
monitor1394
d44bf55a87 [add][VisualMap] add workOnLine and workOnArea (#191) 2022-04-13 22:03:23 +08:00
monitor1394
ad273cf1b1 [optimize] optimize interact and performance 2022-04-13 13:33:09 +08:00
monitor1394
a3d2d3f1d5 [optimize] optimize interact and performance 2022-04-13 13:26:46 +08:00
monitor1394
7ca4ddcb88 [optimize] radar support area tooltip 2022-04-12 08:09:18 +08:00
monitor1394
9a3461084c [doc] update readme 2022-04-11 21:54:09 +08:00
monitor1394
09df6fa73d [doc] update doc 2022-04-11 21:49:18 +08:00
monitor1394
be4ed41ca6 [optimize] visualmap 2022-04-09 21:30:28 +08:00
monitor1394
e2b0c935e0 [optimize] tooltip 2022-04-09 11:03:41 +08:00
monitor1394
e4fac71987 v3.0.0-preivew7 2022-04-07 08:38:17 +08:00
monitor1394
20825c148f [doc] update api and configuration 2022-04-07 08:36:14 +08:00
monitor1394
5476fa8d09 [setting] update setting 2022-04-07 08:35:20 +08:00
monitor1394
80c77fc69a [optimize] Pie support startAngle 2022-04-07 08:35:03 +08:00
monitor1394
621bc3dcfd [bug] Fix pie color 2022-04-07 08:16:50 +08:00
monitor1394
1ed0ff377a fix add main component error 2022-03-31 21:54:34 +08:00
monitor1394
426d437e6d fixed axis label custom color 2022-03-30 13:15:24 +08:00
monitor1394
6c0dcbbcbb 3.0 2022-03-30 08:25:48 +08:00
monitor1394
4ade064266 3.0 2022-03-30 08:24:47 +08:00
monitor1394
1ad87920d0 3.0 2022-03-29 22:06:10 +08:00
monitor1394
b784900fda 3.0 2022-03-28 19:28:39 +08:00
monitor1394
acba2f5c1e 3.0 2022-03-27 12:49:20 +08:00
monitor1394
3bccbd0ab2 3.0 2022-03-26 22:28:23 +08:00
monitor1394
327661bfdd Create FUNDING.yml 2022-03-26 22:05:59 +08:00
monitor1394
ed393ea560 3.0 2022-03-26 21:34:38 +08:00
monitor1394
3fbf5bc906 3.0 2022-03-26 18:30:55 +08:00
monitor1394
b7efcf87cf 3.0 2022-03-26 18:26:34 +08:00
monitor1394
1aea9f3cfe 3.0 2022-03-26 17:20:52 +08:00
monitor1394
edd6d940b6 3.0 2022-03-26 17:11:12 +08:00
monitor1394
09f7557e1f 3.0 2022-03-25 13:36:10 +08:00
monitor1394
2e954490ec 3.0 2022-03-24 21:48:53 +08:00
monitor1394
f597a3f116 3.0 2022-03-24 08:37:06 +08:00
monitor1394
6cb3709655 3.0 2022-03-21 08:21:16 +08:00
monitor1394
ab21d97029 3.0 2022-03-21 08:06:31 +08:00
monitor1394
2dfda6c0ca 3.0 2022-03-21 07:42:32 +08:00
monitor1394
59896d2323 3.0 2022-03-20 21:37:17 +08:00
monitor1394
da611012da 3.0 2022-03-20 20:58:17 +08:00
monitor1394
1ba362ad11 3.0 2022-03-20 19:08:08 +08:00
monitor1394
c510831f59 3.0 2022-03-20 18:52:50 +08:00
monitor1394
4e24ba7922 3.0 2022-03-18 08:23:17 +08:00
monitor1394
407b3625d7 3.0 2022-03-16 13:41:26 +08:00
monitor1394
d6c45aaf6b 3.0 2022-03-09 08:23:15 +08:00
monitor1394
115a47a5df 3.0 2022-03-09 08:18:59 +08:00
monitor1394
7582a76d1f 3.0 2022-03-09 07:26:15 +08:00
monitor1394
5745fea9a1 3.0 - optimize code 2022-03-04 22:17:32 +08:00
monitor1394
1ee0df09eb 3.0 - inspector 2022-02-25 08:10:09 +08:00
monitor1394
e72349a69f 3.0 - namespace 2022-02-19 22:37:57 +08:00
monitor1394
ce5aeb2d98 3.0 - guage chart 2022-02-19 17:35:22 +08:00
monitor1394
a19b796a02 3.0 - tooltip 2022-02-12 20:10:29 +08:00
monitor1394
cc4ee3735c 3.0 - polar chart 2022-01-26 20:47:14 +08:00
monitor1394
a32f5f5bcf 3.0 - liquid chart and ring chart 2022-01-22 22:58:55 +08:00
monitor1394
d9840bef52 3.0 - radar chart 2022-01-22 21:08:26 +08:00
monitor1394
a8b2068029 3.0 - scatter chart and candlestick chart 2022-01-16 22:16:33 +08:00
monitor1394
c9addaf02c 3.0 - bar chart 2022-01-13 21:45:59 +08:00
monitor1394
0282dae582 compatibility 2022-01-07 09:48:59 +08:00
monitor1394
228a4b2840 3.0 - unitypackage 2022-01-05 21:40:48 +08:00
monitor1394
c160867765 3.0 - optimize vert 2022-01-05 07:46:30 +08:00
monitor1394
d20f27b610 3.0 - simplified serie 2021-12-31 13:00:17 +08:00
monitor1394
3a41f1e00e 3.0 - serie extra component 2021-12-28 08:18:24 +08:00
monitor1394
90cb25b74f 3.0 - cleanup code 2021-12-24 13:33:09 +08:00
monitor1394
fa3137eb55 3.0 - remove gauge chart to extension 2021-12-24 07:38:10 +08:00
monitor1394
18ed060c67 3.0 - interaction 2021-12-23 13:23:18 +08:00
monitor1394
761ae595c2 3.0 - tooltip 2021-12-19 20:53:55 +08:00
monitor1394
0aa476e757 3.0 - animation 2021-12-12 18:05:26 +08:00
monitor1394
9c69774d35 3.0 - bar chart 2021-12-11 18:26:28 +08:00
monitor1394
081cd4b503 3.0 - serie clone and covert 2021-12-09 21:35:23 +08:00
monitor1394
cd1a36cc18 3.0 - serie data context 2021-12-09 07:12:15 +08:00
monitor1394
6109b62eb7 3.0 - serie context 2021-12-08 13:36:02 +08:00
monitor1394
a5469c0996 3.0 - LineChart 2021-12-08 08:31:32 +08:00
monitor1394
f39cddaa5e 3.0 - ParallelChart 2021-11-28 20:31:41 +08:00
monitor1394
1b3fa7fb43 3.0 commit 2021-11-23 13:20:07 +08:00
monitor1394
d87e0f8267 Fixed the problem of displaying exceptions after adding data again when DataZoom is enable (#163) 2021-08-16 14:47:02 +08:00
monitor1394
3590d1ebbc Improved Axis's AxisLabel text rotate setting to avoid inconsistency offset in DataZoom (#163) 2021-08-15 22:35:27 +08:00
monitor1394
6fae151c8e Added Legend's textAutoColor to set the text color match with Serie color (#163) 2021-08-14 15:05:37 +08:00
monitor1394
92ee57baf8 优化BarChart设置Corner时正负柱条圆角对称 2021-08-12 22:16:00 +08:00
monitor1394
b5098d5682 优化Serie的数据全为0时Y轴不显示的问题 2021-08-03 08:23:23 +08:00
monitor1394
a4963435d7 修复Serie开启ignore时被忽略的数据还会参与计算的问题 (#161) 2021-07-29 08:28:07 +08:00
monitor1394
25972f0382 完善BarChartZebra斑马柱图渐变支持 2021-07-29 08:27:59 +08:00
monitor1394
708b08e701 修复TextMeshPro Enable时找不到XCharts路径的问题 (#160) 2021-07-26 21:29:13 +08:00
monitor1394
f69aa1d232 v2.3.0 2021-07-24 09:31:40 +08:00
monitor1394
bdd53bbe24 完善SerieSymbol以支持象形柱图PictorialBarChart扩展 2021-07-22 08:11:12 +08:00
monitor1394
b20e768cd1 修复WdbGL平台上Tooltip不显示的问题 2021-07-19 08:23:39 +08:00
monitor1394
4de732a369 增加SerieiconStyle统一配置图标 2021-07-18 14:16:06 +08:00
monitor1394
f87c8445f9 MarkLine优化 2021-07-16 08:31:10 +08:00
monitor1394
8d6d4ce0c5 增加MarkLine标线 (#142) 2021-07-15 21:18:23 +08:00
monitor1394
5238689baa 优化BarChart可通过serieData.show设置是否显示柱条 2021-07-09 06:50:19 +08:00
monitor1394
6f39e692ef 优化数据存储类型由float全部转为double 2021-07-08 07:20:06 +08:00
monitor1394
e873709443 修复ChartLabel在TMP下异常报错的问题 2021-07-08 07:04:46 +08:00
monitor1394
8d4a65a002 修复PieChartavoidLabelOverlap参数不生效的问题 2021-07-05 07:12:20 +08:00
monitor1394
32a8fed625 修复PieChart选中扇区后鼠标区域指示不准确的问题 2021-07-04 21:16:30 +08:00
monitor1394
1fccc25873 优化SerieLabel 2021-07-04 20:38:26 +08:00
monitor1394
0621845e5a 增加DataZoomsupportInsideScrollsupportInsideDrag参数设置坐标系内是否支持滚动和拖拽 2021-07-01 07:38:06 +08:00
monitor1394
18391881d7 整理代码 2021-07-01 07:35:55 +08:00
monitor1394
0e1d5cc81d 确保XChartsMgr只有一个 2021-06-28 07:23:44 +08:00
monitor1394
78a83238f7 增加AxisLabelshowStartLabelshowEndLabel参数设置首尾的Label是否显示 2021-06-27 21:45:17 +08:00
monitor1394
05f21f2d02 增加AxisLabel和SerieLabel的formatter委托方法 #145 2021-06-27 12:26:20 +08:00
monitor1394
bcb30f3c82 增加更新Axis数据和图标的接口 2021-06-27 12:21:56 +08:00
monitor1394
470da8f975 增加DataZoomorient参数设置水平或垂直样式 2021-06-27 12:20:03 +08:00
monitor1394
8c83e828bf 接口优化 2021-06-26 21:45:56 +08:00
monitor1394
a91d190d85 增加IconStyleautoHideWhenLabelEmpty参数设置当label为空时是否自动隐藏图标 2021-06-21 07:08:59 +08:00
monitor1394
e9e7371213 v2.2.3 2021-06-20 17:05:15 +08:00
monitor1394
9349900ea5 v2.2.2 2021-06-18 06:48:11 +08:00
monitor1394
0ae9be9c63 v2.2.1 2021-06-13 12:10:50 +08:00
monitor1394
953bea6962 完善对多屏幕的支持 2021-06-13 11:50:41 +08:00
monitor1394
1f676c431a 增加IconStylealign参数设置图标的水平对齐 2021-06-12 19:46:57 +08:00
monitor1394
f953a069cb 优化主题Theme的导入和字体自动刷新 (#148) 2021-06-12 14:32:23 +08:00
monitor1394
442206dad8 修复Unity版本兼容问题 (#154) 2021-06-10 12:54:13 +08:00
monitor1394
8dd3ef2a63 增加runtimeSortedData用于排序数据 2021-06-09 07:26:03 +08:00
monitor1394
44110feaaf Improved Candlestickchart support for inverse (#152) 2021-06-05 09:56:40 +08:00
monitor1394
a42c1845d6 优化自定义主题Theme的自动刷新 (#148) 2021-06-05 09:56:00 +08:00
monitor1394
d233f64a68 修复Gauge在最小值为负数时指针指示位置异常的问题 2021-06-04 23:08:34 +08:00
monitor1394
055d3806d8 默认关闭TextLimit 2021-06-04 07:56:01 +08:00
monitor1394
b4f6bd7248 v2.2.0 2021-05-30 20:17:45 +08:00
monitor1394
fb49b2f46a 调整订阅服务 2021-05-30 20:09:32 +08:00
monitor1394
f1a14830b7 增加漏斗图基础代码支持 2021-05-29 22:07:09 +08:00
monitor1394
b849633110 修复DataZoom报错 2021-05-27 21:11:14 +08:00
monitor1394
f656cba56b 优化代码 2021-05-25 23:45:15 +08:00
monitor1394
6872d42f2e 完善TextStylealignment的支持 (#150) 2021-05-25 08:06:32 +08:00
monitor1394
93e376bdbf 修复PieChart数据全为0Label无法正常显示的问题 2021-05-24 21:35:53 +08:00
monitor1394
efc82d01a7 修复Add Serie面板上Serie Name不生效的问题 (#149) 2021-05-24 07:28:45 +08:00
monitor1394
057376882d 增加Axis的图标、自动换行、自定义长宽的支持 2021-05-24 07:17:54 +08:00
monitor1394
d92640c49b 优化DataZoom 2021-05-22 15:29:55 +08:00
monitor1394
bc25663db4 增加SerieAxisinsertDataToHead参数控制数据插入头部还是尾部 2021-05-21 07:24:02 +08:00
monitor1394
d9f99e0d27 serie增加自定义参数 2021-05-20 21:51:52 +08:00
monitor1394
0c549bf23b 优化Editor下的图表创建 #147 2021-05-18 13:10:29 +08:00
monitor1394
4de87fd358 修复Tooltip不触发的问题 2021-05-18 09:29:03 +08:00
monitor1394
01b77ccb55 修复CoordinateChart的tooltip报错 2021-05-18 08:34:11 +08:00
monitor1394
e2aec83de2 CandlestickChart加入菜单栏 #146 2021-05-18 00:06:56 +08:00
monitor1394
d5c8b296a7 修复PieChart的Tooltip高亮不会还原的问题 2021-05-18 00:06:15 +08:00
monitor1394
f2c944baa9 修复BarChart在水平布局时clip不生效的问题 2021-05-18 00:05:12 +08:00
monitor1394
7070c5caa7 移除GanttChart 2021-05-17 12:51:48 +08:00
monitor1394
f2b7cfd40b 修复DataZoom报错 2021-05-17 12:29:28 +08:00
monitor1394
79a02e5594 抽离甘特图 2021-05-16 23:38:06 +08:00
monitor1394
a88b1979d8 重构VisualMap和DataZoom 2021-05-13 09:38:32 +08:00
monitor1394
c1f604f1b6 修复TMP下Theme不显示TMPFont的问题 #143 2021-05-11 21:00:26 +08:00
monitor1394
cb29b38e1c 修复散点图会显示图表外的点的问题 2021-05-11 20:53:09 +08:00
monitor1394
6bee9b20dd VisualMap支持Piecewise类型 2021-05-10 12:45:58 +08:00
monitor1394
6e35907f46 修复RingChart无法设置环形的背景色的问题 #141 2021-05-10 08:27:43 +08:00
monitor1394
44d67151ee 优化Log轴显示极小浮点数 2021-05-08 13:01:46 +08:00
monitor1394
2f98f6a486 增加LiquidChart的方形水位图支持 2021-05-08 09:42:25 +08:00
monitor1394
53085b01b6 优化Axis的刻度表现 #135 2021-05-07 08:35:49 +08:00
monitor1394
424577ca4d 增加Settings中关于关于材质球设置的参数 #140 2021-05-01 22:43:17 +08:00
monitor1394
636df6ebd6 修复无法正确表示部分超大或超小数值的问题 2021-05-01 20:21:31 +08:00
monitor1394
e28c730c21 优化代码,更好的支持自定义图表 2021-04-30 13:10:19 +08:00
monitor1394
3d457bb681 增加Custom类型的Serie的tooltip自定义 2021-04-29 19:57:07 +08:00
monitor1394
fdd6ab0063 修复Radar切换到Circle异常的问题 #139 2021-04-29 19:43:42 +08:00
monitor1394
13a81b8374 修复Log轴时绘制异常的问题 2021-04-29 19:17:12 +08:00
monitor1394
11fc9d15a2 增加SettingsreversePainter可设置Serie的绘制是否逆序 2021-04-29 07:30:42 +08:00
monitor1394
bf82904e66 增加SerieDataignore可忽略当前数据项 2021-04-28 19:28:05 +08:00
monitor1394
3c58396c1f Fixed bug where AxisLabel displayed incorrectly with DataRoom (#138) 2021-04-28 07:00:23 +08:00
monitor1394
6291fd27b0 优化代码,更好的支持自定义图表 2021-04-28 06:56:28 +08:00
monitor1394
59f1fda131 优化代码,更好的支持自定义图表 2021-04-27 12:47:46 +08:00
monitor1394
8a8f352bad Fixed dynamically creating chart at runtime would be abnormal 2021-04-26 19:37:02 +08:00
monitor1394
20ea9e2620 增加BarChart绘制渐变边框的支持 2021-04-26 07:17:26 +08:00
monitor1394
05f0002ef4 ignore obj folder 2021-04-23 07:29:06 +08:00
monitor1394
3507434e7a 增加对自定义Chart的支持 2021-04-22 18:55:56 +08:00
monitor1394
7c762b4455 修复Gauge的AxisLabel文字颜色无法修改的问题 2021-04-22 07:29:08 +08:00
monitor1394
6220b6af6f 取消GaugeAxis的m_SplitLineLength参数忽略 2021-04-22 07:09:47 +08:00
monitor1394
63f054493a 完善多坐标轴的支持 #132 2021-04-14 08:59:03 +08:00
monitor1394
cd35d00e06 v2.1.1 2021-04-13 20:56:33 +08:00
monitor1394
0bc5a24595 整理代码 2021-04-13 10:12:02 +08:00
monitor1394
ce08b0f81e 兼容unity5.6 2021-04-13 09:57:33 +08:00
monitor1394
5aa90274dc 处理unity版本兼容 2021-04-12 19:31:26 +08:00
monitor1394
4b40604a27 fiexd missing class attribute ExtensionOfNativeClass #131 2021-04-12 12:55:22 +08:00
monitor1394
adfc15efd8 unity版本兼容 2021-04-08 19:30:23 +08:00
monitor1394
1e43fc7283 v2.1.0 2021-04-07 20:30:40 +08:00
monitor1394
a2307d9c21 更新Doc 2021-04-02 12:46:29 +08:00
monitor1394
2bec0f1178 优化Theme 2021-04-02 12:41:42 +08:00
monitor1394
c19870444e 优化demo 2021-04-02 12:41:15 +08:00
monitor1394
d423ad6c9e 优化Theme 2021-04-01 12:13:51 +08:00
monitor1394
9c96fbb604 优化Theme 2021-04-01 08:14:04 +08:00
monitor1394
d6caeb585e 优化和重构Theme,解决引用相同或丢失的问题 #118 2021-03-31 21:17:29 +08:00
monitor1394
e23f8b4a96 更新demo 2021-03-30 20:50:03 +08:00
monitor1394
fbeca8f442 更新文档 2021-03-30 20:49:27 +08:00
monitor1394
aebbfaac83 优化Tooltip支持设置不同的类目轴数据 #129 2021-03-30 20:24:12 +08:00
monitor1394
e26220ef93 优化自定义绘制回调接口 2021-03-29 20:28:53 +08:00
monitor1394
ed93fc3005 优化自定义绘制回调接口 2021-03-29 20:27:21 +08:00
monitor1394
ac64bd9435 增加GanttChart甘特图 2021-03-25 12:55:52 +08:00
monitor1394
6a548899fa 修复增删XY轴时可能异常的问题 2021-03-22 20:32:19 +08:00
monitor1394
ddea85d9f0 增加ThemeUnbind按钮用于解绑复制图表时的主题 #118 2021-03-22 03:26:16 +08:00
monitor1394
e8a725fb05 修复InspectorFoldout后的勾选框无法选中的问题 2021-03-18 20:15:40 +08:00
monitor1394
09c32f171d 修复BarChart0 数值时显示异常的问题 2021-03-18 19:25:36 +08:00
monitor1394
457db21751 修复Tooltip的指示器在某些情况下指示位置不准的问题 2021-03-14 05:23:08 +08:00
monitor1394
e06393a22f 修复DataZoom多生成了一个组件的问题 2021-03-14 04:45:19 +08:00
monitor1394
e182827509 优化K线图的Tooltip 2021-03-14 04:44:31 +08:00
monitor1394
234b5ecfa6 优化MultiComponentMode开启后的编辑体验和组件刷新 #128 2021-03-13 04:21:52 +08:00
monitor1394
b7b8d37ecd 优化多条k线图显示 2021-03-12 07:16:20 +08:00
monitor1394
5d19466fdc 增加CandlestickChartK线图 #124 2021-03-10 13:05:31 +08:00
monitor1394
7d46feb1a5 UGL接口优化 2021-03-10 13:05:23 +08:00
monitor1394
7169fdc8ae 修复DataZoom异常 2021-03-10 13:05:15 +08:00
monitor1394
db9e0659f3 Merge branch 'develop' 2021-03-06 08:53:15 +08:00
monitor1394
00057788ab update doc 2021-03-06 08:52:15 +08:00
monitor1394
117ab9e31a 增加PieChartminAngle参数支持设置最小扇区角度 #117 2021-03-06 08:25:43 +08:00
monitor1394
404430e4b2 增加Legend几种内置图标的支持 #90 2021-03-05 08:56:55 +08:00
monitor1394
0d53fa91ff 优化TMP的Enable和Disable 2021-03-04 07:30:29 +08:00
monitor1394
b3037f0818 增加DataZoom对数值轴的支持 #71 2021-03-02 09:16:53 +08:00
monitor1394
9fe8b762b6 Fixed display exception of hidden gameObjects when enabling and disabling a chart #125 2021-03-01 10:07:40 +08:00
monitor1394
0a2751b220 修复启用TMP时编译报错的问题 #125 2021-02-27 05:01:26 +08:00
1100 changed files with 47107 additions and 1625586 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ['https://www.paypal.me/monitor1394','https://github.com/XCharts-Team/XCharts/blob/master/Documentation/res/alipay.png','https://github.com/XCharts-Team/XCharts/blob/master/Documentation/res/wechat.png']

19
.gitignore vendored
View File

@@ -1,25 +1,6 @@
/.vs
/.vscode
.vs
/XCharts-ios
/Library
/Temp
/Logs
/UnityPackageManager
/Packages
/ProjectSettings/XRSettings.asset
/Assets/Res
/Assets/Res.meta
/Assets/Package
/Assets/Package.meta
/Assets/TextMesh Pro
/Assets/TextMesh Pro.meta
/Doc/*.meta
/Assets/XChartsDemo/demo_test.unity
/Assets/XChartsDemo/demo_test.unity.meta
/Assets/XChartsDemo/empty.unity
/Assets/XChartsDemo/empty.unity.meta
*.sln
*.csproj

View File

@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 3e77b3cfd5a4d2646964841d2b14dcb2
folderAsset: yes
timeCreated: 1536101212
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,138 +0,0 @@
# XCharts API
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts问答](XCharts问答.md)
## `BaseChart`
* `BaseChart.theme`:主题组件`ThemeInfo`
* `BaseChart.title`:标题组件`Title`
* `BaseChart.legend`:图例组件`Legend`
* `BaseChart.tooltip`:提示框组件`Tooltip`
* `BaseChart.series`:系列列表`Series`
* `BaseChart.chartName`:图表的别称。
* `BaseChart.chartWidth`:图表的宽。
* `BaseChart.chartHeight`:图表的高。
* `BaseChart.forceOpenRaycastTarget`:强制开启鼠标事件检测。一般不用手动设置,内部会自动判断是否需要检测。
* `BaseChart.onCustomDraw`:自定义绘制回调。
* `BaseChart.onPointerClick`:鼠标点击回调。
* `BaseChart.onPointerDown`:鼠标按下回调。
* `BaseChart.onPointerUp`:鼠标弹起回调。
* `BaseChart.onPointerEnter`:鼠标进入图表回调。
* `BaseChart.onPointerExit`:鼠标退出图表回调。
* `BaseChart.onBeginDrag`:鼠标开始拖拽回调。
* `BaseChart.onDrag`:鼠标拖拽回调。
* `BaseChart.onEndDrag`:鼠标结束拖拽回调。
* `BaseChart.onScroll`:鼠标滚动回调。
* `BaseChart.onPointerClickPie`:点击柱条回调。参数:`eventData`, `serieIndex`, `dataIndex`
* `BaseChart.SetSize(float width, float height)` 设置图表的宽高在非stretch pivot下才有效其他情况需要自己调整RectTransform
* `BaseChart.ClearData()`:清除所有数据,系列列表会保留,只是移除列表中系列的数据。
* `BaseChart.RemoveData()`:清除所有系列和图例数据,系列列表也会被清除。
* `BaseChart.RemoveData(string serieName)`:清除指定系列名称的数据。
* `BaseChart.AddSerie(SerieType type, string serieName = null, bool show = true)`:添加一个系列到系列列表中。
* `BaseChart.AddData(string serieName, float data, string dataName = null)`:添加一个数据到指定的系列中。
* `BaseChart.AddData(int serieIndex, float data, string dataName = null)`:添加一个数据到指定的系列中。
* `BaseChart.AddData(string serieName, List<float> multidimensionalData, string dataName = null)`:添加多维数据`x,y,z...`到指定的系列中。
* `BaseChart.AddData(int serieIndex, List<float> multidimensionalData, string dataName = null)`:添加多维数据`x,y,z...`到指定的系列中。
* `BaseChart.AddData(string serieName, float xValue, float yValue, string dataName)`:添加`x,y`数据到指定系列中。
* `BaseChart.AddData(int serieIndex, float xValue, float yValue, string dataName = null)`:添加`x,y`数据到指定系列中。
* `BaseChart.UpdateData(string serieName,int dataIndex, float value)`:更新指定系列中的指定索引数据。
* `BaseChart.UpdateData(int serieIndex,int dataIndex, float value)`:更新指定系列中的指定索引数据。
* `BaseChart.UpdateData(string serieName, int dataIndex, List<float> multidimensionalData)`:更新指定系列指定索引的数据项的多维数据。
* `BaseChart.UpdateData(int serieIndex, int dataIndex, List<float> multidimensionalData)`:更新指定系列指定索引的数据项的多维数据。
* `BaseChart.UpdateData(string serieName, int dataIndex, int dimension, float value)`更新指定系列指定索引指定维数的数据。维数从0开始。
* `BaseChart.UpdateData(int serieIndex, int dataIndex, int dimension, float value)`更新指定系列指定索引指定维数的数据。维数从0开始。
* `BaseChart.UpdateDataName(string serieName,int dataIndex, string dataName)`:更新指定系列中的指定索引数据名称。
* `BaseChart.UpdateDataName(int serieIndex, int dataIndex, string dataName)`:更新指定系列中的指定索引数据名称。
* `BaseChart.SetActive(string serieName, bool active)`:设置指定系列是否显示。
* `BaseChart.SetActive(int serieIndex, bool active)`:设置指定系列是否显示。
* `BaseChart.IsActive(string serieName)`:获取指定系列是否显示。
* `BaseChart.IsActive(int serieIndex)`:获取指定系列是否显示。
* `BaseChart.IsActiveByLegend(string legendName)`:获得指定图例名字的系列是否显示。
* `BaseChart.RefreshChart()`:在下一帧刷新图表。
* `BaseChart.RefreshLabel()`:在下一帧刷新文本标签。
* `BaseChart.RefreshTooltip()`:立即刷新`Tooltip`组件。
* `BaseChart.UpdateTheme(Theme theme)`:切换图表主题。
* `BaseChart.AnimationEnable(bool flag)`:启用或关闭动画。
* `BaseChart.AnimationFadeIn()`:渐入动画。
* `BaseChart.AnimationFadeOut()`:渐出动画。
* `BaseChart.AnimationPause()`:暂停动画。
* `BaseChart.AnimationResume()`:继续动画。
* `BaseChart.AnimationReset()`:重置动画。
* `BaseChart.ClickLegendButton(int legendIndex, string legendName, bool show)`:点击图例按钮。
* `BaseChart.IsInChart(Vector2 local)`:坐标是否在图表范围内。
* `BaseChart.IsInChart(float x, float y)`:坐标是否在图表范围内。
* `BaseChart.EnableBackground(bool flag)`:开启背景组件。背景组件在`chart`受上层布局控制时无法开启。
## `CoordinateChart`
* `CoordinateChart.grid`:网格组件 `Grid`
* `CoordinateChart.xAxes`:左右两个 `X` 轴组件 `XAxis`
* `CoordinateChart.yAxes`:左右两个 `Y` 轴组件 `YAxis`
* `CoordianteChart.xAxis0`X轴
* `CoordianteChart.xAxis1`X轴
* `CoordianteChart.xAxis0`Y轴
* `CoordianteChart.yAxis1`Y轴
* `CoordinateChart.dataZoom`:区域缩放组件 `DataZoom`
* `CoordinateChart.ClearAxisData()`清除所有x轴和y轴的类目数据。
* `CoordinateChart.AddXAxisData(string category, int xAxisIndex = 0)`:添加一个类目数据到指定的 `X` 轴。
* `CoordinateChart.AddYAxisData(string category, int yAxisIndex = 0)`:添加一个类目数据到指定的 `Y` 轴。
* `CoordinateChart.IsValue()`:是否是纯数值坐标。
* `CoordinateChart.RefreshDataZoom()`在下一帧刷新DataZoom组件。
* `CoordinateChart.RefreshAxisMinMaxValue()`:立即刷新数值坐标轴的最大最小值(更新坐标轴标签并触发重绘)。
* `CoordinateChart.IsInCooridate(Vector2 local)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(Vector3 local)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(float x, float y)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(Vector2 local)`:坐标是否在坐标轴内。
* `CoordinateChart.ClampInGrid(grid, Vector3 pos)`:将坐标限制在坐标系内。
* `CoordinateChart.CovertXYAxis(int index)`转换X轴和Y轴的配置。
* `CoordinateChart.UpdateCoordinate()`:更新坐标系原点和宽高。一般内部会自动更新,也可强制更新。
* `CoordinateChart.SetMaxCache(int maxCache)`:设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。
## `LineChart`
* 继承 `BaseChart`
* 继承自 `CoordinateChart`
## `BarChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
* `BarChart.onPointerClickBar`:点击柱条回调。参数:`eventData`, `dataIndex`
## `RadarChart`
* 继承自 `BaseChart`
* `RadarChart.radars`:雷达坐标系组件列表 `Radar`
* `RadarChart.RemoveRadar()`:移除所有雷达坐标系组件。
* `RadarChart.AddRadar(Radar radar)`:添加雷达坐标系组件。
* `RadarChart.AddRadar(Radar.Shape shape, Vector2 center, float radius, int splitNumber = 5,float lineWidth = 0.6f, bool showIndicator = true, bool showSplitArea = true)`:添加雷达坐标系组件。
* `RadarChart.AddIndicator(int radarIndex, string name, float min, float max)`:添加指示器。
* `RadarChart.UpdateIndicator(int radarIndex, int indicatorIndex, string name, float min, float max)`:更新指示器。
* `RadarChart.GetRadar(int radarIndex)`:获得指定索引的雷达坐标系组件。
* `RadarChart.GetIndicator(int radarIndex, int indicatorIndex)`:获得指定雷达坐标系组件指定索引的指示器。
## `ScatterChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
## `HeatmapChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
## `RingChart`
* 继承自 `BaseChart`
* `RingChart.UpdateMax(int serieIndex, int dataIndex, float value)`:更新指定系列执行数据项的最大值。
* `RingChart.UpdateMax(int serieIndex, float value)`:更新指定系列的所有数据项的最大值。
* `RingChart.UpdateMax(float value)`:更新第一个系列第一个数据项的最大值。
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts问答](XCharts问答.md)

View File

@@ -1,976 +0,0 @@
# 配置项手册
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XChartsAPI接口](XChartsAPI.md)
[XCharts问答](XCharts问答.md)
主组件:
* [Axis 坐标轴](#XAxis)
* [Background 背景图](#Background)
* [DataZoom 区域缩放](#DataZoom)
* [Grid 网格](#Grid)
* [Legend 图例](#Legend)
* [Polar 极坐标](#Polar)
* [Radar 雷达](#Radar)
* [Series 系列](#Series)
* [Serie-Line 折线图](#Serie-Line)
* [Serie-Bar 柱形图](#Serie-Bar)
* [Serie-Pie 饼图](#Serie-Pie)
* [Serie-Radar 雷达图](#Serie-Radar)
* [Serie-Scatter 散点图](#Serie-Scatter)
* [Serie-Heatmap 热力图](#Serie-Heatmap)
* [Serie-Gauge 仪表盘](#Serie-Gauge)
* [Serie-Ring 环形图](#Serie-Ring)
* [Serie-Liquid 水位图](#Serie-Liquid)
* [Settings 设置](#Settings)
* [Theme 主题](#Theme)
* [Tooltip 提示框](#Tooltip)
* [Vessel 容器](#Vessel)
* [Title 标题](#Title)
* [VisualMap 视觉映射](#VisualMap)
子组件:
* [AreaStyle 区域填充样式](#AreaStyle)
* [AxisLabel 坐标轴刻度标签](#AxisLabel)
* [AxisLine 坐标轴轴线](#AxisLine)
* [AxisName 坐标轴名称](#AxisName)
* [AxisSplitLine 坐标轴分割线条](#AxisSplitLine)
* [AxisSplitArea 坐标轴分割区域](#AxisSplitArea)
* [AxisTick 坐标轴刻度](#AxisTick)
* [Emphasis 高亮样式](#Emphasis)
* [ItemStyle 数据项样式](#ItemStyle)
* [LineArrow 折线图箭头](#LineArrow)
* [LineStyle 折线图样式](#LineStyle)
* [Location 位置](#Location)
* [SerieAnimation 动画](#SerieAnimation)
* [SerieData 数据项](#SerieData)
* [SerieLabel 图形上的文本标签](#SerieLabel)
* [SerieSymbol 图形标记](#SerieSymbol)
* [TextLimit 文本自适应](#TextLimit)
* [TextStyle 文本样式](#TextStyle)
## `Theme`
主题组件。主题用来配置图表的全局配色等其他参数。
相关参数:
* `theme`:内置主题类型。有`Default``Light``Dark`三种可选内置主题。
* `font`:所有文字的通用字体。
* `backgroundColor`:图表背景颜色。
* `titleTextColor`:主题的主标题文字颜色。
* `titleSubTextColor`:主题的副标题文字颜色。
* `legendTextColor`:图例的激活时文字颜色。
* `legendUnableColor`:图例的非激活时文字颜色。
* `axisTextColor`:坐标轴的文字颜色。
* `axisLineColor`:坐标轴的轴线颜色。
* `axisSplitLineColor`:坐标轴的分割线颜色,默认和轴线颜色一致。
* `tooltipBackgroundColor`:提示框的背景颜色。
* `tooltipFlagAreaColor`:提示框的阴影指示器的颜色。
* `tooltipTextColor`:提示框的文字颜色。
* `tooltipLabelColor`:提示框的十字指示器坐标轴标签的背景颜色。
* `tooltipLineColor`:提示框的指示线的颜色。
* `dataZoomTextColor`:区域缩放的文字颜色。
* `dataZoomLineColor`:区域缩放的线条颜色。
* `dataZoomSelectedColor`:区域缩放的选中区域颜色。
* `colorPalette`:调色盘颜色列表。如果系列没有设置颜色,则会依次循环从该列表中取颜色作为系列颜色。
相关接口:
* `GetColor(int index)`:获得调色盘对应系列索引的颜色值。
* `GetColorStr(int index)`:获得指定系列索引的十六进制颜色值字符串。
* `GetColor(string hexColorStr)`将字符串颜色值转成Color。
## `Title`
标题组件,包含主标题和副标题。
相关参数:
* `show`:是否显示标题组件。
* `text`:主标题文本,支持使用 `\n` 换行。
* `textStyle`:主标题文本样式 [TextStyle](#TextStyle)。
* `subText`:副标题文本,支持使用 `\n` 换行。
* `subTextStyle`:副标题文本样式 [TextStyle](#TextStyle)。
* `itemGap`:主副标题之间的间距。
* `location`:标题显示位置 [Location](#Location)。
## `TitleStyle`
标题样式。
* `show`:是否显示标题组件。
* `rotate`:旋转。
* `offset`:偏移。
* `color`:颜色。
* `fontSize`:字体大小。
* `fontStyle`:字体风格。
## `Legend`
图例组件。图例组件展现了不同系列的标记,颜色和名字。可以通过点击图例控制哪些系列不显示。
相关参数:
* `show`:是否显示图例组件。
* `selectedMode`:选择模式。控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 `None` 关闭。有以下三种选择方式:
* `Multiple`:多选。
* `Single`:单选。
* `None`:无法选择。
* `orient`:布局方式是横还是竖。
* `Horizonal`:水平。
* `Vertical`:垂直。
* `location`:图例的显示位置 [Location](#Location)。
* `itemWidth`:图例标记的图形宽度。
* `itemHeight`:图例标记的图形高度。
* `itemGap`:图例每项之间的间隔。横向布局时为水平间隔,纵向布局时为纵向间隔。
* `itemAutoColor`:图例标记的图形是否自动匹配颜色。
* `formatter`:图例内容字符串模版格式器。支持用 `\n` 换行。模板变量为图例名称 `{name}`
* `data`:图例的数据数组。数组项通常为一个字符串,每一项代表一个系列的 `name`(如果是饼图,也可以是饼图单个数据的 `name`)。如果 `data` 没有被指定,会自动从当前系列中获取。指定 `data` 时里面的数据项和 `serie` 匹配时才会生效。
* `icons`:自定义的图例标记图形。
* `textStyle`:图例的内容文本样式 [TextStyle](#TextStyle)。
相关接口:
* `ClearData()`:清空数据。
* `ContainsData(string name)`:是否包括指定名字的图例。
* `RemoveData(string name)`:移除指定名字的图例。
* `AddData(string name)`:添加图例项。
* `GetData(int index)`:获得指定索引的图例。
* `GetIndex(string legendName)`:获得指定图例的索引。
## `Polar`
极坐标系组件。极坐标系,可以用于散点图和折线图。每个极坐标系拥有一个角度轴和一个半径轴。
相关参数:
* `show`:是否显示直角坐标系网格。
* `center`极坐标的中心点。数组的第一项是横坐标第二项是纵坐标。当值为0-1之间时表示百分比设置成百分比时第一项是相对于容器宽度第二项是相对于容器高度。
* `radius`:极坐标的半径。
* `backgroundColor`:极坐标的背景色,默认透明。
## `Radar`
* `shape`:雷达图绘制类型。
* `Polygon`:多边形。
* `Circle`:圆形。
* `positionType`:显示位置类型。
* `Vertice`:显示在顶点处。
* `Between`:显示在顶点之间。
* `radius`:雷达图的半径。
* `center`雷达图的中心点。数组的第一项是横坐标第二项是纵坐标。当值为0-1之间时表示百分比设置成百分比时第一项是相对于容器宽度第二项是相对于容器高度。
* `ceilRate`最大最小值向上取整的倍率。默认为0时自动计算。
* `splitNumber`:分割段数。默认为 `5`
* `isAxisTooltip`是否Tooltip显示轴线上的所有数据。只对Mutiple类型的Radar有效。
* `splitLine`:分割线条 [AxisSplitLine](#AxisSplitLine)。
* `splitArea`:分割区域 [AxisSplitArea](#AxisSplitArea)。
* `indicator`:是否显示指示器。
* `indicatorGap`:指示器和雷达的间距。
* `indicatorList`指示器列表 [Radar.Indicator](#Radar.Indicator)。
## `Radar.Indicator`
* `name`:指示器名称。
* `max`:指示器的最大值,默认为 0 无限制。
* `min`:指示器的最小值,默认为 0 无限制。
* `textStyle`:文本样式 [TextStyle](#TextStyle)。
## `TextLimit`
* `enable`:是否启用文本自适应。默认为`true`
* `maxWidth`:设定最大宽度。默认为`0`表示自动获取,否则表示自定义。当文本的宽度大于该值进行裁剪。
* `gap`:两边留白像素距离。默认为`10`
* `suffix` 长度超出被裁剪后附加的后缀。默认为`...`
## `TextStyle`
* `rotate`:旋转。
* `offset`:偏移。
* `color`:颜色。
* `backgroundColor`:背景颜色。
* `font`:字体。
* `fontSize`:字体大小。
* `fontStyle`:字体风格。
* `lineSpacing`:行间距。
## `Tooltip`
提示框组件。
相关参数:
* `show`:是否显示提示框组件。
* `type`:提示框指示器类型。指示器类型有:
* `Line`:线性指示器。
* `Shadow`:阴影指示器。
* `None`:无指示器。
* `Corss`:十字准星指示器。坐标轴显示`Label`和交叉线。
* `formatter`:提示框内容字符串模版格式器。支持用 `\n` 换行。当`formatter`不为空时,优先使用`formatter`,否则使用`itemFormatter`
* 模板变量有`{.}``{a}``{b}``{c}``{d}`
* `{.}`为当前所指示或`index``0``serie`的对应颜色的圆点。
* `{a}`为当前所指示或`index``0``serie`的系列名`name`
* `{b}`为当前所指示或`index``0``serie`的数据项`serieData``name`,或者类目值(如折线图的`X`轴)。
* `{c}`为当前所指示或`index``0``serie``y`维(`dimesion``1`)的数值。
* `{d}`为当前所指示或`index``0``serie``y`维(`dimesion``1`)百分比值,注意不带`%`号。
* `{.1}`表示指定`index``1``serie`对应颜色的圆点。
* `{a1}``{b1}``{c1}`中的`1`表示指定`index``1``serie`
* `{c1:2}`表示索引为`1``serie`的当前指示数据项的第`3`个数据一个数据项有多个数据index为`2`表示第`3`个数据)。
* `{c1:2-2}`表示索引为`1``serie`的第`3`个数据项的第`3`个数据(也就是要指定第几个数据项时必须要指定第几个数据)。
* `{d1:2:f2}`表示单独指定了数值的格式化字符串为`f2`(不指定时用`numericFormatter`)。
* 示例:`"{a}:{c}"``"{a1}:{c1:f1}"``"{a1}:{c1:1f1}"`
* `titleFormatter`:提示框标题内容的字符串模版格式器。支持用 `\n` 换行。仅当`itemFormatter`生效时才有效。可以单独设置占位符`{i}`表示忽略不显示标题内容。
* `itemFormatter`:提示框单个`serie`或数据项内容的字符串模版格式器。支持用 `\n` 换行。当`formatter`不为空时,优先使用`formatter`,否则使用`itemFormatter`
* `numericFormatter`:标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式:`A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `fixedWidth`:固定宽度。当同时设置 `fixedWidth``minWidth` 时,`fixedWidth``minWidth` 优先级高。
* `fixedHeight`:固定高度。当同时设置 `fixedHeight``minHeight` 时,`fixedHeight``minHeight` 优先级高。
* `minWidth`:最小宽度。当同时设置 `fixedWidth``minWidth` 时,`fixedWidth``minWidth` 优先级高。
* `minHeight`:最小高度。当同时设置 f`ixedHeight``minHeight` 时,`fixedHeight``minHeight` 优先级高。
* `paddingLeftRight`:文字和边框的左右边距。
* `paddingTopBottom`:文字和边框的上下边距。
* `backgroundImage`:提示框的背景图。
* `ignoreDataShow``(since v2.0.1)`是否显示忽略数据在`tooltip`上。 [defaut: `false`]。
* `ignoreDataDefaultContent`:忽略数据的默认显示字符信息。
* `alwayShow`:是否触发后一直显示。
* `offset``(since v1.5.3)`提示框相对于鼠标位置的偏移。
* `lineStyle`:指示器线条样式 [LineStyle](#LineStyle)。
* `textStyle`:显示内容文本样式 [TextStyle](#TextStyle)。
## `Vessel`
容器组件。一般用于LiquidChart。
相关参数:
* `show`:是否显示容器组件。
* `shape`:容器形状。
* `shapeWidth`:容器的厚度。
* `gap`:间隙。容器和液体的间隙。
* `center`中心点。数组的第一项是横坐标第二项是纵坐标。当值为0-1之间时表示百分比设置成百分比时表示图表宽高最小值的百分比。
* `radius`:半径。
* `smoothness`:开启或关闭缩放区域功能。
* `backgroundColor`:背景色,默认透明。
* `color`:容器颜色。当`autoColor``false`时生效。
* `autoColor`:是否自动颜色。默认`true`。为`true`时颜色会和`serie`一致。
## `DataZoom`
区域缩放组件。用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。
目前只支持控制 `X` 轴。
相关参数:
* `enable`:开启或关闭缩放区域功能。
* `supportInside`:是否支持内置缩放。内置于坐标系中,可在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。
* `supportSlider`:是否支持滑动条缩放。有单独的滑动条,可在滑动条上进行缩放或漫游。
* ~~`filterMode`:数据过滤,暂未启用。支持以下几种类型:~~
* ~~`Filter`:当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只要有一个维度在数据窗口外,整个数据项就会被过滤掉。~~
* ~~`WeakFilter`:当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只有当全部维度都在数据窗口同侧外部,整个数据项才会被过滤掉。~~
* ~~`Empty`:当前数据窗口外的数据,被 设置为空。即 不会 影响其他轴的数据范围。~~
* ~~`None`:不过滤数据,只改变数轴范围。~~
* ~~`xAxisIndex`:控制哪一个 `x` 轴。~~
* ~~`yAxisIndex`:控制哪一个 `y` 轴。~~
* `showDataShadow`:是否显示数据阴影。数据阴影可以简单地反应数据走势。
* `showDetail`:是否显示 `detail`,即拖拽时候显示详细数值信息。
* `zoomLock`:是否锁定选择区域(或叫做数据窗口)的大小。如果设置为 `true` 则锁定选择区域的大小,也就是说,只能平移,不能缩放。
* ~~`realtime`:拖动时,是否实时更新系列的视图。如果设置为 `false`,则只在拖拽结束的时候更新。~~
* `backgroundColor`:组件的背景颜色。
* `selectedAreaColor`:框选区域颜色。
* `bottom`:组件离容器下侧的距离。
* `top`:组件离容器上侧的距离。
* `left`:组件离容器左侧的距离。
* `right`:组件离容器右侧的距离。
* `height`:组件高度。
* `rangeMode`:取值类型是取绝对值还是百分比。
* `Percent`:百分比。
* `start`数据窗口范围的起始百分比。范围是0 ~ 100。
* `end`数据窗口范围的结束百分比。范围是0 ~ 100。
* `scrollSensitivity`:缩放区域组件的敏感度。值越高每次缩放所代表的数据越多。
* `textStyle`:字体风格。
* `minShowNum`最小显示数据个数。当DataZoom放大到最大时最小显示的数据个数。
## `VisualMap`
视觉映射组件。用于进行『视觉编码』,也就是将数据映射到视觉元素(视觉通道)。
* `enable`:开启或关闭视觉映射功能。
* `show`:是否显示组件。如果设置为 `false`,不会显示,但是数据映射的功能还存在。
* `type`:组件类型。支持以下类型:
* `Continuous`:连续型。
* ~~`Piecewise`:分段型。~~
* ~~`selectedMode`:分段型的选择模式,支持以下模式:~~
* ~~`Multiple`:多选。~~
* ~~`Single`:单选。~~
* `autoMinMax`:自动设置`min``max`的值。
* `min`:允许的最小值。`autoMinMax``false`时必须指定。`[min, max]` 形成了视觉映射的『定义域』。
* `max`:允许的最大值。`autoMinMax``false`时必须指定。`[min, max]` 形成了视觉映射的『定义域』。
* `range`指定手柄对应数值的位置。range 应在 min max 范围内。
* ~~`text`:两端的文本,如 ['High', 'Low']。~~
* ~~`textGap`两端文字主体之间的距离单位为px。~~
* `splitNumber`对于连续型数据自动平均切分成几段默认为0时自动匹配inRange颜色列表大小。
* `calculable`:是否显示拖拽用的手柄(手柄能拖拽调整选中范围)。
* ~~`realtime`:拖拽时,是否实时更新。~~
* `itemWidth`:图形的宽度,即颜色条的宽度。
* `itemHeight`:图形的高度,即颜色条的高度。
* `borderWidth`边框线宽单位px。
* `dimension`:指定用数据的『哪个维度』,映射到视觉元素上。『数据』即 series.data。从1开始默认为0取 data 中最后一个维度。
* `hoverLink`:打开 hoverLink 功能时,鼠标悬浮到 visualMap 组件上时,鼠标位置对应的数值 在 图表中对应的图形元素,会高亮。
* `orient`:布局方式是横还是竖。
* `location`:组件显示在图表中的位置。
* `inRange`:定义 在选中范围中 的视觉颜色。
* ~~`outOfRange`:定义 在选中范围外 的视觉颜色。~~
## `Grid`
网格组件。直角坐标系内绘图网格,单个 `grid` 内最多可以放置上下两个 `X` 轴,左右两个 `Y` 轴。可以在网格上绘制折线图,柱状图,散点图。目前最多只能存在一个 `grid` 组件。
相关参数:
* `show`:是否显示直角坐标系网格组件。
* `left`:组件离容器左侧的距离。
* `right`:组件离容器右侧的距离。
* `top`:组件离容器顶部的距离。
* `bottom`:组件离容器底部的距离。
* `backgroundColor`:背景颜色。
## `GaugeAxis`
仪表盘坐标轴。
* `axisLine`:坐标轴轴线样式。
* `splitLine`:坐标轴分割线样式。
* `axisTick`:坐标轴刻度样式。
* `axisLabel`:坐标轴刻度标签样式。
* `axisLabelText`:坐标轴刻度标签自定义内容。当内容为空时,`axisLabel`根据刻度自动显示内容,否则取自该列表定义的内容。
## `GaugePointer`
仪表盘指针。
* `width`:指针宽度。
* `length`:指针长度。当为`0-1`的浮点数时表示相对仪表盘半径的百分比。
## `XAxis`
直角坐标系 `grid` 中的 `X` 轴。单个 `grid` 组件最多只能放上下两个 `X` 轴。两个 `X` 轴存储在 `xAxes` 中。
相关参数:
* `show`:是否显示 `X` 轴。默认 `xAxes[0]``true``xAxes[1]``false`
* `gridIndex`:坐标轴所在的 grid 的索引,默认位于第一个 grid。
* `type`:坐标轴类型。默认为 `Category`。支持以下类型:
* `Value`:数值轴,用于连续数据。
* `Category`:类目轴,适用于离散的类目数据,为该类型时必须通过 `data` 设置类目数据。
* `Log`:对数轴,适用于对数数据。
* `position`坐标轴在Grid中的位置`AxisPosition`。支持以下类型:
* `Left`:左边。
* `Right`:右边。
* `Bottom`:底部。
* `Top`:顶部。
* `offset`坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
* `logBaseE`:对数轴是否以自然数 `e` 为底数,为 `true``logBase` 失效,只在对数轴(`type:'Log'`)中有效。
* `logBase`:对数轴的底数,只在对数轴(`type:'Log'`)中有效。
* `minMaxType`:坐标轴刻度最大最小值显示类型。默认为 `Default`。有以下三种类型:
* `Default`0-最大值。
* `MinMax`:最小值-最大值。
* `Custom`:自定义的最小值-最大值。
* `min`:设定的坐标轴刻度最小值,当 `minMaxType``Custom` 时有效。
* `max`:设定的坐标轴刻度最大值,当 `minMaxType``Custom` 时有效。
* `ceilRate`最大最小值向上取整的倍率。默认为0时自动计算。
* `splitNumber`:坐标轴的分割段数。默认为 `5`。当 `splitNumber` 设为 `0` 时,表示绘制所有的类目数据。
* `interval`:强制设置坐标轴分割间隔。无法在类目轴中使用。设置该值时 `splitNumber` 无效。
* `boundaryGap`:坐标轴两边是否留白。默认为 `true`
* `maxCache`:类目数据中可缓存的最大数据量。默认为`0`没有限制大于0时超过指定值会移除旧数据再插入新数据。
* `inverse`:是否反向坐标轴。只在数值轴`Value`中有效。
* `data`:类目数据,在类目轴(`type: 'Category'`)中有效。
* `axisLine`:坐标轴轴线相关配置 [AxisLine](#AxisLine)。
* `axisName`:坐标轴名称相关配置 [AxisName](#AxisName)。
* `axisTick`:坐标轴刻度相关配置 [AxisTick](#AxisTick)。
* `axisLabel`:坐标轴刻度标签 [AxisLabel](#AxisLabel)。
* `splitLine`:坐标轴轴线坐标轴分割线 [AxisSplitLine](#SplitLine)。
* `splitArea`:坐标轴轴线坐标轴分割区域 [AxisSplitArea](#AxisSplitArea)。
相关接口:
* `ClearData()`:清空类目数据。
* `IsCategory()`:是否为类目轴。
* `IsValue()`:是否为数值轴。
* `AddData(string category, int maxDataNumber)`:添加一个类目到类目数据列表。
## `Background`
背景组件。
由于框架的局限性,背景组件使用有以下两个限制:
1`chart`的父节点不能有布局控制类组件。
2`chart`的父节点只能有当前`chart`一个子节点。
背景组件的开启需要通过接口来开启:`BaseChart.EnableBackground(bool flag)`
相关参数:
* `show`:是否显示启用背景组件。但能否激活背景组件还要受其他条件限制。
* `image`:背景图。
* `imageType`:背景图填充类型。
* `imageColor`背景图颜色。默认`white`
* `hideThemeBackgroundColor`:当背景组件启用时,是否隐藏主题中设置的背景色。
## `YAxis`
直角坐标系 `grid` 中的 `Y` 轴。单个 `grid` 组件最多只能放左右两个 `Y` 轴。两个 `Y` 轴存储在 `yAxes` 中。
相关参数:
* `show`:是否显示 `Y` 轴。默认 `yAxes[0]``true``yAxes[1]``false`
* `type`:坐标轴类型。默认为 `Value`。有以下两种类型:
* `Value`:数值轴,用于连续数据。
* `Category`:类目轴,适用于离散的类目数据,为该类型时必须通过 `data` 设置类目数据。
* `minMaxType`:坐标轴刻度最大最小值显示类型。默认为 `Default`。有以下三种类型:
* `Default`0-最大值。
* `MinMax`:最小值-最大值。
* `Custom`:自定义的最小值-最大值。
* `min`:设定的坐标轴刻度最小值,当 `minMaxType``Custom` 时有效。
* `max`:设定的坐标轴刻度最大值,当 `minMaxType``Custom` 时有效。
* `splitNumber`:坐标轴的分割段数。默认为 `5`
* `interval`:强制设置坐标轴分割间隔。无法在类目轴中使用。设置改值时 `splitNumber` 无效。
* `splitLineType`:分割线类型。默认为 `Dashed`。支持以下五种类型:
* `None`:不显示分割线。
* `Solid`:实线。
* `Dashed`:虚线。
* `Dotted`:点线。
* `DashDot`:点划线。
* `DashDotDot`:双点划线。
* `boundaryGap`:坐标轴两边是否留白。默认为 `false`
* `data`:类目数据,在类目轴(`type: 'Category'`)中有效。
* `axisLine`:坐标轴轴线相关配置 [AxisLine](#AxisLine)。
* `axisName`:坐标轴名称相关配置 [AxisName](#AxisName)。
* `axisTick`:坐标轴刻度相关配置 [AxisTick](#AxisTick)。
* `axisLabel`:坐标轴刻度标签 [AxisLabel](#AxisLabel)。
* `splitArea`:坐标轴轴线坐标轴分割区域 [SplitArea](#SplitArea)。
相关接口:
* `ClearData()`:清空类目数据。
* `IsCategory()`:是否为类目轴。
* `IsValue()`:是否为数值轴。
* `AddData(string category, int maxDataNumber)`:添加一个类目到类目数据列表。
## `Series`
系列列表。每个系列通过 type 决定自己的图表类型。
相关参数:
* `show`:系列是否显示在图表上。
* `type`:系列的图表类型。有以下几种类型:
* `Line`:折线图。
* `Bar`:柱状图。
* `Pie`:饼图。
* `Radar`:雷达图。
* `Scatter`:散点图。
* `EffectScatter`:带有涟漪特效动画的散点图。
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `stack`:数据堆叠。同个类目轴上系列配置相同的 `stack` 值后,后一个系列的值会在前一个系列的值上相加。
* `axisIndex`:使用的坐标轴轴的 `index`,在单个图表实例中存在多个坐标轴轴的时候有用。
* `radarIndex`:雷达图所使用的 `radar` 组件的 `index`
* `minShow`:系列显示数据的最小索引。
* `maxShow`:系列显示数据的最大索引。
* `maxCache`:系列中可缓存的最大数据量。默认为`0`没有限制大于0时超过指定值会移除旧数据再插入新数据。
* `sampleDist`采样的最小水平像素距离,默认为`0`时不采样。当两个数据点间的水平像素距离小于该值时,开启采样,保证两点间的水平像素距离不小于该值。
* `sampleType`:采样类型。当`sampleDist`大于`0`时有效。支持以下五种采样类型:
* `Peak`:取峰值。当过滤点的平均值大于等于`sampleAverage`时,取最大值;反之取最小值。
* `Average`:取过滤点的平均值。
* `Max`:取过滤点的最大值。
* `Min`:取过滤点的最小值。
* `Sum`:取过滤点之和。
* `sampleAverage`:设定的采样平均值。当 `sampleType``Peak` 时,用于和过滤数据的平均值做对比是取最大值还是最小值。默认为`0`时会实时计算所有数据的平均值。
* `areaStyle`:区域填充样式 [AreaStyle](#AreaStyle)。
* `symbol`:标记的图形 [SerieSymbol](#SerieSymbol)。
* `lineType`:折线图样式类型。支持以下十种类型:
* `Normal`:普通折线图。
* `Smooth`:平滑曲线。
* `SmoothDash`:平滑虚线。
* `StepStart`:阶梯线图:当前点。
* `StepMiddle`:阶梯线图:当前点和下一个点的中间。
* `StepEnd`:阶梯线图:下一个拐点。
* `Dash`:虚线。
* `Dot`:点线。
* `DashDot`:点划线。
* `DashDotDot`:双点划线。
* `lineStyle`:线条样式 [LineStyle](#LineStyle)。
* `barType`:柱状图类型。以下几种类型:
* `Normal`:普通柱状图。
* `Zebra`:斑马柱状图。
* `Capsule`:胶囊柱状图。
* `barPercentStack`:是否百分比堆叠柱状图,相同 `stack``serie` 只要有一个 `barPercentStack``true`,则就显示成百分比堆叠柱状图。
* `barWidth`:柱条的宽度,不设时自适应。支持设置成相对于类目宽度的百分比。
* `barGap`:不同系列的柱间距离。为百分比(如 `'0.3f'`,表示柱子宽度的 `30%`)。如果想要两个系列的柱子重叠,可以设置 `barGap``'-1f'`。这在用柱子做背景的时候有用。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barCategoryGap`同一系列的柱间距离默认为类目间距的20%,可设固定值。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barZebraWidth`:斑马线的粗细。`barType``Zebra` 时有效。
* `barZebraGap`:斑马线的间距。`barType``Zebra` 时有效。
* `pieClickOffset`鼠标点击时是否开启偏移一般用在PieChart图表中。
* `pieRoseType`:是否展示成南丁格尔图,通过半径区分数据大小。
* `pieSpace`:饼图项间的空隙留白。
* `pieCenter`:饼图的中心点。
* `pieRadius`:饼图的半径。`radius[0]` 表示内径,`radius[1]` 表示外径。
* `roundCap`:启用圆弧效果。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `lineArrow`:折线图的箭头 [LineArrow](#LineArrow)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Line`
折线图系列。
* `show`:系列是否显示在图表上。
* `type``Line`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `stack`:数据堆叠。同个类目轴上系列配置相同的 `stack` 值后,后一个系列的值会在前一个系列的值上相加。
* `xAxisIndex`使用的坐标轴X轴的 `index`,在单个图表实例中存在多个坐标轴的时候有用。
* `yAxisIndex`使用的坐标轴Y轴的 `index`,在单个图表实例中存在多个坐标轴的时候有用。
* `minShow`:系列显示数据的最小索引。
* `maxShow`:系列显示数据的最大索引。
* `maxCache`:系列中可缓存的最大数据量。默认为`0`没有限制大于0时超过指定值会移除旧数据再插入新数据。
* `sampleDist`采样的最小水平像素距离,默认为`0`时不采样。当两个数据点间的水平像素距离小于该值时,开启采样,保证两点间的水平像素距离不小于该值。
* `sampleType`:采样类型。当`sampleDist`大于`0`时有效。支持以下五种采样类型:
* `Peak`:取峰值。当过滤点的平均值大于等于`sampleAverage`时,取最大值;反之取最小值。
* `Average`:取过滤点的平均值。
* `Max`:取过滤点的最大值。
* `Min`:取过滤点的最小值。
* `Sum`:取过滤点之和。
* `sampleAverage`:设定的采样平均值。当 `sampleType``Peak` 时,用于和过滤数据的平均值做对比是取最大值还是最小值。默认为`0`时会实时计算所有数据的平均值。
* `clip`:是否裁剪超出坐标系部分的图形。
* `ignore`:是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `showAsPositiveNumber`:将负数数值显示为正数。一般和`AxisLabel``showAsPositiveNumber`配合使用。仅在折线图和柱状图中有效。
* `large`:是否开启大数据量优化,在数据图形特别多而出现卡顿时候可以开启。开启后配合 largeThreshold 在数据量大于指定阈值的时候对绘制进行优化。缺点优化后不能自定义设置单个数据项的样式不能显示Label折线图不绘制Symbol。
* `largeThreshold`开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。
* `areaStyle`:区域填充样式 [AreaStyle](#AreaStyle)。
* `symbol`:标记的图形 [SerieSymbol](#SerieSymbol)。
* `lineType`:折线图样式类型。支持以下十种类型:
* `Normal`:普通折线图。
* `Smooth`:平滑曲线。
* `SmoothDash`:平滑虚线。
* `StepStart`:阶梯线图:当前点。
* `StepMiddle`:阶梯线图:当前点和下一个点的中间。
* `StepEnd`:阶梯线图:下一个拐点。
* `Dash`:虚线。
* `Dot`:点线。
* `DashDot`:点划线。
* `DashDotDot`:双点划线。
* `lineStyle`:线条样式 [LineStyle](#LineStyle)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `lineArrow`:折线图的箭头 [LineArrow](#LineArrow)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Bar`
折线图系列。
* `show`:系列是否显示在图表上。
* `type``Bar`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `stack`:数据堆叠。同个类目轴上系列配置相同的 `stack` 值后,后一个系列的值会在前一个系列的值上相加。
* `xAxisIndex`使用的坐标轴X轴的 `index`,在单个图表实例中存在多个坐标轴的时候有用。
* `yAxisIndex`使用的坐标轴Y轴的 `index`,在单个图表实例中存在多个坐标轴的时候有用。
* `minShow`:系列显示数据的最小索引。
* `maxShow`:系列显示数据的最大索引。
* `maxCache`:系列中可缓存的最大数据量。默认为`0`没有限制大于0时超过指定值会移除旧数据再插入新数据。
* `barType`:柱状图类型。以下几种类型:
* `Normal`:普通柱状图。
* `Zebra`:斑马柱状图。
* `Capsule`:胶囊柱状图。
* `barPercentStack`:是否百分比堆叠柱状图,相同 `stack``serie` 只要有一个 `barPercentStack``true`,则就显示成百分比堆叠柱状图。
* `barWidth`:柱条的宽度,不设时自适应。支持设置成相对于类目宽度的百分比。
* `barGap`:不同系列的柱间距离。为百分比(如 `'0.3f'`,表示柱子宽度的 `30%`)。如果想要两个系列的柱子重叠,可以设置 `barGap``'-1f'`。这在用柱子做背景的时候有用。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barCategoryGap`同一系列的柱间距离默认为类目间距的20%,可设固定值。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barZebraWidth`:斑马线的粗细。`barType``Zebra` 时有效。
* `barZebraGap`:斑马线的间距。`barType``Zebra` 时有效。
* `clip`:是否裁剪超出坐标系部分的图形。
* `ignore`:是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `showAsPositiveNumber`:将负数数值显示为正数。一般和`AxisLabel``showAsPositiveNumber`配合使用。仅在折线图和柱状图中有效。
* `large`:是否开启大数据量优化,在数据图形特别多而出现卡顿时候可以开启。开启后配合 largeThreshold 在数据量大于指定阈值的时候对绘制进行优化。缺点优化后不能自定义设置单个数据项的样式不能显示Label折线图不绘制Symbol。
* `largeThreshold`开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。
* `symbol`:标记的图形 [SerieSymbol](#SerieSymbol)。
* `itemStyle`:柱条样式 [ItemStyle](#ItemStyle)。
* `areaStyle`:区域填充样式 [AreaStyle](#AreaStyle)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Pie`
饼图系列。
* `show`:系列是否显示在图表上。
* `type``Pie`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `pieRoseType`:南丁格尔玫瑰图类型,支持以下类型:
* `None`:不展示成南丁格尔玫瑰图。
* `Radius`:扇区圆心角展现数据的百分比,半径展现数据的大小。
* `Area`:所有扇区圆心角相同,仅通过半径展现数据大小。
* `space`:扇区间隙。
* `center`:中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`:半径。`radius[0]`为内径,`radius[1]`为外径。当内径大于0时即为圆环图。
* `roundCap`:是否启用圆弧效果。
* `ignore`:是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制,对应的`Label``Legend`也不会显示。
* `ignoreValue`忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `avoidLabelOverlap`:在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Radar`
雷达图系列。
* `show`:系列是否显示在图表上。
* `type``Radar`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `radarType`:雷达图类型`RadarType`,支持以下类型:
* `Multiple`:多圈雷达图。此时可一个雷达里绘制多个圈,一个`serieData`就可组成一个圈(多维数据)。
* `Single`:单圈雷达图。此时一个雷达只能绘制一个圈,多个`serieData`组成一个圈,数据取自`data[1]`
* `radarIndex`:雷达图所使用的 `radar` 组件的 `index`
* `symbol`:标记的图形 [SerieSymbol](#SerieSymbol)。
* `lineStyle`:线条样式 [LineStyle](#LineStyle)。
* `itemStyle`:标记样式 [ItemStyle](#ItemStyle)。
* `areaStyle`:区域填充样式 [AreaStyle](#AreaStyle)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Scatter`
散点图系列。
* `show`:系列是否显示在图表上。
* `type``Scatter`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `clip`:是否裁剪超出坐标系部分的图形。
* `symbol`:标记的图形 [SerieSymbol](#SerieSymbol)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Heatmap`
热力图系列。
* `show`:系列是否显示在图表上。
* `type``Scatter`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `ignore`:是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`:忽略数据的默认值。默认值默认为`0`,当 `ignore``true` 才有效。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Gauge`
仪表盘系列。
* `show`:系列是否显示在图表上。
* `type``Gauge`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `gaugeType`:仪表盘类型,支持以下类型:
* `Pointer`:指针类型。
* `ProgressBar`:进度条类型。
* `center`中心点坐标。当值为0-1的浮点数时表示百分比。
* `radius`:仪表盘半径。
* `min`:最小的数据值。映射到`startAngle`
* `max`:最大的数据值。映射到`endAngle`
* `startAngle`:仪表盘起始角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `endAngle`:仪表盘结束角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `splitNumber`:仪表盘刻度分割段数。
* `roundCap`:是否启用圆弧效果。
* `titleStyle`:仪表盘标题 [TitleStyle](#TitleStyle)。
* `gaugeAxis` 仪表盘坐标轴 [GaugeAxis](#GaugeAxis)。
* `gaugePointer`:仪表盘指针 [GaugePointer](#GaugePointer)。
* `itemStyle`:仪表盘指针样式 [ItemStyle](#ItemStyle)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。仪表盘的数据一般只有一个,值通过`label`样式显示,`name`通过`titleStyle`样式显示。
## `Serie-Ring`
环形图系列。
* `show`:系列是否显示在图表上。
* `type``Ring`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `center`:中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`:仪表盘半径。
* `startAngle`:仪表盘起始角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `ringGap`:环形图的环间隙。
* `roundCap`:是否启用圆弧效果。
* `clockwise`:是否顺时针,默认为`true`
* `titleStyle`:环形图中心标题 [TitleStyle](#TitleStyle)。
* `itemStyle`:环形图的圆环样式,包括设置背景颜色和边框等 [ItemStyle](#ItemStyle)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。环形图的数据只有二维,`data[0]`表示当前值,`data[1]`表示最大值。
## `Serie-Liquid`
水位图系列。
* `show`:系列是否显示在图表上。
* `type``Liquid`
* `name`:系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `vesselIndex`:水位图所使用的`vessel`组件的`index`
* `min`:最小值。
* `max`:最大值。
* `waveLength`:水波长。
* `waveHeight`:水波高。
* `waveSpeed`:水波移动速度。正数时左移,负数时右移。
* `waveOffset`:水波偏移。
* `itemStyle`:环形图的圆环样式,包括设置背景颜色和边框等 [ItemStyle](#ItemStyle)。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
* `data`:系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。水位图的数据一般只有一个,表示当前水位值,用`max`设置最大水位值。
## `Settings`
全局参数设置组件。一般情况下可使用默认值,当有需要时可进行调整。
* `lineSmoothStyle`:曲线平滑系数。通过调整平滑系数可以改变曲线的曲率,得到外观稍微有变化的不同曲线。
* `lineSmoothness`:曲线平滑度。值越小曲线越平滑,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
* `lineSegmentDistance` 线段的分割距离。普通折线图的线是由很多线段组成,段数由该数值决定。值越小段数越多,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
* `cicleSmoothness`:圆形(包括扇形、环形等)的平滑度。数越小圆越平滑,但顶点数也会随之增加。
## `SerieAnimation`
* `enable`:是否开启动画系统。
* ~~`threshold`:是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。~~
* `fadeInDelay`:设定的渐入动画延时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制:`customFadeInDelay`
* `fadeInDuration`:设定的渐入动画时长,单位毫秒。如果要设置单个数据项的渐入时长,可以用代码定制:`customFadeInDuration`
* `fadeOutDelay`:设定的渐出动画延时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制:`customFadeOutDelay`
* `fadeOutDuration`:设定的渐出动画时长,单位毫秒。如果要设置单个数据项的渐出时长,可以用代码定制:`customFadeOutDuration`
* `dataChangeEnable`:是否开启数据变更动画。
* `dataChangeDuration`:数据变更动画时长,单位毫秒。
## `AreaStyle`
* `show`:是否显示区域填充。
* `origin`:区域填充的起始位置 `AreaOrigin`。有以下三种填充方式:
* `Auto`:填充坐标轴轴线到数据间的区域。
* `Start`:填充坐标轴底部到数据间的区域。
* `End`:填充坐标轴顶部到数据间的区域。
* `color`:区域填充的颜色,默认取 `serie` 对应的颜色。如果 `toColor` 不是默认值,则表示渐变色的起点颜色。
* `toColor`:区域填充的渐变色的终点颜色。
* `highlightColor`:高亮时区域填充的颜色,默认取 `serie` 对应的颜色。如果 `highlightToColor` 不是默认值,则表示渐变色的起点颜色。
* `highlightToColor`:高亮时区域填充的渐变色的终点颜色。
* `opacity`:图形透明度。支持从 `0``1` 的数字,为 `0` 时不绘制该图形。
* `tooltipHighlight`:鼠标悬浮时是否高亮之前的区域。
## `AxisLabel`
* `show`:是否显示刻度标签。
* `interval`:坐标轴刻度标签的显示间隔,在类目轴中有效。`0`表示显示所有标签,`1`表示隔一个隔显示一个标签,以此类推。
* `inside`:刻度标签是否朝内,默认朝外。
* `margin`:刻度标签与轴线之间的距离。
* `formatter`:图例内容字符串模版格式器。支持用 `\n` 换行。模板变量为图例名称 `{value}`,数值格式化通过`numericFormatter`
* `numericFormatter`:标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式:`A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `showAsPositiveNumber`:将负数数值显示为正数。一般和`Serie``showAsPositiveNumber`配合使用。
* `onZero`:刻度标签显示在`0`刻度上。
* `textLimit`:文本自适应 [TextLimit](#TextLimit)。只在类目轴中有效。
* `textStyle`:文本样式 [TextStyle](#TextStyle)。
## `AxisLine`
* `show`:是否显示坐标轴轴线。
* `onZero` `X` 轴或者 `Y` 轴的轴线是否在另一个轴的 `0` 刻度上,只有在另一个轴为数值轴且包含 `0` 刻度时有效。
* `width`:坐标轴线线宽。
* `symbol`:是否显示箭头。
* `symbolWidth`:箭头宽。
* `symbolHeight`:箭头高。
* `symbolOffset`:箭头偏移。
* `symbolDent`:箭头的凹陷程度。
## `AxisName`
* `show`:是否显示坐标名称。
* `name`:坐标轴名称。
* `location`:坐标轴名称的位置。支持以下类型:
* `Start`:坐标轴起始处。
* `Middle`:坐标轴中间。
* `End`:坐标轴末端。
* `textStyle`:显示内容文本样式 [TextStyle](#TextStyle)。
## `AxisSplitLine`
* `show`:是否显示坐标分割线。
* `interval`:分割线的显示间隔。`0` 表示显示所有分割线,`1` 表示隔一个隔显示一个分割线,以此类推。
* `lineStyle`:线条样式 [LineStyle](#LineStyle)。
## `AxisSplitArea`
* `show`:是否显示坐标分割区域。
* `color`:分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
## `AxisTick`
* `show`:是否显示坐标轴刻度。
* `alignWithLabel`:类目轴中在 `boundaryGap``true` 的时候有效,可以保证刻度线和标签对齐。
* `inside`:坐标轴刻度是否朝内,默认朝外。
* `length`:坐标轴刻度的长度。
* `width`坐标轴刻度的宽度。默认为0时宽度和坐标轴一致。
## `Emphasis`
* `show`:是否启用高亮样式。
* `label`:图形文本标签样式 [SerieLabel](#SerieLabel)。
* `itemStyle`:图形样式 [ItemStyle](#ItemStyle)。
## `ItemStyle`
* `show`:是否启用。
* `color`:颜色。
* `toColor`渐变颜色1。
* `toColor2`渐变颜色2。只在折线图中有效。
* `backgroundColor`:背景颜色。
* `backgroundWidth`:背景的宽。
* `centerColor`:中心区域的颜色。如环形图的中心区域。
* `centerGap`:中心区域的间隙。如环形图的中心区域于最内环的间隙。
* `borderType`:边框的类型。
* `borderColor`:边框的颜色。
* `borderWidth`:边框宽。
* `opacity`:透明度。
* `tooltipFormatter`:提示框单项的字符串模版格式器。具体配置参考`Tooltip``formatter`
* `numericFormatter`:标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式:`A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`。此字段优先于`SerieLabel``Tooltip``numericFormatter`
* `cornerRadius`圆角半径。用数组分别指定4个圆角半径顺时针左上右上右下左下。支持用0-1的浮点数设置百分比。
## `LineArrow`
* `show`:是否显示箭头。
* `position`:箭头显示位置。支持以下两种位置:
* `End`:末端显示。最后一个数据上显示箭头。
* `Start`:起始端显示。第一个数据上显示箭头。
* `width`:箭头宽。
* `height`:箭头长。
* `offset`:箭头偏移。默认箭头的中心点和数据坐标点一致,可通过 `offset` 调整偏移。
* `dent`:箭头的凹度。
## `LineStyle`
* `show`:是否显示线条。当作为子组件,它的父组件有参数控制是否显示时,改参数无效。
* `type`:线条类型。支持以下五种类型:
* `None`:不显示分割线。
* `Solid`:实线。
* `Dashed`:虚线。
* `Dotted`:点线。
* `DashDot`:点划线。
* `DashDotDot`:双点划线。
* `color`:线条颜色。默认和 `serie` 一致。
* `toColor`:线的渐变颜色(需要水平方向渐变时)。
* `toColor2`线的渐变颜色2需要水平方向三个渐变色的渐变时
* `width`:线条宽。
* `opacity`:线条的透明度。支持从 `0``1` 的数字,为 `0` 时不绘制该图形。
## `Location`
* `align`:对齐方式。有以下对齐方式。
* `TopLeft`:左上角对齐。
* `TopRight`:右上角对齐。
* `TopCenter`:置顶居中对齐。
* `BottomLeft`:左下对齐。
* `BottomRight`:右下对齐。
* `BottomCenter`:底部居中对齐。
* `Center`:居中对齐。
* `CenterLeft`:中部靠左对齐。
* `CenterRight`:中部靠右对齐。
* `left`:离容器左侧的距离。
* `right`:离容器右侧的距离。
* `top`:离容器上侧的距离。
* `bottom`:离容器下侧的距离。
## `SerieData`
* `name`:数据项名称。
* `selected`:该数据项是否被选中。
* `radius`:自定义半径。可用在饼图中自定义某个数据项的半径。
* `iconStyle`:数据项图标样式。
* `enableLabel`:是否启用单个数据项的标签设置。
* `label`:单个数据项的标签设置。
* `enableItemStyle`:是否启用单个数据项的样式。
* `itemStyle`:单个数据项的样式设置。
* `enableEmphasis`:是否启用单个数据项的高亮样式。
* `emphasis`:单个数据项的高亮样式设置。
* `enableSymbol`:是否启用单个数据项的标记设置。
* `symbol`:单个数据项的标记设置。
* `data`:可指定任意维数的数值列表。对于折线图和柱状图,`data`其实是`size``2`的数组,`data[0]`是x的编号`data[1]``y`的数值,默认显示`data[1]`。其他图表看需求而定是长度大于`2`的数组。可通过`Serie``showDataDimension`指定数据长度。
## `SerieLabel`
* `show`:是否显示文本标签。
* `position`:标签的位置。折线图时强制默认为 `Center`,支持以下 `5` 种位置:
* `Outside`:饼图扇区外侧,通过视觉引导线连到相应的扇区。只在饼图种可用。
* `Inside`:饼图扇区内部。只在饼图可用。
* `Center`:在中心位置(折线图,柱状图,饼图)。
* `Top`:顶部(柱状图)。
* `Bottom`:底部(柱状图)。
* `formatter`:标签内容字符串模版格式器。支持用 `\n` 换行。模板变量有:`{a}`:系列名;`{b}`:数据名;`{c}`:数据值;`{d}`:百分比。示例:`{b}:{c}`
* `numericFormatter`:标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式:`A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `offset`:距离图形元素的偏移。
* `autoOffset`是否开启自动偏移。当开启时Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。
* `backgroundWidth`:标签的背景宽度。一般不用指定,不指定时则自动是文字的宽度。
* `backgroundHeight`:标签的背景高度。一般不用指定,不指定时则自动是文字的高度。
* `paddingLeftRight`:标签文字和边框的左右边距。
* `paddingTopBottom`:标签文字和边框的上下边距。
* `line`:是否显示视觉引导线。在 `label` 位置 设置为 `'Outside'` 的时候会显示视觉引导线。
* `lineType`:视觉引导线类型。支持以下几种类型:
* `BrokenLine`:折线。
* `Curves`:曲线。
* `HorizontalLine`:水平线。
* `lineColor`:视觉引导线自定义颜色。
* `lineWidth`:视觉引导线的宽度。
* `lineLength1`:视觉引导线第一段的长度。
* `lineLength2`:视觉引导线第二段的长度。
* `border`:是否显示边框。
* `borderWidth`:边框宽度。
* `borderColor`:边框颜色。
* `textStyle`:显示内容文本样式 [TextStyle](#TextStyle)。
## `SerieSymbol`
* `show`:是否显示标记。
* `type`:标记类型。支持以下六种类型:
* `EmptyCircle`:空心圆。
* `Circle`:实心圆。
* `Rect`:正方形。可通过设置`itemStyle``cornerRadius`变成圆角矩形。
* `Triangle`:三角形。
* `Diamond`:菱形。
* `None`:不显示标记。
* `gap`:图形标记的外留白距离。
* `sizeType`:标记图形的大小获取方式。支持以下三种类型:
* `Custom`:自定义大小。
* `FromData`:通过 `dataIndex` 从数据中获取,再乘以一个比例系数 `dataScale`
* `Callback`:通过回调函数 `sizeCallback` 获取。
* `size`:标记的大小。
* `selectedSize`:被选中的标记的大小。
* `dataIndex`:当 `sizeType` 指定为 `FromData` 时,指定的数据源索引。
* `dataScale`:当 `sizeType` 指定为 `FromData` 时,指定的倍数系数。
* `selectedDataScale`:当 `sizeType` 指定为 `FromData` 时,指定的高亮倍数系数。
* `sizeCallback`:当 `sizeType` 指定为 `Callback` 时,指定的回调函数。
* `selectedSizeCallback`:当 `sizeType` 指定为 `Callback` 时,指定的高亮回调函数。
* `color`:标记图形的颜色,默认和系列一致。
* `opacity`:图形标记的透明度。
* `startIndex`:开始显示图形标记的索引。
* `interval`:显示图形标记的间隔。`0`表示显示所有标签,`1`表示隔一个隔显示一个标签,以此类推。
* `forceShowLast`:是否强制显示最后一个图形标记。默认为 `false`
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XChartsAPI接口](XChartsAPI.md)
[XCharts问答](XCharts问答.md)

View File

@@ -1,142 +0,0 @@
# XCharts API
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts问答](XCharts问答.md)
## `BaseChart`
* `BaseChart.theme`:主题组件`ThemeInfo`
* `BaseChart.title`:标题组件`Title`
* `BaseChart.legend`:图例组件`Legend`
* `BaseChart.tooltip`:提示框组件`Tooltip`
* `BaseChart.series`:系列列表`Series`
* `BaseChart.chartName`:图表的别称。
* `BaseChart.chartWidth`:图表的宽。
* `BaseChart.chartHeight`:图表的高。
* `BaseChart.forceOpenRaycastTarget`:强制开启鼠标事件检测。一般不用手动设置,内部会自动判断是否需要检测。
* `BaseChart.onCustomDraw`:自定义绘制回调。
* `BaseChart.onPointerClick`:鼠标点击回调。
* `BaseChart.onPointerDown`:鼠标按下回调。
* `BaseChart.onPointerUp`:鼠标弹起回调。
* `BaseChart.onPointerEnter`:鼠标进入图表回调。
* `BaseChart.onPointerExit`:鼠标退出图表回调。
* `BaseChart.onBeginDrag`:鼠标开始拖拽回调。
* `BaseChart.onDrag`:鼠标拖拽回调。
* `BaseChart.onEndDrag`:鼠标结束拖拽回调。
* `BaseChart.onScroll`:鼠标滚动回调。
* `BaseChart.SetSize(float width, float height)` 设置图表的宽高在非stretch pivot下才有效其他情况需要自己调整RectTransform
* `BaseChart.ClearData()`:清除所有数据,系列列表会保留,只是移除列表中系列的数据。
* `BaseChart.RemoveData()`:清除所有系列和图例数据,系列列表也会被清除。
* `BaseChart.RemoveData(string serieName)`:清除指定系列名称的数据。
* `BaseChart.AddSerie(SerieType type, string serieName = null, bool show = true)`:添加一个系列到系列列表中。
* `BaseChart.AddData(string serieName, float data, string dataName = null)`:添加一个数据到指定的系列中。
* `BaseChart.AddData(int serieIndex, float data, string dataName = null)`:添加一个数据到指定的系列中。
* `BaseChart.AddData(string serieName, List<float> multidimensionalData, string dataName = null)`:添加多维数据`x,y,z...`到指定的系列中。
* `BaseChart.AddData(int serieIndex, List<float> multidimensionalData, string dataName = null)`:添加多维数据`x,y,z...`到指定的系列中。
* `BaseChart.AddData(string serieName, float xValue, float yValue, string dataName)`:添加`x,y`数据到指定系列中。
* `BaseChart.AddData(int serieIndex, float xValue, float yValue, string dataName = null)`:添加`x,y`数据到指定系列中。
* `BaseChart.UpdateData(string serieName,int dataIndex, float value)`:更新指定系列中的指定索引数据。
* `BaseChart.UpdateData(int serieIndex,int dataIndex, float value)`:更新指定系列中的指定索引数据。
* `BaseChart.UpdateData(string serieName, int dataIndex, List<float> multidimensionalData)`:更新指定系列指定索引的数据项的多维数据。
* `BaseChart.UpdateData(int serieIndex, int dataIndex, List<float> multidimensionalData)`:更新指定系列指定索引的数据项的多维数据。
* `BaseChart.UpdateData(string serieName, int dataIndex, int dimension, float value)`更新指定系列指定索引指定维数的数据。维数从0开始。
* `BaseChart.UpdateData(int serieIndex, int dataIndex, int dimension, float value)`更新指定系列指定索引指定维数的数据。维数从0开始。
* `BaseChart.UpdateDataName(string serieName,int dataIndex, string dataName)`:更新指定系列中的指定索引数据名称。
* `BaseChart.UpdateDataName(int serieIndex, int dataIndex, string dataName)`:更新指定系列中的指定索引数据名称。
* `BaseChart.SetActive(string serieName, bool active)`:设置指定系列是否显示。
* `BaseChart.SetActive(int serieIndex, bool active)`:设置指定系列是否显示。
* `BaseChart.IsActive(string serieName)`:获取指定系列是否显示。
* `BaseChart.IsActive(int serieIndex)`:获取指定系列是否显示。
* `BaseChart.IsActiveByLegend(string legendName)`:获得指定图例名字的系列是否显示。
* `BaseChart.RefreshChart()`:在下一帧刷新图表。
* `BaseChart.RefreshLabel()`:在下一帧刷新文本标签。
* `BaseChart.RefreshTooltip()`:立即刷新`Tooltip`组件。
* `BaseChart.UpdateTheme(Theme theme)`:切换图表主题。
* `BaseChart.AnimationEnable(bool flag)`:启用或关闭动画。
* `BaseChart.AnimationFadeIn()`:渐入动画。
* `BaseChart.AnimationFadeOut()`:渐出动画。
* `BaseChart.AnimationPause()`:暂停动画。
* `BaseChart.AnimationResume()`:继续动画。
* `BaseChart.AnimationReset()`:重置动画。
* `BaseChart.ClickLegendButton(int legendIndex, string legendName, bool show)`:点击图例按钮。
* `BaseChart.IsInChart(Vector2 local)`:坐标是否在图表范围内。
* `BaseChart.IsInChart(float x, float y)`:坐标是否在图表范围内。
* `BaseChart.EnableBackground(bool flag)`:开启背景组件。背景组件在`chart`受上层布局控制时无法开启。
## `CoordinateChart`
* `CoordinateChart.grid`:网格组件 `Grid`
* `CoordinateChart.xAxes`:左右两个 `X` 轴组件 `XAxis`
* `CoordinateChart.yAxes`:左右两个 `Y` 轴组件 `YAxis`
* `CoordianteChart.xAxis0`X轴
* `CoordianteChart.xAxis1`X轴
* `CoordianteChart.xAxis0`Y轴
* `CoordianteChart.yAxis1`Y轴
* `CoordinateChart.dataZoom`:区域缩放组件 `DataZoom`
* `CoordinateChart.ClearAxisData()`清除所有x轴和y轴的类目数据。
* `CoordinateChart.AddXAxisData(string category, int xAxisIndex = 0)`:添加一个类目数据到指定的 `X` 轴。
* `CoordinateChart.AddYAxisData(string category, int yAxisIndex = 0)`:添加一个类目数据到指定的 `Y` 轴。
* `CoordinateChart.IsValue()`:是否是纯数值坐标。
* `CoordinateChart.RefreshDataZoom()`在下一帧刷新DataZoom组件。
* `CoordinateChart.RefreshAxisMinMaxValue()`:立即刷新数值坐标轴的最大最小值(更新坐标轴标签并触发重绘)。
* `CoordinateChart.IsInCooridate(Vector2 local)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(Vector3 local)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(float x, float y)`:坐标是否在坐标轴内。
* `CoordinateChart.IsInCooridate(Vector2 local)`:坐标是否在坐标轴内。
* `CoordinateChart.ClampInGrid(grid, Vector3 pos)`:将坐标限制在坐标系内。
* `CoordinateChart.CovertXYAxis(int index)`转换X轴和Y轴的配置。
* `CoordinateChart.UpdateCoordinate()`:更新坐标系原点和宽高。一般内部会自动更新,也可强制更新。
* `CoordinateChart.SetMaxCache(int maxCache)`:设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。
## `LineChart`
* 继承 `BaseChart`
* 继承自 `CoordinateChart`
## `BarChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
* `BarChart.onPointerClickBar`:点击柱条回调。参数:`eventData`, `dataIndex`
## `PieChart`
* 继承自 `BaseChart`
* `PieChart.onPointerClickPie`:点击柱条回调。参数:`eventData`, `serieIndex`, `dataIndex`
## `RadarChart`
* 继承自 `BaseChart`
* `RadarChart.radars`:雷达坐标系组件列表 `Radar`
* `RadarChart.RemoveRadar()`:移除所有雷达坐标系组件。
* `RadarChart.AddRadar(Radar radar)`:添加雷达坐标系组件。
* `RadarChart.AddRadar(Radar.Shape shape, Vector2 center, float radius, int splitNumber = 5,float lineWidth = 0.6f, bool showIndicator = true, bool showSplitArea = true)`:添加雷达坐标系组件。
* `RadarChart.AddIndicator(int radarIndex, string name, float min, float max)`:添加指示器。
* `RadarChart.UpdateIndicator(int radarIndex, int indicatorIndex, string name, float min, float max)`:更新指示器。
* `RadarChart.GetRadar(int radarIndex)`:获得指定索引的雷达坐标系组件。
* `RadarChart.GetIndicator(int radarIndex, int indicatorIndex)`:获得指定雷达坐标系组件指定索引的指示器。
## `ScatterChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
## `HeatmapChart`
* 继承自 `BaseChart`
* 继承自 `CoordinateChart`
## `RingChart`
* 继承自 `BaseChart`
* `RingChart.UpdateMax(int serieIndex, int dataIndex, float value)`:更新指定系列执行数据项的最大值。
* `RingChart.UpdateMax(int serieIndex, float value)`:更新指定系列的所有数据项的最大值。
* `RingChart.UpdateMax(float value)`:更新第一个系列第一个数据项的最大值。
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts配置项手册](XCharts配置项手册.md)
[XCharts问答](XCharts问答.md)

View File

@@ -1,869 +0,0 @@
# XCharts Configuration
[XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts API](xcharts-api-EN.md)
[XCharts Q&A](xcharts-questions-and-answers-EN.md)
The translation work is still in progress.
__Main component:__
* [Axis](#XAxis)
* [Background](#Background)
* [DataZoom](#DataZoom)
* [Grid](#Grid)
* [Legend](#Legend)
* [Polar](#Polar)
* [Radar](#Radar)
* [Series](#Series)
* [Serie-Line](#Serie-Line)
* [Serie-Bar](#Serie-Bar)
* [Serie-Pie](#Serie-Pie)
* [Serie-Radar](#Serie-Radar)
* [Serie-Scatter](#Serie-Scatter)
* [Serie-Heatmap](#Serie-Heatmap)
* [Serie-Gauge](#Serie-Gauge)
* [Serie-Ring](#Serie-Ring)
* [Serie-Liquid](#Serie-Liquid)
* [Settings](#Settings)
* [Theme](#Theme)
* [Title](#Title)
* [Tooltip](#Tooltip)
* [Vessel](#Vessel)
* [VisualMap](#VisualMap)
__Sub component:__
* [AreaStyle](#AreaStyle)
* [AxisLabel](#AxisLabel)
* [AxisLine](#AxisLine)
* [AxisName](#AxisName)
* [AxisSplitLine](#AxisSplitLine)
* [AxisSplitArea](#AxisSplitArea)
* [AxisTick](#AxisTick)
* [Emphasis](#Emphasis)
* [ItemStyle](#ItemStyle)
* [LineArrow](#LineArrow)
* [LineStyle](#LineStyle)
* [Location](#Location)
* [SerieAnimation](#SerieAnimation)
* [SerieData](#SerieData)
* [SerieLabel](#SerieLabel)
* [SerieSymbol](#SerieSymbol)
* [TextLimit](#TextLimit)
* [TextStyle](#TextStyle)
## `Theme`
Theme components. Topics are used to configure other parameters such as the global color scheme for the chart.
Parameters:
* `theme`: Built-in theme types. There are `Default`, `Light`, `Dark` three optional built-in theme.
* `font`: A common font for all text.
* `backgroundColor`: Chart background color.
* `titleTextColor`: The text color of the main title.
* `titleSubTextColor`: The text color of the sub title.
* `legendTextColor`: Legend text color when actived.
* `legendUnableColor`: Legend text color when unactived.
* `axisTextColor`: The text color of axis label.
* `axisLineColor`: The color of axis line.
* `axisSplitLineColor`: The color of the dividing line of the coordinate axis is the same as the default color of the axis.
* `tooltipBackgroundColor`: The background color of the tooltip.
* `tooltipFlagAreaColor`: The color of the shadow indicator for the tooltip.
* `tooltipTextColor`: The text color of Tooltip.
* `tooltipLabelColor`: The cross indicator in the tooltip coordinates the background color of the label.
* `tooltipLineColor`: The color of the indicator line in the tooltip.
* `dataZoomTextColor`: The text color of dataZoom.
* `dataZoomLineColor`: The line color of dataZoom.
* `dataZoomSelectedColor`: The selected area color of dataZoom.
* `colorPalette`: Palette color list. The color list of palette. If no color is set in series, the colors would be adopted sequentially and circularly from this list as the colors of series.
API:
* `GetColor(int index)`: Gets the color of the specified index from the palette.
* `GetColorStr(int index)`: Gets the hexadecimal color string of the specified index from the palette.
* `GetColor(string hexColorStr)`: Convert the html string to color.
## `Title`
Title component, including main title and subtitle.
Parameters:
* `show`: Whether to show title component.Set this to false to prevent the title component from showing.
* `text`: The content of main title, supporting `\n` for newlines.
* `textStyle`: The text style of main title [TextStyle](#TextStyle).
* `subText`: The content of sub title, supporting `\n` for newlines.
* `subTextStyle`: The text style of sub title [TextStyle](#TextStyle).
* `itemGap`: The gap between the main title and sub title.
* `location`: The location of title component [Location](#Location).
## `TitleStyle`
Sub component for serie title.
* `show`: Whether to show serie title.
* `textStyle`: The text style of title [TextStyle](#TextStyle).
## `Legend`
Legend component.The legend component shows different sets of symbol, colors, and names. You can control which series are not displayed by clicking on the legend.
Parameters:
* `show`: Whether show legend component.
* `selectedMode`: Selected mode of legend, which controls whether series can be toggled displaying by clicking legends:
* `Multiple`: multi-select.
* `Single`: single select.
* `None`: cant select.
* `orient`: horizontal or vertical layout:
* `Horizonal`: horizontal layout.
* `Vertical`: vertical layout.
* `location`: the localtion of legend in chart [Location](#Location).
* `itemWidth`: the width of legend icon.
* `itemHeight`: the height of legend icon.
* `itemGap`: The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout.
* `itemAutoColor`: Whether the legend symbol matches the color automatically.
* `formatter`: Legend content string template formatter. Support for wrapping lines with `\n`. Template:`{name}`.
* `data`: Data array of legend. An array item is usually a name representing string. (If it is a pie chart, it could also be the name of a single data in the pie chart) of a series. If data is not specified, it will be auto collected from series.
* `icons`: The list of cunstomize icons.
* `textStyle`: The style of text [TextStyle](#TextStyle).
API:
* `ClearData()`: Clear legend data.
* `ContainsData(string name)`: Whether include in legend data by the specified name.
* `RemoveData(string name)`: Remove legend from data.
* `AddData(string name)`: Add legend.
* `GetData(int index)`: Get legend.
* `GetIndex(string legendName)`: Get the index of legend.
## `Polar`
Polar coordinate can be used in scatter and line chart. Every polar coordinate has an angleAxis and a radiusAxis.
Parameters:
* `show`: Whether to show the polor component.
* `center`: The center of ploar. The `center[0]` is the x-coordinate, and the `center[1]` is the y-coordinate. When value between 0 and 1 represents a percentage relative to the chart.
* `radius`: the radius of polar.
* `backgroundColor`: Background color of polar, which is transparent by default.
## `Radar`
Radar coordinate conponnet for radar charts.
* `shape`: Radar render type, in which `Polygon` and `Circle` are supported.
* `Polygon`: Polygon.
* `Circle`: Circle.
* `positionType`: The position type of radar indicator label display.
* `Vertice`: Display at the vertex.
* `Between`: Display at the middle of line.
* `radius`: The radius of radar.[default:0.3f].
* `center`: the center of radar chart. The `center[0]` is the x-coordinate, and the `center[1]` is the y-coordinate. When value between 0 and 1 represents a percentage relative to the chart.[default:[0.5f,0.4f]].
* `ceilRate`: The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.[default:0].
* `splitNumber`: Segments of indicator axis.[default:5].
* `splitNumber`: Tooltip displays all the data on the axis.[default:false].
* `splitLine`: The split line style of radar [AxisSplitLine](#AxisSplitLine).
* `splitArea`: The split area style of radar [AxisSplitArea](#AxisSplitArea).
* `indicator`: Whether to show indicator.
* `indicatorGap`: The gap of indicator and radar.
* `indicatorList`: The indicator list [Radar.Indicator](#Radar.Indicator).
## `Radar.Indicator`
Indicator of radar chart, which is used to assign multiple variables(dimensions) in radar chart.
* `name`: The name of indicator.
* `max`: The maximum value of indicator, with default value of 0, but we recommend to set it manually.
* `min`: The minimum value of indicator, with default value of 0.
* `textStyle`: The text style of indicator [TextStyle](#TextStyle).
## `TextLimit`
Text character limitation and adaptation component. When the length of the text exceeds the set length, it is cropped and suffixes are appended to the end. Only valid in the category axis.
* `enable`: Whether to enable text limit. [default: `true`].
* `maxWidth`: Set the maximum width. A default of 0 indicates automatic fetch; otherwise, custom. Clipping occurs when the width of the text is greater than this value. [default: `0f`].
* `gap`: White pixel distance at both ends. [default: `10f`].
* `suffix`: Suffixes when the length exceeds. [default: `"..."`].
## `TextStyle`
The component of settings related to text.
* `rotate`: rotate of text. [default: `0f`].
* `offset`: offset of text position. [default: `Vector2.zero`].
* `color`: color of text. [default: `Color.clear`].
* `backgroundColor`: color of text background. [default: `Color.clear`].
* `font`: the font of text. When `null`, the theme's font is used by default. [default: `null`].
* `fontSize`: the size of text. [default: `18`].
* `fontStyle`: the font style of text. [default: `FontStyle.Normal`].
* `lineSpacing`: the space of text line. [default: `1f`].
## `Tooltip`
Tooltip component.
* `show`: Whether to show the tooltip component.
* `type`: Indicator type. Indicator types are:
* `Line`: line indicator.
* `Shadow`: shadow crosshair indicator.
* `None`: no indicator displayed.
* `Corss`: crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.
* `formatter`: A string template formatter for the total content of the prompt box. Support for wrapping lines with `\n`. When formatter is not null, use formatter first, otherwise use itemFormatter.
* Template variables are `{.}`, `{a}`, `{b}`, `{c}`, `{d}`.
* `{.}` is the dot of the corresponding color of `serie` that is currently indicated or whose `index` is `0`.`
* `{a}` is the `name` of the `serie` that is currently indicated or whose `index` is `0`.
* `{b}` is the `name` of the `serieData` that is currently indicated or whose `index` is `0`, or a `category` value (such as the X-axis of a line chart).
* `{c}` is the value of a Y-dimension (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`.
* `{d}` is the percentage value of Y-dimensions (`dimesion` is 1) from the `serie` that is currently indicated or whose `index` is `0`, with no `%` sign.
* `{.1}` represents a dot from serie corresponding color that specifies `index` as `1`.
* `1` in `{a1}`, `{b1}`, `{c1}` represents a `serie` that specifies an `index` of `1`.
* `{c1:2}` represents the third data from `serie`'s current indication data item indexed to `1` (a data item has multiple data, `index` 2 represents the third data).
* `{c1:2-2}` represents the third data item from `serie`'s third data item indexed to `1` (i.e., which data item must be specified to specify).
* `{d1:2: F2}` indicates that a formatted string with a value specified separately is `F2` (`numericFormatter` is used when not specified).
* Example: `"{a}, {c}"`, `"{a1}, {c1: f1}"`, `"{a1}, {c1:0: f1}"`, `"{a1} : {c1:1-1: f1}"`
* `titleFormatter`: The string template formatter for the tooltip title content. Support for wrapping lines with `\n`. This is only valid if the `itemFormatter` is in effect. The placeholder `{I}` can be set separately to indicate that the title is ignored and not displayed.
* `itemFormatter`: a string template formatter for a single Serie or data item content. Support for wrapping lines with `\n`. When `formatter` is not null, use `formatter` first, otherwise use `itemFormatter`.
* `numericFormatter`: Standard numeric format string. Used to format numeric values to display as strings. Using 'Axx' form: 'A' is the single character of the format specifier, supporting 'C' currency, 'D' decimal, 'E' exponent, 'F' number of vertices, 'G' regular, 'N' digits, 'P' percentage, 'R' round tripping, 'X' hex etc. 'XX' is the precision specification, from '0' - '99'. see: <https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings>
* `fixedWidth`: Fixed width. Higher priority than `minWidth`.
* `fixedHeight`: Fixed height. Higher priority than `minHeight`.
* `minWidth`: Minimum width. If `fixedWidth` has a value, get `fixedWidth` first.
* `minHeight`: Minimum height. If `fixedHeight` has a value, get `fixedHeight` first.
* `paddingLeftRight`: the text padding of left and right. [defaut: `5f`].
* `paddingTopBottom`: the text padding of top and bottom. [defaut: `5f`].
* `backgroundImage`: The image of icon.
* `ignoreDataShow`: Whether to show ignored data on tooltip. [defaut: `false`].
* `ignoreDataDefaultContent`: The default display character information for ignored data.
* `alwayShow`: Whether to trigger after always display.
* `offset`: `(since v1.5.3)`The position offset of tooltip relative to the mouse position.
* `lineStyle`: the line style of indicator line [LineStyle](#LineStyle).
* `textStyle`: the text style of content [TextStyle](#TextStyle).
## `Vessel`
Vessel component for liquid chart. There can be multiple vessels in a Chart, which can be matched by vesselIndex in Serie.
* `show`: Whether to show the vessel. [defaut: `true`]
* `shape`: The shape of vessel. [default: `Shape.Circle`]
* `shapeWidth`: Thickness of vessel. [defaut: `5f`]
* `gap`: The gap between the vessel and the liquid. [defaut: `10f`]
* `center`: The center of vessel. The `center[0]` is the x-coordinate, and the `center[1]` is the y-coordinate. When value between `0` and `1` represents a percentage relative to the chart. [default: `[0.5f,0.45f]`]
* `radius`: The radius of vessel. When value between 0 and 1 represents a percentage relative to the chart. [default: `0.35f`]
* `smoothness`: The smoothness of wave. [default: `1f`]
* `backgroundColor`: Background color of polar, which is transparent by default. [default: `Color.clear`]
* `color`: Vessel color. The default is consistent with Serie. [default: `Color32(70, 70, 240, 255)`]
* `autoColor`: Whether automatic color. If true, the color matches serie. [default: `true`]
## `DataZoom`
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.
Currently only the control 'X' axis is supported.
* `enable`: Whether to show dataZoom.
* `supportInside`: Whether built-in support is supported. Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging, mouse wheel, finger swiping (on the touch screen).
* `supportSlider`: Whether a slider is supported. There are separate sliders on which the user zooms or roams.
* ~~`filterMode`: The mode of data filter, not support yet.~~
* ~~`Filter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered if one of the relevant dimensions is out of the window.~~
* ~~`WeakFilter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered only if all of the relevant dimensions are out of the same side of the window.~~
* ~~`Empty`: data that outside the window will be set to NaN, which will not lead to changes of windows of other axes.~~
* ~~`None`: Do not filter data.~~
* ~~`xAxisIndex`: Specify which xAxis is controlled by the dataZoom.~~
* ~~`yAxisIndex`: Specify which yAxis is controlled by the dataZoom.~~
* `showDataShadow`: Whether to show data shadow, to indicate the data tendency in brief. [default: `true`]
* `showDetail`: Whether to show detail, that is, show the detailed data information when dragging. [default: `false`]
* `zoomLock`: Specify whether to lock the size of window (selected area). [default: `false`]
* ~~`realtime`: Whether to show data shadow in dataZoom-silder component, to indicate the data tendency in brief. [default: `true`]~~
* `backgroundColor`: The background color of the component.
* `selectedAreaColor`: The color of the selected area.
* `bottom`: Distance between dataZoom component and the bottom side of the container. [default: `10f`]
* `top`: Distance between dataZoom component and the top side of the container. [default: `0`]
* `left`: Distance between dataZoom component and the left side of the container. [default: `0`]
* `right`: Distance between dataZoom component and the right side of the container. [default: `0`]
* `height`: The height of dataZoom component. height value is a instant pixel value like 10. [default: `50f`]
* `rangeMode`: Use absolute value or percent value in `DataZoom.start` and `DataZoom.end`. [default: `RangeMode.Percent`].
* `Percent`: percent.
* `start`: The start percentage of the window out of the data extent, in the range of `0 ~ 100`. [default: `30f`]
* `end`: The end percentage of the window out of the data extent, in the range of 0 ~ 100. [default: `70f`]
* `scrollSensitivity`: The sensitivity of dataZoom scroll. The larger the number, the more sensitive it is. [default: `10f`]
* `textStyle`: style of datazoom label.
* `minShowNum`: Minimum number of display data. Minimum number of data displayed when DataZoom is enlarged to maximum. [default: `1`]
## `VisualMap`
VisualMap component. mapping data to visual elements such as colors.
* `enable`: Whether enable visualMap component. [default: false]
* `show`: Whether to display components. If set to false, it will not show up, but the data mapping function still exists. [default: true]
* `type`: the type of visualmap component.
* `Continuous`: Continuous.
* ~~`Piecewise`: Piecewise.~~
* ~~`selectedMode`: the selected mode for Piecewise visualMap.~~
* ~~`Multiple`: Multiple.~~
* ~~`Single`: Single.~~
* `autoMinMax`: Automatically set min, Max value.
* `min`: The minimum allowed. `min` must be user specified. `[min, max]` forms the domain of the visualMap.
* `max`: The maximum allowed. `max` must be user specified. `[min, max]` forms the domain of the visualMap.
* `range`: Specifies the position of the numeric value corresponding to the handle. Range should be within the range of [min,max].
* ~~`text`: Text on both ends. such as ['High', 'Low'].~~
* ~~`textGap`: The distance between the two text bodies.~~
* `splitNumber`: For continuous data, it is automatically evenly divided into several segments and automatically matches the size of inRange color list when the default is 0.
* `calculable`: Whether the handle used for dragging is displayed (the handle can be dragged to adjust the selected range).
* ~~`realtime`: Whether to update in real time while dragging.~~
* `itemWidth`: The width of the figure, that is, the width of the color bar.
* `itemHeight`: The height of the figure, that is, the height of the color bar.
* `borderWidth`: 边框线宽单位px。
* `dimension`: Specifies which `dimension` of the `Data` to map to the visual element. `Data` is series.data. Starting at 1, the default is 0 to take the last dimension in data.
* `hoverLink`: When the hoverLink function is turned on, when the mouse hovers over the visualMap component, the corresponding value of the mouse position is highlighted in the corresponding graphic element in the diagram. Conversely, when the mouse hovers over a graphic element in a diagram, the corresponding value of the visualMap component is triangulated in the corresponding position.
* `orient`: Is the layout horizontal or vertical.
* `location`: The location of component.
* `inRange`: Defines the visual color in the selected range.
* ~~`outOfRange`: Defines a visual color outside of the selected range.~~
## `Grid`
Grid component. Drawing grid in rectangular coordinate. In a single grid, at most two X and Y axes each is allowed. Line chart, bar chart, and scatter chart can be drawn in grid. There is only one single grid component at most in a single echarts instance.
* `show`: Whether to show the grid in rectangular coordinate.
* `left`: Distance between grid component and the left side of the container.
* `right`: Distance between grid component and the right side of the container.
* `top`: Distance between grid component and the top side of the container.
* `bottom`: Distance between grid component and the bottom side of the container.
* `backgroundColor`: Background color of grid, which is transparent by default.
## `GaugeAxis`
GaugeAxis sub component. Settings related to gauge axis line.
* `axisLine`: axis line style.
* `splitLine`: slit line style.
* `axisTick`: axis tick style.
* `axisLabel`: axis label style.
* `axisLabelText`: Coordinate axis scale label custom content. When the content is empty, `axisLabel` automatically displays the content according to the scale; otherwise, the content is taken from the list definition.
## `GaugePointer`
GaugePointer sub component. Settings related to gauge pointer.
* `show`: Whether to display a pointer.
* `width`: Pointer width.
* `length`: Pointer length. It can be an absolute value, or it can be a percentage relative to the radius (0-1).
## `XAxis`
The x axis in cartesian(rectangular) coordinate. a grid component can place at most 2 x axis, one on the bottom and another on the top.
* `show`: Whether to show axis. By default `xAxes[0]` is `true` and `xAxes[1]` is `false`.
* `gridIndex`: The index of the grid on which the axis are located, by default, is in the first grid.
* `type`: the type of axis. The default is `Category`.
* `Value`: Numerical axis for continuous data.
* `Category`: Category axis, applicable to discrete category data, category data must be set through `data` for this type.
* `Log`: Log axis, it applies to logarithmic data.
* `position`: the position of axis in grid.
* `Left`: left of grid.
* `Right`: right of grid.
* `Bottom`: bottom of grid.
* `Top`: top of grid.
* `offset`: the offset of axis from the default position. Useful when the same position has multiple axes.
* `logBaseE`: On the log axis, if base e is the natural number, and is true, logBase fails.
* `logBase`: Base of logarithm, which is valid only for numeric axes with type: `Log`.
* `minMaxType`: the type of axis minmax.The default is `Default`.
* `Default`: 0 - max.
* `MinMax`: min - max.
* `Custom`: Custom min - max.
* `min`: The minimun value of axis. Valid when `minMaxType` is `Custom`.
* `max`: The maximum value of axis. Valid when `minMaxType` is `Custom`.
* `ceilRate`: The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
* `splitNumber`: Number of segments that the axis is split into. The default is `5`, When `splitNumber` is set to `0`, it draws all the category data.
* `interval`: Compulsively set segmentation interval for axis.This is unavailable for category axis. The `splitNumber` is invalid when set.
* `boundaryGap`: The boundary gap on both sides of a coordinate axis.
* `maxCache`: The max number of axis data cache. The first data will be remove when the size of axis data is larger then `maxCache`.
* `inverse`: Whether the axis are reversed or not. Invalid in `Category` axis.
* `data`: Category data, valid in the `Category` axis.
* `axisLine`: the style of axis line [AxisLine](#AxisLine).
* `axisName`: the style of axis name [AxisName](#AxisName).
* `axisTick`: the style of axis tick [AxisTick](#AxisTick).
* `axisLabel`: the style of axis label [AxisLabel](#AxisLabel).
* `splitLine`: the style of axis split line [AxisSplitLine](#SplitLine).
* `splitArea`: the style of axis split area [AxisSplitArea](#AxisSplitArea).
## `Background`
Background component.Due to the limitations of the framework, there are two limitations to the use of background component:
1: The parent node of chart cannot have a layout control class component.
2: The parent node of Chart can only have one child node of the current chart.
* `show`: Whether to enable the background component. However, the ability to activate the background component is subject to other conditions.
* `image`: the image of background.
* `imageType`: the fill type of background image.
* `imageColor`: the color of background image, The default is `white`.
* `hideThemeBackgroundColor`: Whether to hide the background color set in the `theme` when the background component is on.
## `YAxis`
The y axis in cartesian(rectangular) coordinate. a grid component can place at most 2 y axis, one on the left and another on the right.
The parameters are the same as XAxis.
## `Series`
Serie list. Each serie determines its own chart type by `type`.
Check each serie for parameters.
## `Serie-Line`
Line chart serie.
* `show`: Whether to show serie in chart.
* `type`: `Line`.
* `name`: Series name used for displaying in tooltip and filtering with legend.
* `stack`: If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
* `xAxisIndex`: Index of x axis to combine with, which is useful for multiple axes in one chart.
* `yAxisIndex`: Index of y axis to combine with, which is useful for multiple axes in one chart.
* `minShow`: The min number of data to show in chart.
* `maxShow`: The max number of data to show in chart.
* `maxCache`: The max number of serie data cache. The first data will be remove when the size of serie data is larger then maxCache.
* `sampleDist`: The minimum horizontal pixel distance of sampling, which defaults to `0` without sampling. When the horizontal pixel distance between two data points is less than this value, start sampling to ensure that the horizontal pixel distance between two points is not less than this value.
* `sampleType`: Sample type. This is valid when `sampleDist` is greater than `0`. The following five sampling types are supported:
* `Peak`: Take a peak. When the average value of the filter point is greater than or equal to `sampleAverage`, take the maximum value; If you do it the other way around, you get the minimum.
* `Average`: Take the average of the filter points.
* `Max`: Take the maximum value of the filter point.
* `Min`: Take the minimum value of the filter point.
* `Sum`: Take the sum of the filter points.
* `sampleAverage`: Set the sampling average. When `sampleType` is `Peak`, is the maximum or minimum value used to compare the average value of the filtered data. The default of `0` is to calculate the average of all data in real time.
* `clip`: 是否裁剪超出坐标系部分的图形。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`: 忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `showAsPositiveNumber`: 将负数数值显示为正数。一般和`AxisLabel``showAsPositiveNumber`配合使用。仅在折线图和柱状图中有效。
* `large`: 是否开启大数据量优化,在数据图形特别多而出现卡顿时候可以开启。开启后配合 largeThreshold 在数据量大于指定阈值的时候对绘制进行优化。缺点: 优化后不能自定义设置单个数据项的样式不能显示Label折线图不绘制Symbol。
* `largeThreshold`: 开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。
* `areaStyle`: 区域填充样式 [AreaStyle](#AreaStyle)。
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `lineType`: 折线图样式类型。支持以下十种类型:
* `Normal`: 普通折线图。
* `Smooth`: 平滑曲线。
* `SmoothDash`: 平滑虚线。
* `StepStart`: 阶梯线图: 当前点。
* `StepMiddle`: 阶梯线图: 当前点和下一个点的中间。
* `StepEnd`: 阶梯线图: 下一个拐点。
* `Dash`: 虚线。
* `Dot`: 点线。
* `DashDot`: 点划线。
* `DashDotDot`: 双点划线。
* `lineStyle`: 线条样式 [LineStyle](#LineStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `lineArrow`: 折线图的箭头 [LineArrow](#LineArrow)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Bar`
折线图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Bar`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `stack`: 数据堆叠。同个类目轴上系列配置相同的 `stack` 值后,后一个系列的值会在前一个系列的值上相加。
* `xAxisIndex`: Index of x axis to combine with, which is useful for multiple axes in one chart.
* `yAxisIndex`: Index of y axis to combine with, which is useful for multiple axes in one chart.
* `minShow`: 系列显示数据的最小索引。
* `maxShow`: 系列显示数据的最大索引。
* `maxCache`: 系列中可缓存的最大数据量。默认为`0`没有限制大于0时超过指定值会移除旧数据再插入新数据。
* `barType`: 柱状图类型。以下几种类型:
* `Normal`: 普通柱状图。
* `Zebra`: 斑马柱状图。
* `Capsule`: 胶囊柱状图。
* `barPercentStack`: 是否百分比堆叠柱状图,相同 `stack``serie` 只要有一个 `barPercentStack``true`,则就显示成百分比堆叠柱状图。
* `barWidth`: 柱条的宽度,不设时自适应。支持设置成相对于类目宽度的百分比。
* `barGap`: 不同系列的柱间距离。为百分比(如 `'0.3f'`,表示柱子宽度的 `30%`)。如果想要两个系列的柱子重叠,可以设置 `barGap``'-1f'`。这在用柱子做背景的时候有用。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barCategoryGap`: 同一系列的柱间距离默认为类目间距的20%,可设固定值。在同一坐标系上,此属性会被多个 `'bar'` 系列共享。此属性应设置于此坐标系中最后一个 `'bar'` 系列上才会生效,并且是对此坐标系中所有 `'bar'` 系列生效。
* `barZebraWidth`: 斑马线的粗细。`barType``Zebra` 时有效。
* `barZebraGap`: 斑马线的间距。`barType``Zebra` 时有效。
* `clip`: 是否裁剪超出坐标系部分的图形。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`: 忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `showAsPositiveNumber`: 将负数数值显示为正数。一般和`AxisLabel``showAsPositiveNumber`配合使用。仅在折线图和柱状图中有效。
* `large`: 是否开启大数据量优化,在数据图形特别多而出现卡顿时候可以开启。开启后配合 largeThreshold 在数据量大于指定阈值的时候对绘制进行优化。缺点: 优化后不能自定义设置单个数据项的样式不能显示Label折线图不绘制Symbol。
* `largeThreshold`: 开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `itemStyle`: 柱条样式 [ItemStyle](#ItemStyle)。
* `areaStyle`: 区域填充样式 [AreaStyle](#AreaStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Pie`
饼图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Pie`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `pieRoseType`: 南丁格尔玫瑰图类型,支持以下类型:
* `None`: 不展示成南丁格尔玫瑰图。
* `Radius`: 扇区圆心角展现数据的百分比,半径展现数据的大小。
* `Area`: 所有扇区圆心角相同,仅通过半径展现数据大小。
* `space`: 扇区间隙。
* `center`: 中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`: 半径。`radius[0]`为内径,`radius[1]`为外径。当内径大于0时即为圆环图。
* `roundCap`: 是否启用圆弧效果。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制,对应的`Label``Legend`也不会显示。
* `ignoreValue`: 忽略数据的默认值。默认值默认为0`ignore``true` 才有效。
* `avoidLabelOverlap`: 在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Radar`
雷达图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Radar`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `radarType`: 雷达图类型`RadarType`,支持以下类型:
* `Multiple`: 多圈雷达图。此时可一个雷达里绘制多个圈,一个`serieData`就可组成一个圈(多维数据)。
* `Single`: 单圈雷达图。此时一个雷达只能绘制一个圈,多个`serieData`组成一个圈,数据取自`data[1]`
* `radarIndex`: 雷达图所使用的 `radar` 组件的 `index`
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `lineStyle`: 线条样式 [LineStyle](#LineStyle)。
* `itemStyle`: 标记样式 [ItemStyle](#ItemStyle)。
* `areaStyle`: 区域填充样式 [AreaStyle](#AreaStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Scatter`
散点图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Scatter`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `clip`: 是否裁剪超出坐标系部分的图形。
* `symbol`: 标记的图形 [SerieSymbol](#SerieSymbol)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Heatmap`
热力图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Scatter`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `ignore`: 是否开启忽略数据。当为 `true` 时,数据值为 `ignoreValue` 时不进行绘制。
* `ignoreValue`: 忽略数据的默认值。默认值默认为`0`,当 `ignore``true` 才有效。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。
## `Serie-Gauge`
仪表盘系列。
* `show`: 系列是否显示在图表上。
* `type`: `Gauge`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `gaugeType`: 仪表盘类型,支持以下类型:
* `Pointer`: 指针类型。
* `ProgressBar`: 进度条类型。
* `center`: 中心点坐标。当值为0-1的浮点数时表示百分比。
* `radius`: 仪表盘半径。
* `min`: 最小的数据值。映射到`startAngle`
* `max`: 最大的数据值。映射到`endAngle`
* `startAngle`: 仪表盘起始角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `endAngle`: 仪表盘结束角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `splitNumber`: 仪表盘刻度分割段数。
* `roundCap`: 是否启用圆弧效果。
* `titleStyle`: 仪表盘标题 [TitleStyle](#TitleStyle)。
* `gaugeAxis`: 仪表盘坐标轴 [GaugeAxis](#GaugeAxis)。
* `gaugePointer`: 仪表盘指针 [GaugePointer](#GaugePointer)。
* `itemStyle`: 仪表盘指针样式 [ItemStyle](#ItemStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。仪表盘的数据一般只有一个,值通过`label`样式显示,`name`通过`titleStyle`样式显示。
## `Serie-Ring`
环形图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Ring`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `center`: 中心点坐标。当值为`0-1`的浮点数时表示百分比。
* `radius`: 仪表盘半径。
* `startAngle`: 仪表盘起始角度。和时钟一样,`12`点钟位置是`0`度,顺时针到`360`度。
* `ringGap`: 环形图的环间隙。
* `roundCap`: 是否启用圆弧效果。
* `clockwise`: 是否顺时针,默认为`true`
* `titleStyle`: 环形图中心标题 [TitleStyle](#TitleStyle)。
* `itemStyle`: 环形图的圆环样式,包括设置背景颜色和边框等 [ItemStyle](#ItemStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`: 高亮样式 [Emphasis](#Emphasis)。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。环形图的数据只有二维,`data[0]`表示当前值,`data[1]`表示最大值。
## `Serie-Liquid`
水位图系列。
* `show`: 系列是否显示在图表上。
* `type`: `Liquid`
* `name`: 系列名称。用于 `tooltip` 的显示,`legend` 的图例筛选。
* `vesselIndex`: 水位图所使用的`vessel`组件的`index`
* `min`: 最小值。
* `max`: 最大值。
* `waveLength`: 水波长。
* `waveHeight`: 水波高。
* `waveSpeed`: 水波移动速度。正数时左移,负数时右移。
* `waveOffset`: 水波偏移。
* `itemStyle`: 环形图的圆环样式,包括设置背景颜色和边框等 [ItemStyle](#ItemStyle)。
* `label`: 图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `animation`: 起始动画 [SerieAnimation](#SerieAnimation)。
* `data`: 系列中的数据项 [SerieData](#SerieData) 数组,可以设置`1``n`维数据。水位图的数据一般只有一个,表示当前水位值,用`max`设置最大水位值。
## `Settings`
全局参数设置组件。一般情况下可使用默认值,当有需要时可进行调整。
* `lineSmoothStyle`: 曲线平滑系数。通过调整平滑系数可以改变曲线的曲率,得到外观稍微有变化的不同曲线。
* `lineSmoothness`: 曲线平滑度。值越小曲线越平滑,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
* `lineSegmentDistance`: 线段的分割距离。普通折线图的线是由很多线段组成,段数由该数值决定。值越小段数越多,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
* `cicleSmoothness`: 圆形(包括扇形、环形等)的平滑度。数越小圆越平滑,但顶点数也会随之增加。
## `SerieAnimation`
* `enable`: 是否开启动画系统。
* ~~`threshold`: 是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。~~
* `fadeInDelay`: 设定的渐入动画延时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制: `customFadeInDelay`
* `fadeInDuration`: 设定的渐入动画时长,单位毫秒。如果要设置单个数据项的渐入时长,可以用代码定制: `customFadeInDuration`
* `fadeOutDelay`: 设定的渐出动画延时,单位毫秒。如果要设置单个数据项的延时,可以用代码定制: `customFadeOutDelay`
* `fadeOutDuration`: 设定的渐出动画时长,单位毫秒。如果要设置单个数据项的渐出时长,可以用代码定制: `customFadeOutDuration`
* `dataChangeEnable`: 是否开启数据变更动画。
* `dataChangeDuration`: 数据变更动画时长,单位毫秒。
## `AreaStyle`
* `show`: 是否显示区域填充。
* `origin`: 区域填充的起始位置 `AreaOrigin`。有以下三种填充方式:
* `Auto`: 填充坐标轴轴线到数据间的区域。
* `Start`: 填充坐标轴底部到数据间的区域。
* `End`: 填充坐标轴顶部到数据间的区域。
* `color`: 区域填充的颜色,默认取 `serie` 对应的颜色。如果 `toColor` 不是默认值,则表示渐变色的起点颜色。
* `toColor`: 区域填充的渐变色的终点颜色。
* `highlightColor`: 高亮时区域填充的颜色,默认取 `serie` 对应的颜色。如果 `highlightToColor` 不是默认值,则表示渐变色的起点颜色。
* `highlightToColor`: 高亮时区域填充的渐变色的终点颜色。
* `opacity`: 图形透明度。支持从 `0``1` 的数字,为 `0` 时不绘制该图形。
* `tooltipHighlight`: 鼠标悬浮时是否高亮之前的区域。
## `AxisLabel`
* `show`: 是否显示刻度标签。
* `interval`: 坐标轴刻度标签的显示间隔,在类目轴中有效。`0`表示显示所有标签,`1`表示隔一个隔显示一个标签,以此类推。
* `inside`: 刻度标签是否朝内,默认朝外。
* `margin`: 刻度标签与轴线之间的距离。
* `formatter`: 图例内容字符串模版格式器。支持用 `\n` 换行。模板变量为图例名称 `{value}`,数值格式化通过`numericFormatter`
* `numericFormatter`: 标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式: `A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `showAsPositiveNumber`: 将负数数值显示为正数。一般和`Serie``showAsPositiveNumber`配合使用。
* `onZero`: 刻度标签显示在`0`刻度上。
* `textLimit`: 文本自适应 [TextLimit](#TextLimit)。只在类目轴中有效。
* `textStyle`: The style of text [TextStyle](#TextStyle).
## `AxisLine`
* `show`: 是否显示坐标轴轴线。
* `onZero`: `X` 轴或者 `Y` 轴的轴线是否在另一个轴的 `0` 刻度上,只有在另一个轴为数值轴且包含 `0` 刻度时有效。
* `width`: 坐标轴线线宽。
* `symbol`: 是否显示箭头。
* `symbolWidth`: 箭头宽。
* `symbolHeight`: 箭头高。
* `symbolOffset`: 箭头偏移。
* `symbolDent`: 箭头的凹陷程度。
## `AxisName`
* `show`: 是否显示坐标名称。
* `name`: 坐标轴名称。
* `location`: 坐标轴名称的位置。支持以下类型:
* `Start`: 坐标轴起始处。
* `Middle`: 坐标轴中间。
* `End`: 坐标轴末端。
* `textStyle`: The style of text [TextStyle](#TextStyle).
## `AxisSplitLine`
* `show`: 是否显示坐标分割线。
* `interval`: 分割线的显示间隔。`0` 表示显示所有分割线,`1` 表示隔一个隔显示一个分割线,以此类推。
* `lineStyle`: 线条样式 [LineStyle](#LineStyle)。
## `AxisSplitArea`
* `show`: 是否显示坐标分割区域。
* `color`: 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
## `AxisTick`
* `show`: 是否显示坐标轴刻度。
* `alignWithLabel`: 类目轴中在 `boundaryGap``true` 的时候有效,可以保证刻度线和标签对齐。
* `inside`: 坐标轴刻度是否朝内,默认朝外。
* `length`: 坐标轴刻度的长度。
* `width`: 坐标轴刻度的宽度。默认为0时宽度和坐标轴一致。
## `Emphasis`
* `show`: 是否启用高亮样式。
* `label`: 图形文本标签样式 [SerieLabel](#SerieLabel)。
* `itemStyle`: 图形样式 [ItemStyle](#ItemStyle)。
## `ItemStyle`
* `show`: 是否启用。
* `color`: 颜色。
* `toColor`gradient color1.
* `toColor2`gradient color2.
* `backgroundColor`: 背景颜色。
* `backgroundWidth`: 背景的宽。
* `centerColor`: 中心区域的颜色。如环形图的中心区域。
* `centerGap`: 中心区域的间隙。如环形图的中心区域于最内环的间隙。
* `borderType`: 边框的类型。
* `borderColor`: 边框的颜色。
* `borderWidth`: 边框宽。
* `opacity`: 透明度。
* `tooltipFormatter`: 提示框单项的字符串模版格式器。具体配置参考`Tooltip``formatter`
* `numericFormatter`: 标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式: `A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`。此字段优先于`SerieLabel``Tooltip``numericFormatter`
* `cornerRadius`: 圆角半径。用数组分别指定4个圆角半径顺时针左上右上右下左下。支持用0-1的浮点数设置百分比。
## `LineArrow`
* `show`: 是否显示箭头。
* `position`: 箭头显示位置。支持以下两种位置:
* `End`: 末端显示。最后一个数据上显示箭头。
* `Start`: 起始端显示。第一个数据上显示箭头。
* `width`: 箭头宽。
* `height`: 箭头长。
* `offset`: 箭头偏移。默认箭头的中心点和数据坐标点一致,可通过 `offset` 调整偏移。
* `dent`: 箭头的凹度。
## `LineStyle`
* `show`: 是否显示线条。当作为子组件,它的父组件有参数控制是否显示时,改参数无效。
* `type`: 线条类型。支持以下五种类型:
* `None`: 不显示分割线。
* `Solid`: 实线。
* `Dashed`: 虚线。
* `Dotted`: 点线。
* `DashDot`: 点划线。
* `DashDotDot`: 双点划线。
* `color`: 线条颜色。默认和 `serie` 一致。
* `toColor`:线的渐变颜色(需要水平方向渐变时)。
* `toColor2`线的渐变颜色2需要水平方向三个渐变色的渐变时
* `width`: 线条宽。
* `opacity`: 线条的透明度。支持从 `0``1` 的数字,为 `0` 时不绘制该图形。
## `Location`
* `align`: 对齐方式。有以下对齐方式。
* `TopLeft`: 左上角对齐。
* `TopRight`: 右上角对齐。
* `TopCenter`: 置顶居中对齐。
* `BottomLeft`: 左下对齐。
* `BottomRight`: 右下对齐。
* `BottomCenter`: 底部居中对齐。
* `Center`: 居中对齐。
* `CenterLeft`: 中部靠左对齐。
* `CenterRight`: 中部靠右对齐。
* `left`: 离容器左侧的距离。
* `right`: 离容器右侧的距离。
* `top`: 离容器上侧的距离。
* `bottom`: 离容器下侧的距离。
## `SerieData`
* `name`: 数据项名称。
* `selected`: 该数据项是否被选中。
* `radius`: 自定义半径。可用在饼图中自定义某个数据项的半径。
* `iconStyle`: 数据项图标样式。
* `enableLabel`: 是否启用单个数据项的标签设置。
* `label`: 单个数据项的标签设置。
* `enableItemStyle`: 是否启用单个数据项的样式。
* `itemStyle`: 单个数据项的样式设置。
* `enableEmphasis`: 是否启用单个数据项的高亮样式。
* `emphasis`: 单个数据项的高亮样式设置。
* `enableSymbol`: 是否启用单个数据项的标记设置。
* `symbol`: 单个数据项的标记设置。
* `data`: 可指定任意维数的数值列表。对于折线图和柱状图,`data`其实是`size``2`的数组,`data[0]`是x的编号`data[1]``y`的数值,默认显示`data[1]`。其他图表看需求而定是长度大于`2`的数组。可通过`Serie``showDataDimension`指定数据长度。
## `SerieLabel`
* `show`: 是否显示文本标签。
* `position`: 标签的位置。折线图时强制默认为 `Center`,支持以下 `5` 种位置:
* `Outside`: 饼图扇区外侧,通过视觉引导线连到相应的扇区。只在饼图种可用。
* `Inside`: 饼图扇区内部。只在饼图可用。
* `Center`: 在中心位置(折线图,柱状图,饼图)。
* `Top`: 顶部(柱状图)。
* `Bottom`: 底部(柱状图)。
* `formatter`: 标签内容字符串模版格式器。支持用 `\n` 换行。模板变量有: `{a}`: 系列名;`{b}`: 数据名;`{c}`: 数据值;`{d}`: 百分比。示例: `{b}:{c}`
* `numericFormatter`: 标准数字格式字符串。用于将数值格式化显示为字符串。使用`Axx`的形式: `A`是格式说明符的单字符,支持`C`货币、`D`十进制、`E`指数、`F`顶点数、`G`常规、`N`数字、`P`百分比、`R`往返过程、`X`十六进制等九种。`xx`是精度说明,从`0`-`99`
* `offset`: 距离图形元素的偏移。
* `autoOffset`: 是否开启自动偏移。当开启时Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。
* `backgroundWidth`: 标签的背景宽度。一般不用指定,不指定时则自动是文字的宽度。
* `backgroundHeight`: 标签的背景高度。一般不用指定,不指定时则自动是文字的高度。
* `paddingLeftRight`: 标签文字和边框的左右边距。
* `paddingTopBottom`: 标签文字和边框的上下边距。
* `line`: 是否显示视觉引导线。在 `label` 位置 设置为 `'Outside'` 的时候会显示视觉引导线。
* `lineType`: 视觉引导线类型。支持以下几种类型:
* `BrokenLine`: 折线。
* `Curves`: 曲线。
* `HorizontalLine`: 水平线。
* `lineColor`: 视觉引导线自定义颜色。
* `lineWidth`: 视觉引导线的宽度。
* `lineLength1`: 视觉引导线第一段的长度。
* `lineLength2`: 视觉引导线第二段的长度。
* `border`: 是否显示边框。
* `borderWidth`: 边框宽度。
* `borderColor`: 边框颜色。
* `textStyle`: The style of text [TextStyle](#TextStyle).
## `SerieSymbol`
* `show`: 是否显示标记。
* `type`: 标记类型。支持以下六种类型:
* `EmptyCircle`: 空心圆。
* `Circle`: 实心圆。
* `Rect`: 正方形。可通过设置`itemStyle``cornerRadius`变成圆角矩形。
* `Triangle`: 三角形。
* `Diamond`: 菱形。
* `None`: 不显示标记。
* `gap`: 图形标记的外留白距离。
* `sizeType`: 标记图形的大小获取方式。支持以下三种类型:
* `Custom`: 自定义大小。
* `FromData`: 通过 `dataIndex` 从数据中获取,再乘以一个比例系数 `dataScale`
* `Callback`: 通过回调函数 `sizeCallback` 获取。
* `size`: 标记的大小。
* `selectedSize`: 被选中的标记的大小。
* `dataIndex`: 当 `sizeType` 指定为 `FromData` 时,指定的数据源索引。
* `dataScale`: 当 `sizeType` 指定为 `FromData` 时,指定的倍数系数。
* `selectedDataScale`: 当 `sizeType` 指定为 `FromData` 时,指定的高亮倍数系数。
* `sizeCallback`: 当 `sizeType` 指定为 `Callback` 时,指定的回调函数。
* `selectedSizeCallback`: 当 `sizeType` 指定为 `Callback` 时,指定的高亮回调函数。
* `color`: 标记图形的颜色,默认和系列一致。
* `opacity`: 图形标记的透明度。
* `startIndex`: 开始显示图形标记的索引。
* `interval`: 显示图形标记的间隔。`0`表示显示所有标签,`1`表示隔一个隔显示一个标签,以此类推。
* `forceShowLast`: 是否强制显示最后一个图形标记。默认为 `false`
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XChartsAPI接口](XChartsAPI.md)
[XCharts问答](XCharts问答.md)

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 3fa7a80a30cd846139159beaadba05f2
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ca54a17a3a60f4b36b0be43df9f1c33d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,34 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI BarChart.
/// </summary>
[CustomEditor(typeof(BarChart), false)]
public class BarChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (BarChart)target;
}
protected override void OnEndInspectorGUI()
{
base.OnEndInspectorGUI();
if (m_Chart == null && target == null)
{
return;
}
}
}
}

View File

@@ -1,296 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using System.Text;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI BaseChart.
/// </summary>
[CustomEditor(typeof(BaseChart), false)]
public class BaseChartEditor : Editor
{
#if UNITY_2019_3_OR_NEWER
private const float k_IconWidth = 14;
private const float k_IconGap = 0f;
private const float k_IconXOffset = 7f;
private const float k_IconYOffset = -1f;
#else
private const float k_IconWidth = 14;
private const float k_IconGap = 0f;
private const float k_IconXOffset = 4f;
private const float k_IconYOffset = -3f;
#endif
protected BaseChart m_Chart;
protected SerializedProperty m_Script;
protected SerializedProperty m_MultiComponentMode;
protected SerializedProperty m_EnableTextMeshPro;
protected SerializedProperty m_ChartWidth;
protected SerializedProperty m_ChartHeight;
protected SerializedProperty m_Settings;
protected SerializedProperty m_Theme;
protected SerializedProperty m_Background;
protected SerializedProperty m_Titles;
protected SerializedProperty m_Legends;
protected SerializedProperty m_Tooltips;
protected SerializedProperty m_Vessels;
protected SerializedProperty m_Radars;
protected SerializedProperty m_Series;
protected SerializedProperty m_Large;
protected SerializedProperty m_ChartName;
protected SerializedProperty m_DebugMode;
protected float m_DefaultLabelWidth;
protected float m_DefaultFieldWidth;
private int m_SeriesSize;
private Vector2 scrollPos;
private bool m_CheckWarning = false;
private StringBuilder sb = new StringBuilder();
private bool m_BaseFoldout;
protected bool m_ShowAllComponent;
protected Dictionary<string, bool> m_Flodouts = new Dictionary<string, bool>();
protected virtual void OnEnable()
{
if (target == null) return;
m_Chart = (BaseChart)target;
m_Script = serializedObject.FindProperty("m_Script");
m_MultiComponentMode = serializedObject.FindProperty("m_MultiComponentMode");
m_EnableTextMeshPro = serializedObject.FindProperty("m_EnableTextMeshPro");
m_ChartName = serializedObject.FindProperty("m_ChartName");
m_ChartWidth = serializedObject.FindProperty("m_ChartWidth");
m_ChartHeight = serializedObject.FindProperty("m_ChartHeight");
m_Theme = serializedObject.FindProperty("m_Theme");
m_Settings = serializedObject.FindProperty("m_Settings");
m_Background = serializedObject.FindProperty("m_Background");
m_Titles = serializedObject.FindProperty("m_Titles");
m_Legends = serializedObject.FindProperty("m_Legends");
m_Tooltips = serializedObject.FindProperty("m_Tooltips");
m_Vessels = serializedObject.FindProperty("m_Vessels");
m_Series = serializedObject.FindProperty("m_Series");
m_Radars = serializedObject.FindProperty("m_Radars");
m_Large = serializedObject.FindProperty("m_Large");
m_DebugMode = serializedObject.FindProperty("m_DebugMode");
}
public override void OnInspectorGUI()
{
if (m_Chart == null && target == null)
{
base.OnInspectorGUI();
return;
}
serializedObject.Update();
m_DefaultLabelWidth = EditorGUIUtility.labelWidth;
m_DefaultFieldWidth = EditorGUIUtility.fieldWidth;
OnStartInspectorGUI();
OnMiddleInspectorGUI();
OnEndInspectorGUI();
OnDebugInspectorGUI();
EditorGUILayout.Space();
serializedObject.ApplyModifiedProperties();
}
protected virtual void OnStartInspectorGUI()
{
BlockStart();
EditorGUILayout.BeginHorizontal();
var version = string.Format("v{0}_{1}", XChartsMgr.version, XChartsMgr.versionDate);
if (m_EnableTextMeshPro.boolValue)
{
version += " TMP";
}
EditorGUILayout.LabelField(version);
if (GUILayout.Button("Github"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
}
EditorGUILayout.EndHorizontal();
BlockEnd();
BlockStart();
m_BaseFoldout = EditorGUILayout.Foldout(m_BaseFoldout, "Base");
if (m_BaseFoldout)
{
EditorGUILayout.PropertyField(m_Script);
EditorGUILayout.PropertyField(m_ChartName);
}
BlockEnd();
BlockField(m_Theme);
BlockField(m_Settings);
BlockField(m_Background);
m_ShowAllComponent = m_MultiComponentMode.boolValue;
BlockListField(m_ShowAllComponent, m_Titles);
BlockListField(m_ShowAllComponent, m_Legends);
BlockListField(m_ShowAllComponent, m_Tooltips);
BlockListField(m_ShowAllComponent, SerieType.Liquid, m_Vessels);
BlockListField(m_ShowAllComponent, SerieType.Radar, m_Radars);
}
protected virtual void OnMiddleInspectorGUI()
{
BlockField(m_Series);
}
protected virtual void OnEndInspectorGUI()
{
}
protected virtual void OnDebugInspectorGUI()
{
BlockStart();
EditorGUILayout.PropertyField(m_DebugMode);
EditorGUILayout.PropertyField(m_MultiComponentMode);
EditorGUILayout.Space();
EditorGUILayout.Space();
MoreDebugInspector();
CheckWarning();
BlockEnd();
}
protected virtual void MoreDebugInspector()
{
}
protected void BlockStart()
{
if (XChartsSettings.editorBlockEnable) EditorGUILayout.BeginVertical(EditorStyles.helpBox);
}
protected void BlockEnd()
{
if (XChartsSettings.editorBlockEnable) EditorGUILayout.EndVertical();
}
protected void BlockField(params SerializedProperty[] props)
{
if (props.Length == 0) return;
BlockStart();
foreach (var prop in props)
EditorGUILayout.PropertyField(prop, true);
BlockEnd();
}
protected void BlockListField(bool all, params SerializedProperty[] props)
{
if (props.Length == 0) return;
BlockStart();
foreach (var prop in props)
{
if (all)
{
var flag = m_Flodouts.ContainsKey(prop.displayName) && m_Flodouts[prop.displayName];
m_Flodouts[prop.displayName] = EditorGUILayout.Foldout(flag, prop.displayName);
if (m_Flodouts[prop.displayName])
{
EditorGUI.indentLevel++;
prop.arraySize = EditorGUILayout.IntField("Size", prop.arraySize);
for (int i = 0; i < prop.arraySize; i++)
{
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
var currRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
currRect.y -= EditorGUI.GetPropertyHeight(prop.GetArrayElementAtIndex(i));
var rect1 = new Rect(currRect.width + k_IconXOffset,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconRemove, ChartEditorHelper.Styles.invisibleButton))
{
if (i < prop.arraySize && i >= 0) prop.DeleteArrayElementAtIndex(i);
}
var rect2 = new Rect(currRect.width + k_IconXOffset - k_IconWidth - k_IconGap,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect2, ChartEditorHelper.Styles.iconDown, ChartEditorHelper.Styles.invisibleButton))
{
if (i < prop.arraySize - 1) prop.MoveArrayElement(i, i + 1);
}
var rect3 = new Rect(currRect.width + k_IconXOffset - 2 * (k_IconWidth + k_IconGap),
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect3, ChartEditorHelper.Styles.iconUp, ChartEditorHelper.Styles.invisibleButton))
{
if (i > 0) prop.MoveArrayElement(i, i - 1);
}
GUI.contentColor = oldColor;
}
EditorGUI.indentLevel--;
}
}
else if (prop.arraySize > 0) EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(0), true);
}
BlockEnd();
}
protected void BlockListField(bool all, SerieType serieType, params SerializedProperty[] props)
{
if (!m_Chart.ContainsSerie(serieType)) return;
BlockListField(all, props);
}
private void CheckWarning()
{
if (GUILayout.Button("Remove All Chart Object"))
{
m_Chart.RemoveChartObject();
}
// if (GUILayout.Button("Check XCharts Update"))
// {
// CheckVersionEditor.ShowWindow();
// }
if (m_CheckWarning)
{
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Check Warning"))
{
m_CheckWarning = true;
m_Chart.CheckWarning();
}
if (GUILayout.Button("Hide Warning"))
{
m_CheckWarning = false;
}
EditorGUILayout.EndHorizontal();
sb.Length = 0;
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
if (!string.IsNullOrEmpty(m_Chart.warningInfo))
{
sb.AppendLine();
sb.Append(m_Chart.warningInfo);
}
else
{
sb.AppendLine();
sb.Append("Perfect! No warning!");
}
EditorGUILayout.HelpBox(sb.ToString(), MessageType.Warning);
}
else
{
if (GUILayout.Button("Check warning"))
{
m_CheckWarning = true;
m_Chart.CheckWarning();
}
}
EditorGUILayout.Space();
}
}
}

View File

@@ -1,62 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI CoordinateChart.
/// </summary>
[CustomEditor(typeof(CoordinateChart), false)]
public class CoordinateChartEditor : BaseChartEditor
{
protected SerializedProperty m_Grids;
protected SerializedProperty m_MultipleXAxis;
protected SerializedProperty m_XAxes;
protected SerializedProperty m_MultipleYAxis;
protected SerializedProperty m_YAxes;
protected SerializedProperty m_DataZooms;
protected SerializedProperty m_VisualMaps;
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (CoordinateChart)target;
m_Grids = serializedObject.FindProperty("m_Grids");
m_XAxes = serializedObject.FindProperty("m_XAxes");
m_YAxes = serializedObject.FindProperty("m_YAxes");
m_DataZooms = serializedObject.FindProperty("m_DataZooms");
m_VisualMaps = serializedObject.FindProperty("m_VisualMaps");
}
protected override void OnStartInspectorGUI()
{
base.OnStartInspectorGUI();
BlockListField(m_ShowAllComponent, m_DataZooms);
BlockListField(m_ShowAllComponent, m_VisualMaps);
BlockListField(m_ShowAllComponent, m_Grids);
BlockListField(m_ShowAllComponent, m_XAxes);
BlockListField(m_ShowAllComponent, m_YAxes);
}
protected override void MoreDebugInspector()
{
base.MoreDebugInspector();
CovertXYAxis();
}
private void CovertXYAxis()
{
if (GUILayout.Button("Covert XY Axis"))
{
(m_Chart as CoordinateChart).CovertXYAxis(0);
}
}
}
}

View File

@@ -1,24 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI GaugeChart.
/// </summary>
[CustomEditor(typeof(GaugeChart), false)]
public class GaugeChartEditor : BaseChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (GaugeChart)target;
}
}
}

View File

@@ -1,24 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI HeatmapChart.
/// </summary>
[CustomEditor(typeof(HeatmapChart), false)]
public class HeatmapChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (HeatmapChart)target;
}
}
}

View File

@@ -1,24 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI LineChart.
/// </summary>
[CustomEditor(typeof(LineChart), false)]
public class LineChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (LineChart)target;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6bd1a238bc5b407408b8f902aa3db9fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,20 +0,0 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI LiquidChart.
/// </summary>
[CustomEditor(typeof(LiquidChart), false)]
public class LiquidChartEditor : BaseChartEditor
{
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 307a1578a6be1403c98fdc27d99d1808
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,24 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI PieChart.
/// </summary>
[CustomEditor(typeof(PieChart), false)]
public class PieChartEditor : BaseChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (PieChart)target;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 28de30021bed0f945af09633584fcb44
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,40 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI PolarChart.
/// </summary>
[CustomEditor(typeof(PolarChart), false)]
public class PolarChartEditor : BaseChartEditor
{
protected SerializedProperty m_Polars;
protected SerializedProperty m_RadiusAxes;
protected SerializedProperty m_AngleAxes;
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (PolarChart)target;
m_Polars = serializedObject.FindProperty("m_Polars");
m_RadiusAxes = serializedObject.FindProperty("m_RadiusAxes");
m_AngleAxes = serializedObject.FindProperty("m_AngleAxes");
}
protected override void OnStartInspectorGUI()
{
base.OnStartInspectorGUI();
var showAll = m_MultiComponentMode.boolValue;
BlockListField(showAll, m_Polars);
BlockListField(showAll, m_RadiusAxes);
BlockListField(showAll, m_AngleAxes);
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 157ef5f1d75e04aa1814e0b188591912
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,178 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Axis), true)]
public class AxisDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Axis"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
SerializedProperty m_Type = prop.FindPropertyRelative("m_Type");
SerializedProperty m_LogBase = prop.FindPropertyRelative("m_LogBase");
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
var chart = prop.serializedObject.targetObject as BaseChart;
var isPolar = chart is PolarChart;
EditorGUI.indentLevel++;
PropertyField(prop, isPolar ? "m_PolarIndex" : "m_GridIndex");
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Position");
PropertyField(prop, "m_Offset");
if (type == Axis.AxisType.Log)
{
PropertyField(prop, "m_LogBaseE");
EditorGUI.BeginChangeCheck();
PropertyField(prop, "m_LogBase");
if (m_LogBase.floatValue <= 0 || m_LogBase.floatValue == 1)
{
m_LogBase.floatValue = 10;
}
EditorGUI.EndChangeCheck();
}
if (type == Axis.AxisType.Value)
{
PropertyField(prop, "m_MinMaxType");
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++;
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
EditorGUI.indentLevel--;
break;
}
PropertyField(prop, "m_CeilRate");
PropertyField(prop, "m_Inverse");
}
PropertyField(prop, "m_SplitNumber");
if (type == Axis.AxisType.Category)
{
PropertyField(prop, "m_BoundaryGap");
}
else
{
PropertyField(prop, "m_Interval");
}
DrawExtendeds(prop);
PropertyField(prop, "m_AxisLine");
PropertyField(prop, "m_AxisName");
PropertyField(prop, "m_AxisTick");
PropertyField(prop, "m_AxisLabel");
PropertyField(prop, "m_SplitLine");
PropertyField(prop, "m_SplitArea");
if (type == Axis.AxisType.Category)
{
PropertyListField(prop, "m_Data", true);
}
EditorGUI.indentLevel--;
}
}
}
[CustomPropertyDrawer(typeof(XAxis), true)]
public class XAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "XAxis"; } }
}
[CustomPropertyDrawer(typeof(YAxis), true)]
public class YAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "YAxis"; } }
}
[CustomPropertyDrawer(typeof(AngleAxis), true)]
public class AngleAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "AngleAxis"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_StartAngle");
PropertyField(prop, "m_Clockwise");
}
}
[CustomPropertyDrawer(typeof(RadiusAxis), true)]
public class RadiusAxisDrawer : AxisDrawer
{
public override string ClassName { get { return "RadiusAxis"; } }
}
[CustomPropertyDrawer(typeof(AxisLabel), true)]
public class AxisLabelDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AxisLabel"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_Margin");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_TextLimit");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisName), true)]
public class AxisNameDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AxisName"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_Location");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisSplitArea), true)]
public class AxisSplitAreaDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "SplitArea"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Color");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d0544f1db7f17644bb3cbe7c85da84d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,31 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Background), true)]
public class BackgroundDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Background"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_ImageColor");
PropertyField(prop, "m_HideThemeBackgroundColor");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 24e3f8609cdf9494cb350a110566176f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,65 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(DataZoom), true)]
public class DataZoomDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "DataZoom"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Enable"))
{
var m_SupportSlider = prop.FindPropertyRelative("m_SupportSlider");
var m_Start = prop.FindPropertyRelative("m_Start");
var m_End = prop.FindPropertyRelative("m_End");
var m_MinShowNum = prop.FindPropertyRelative("m_MinShowNum");
++EditorGUI.indentLevel;
PropertyField(prop, "m_SupportInside");
PropertyField(prop, m_SupportSlider);
PropertyField(prop, "m_ZoomLock");
PropertyField(prop, "m_ScrollSensitivity");
PropertyField(prop, "m_RangeMode");
PropertyField(prop, m_Start);
PropertyField(prop, m_End);
PropertyField(prop, m_MinShowNum);
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
if (m_End.floatValue > 100) m_End.floatValue = 100;
if (m_MinShowNum.intValue < 0) m_MinShowNum.intValue = 0;
if (m_SupportSlider.boolValue)
{
PropertyField(prop, "m_ShowDataShadow");
PropertyField(prop, "m_ShowDetail");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_FillerColor");
PropertyField(prop, "m_Left");
PropertyField(prop, "m_Right");
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_AreaStyle");
PropertyListField(prop, "m_XAxisIndexs", true);
PropertyListField(prop, "m_YAxisIndexs", true);
PropertyField(prop, "m_TextStyle");
}
else
{
PropertyListField(prop, "m_XAxisIndexs", true);
PropertyListField(prop, "m_YAxisIndexs", true);
}
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cba26e421f79077499f05aaf10d06b4f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,30 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Emphasis), true)]
public class EmphasisDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Emphasis"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Label");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,70 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(GaugeAxis), true)]
public class GaugeAxisDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Gauge Axis"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_AxisLine");
PropertyField(prop, "m_SplitLine");
PropertyField(prop, "m_AxisTick");
PropertyField(prop, "m_AxisLabel");
PropertyField(prop, "m_AxisLabelText");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(StageColor), true)]
public class GaugeAxisLineStageColorDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty m_Percent = prop.FindPropertyRelative("m_Percent");
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
ChartEditorHelper.MakeTwoField(ref drawRect, drawRect.width, m_Percent, m_Color, "Stage");
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
}
}
[CustomPropertyDrawer(typeof(GaugePointer), true)]
public class GaugePointerDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Gauge Pointer"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Length");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: dec6cfc5ef85147738a81d8de84b079a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,32 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Grid), true)]
public class GridDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Grid"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Left");
PropertyField(prop, "m_Right");
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_BackgroundColor");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f4142159d55a64e1d88d81ac84b714d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,38 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Legend), true)]
public class LegendDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Legend"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_ItemWidth");
PropertyField(prop, "m_ItemHeight");
PropertyField(prop, "m_ItemGap");
PropertyField(prop, "m_ItemAutoColor");
PropertyField(prop, "m_SelectedMode");
PropertyField(prop, "m_Orient");
PropertyField(prop, "m_Location");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_TextStyle");
PropertyListField(prop, "m_Icons");
PropertyListField(prop, "m_Data");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b96d10541649a23468168ba0bf1c0bc5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,30 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Polar), true)]
public class PolarDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Polar"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyTwoFiled(prop, "m_Center");
PropertyField(prop, "m_Radius");
PropertyField(prop, "m_BackgroundColor");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 48ff9465776e54e749f9ff8c424bafe2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,58 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Radar), true)]
public class RadarDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Radar"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Shape");
PropertyField(prop, "m_PositionType");
PropertyTwoFiled(prop, "m_Center");
PropertyField(prop, "m_Radius");
PropertyField(prop, "m_SplitNumber");
PropertyField(prop, "m_CeilRate");
PropertyField(prop, "m_IsAxisTooltip");
PropertyField(prop, "m_AxisLine");
PropertyField(prop, "m_SplitLine");
PropertyField(prop, "m_SplitArea");
PropertyField(prop, "m_IndicatorList");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(Radar.Indicator), true)]
public class RadarIndicatorDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Indicator"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, ""))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 09bf71ecf64f321468ac28af28bec878
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,402 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Serie), true)]
public class SerieDrawer : BasePropertyDrawer
{
private bool m_IsPolar = false;
private List<bool> m_DataFoldout = new List<bool>();
public override string ClassName { get { return "Serie"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
pos.width -= 9;
base.OnGUI(pos, prop, label);
var type = prop.FindPropertyRelative("m_Type");
if (!MakeFoldout(prop, "m_Show"))
{
var orderButton = 48;
var gap = 4;
var drawRect = pos;
drawRect.x += EditorGUIUtility.labelWidth + gap;
drawRect.width = pos.width - drawRect.x + ChartEditorHelper.BOOL_WIDTH - orderButton;
EditorGUI.PropertyField(drawRect, type, GUIContent.none);
}
else
{
var chart = prop.serializedObject.targetObject as BaseChart;
m_IsPolar = chart is PolarChart;
var serieType = (SerieType)type.enumValueIndex;
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Name");
switch (serieType)
{
case SerieType.Line:
PropertyField(prop, "m_Stack");
if (m_IsPolar)
{
PropertyField(prop, "m_PolarIndex");
}
else
{
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
}
PropertyFieldLimitMin(prop, "m_MinShow", 0);
PropertyFieldLimitMin(prop, "m_MaxShow", 0);
PropertyFieldLimitMin(prop, "m_MaxCache", 0);
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_SampleDist");
PropertyField(prop, "m_SampleType");
PropertyField(prop, "m_SampleAverage");
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_Large");
PropertyField(prop, "m_LargeThreshold");
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_LineArrow");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_AreaStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Bar:
PropertyField(prop, "m_Stack");
if (m_IsPolar)
{
PropertyField(prop, "m_PolarIndex");
}
else
{
PropertyField(prop, "m_XAxisIndex");
PropertyField(prop, "m_YAxisIndex");
}
PropertyFieldLimitMin(prop, "m_MinShow", 0);
PropertyFieldLimitMin(prop, "m_MaxShow", 0);
PropertyFieldLimitMin(prop, "m_MaxCache", 0);
PropertyField(prop, "m_BarType");
PropertyField(prop, "m_BarPercentStack");
PropertyField(prop, "m_BarWidth");
PropertyField(prop, "m_BarGap");
PropertyField(prop, "m_BarZebraWidth");
PropertyField(prop, "m_BarZebraGap");
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_Large");
PropertyField(prop, "m_LargeThreshold");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Pie:
PropertyField(prop, "m_RoseType");
PropertyField(prop, "m_Space");
PropertyTwoFiled(prop, "m_Center");
PropertyTwoFiled(prop, "m_Radius");
PropertyField(prop, "m_RoundCap");
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_AvoidLabelOverlap");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Ring:
PropertyTwoFiled(prop, "m_Center");
PropertyTwoFiled(prop, "m_Radius");
PropertyField(prop, "m_StartAngle");
PropertyField(prop, "m_RingGap");
PropertyField(prop, "m_RoundCap");
PropertyField(prop, "m_Clockwise");
PropertyField(prop, "m_TitleStyle");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Radar:
PropertyField(prop, "m_RadarType");
PropertyField(prop, "m_RadarIndex");
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_AreaStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Scatter:
case SerieType.EffectScatter:
PropertyField(prop, "m_Clip");
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Heatmap:
PropertyField(prop, "m_Ignore");
PropertyField(prop, "m_IgnoreValue");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Gauge:
PropertyField(prop, "m_GaugeType");
PropertyTwoFiled(prop, "m_Center");
PropertyTwoFiled(prop, "m_Radius");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyField(prop, "m_StartAngle");
PropertyField(prop, "m_EndAngle");
PropertyFieldLimitMax(prop, "m_SplitNumber", 36);
PropertyField(prop, "m_RoundCap");
PropertyField(prop, "m_TitleStyle");
PropertyField(prop, "m_GaugeAxis");
PropertyField(prop, "m_GaugePointer");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_Emphasis");
break;
case SerieType.Liquid:
PropertyField(prop, "m_VesselIndex");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyField(prop, "m_WaveLength");
PropertyField(prop, "m_WaveHeight");
PropertyField(prop, "m_WaveSpeed");
PropertyField(prop, "m_WaveOffset");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
break;
}
PropertyField(prop, "m_Animation");
//PropertyListField(prop, "m_Data");
DrawData(pos, prop, serieType, ref m_DrawRect);
--EditorGUI.indentLevel;
}
}
private void DrawData(Rect pos, SerializedProperty prop, SerieType serieType, ref Rect drawRect)
{
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
SerializedProperty m_DataDimension = prop.FindPropertyRelative("m_ShowDataDimension");
SerializedProperty m_ShowDataName = prop.FindPropertyRelative("m_ShowDataName");
SerializedProperty m_ShowDataIcon = prop.FindPropertyRelative("m_ShowDataIcon");
int index = InitToggle(prop);
drawRect.width = EditorGUIUtility.labelWidth + 10;
m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data");
drawRect.width = pos.width;
AddSingleLineHeight();
if (m_DataFoldout[index])
{
EditorGUI.indentLevel++;
float nameWid = 45;
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
#else
var gap = 0;
var namegap = 0;
#endif
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height), m_DataDimension);
var nameRect = new Rect(pos.width - 2 * nameWid + 14 + gap, drawRect.y, nameWid - gap, pos.height);
if (XChartsSettings.editorBlockEnable)
{
nameRect.x += ChartEditorHelper.BLOCK_WIDTH;
}
if (GUI.Button(nameRect, new GUIContent("Name")))
{
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
}
var iconRect = new Rect(pos.width - nameWid + 14, drawRect.y, nameWid + namegap, pos.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += ChartEditorHelper.BLOCK_WIDTH;
}
if (GUI.Button(iconRect, new GUIContent("More...")))
{
m_ShowDataIcon.boolValue = !m_ShowDataIcon.boolValue;
}
AddSingleLineHeight();
var listSize = m_Datas.arraySize;
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
AddSingleLineHeight();
if (listSize < 0) listSize = 0;
if (m_DataDimension.intValue < 1) m_DataDimension.intValue = 1;
int dimension = m_DataDimension.intValue;
bool showName = m_ShowDataName.boolValue;
bool showIcon = m_ShowDataIcon.boolValue;
bool showSelected = (serieType == SerieType.Pie);
if (listSize != m_Datas.arraySize)
{
while (listSize > m_Datas.arraySize) m_Datas.arraySize++;
while (listSize < m_Datas.arraySize) m_Datas.arraySize--;
}
if (listSize > 30 && !XChartsSettings.editorShowAllListData)
{
int num = listSize > 10 ? 10 : listSize;
for (int i = 0; i < num; i++)
{
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
}
if (num >= 10)
{
EditorGUI.LabelField(drawRect, "...");
AddSingleLineHeight();
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, listSize - 1, pos.width);
}
}
else
{
for (int i = 0; i < m_Datas.arraySize; i++)
{
DrawDataElement(ref drawRect, dimension, m_Datas, showName, showIcon, showSelected, i, pos.width);
}
}
AddHeight(EditorGUIUtility.standardVerticalSpacing);
EditorGUI.indentLevel--;
}
}
private void DrawDataElement(ref Rect drawRect, int dimension, SerializedProperty m_Datas, bool showName,
bool showDetail, bool showSelected, int index, float currentWidth)
{
var lastX = drawRect.x;
var lastWid = drawRect.width;
var lastFieldWid = EditorGUIUtility.fieldWidth;
var lastLabelWid = EditorGUIUtility.labelWidth;
var serieData = m_Datas.GetArrayElementAtIndex(index);
var sereName = serieData.FindPropertyRelative("m_Name");
var selected = serieData.FindPropertyRelative("m_Selected");
var data = serieData.FindPropertyRelative("m_Data");
var fieldCount = dimension + (showName ? 1 : 0);
if (fieldCount <= 1)
{
while (2 > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
if (showSelected)
{
drawRect.width = drawRect.width - 18;
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + index));
drawRect.x = currentWidth - 45;
EditorGUI.PropertyField(drawRect, selected, GUIContent.none);
drawRect.x = lastX;
drawRect.width = lastWid;
}
else
{
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + index));
}
AddHeight(EditorGUI.GetPropertyHeight(element));
}
else
{
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
#else
var gap = 0;
var namegap = 0;
#endif
EditorGUI.LabelField(drawRect, "Element " + index);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
var dataWid = dataWidTotal / fieldCount;
var xWid = dataWid - 4;
for (int i = 0; i < dimension; i++)
{
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + 40;
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
if (showName)
{
drawRect.x = startX + (fieldCount - 1) * xWid;
drawRect.width = dataWid + 40 + dimension * namegap;
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
}
AddSingleLineHeight();
drawRect.x = lastX;
drawRect.width = lastWid;
EditorGUIUtility.fieldWidth = lastFieldWid;
EditorGUIUtility.labelWidth = lastLabelWid;
}
if (showDetail)
{
EditorGUI.indentLevel += 2;
var m_Icon = serieData.FindPropertyRelative("m_IconStyle");
var m_EnableLabel = serieData.FindPropertyRelative("m_EnableLabel");
var m_Label = serieData.FindPropertyRelative("m_Label");
var m_EnableItemStyle = serieData.FindPropertyRelative("m_EnableItemStyle");
var m_ItemStyle = serieData.FindPropertyRelative("m_ItemStyle");
var m_EnableEmphasis = serieData.FindPropertyRelative("m_EnableEmphasis");
var m_Emphasis = serieData.FindPropertyRelative("m_Emphasis");
var m_EnableSymbol = serieData.FindPropertyRelative("m_EnableSymbol");
var m_Symbol = serieData.FindPropertyRelative("m_Symbol");
EditorGUI.PropertyField(drawRect, m_Icon);
AddHeight(EditorGUI.GetPropertyHeight(m_Icon));
EditorGUI.PropertyField(drawRect, m_Symbol);
ChartEditorHelper.MakeBool(drawRect, m_EnableSymbol, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_Symbol));
EditorGUI.PropertyField(drawRect, m_Label);
ChartEditorHelper.MakeBool(drawRect, m_EnableLabel, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_Label));
EditorGUI.PropertyField(drawRect, m_ItemStyle);
ChartEditorHelper.MakeBool(drawRect, m_EnableItemStyle, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_ItemStyle));
EditorGUI.PropertyField(drawRect, m_Emphasis);
ChartEditorHelper.MakeBool(drawRect, m_EnableEmphasis, 1, "(enable)");
AddHeight(EditorGUI.GetPropertyHeight(m_Emphasis));
EditorGUI.indentLevel -= 2;
}
}
private int InitToggle(SerializedProperty prop)
{
int index = 0;
var sindex = prop.propertyPath.LastIndexOf('[');
var eindex = prop.propertyPath.LastIndexOf(']');
if (sindex >= 0 && eindex >= 0)
{
var str = prop.propertyPath.Substring(sindex + 1, eindex - sindex - 1);
int.TryParse(str, out index);
}
if (index >= m_DataFoldout.Count)
{
m_DataFoldout.Add(false);
}
return index;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c30d9496b99e39944a6987e390bed91f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,48 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(SerieLabel), true)]
public class SerieLabelDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Label"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Position");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_AutoOffset");
PropertyField(prop, "m_Margin");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_BackgroundWidth");
PropertyField(prop, "m_BackgroundHeight");
PropertyField(prop, "m_PaddingLeftRight");
PropertyField(prop, "m_PaddingTopBottom");
PropertyField(prop, "m_Border");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_Line");
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineLength1");
PropertyField(prop, "m_LineLength2");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d30d82b48b553451fad726478777a02e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,48 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
public class SerieSymbolDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Symbol"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_SizeType");
switch ((SerieSymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
{
case SerieSymbolSizeType.Custom:
PropertyField(prop, "m_Size");
PropertyField(prop, "m_SelectedSize");
break;
case SerieSymbolSizeType.FromData:
PropertyField(prop, "m_DataIndex");
PropertyField(prop, "m_DataScale");
PropertyField(prop, "m_SelectedDataScale");
break;
case SerieSymbolSizeType.Callback:
break;
}
PropertyField(prop, "m_StartIndex");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_ForceShowLast");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,43 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Series), true)]
public class SeriesDrawer : PropertyDrawer
{
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");
m_SeriesModuleToggle = ChartEditorHelper.MakeListWithFoldout(ref drawRect,
m_Series, m_SeriesModuleToggle, true, true);
}
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)) + EditorGUIUtility.standardVerticalSpacing;
}
}
height += 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
return height;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6c2458b1901047547b1a59d097786816
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,184 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.IO;
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
namespace XCharts
{
[CustomPropertyDrawer(typeof(ChartTheme), true)]
public class ThemeDrawer : BasePropertyDrawer
{
private bool m_ThemeModuleToggle = false;
public override string ClassName { get { return "Theme"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
if (prop.objectReferenceValue == null)
{
EditorGUI.ObjectField(pos, prop, new GUIContent("Theme"));
return;
}
base.OnGUI(pos, prop, label);
var defaultWidth = pos.width;
var defaultX = pos.x;
var btnWidth = 45;
ChartEditorHelper.MakeFoldout(ref m_DrawRect, ref m_ThemeModuleToggle, "Theme");
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (m_ThemeModuleToggle)
{
m_DrawRect.x = defaultX + defaultWidth - 2 * btnWidth - 2;
m_DrawRect.width = btnWidth;
var chart = prop.serializedObject.targetObject as BaseChart;
var lastFont = chart.theme.font;
#if dUI_TextMeshPro
var lastTMPFont = chart.theme.tmpFont;
#endif
if (GUI.Button(m_DrawRect, new GUIContent("Reset", "Reset to theme default color")))
{
chart.theme.ResetTheme();
chart.RefreshAllComponent();
}
m_DrawRect.x = defaultX + defaultWidth - btnWidth;
m_DrawRect.width = btnWidth;
if (GUI.Button(m_DrawRect, new GUIContent("Export", "Export theme to asset for a new theme")))
{
ExportThemeWindow.target = chart;
EditorWindow.GetWindow(typeof(ExportThemeWindow));
}
var data = (ScriptableObject)prop.objectReferenceValue;
SerializedObject serializedObject = new SerializedObject(data);
SerializedProperty newProp = serializedObject.GetIterator();
float y = pos.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
++EditorGUI.indentLevel;
var chartNameList = XChartsMgr.GetAllThemeNames();
var lastIndex = chartNameList.IndexOf(chart.theme.themeName);
var selectedIndex = EditorGUI.Popup(new Rect(pos.x, y, pos.width, EditorGUIUtility.singleLineHeight),
"Theme", lastIndex, chartNameList.ToArray());
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (lastIndex != selectedIndex)
{
GUI.changed = true;
XChartsMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
}
if (newProp.NextVisible(true))
{
do
{
if (newProp.name == "m_Script") continue;
if (newProp.name == "m_ThemeName") continue;
if (newProp.name == "m_Theme") continue;
AddPropertyField(pos, newProp, ref y);
} while (newProp.NextVisible(false));
}
if (GUI.changed)
{
chart.RefreshAllComponent();
serializedObject.ApplyModifiedProperties();
}
if (chart.theme.font != lastFont)
{
chart.theme.SyncFontToSubComponent();
}
#if dUI_TextMeshPro
if (chart.theme.tmpFont != lastTMPFont)
{
chart.theme.SyncTMPFontToSubComponent();
}
#endif
--EditorGUI.indentLevel;
}
}
private void AddPropertyField(Rect pos, SerializedProperty prop, ref float y)
{
float height = EditorGUI.GetPropertyHeight(prop, new GUIContent(prop.displayName), true);
EditorGUI.PropertyField(new Rect(pos.x, y, pos.width, height), prop, true);
y += height + EditorGUIUtility.standardVerticalSpacing;
m_Heights[m_KeyName] += height + EditorGUIUtility.standardVerticalSpacing;
}
}
public class ExportThemeWindow : EditorWindow
{
public static BaseChart target;
private static ExportThemeWindow window;
private string m_ChartName;
static void Init()
{
window = (ExportThemeWindow)EditorWindow.GetWindow(typeof(ExportThemeWindow), false, "Export Theme", true);
window.minSize = new Vector2(600, 50);
window.maxSize = new Vector2(600, 50);
window.Show();
}
void OnInspectorUpdate()
{
Repaint();
}
private void OnGUI()
{
if (target == null)
{
Close();
return;
}
GUILayout.Space(10);
GUILayout.Label("Input a new name for theme:");
m_ChartName = GUILayout.TextField(m_ChartName);
GUILayout.Space(10);
GUILayout.Label("Export path:");
if (string.IsNullOrEmpty(m_ChartName))
{
GUILayout.Label("Need input a new name.");
}
else
{
GUILayout.Label(XChartsMgr.GetThemeAssetPath(m_ChartName));
}
GUILayout.Space(20);
if (GUILayout.Button("Export"))
{
if (string.IsNullOrEmpty(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:Need input a new name!"));
}
else if (XChartsMgr.ContainsTheme(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:The name you entered is already in use!"));
}
else if (IsAssetsExist(XChartsMgr.GetThemeAssetPath(m_ChartName)))
{
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
+ XChartsMgr.GetThemeAssetPath(m_ChartName)));
}
else
{
XChartsMgr.ExportTheme(target.theme, m_ChartName);
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
+ XChartsMgr.GetThemeAssetPath(m_ChartName)));
}
}
}
private bool IsAssetsExist(string path)
{
return File.Exists(Application.dataPath + "/../" + path);
}
}
}

View File

@@ -1,33 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Title), true)]
public class TitleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Title"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Text");
PropertyField(prop, "m_SubText");
PropertyField(prop, "m_ItemGap");
PropertyField(prop, "m_Location");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_SubTextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 22ae7ec778f27c1409cb9151ce7b9aba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,29 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(TitleStyle), true)]
public class TitleStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "TitleStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,43 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Tooltip), true)]
public class TooltipDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Tooltip"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_TitleFormatter");
PropertyField(prop, "m_ItemFormatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_FixedWidth");
PropertyField(prop, "m_FixedHeight");
PropertyField(prop, "m_MinWidth");
PropertyField(prop, "m_MinHeight");
PropertyField(prop, "m_PaddingLeftRight");
PropertyField(prop, "m_PaddingTopBottom");
PropertyField(prop, "m_BackgroundImage");
PropertyField(prop, "m_IgnoreDataDefaultContent");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_TextStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5600b7009bc024a49800448cece012e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(Vessel), true)]
public class VesselDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Vessel"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Show"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Shape");
PropertyField(prop, "m_ShapeWidth");
PropertyField(prop, "m_Gap");
PropertyTwoFiled(prop, "m_Center");
PropertyField(prop, "m_Radius");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_Smoothness");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 744a68155f2f349dc8fe26536ec83f80
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,51 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
[CustomPropertyDrawer(typeof(VisualMap), true)]
public class VisualMapDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "VisualMap"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeFoldout(prop, "m_Enable"))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Direction");
PropertyField(prop, "m_AutoMinMax");
PropertyField(prop, "m_Min");
PropertyField(prop, "m_Max");
PropertyField(prop, "m_SplitNumber");
PropertyField(prop, "m_Dimension");
PropertyListField(prop, "m_InRange");
PropertyListField(prop, "m_OutOfRange");
PropertyField(prop, "m_Show");
if (prop.FindPropertyRelative("m_Show").boolValue)
{
PropertyField(prop, "m_SelectedMode");
PropertyTwoFiled(prop, "m_Range");
PropertyTwoFiled(prop, "m_Text");
PropertyTwoFiled(prop, "m_TextGap");
PropertyField(prop, "m_HoverLink");
PropertyField(prop, "m_Calculable");
PropertyField(prop, "m_ItemWidth");
PropertyField(prop, "m_ItemHeight");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_Orient");
PropertyField(prop, "m_Location");
}
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0fe31d791669a4014ac78fd7a2af9a6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,20 +0,0 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI RadarChart.
/// </summary>
[CustomEditor(typeof(RadarChart), false)]
public class RadarChartEditor : BaseChartEditor
{
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8ea6609b1e1634241947b4ef14c38849
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,24 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI RingChart.
/// </summary>
[CustomEditor(typeof(RingChart), false)]
public class RingChartEditor : BaseChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (RingChart)target;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f61a72b23edc44f48884d4989b04c509
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,24 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI ScatterChart.
/// </summary>
[CustomEditor(typeof(ScatterChart), false)]
public class ScatterChartEditor : CoordinateChartEditor
{
protected override void OnEnable()
{
base.OnEnable();
m_Chart = (ScatterChart)target;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3995bd8e5f80b49008624a5746622f68
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,487 +0,0 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using XCharts;
public class ChartEditorHelper
{
#if UNITY_2019_3_OR_NEWER
public const float INDENT_WIDTH = 15;
public const float BOOL_WIDTH = 15;
public const float ARROW_WIDTH = 20;
public const float BLOCK_WIDTH = 4;
public const float GAP_WIDTH = 2;
#else
public const float INDENT_WIDTH = 15;
public const float BOOL_WIDTH = 15;
public const float ARROW_WIDTH = 17.2f;
public const float BLOCK_WIDTH = 0;
public const float GAP_WIDTH = 0;
#endif
public class Styles
{
public static readonly GUIStyle headerStyle = EditorStyles.boldLabel;
public static readonly GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout)
{
font = headerStyle.font,
fontStyle = headerStyle.fontStyle,
};
public static readonly GUIContent iconAdd = new GUIContent("+", "Add");
public static readonly GUIContent iconRemove = new GUIContent("-", "Remove");
public static readonly GUIContent iconUp = new GUIContent("↑", "Up");
public static readonly GUIContent iconDown = new GUIContent("↓", "Down");
public static readonly GUIStyle invisibleButton = "InvisibleButton";
}
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 MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp,
string name)
{
while (arrayProp.arraySize < 2) arrayProp.arraySize++;
var prop1 = arrayProp.GetArrayElementAtIndex(0);
var prop2 = arrayProp.GetArrayElementAtIndex(1);
MakeTwoField(ref drawRect, rectWidth, prop1, prop2, name);
}
public static void MakeDivideList(ref Rect drawRect, float rectWidth, SerializedProperty arrayProp,
string name, int showNum)
{
while (arrayProp.arraySize < showNum) arrayProp.arraySize++;
EditorGUI.LabelField(drawRect, name);
#if UNITY_2019_3_OR_NEWER
var gap = 2;
#else
var gap = 0;
#endif
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + gap;
var dataWidTotal = (rectWidth - (startX + INDENT_WIDTH + 1));
EditorGUI.DrawRect(new Rect(startX, drawRect.y, dataWidTotal, drawRect.height), Color.grey);
var dataWid = dataWidTotal / showNum;
var xWid = dataWid - gap;
for (int i = 0; i < 1; i++)
{
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + (EditorGUI.indentLevel - 2) * 40.5f;
EditorGUI.PropertyField(drawRect, arrayProp.GetArrayElementAtIndex(i), GUIContent.none);
}
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public static void MakeTwoField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
SerializedProperty prop2, string name)
{
EditorGUI.LabelField(drawRect, name);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
var diff = 14 + EditorGUI.indentLevel * 14;
var offset = diff - INDENT_WIDTH;
var tempWidth = (rectWidth - startX + diff) / 2;
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth, drawRect.height);
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public static void MakeVector2(ref Rect drawRect, float rectWidth, SerializedProperty prop, string name)
{
EditorGUI.LabelField(drawRect, name);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
var diff = 14 + EditorGUI.indentLevel * 14;
var offset = diff - INDENT_WIDTH;
var tempWidth = (rectWidth - startX + diff) / 2;
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height);
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth, drawRect.height);
var x = EditorGUI.FloatField(centerXRect, prop.vector3Value.x);
var y = EditorGUI.FloatField(centerYRect, prop.vector3Value.y);
prop.vector3Value = new Vector3(x, y);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public static void MakeJsonData(ref Rect drawRect, ref bool showTextArea, ref string inputString,
SerializedProperty prop, float currentWidth, float diff = 0)
{
SerializedProperty stringDataProp = prop.FindPropertyRelative("m_JsonData");
SerializedProperty needParseProp = prop.FindPropertyRelative("m_DataFromJson");
float defalutX = drawRect.x;
drawRect.x = EditorGUIUtility.labelWidth + ARROW_WIDTH + diff;
drawRect.width = currentWidth - EditorGUIUtility.labelWidth - GAP_WIDTH - diff;
if (GUI.Button(drawRect, new GUIContent("Parse JsonData", "Parse data from input json")))
{
showTextArea = !showTextArea;
bool needParse = !showTextArea;
if (needParse)
{
stringDataProp.stringValue = inputString;
needParseProp.boolValue = true;
}
}
drawRect.x = defalutX;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (showTextArea)
{
drawRect.width = currentWidth;
drawRect.height = EditorGUIUtility.singleLineHeight * 4;
inputString = EditorGUI.TextArea(drawRect, inputString);
drawRect.y += EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing;
drawRect.height = EditorGUIUtility.singleLineHeight;
}
}
public static bool MakeFoldout(ref Rect drawRect, ref bool moduleToggle, string content,
SerializedProperty prop = null, bool bold = false)
{
float defaultWidth = drawRect.width;
float defaultX = drawRect.x;
var style = bold ? Styles.foldoutStyle : EditorStyles.foldout;
drawRect.width = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH;
moduleToggle = EditorGUI.Foldout(drawRect, moduleToggle, content, style);
MakeBool(drawRect, prop);
drawRect.width = defaultWidth;
drawRect.x = defaultX;
return moduleToggle;
}
public static bool MakeFoldout(ref Rect drawRect, Dictionary<string, float> heights,
Dictionary<string, bool> moduleToggle, string key, string content, SerializedProperty prop, bool bold = false)
{
float defaultWidth = drawRect.width;
float defaultX = drawRect.x;
var style = bold ? Styles.foldoutStyle : EditorStyles.foldout;
drawRect.width = EditorGUIUtility.labelWidth;
moduleToggle[key] = EditorGUI.Foldout(drawRect, moduleToggle[key], content, style);
if (prop != null)
{
if (prop.propertyType == SerializedPropertyType.Boolean)
{
MakeBool(drawRect, prop);
}
else
{
drawRect.x = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + ARROW_WIDTH;
drawRect.width = defaultWidth - drawRect.x + ARROW_WIDTH - 2;
if (XChartsSettings.editorBlockEnable)
{
drawRect.x += BLOCK_WIDTH;
}
EditorGUI.PropertyField(drawRect, prop, GUIContent.none);
}
}
drawRect.width = defaultWidth;
drawRect.x = defaultX;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
heights[key] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
return moduleToggle[key];
}
public static void MakeBool(Rect drawRect, SerializedProperty boolProp, int index = 0, string name = null)
{
float defaultWidth = drawRect.width;
float defaultX = drawRect.x;
float boolWidth = index * (BOOL_WIDTH + GAP_WIDTH);
drawRect.x = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + ARROW_WIDTH + boolWidth;
if (XChartsSettings.editorBlockEnable)
{
drawRect.x += BLOCK_WIDTH;
}
drawRect.width = (EditorGUI.indentLevel + 1) * BOOL_WIDTH + index * 110;
if (boolProp != null)
{
EditorGUI.PropertyField(drawRect, boolProp, GUIContent.none);
if (!string.IsNullOrEmpty(name))
{
drawRect.x += BOOL_WIDTH;
drawRect.width = 200;
EditorGUI.LabelField(drawRect, name);
}
}
drawRect.width = defaultWidth;
drawRect.x = defaultX;
}
public static bool MakeFoldout(ref Rect drawRect, ref float height, ref Dictionary<string, bool> moduleToggle,
SerializedProperty prop, string moduleName, string showPropName, bool bold = false)
{
var relativeProp = prop.FindPropertyRelative(showPropName);
var flag = MakeFoldout(ref drawRect, ref moduleToggle, prop, moduleName, relativeProp, bold);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
return flag;
}
public static bool MakeFoldout(ref Rect drawRect, ref Dictionary<string, bool> moduleToggle, SerializedProperty prop,
string moduleName, SerializedProperty showProp = null, bool bold = false)
{
var key = prop.propertyPath;
if (!moduleToggle.ContainsKey(key))
{
moduleToggle.Add(key, false);
}
var toggle = moduleToggle[key];
float defaultWidth = drawRect.width;
float defaultX = drawRect.x;
#if UNITY_2019_3_OR_NEWER
drawRect.width = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH;
#else
drawRect.width = EditorGUIUtility.labelWidth;
#endif
var displayName = string.IsNullOrEmpty(moduleName) ? prop.displayName : moduleName;
toggle = EditorGUI.Foldout(drawRect, toggle, displayName, bold ? Styles.foldoutStyle : EditorStyles.foldout);
if (moduleToggle[key] != toggle)
{
moduleToggle[key] = toggle;
}
if (showProp != null)
{
drawRect.x = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + ARROW_WIDTH;
if (showProp.propertyType == SerializedPropertyType.Boolean)
{
drawRect.width = (EditorGUI.indentLevel + 1) * BOOL_WIDTH;
}
else
{
drawRect.width = defaultWidth - drawRect.x + ARROW_WIDTH - GAP_WIDTH;
}
if (XChartsSettings.editorBlockEnable)
{
drawRect.x += BLOCK_WIDTH;
}
EditorGUI.PropertyField(drawRect, showProp, GUIContent.none);
}
drawRect.width = defaultWidth;
drawRect.x = defaultX;
return toggle;
}
public static bool MakeListWithFoldout(ref Rect drawRect, SerializedProperty listProp, bool foldout,
bool showOrder = false, bool showSize = true)
{
var height = 0f;
return MakeListWithFoldout(ref drawRect, ref height, listProp, foldout, showOrder, showSize);
}
public static bool MakeListWithFoldout(ref Rect drawRect, ref float height, SerializedProperty listProp,
bool foldout, bool showOrder = false, bool showSize = true)
{
var rawWidth = drawRect.width;
drawRect.width = EditorGUIUtility.labelWidth + 10;
bool flag = EditorGUI.Foldout(drawRect, foldout, listProp.displayName);
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.width = rawWidth;
if (flag)
{
MakeList(ref drawRect, ref height, listProp, showOrder, showSize);
}
return flag;
}
public static void MakeList(ref Rect drawRect, SerializedProperty listProp, bool showOrder = false,
bool showSize = true)
{
var height = 0f;
MakeList(ref drawRect, ref height, listProp, showOrder, showSize);
}
public static void MakeList(ref Rect drawRect, ref float height, SerializedProperty listProp,
bool showOrder = false, bool showSize = true)
{
EditorGUI.indentLevel++;
var listSize = listProp.arraySize;
var iconWidth = 14;
var iconGap = 3f;
if (showSize)
{
if (showOrder)
{
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth + 2, drawRect.height);
var iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += BLOCK_WIDTH;
}
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, Styles.iconAdd, Styles.invisibleButton))
{
if (listProp.displayName.Equals("Series"))
{
AddSerieEditor.chart = listProp.serializedObject.targetObject as BaseChart;
AddSerieEditor.ShowWindow();
}
else
{
listProp.arraySize++;
}
}
GUI.contentColor = oldColor;
listSize = listProp.arraySize;
listSize = EditorGUI.IntField(elementRect, "Size", listSize);
}
else
{
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
}
if (listSize < 0) listSize = 0;
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
if (listSize != listProp.arraySize)
{
while (listSize > listProp.arraySize) listProp.arraySize++;
while (listSize < listProp.arraySize) listProp.arraySize--;
}
}
if (listSize > 30 && !XChartsSettings.editorShowAllListData)
{
SerializedProperty element;
int num = listSize > 10 ? 10 : listSize;
for (int i = 0; i < num; i++)
{
element = listProp.GetArrayElementAtIndex(i);
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + i));
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
}
if (num >= 10)
{
EditorGUI.LabelField(drawRect, "...");
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
element = listProp.GetArrayElementAtIndex(listSize - 1);
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + (listSize - 1)));
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
}
}
else
{
for (int i = 0; i < listProp.arraySize; i++)
{
SerializedProperty element = listProp.GetArrayElementAtIndex(i);
if (showOrder)
{
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var isSerie = "Serie".Equals(element.type);
var elementRect = isSerie
? new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height)
: new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height);
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
var iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += BLOCK_WIDTH;
}
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, Styles.iconUp, Styles.invisibleButton))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
}
iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += BLOCK_WIDTH;
}
if (GUI.Button(iconRect, Styles.iconDown, Styles.invisibleButton))
{
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
}
iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += BLOCK_WIDTH;
}
if (GUI.Button(iconRect, Styles.iconRemove, Styles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
}
else
{
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
}
GUI.contentColor = oldColor;
}
else
{
EditorGUI.PropertyField(drawRect, element, new GUIContent("Element " + i));
drawRect.y += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
height += EditorGUI.GetPropertyHeight(element) + EditorGUIUtility.standardVerticalSpacing;
}
}
}
EditorGUI.indentLevel--;
}
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop)
{
if (prop == null) return false;
EditorGUI.PropertyField(drawRect, prop, true);
var hig = EditorGUI.GetPropertyHeight(prop);
drawRect.y += hig;
heights[key] += hig;
return true;
}
public static bool PropertyFieldWithMinValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop, float minValue)
{
if (prop == null) return false;
EditorGUI.PropertyField(drawRect, prop, true);
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue < minValue)
prop.floatValue = minValue;
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue < minValue)
prop.intValue = (int)minValue;
var hig = EditorGUI.GetPropertyHeight(prop);
drawRect.y += hig;
heights[key] += hig;
return true;
}
public static bool PropertyFieldWithMaxValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop, float maxValue)
{
if (prop == null) return false;
EditorGUI.PropertyField(drawRect, prop, true);
if (prop.propertyType == SerializedPropertyType.Float && prop.floatValue > maxValue)
prop.floatValue = maxValue;
if (prop.propertyType == SerializedPropertyType.Integer && prop.intValue > maxValue)
prop.intValue = (int)maxValue;
var hig = EditorGUI.GetPropertyHeight(prop);
drawRect.y += hig;
heights[key] += hig;
return true;
}
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName)
{
return PropertyField(ref drawRect, heights, key, parentProp.FindPropertyRelative(relativeName));
}
public static bool PropertyFieldWithMinValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName, float minValue)
{
var relativeProp = parentProp.FindPropertyRelative(relativeName);
return PropertyFieldWithMinValue(ref drawRect, heights, key, relativeProp, minValue);
}
public static bool PropertyFieldWithMaxValue(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty parentProp, string relativeName, float maxValue)
{
var relativeProp = parentProp.FindPropertyRelative(relativeName);
return PropertyFieldWithMaxValue(ref drawRect, heights, key, relativeProp, maxValue);
}
}

View File

@@ -1,56 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
public class AddSerieEditor : EditorWindow
{
public static BaseChart chart;
private static AddSerieEditor window;
private SerieType serieType;
private string serieName;
public static void ShowWindow()
{
window = GetWindow<AddSerieEditor>();
window.titleContent = new GUIContent("Add Serie");
window.minSize = new Vector2(350, window.minSize.y);
window.Focus();
window.Show();
}
void OnInspectorUpdate()
{
Repaint();
}
private void OnGUI()
{
if (chart == null)
{
Close();
return;
}
var iconRect = new Rect(5, 10, position.width - 10, EditorGUIUtility.singleLineHeight);
serieType = (SerieType)EditorGUI.EnumPopup(iconRect, "Serie Type", serieType);
iconRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
serieName = "serie" + (chart.series.Count + 1);
serieName = EditorGUI.TextField(iconRect, "Serie Name", serieName);
iconRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
GUILayout.Space(iconRect.y + 5);
if (GUILayout.Button("Add"))
{
SerieTemplate.AddDefaultSerie(chart, serieType, serieName);
chart.RefreshAllComponent();
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 450c3b4decd234f1894f1a8fd1161af8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,108 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
public class CheckVersionEditor : EditorWindow
{
private Vector2 scrollPos;
private static CheckVersionEditor window;
[MenuItem("XCharts/Upgrade Check")]
public static void ShowWindow()
{
window = GetWindow<CheckVersionEditor>();
window.titleContent = new GUIContent("XCharts Upgrade Check");
window.minSize = new Vector2(550, window.minSize.y);
window.Show();
XChartsMgr.Instance.CheckVersion();
}
void OnInspectorUpdate()
{
Repaint();
}
private void OnGUI()
{
var mgr = XChartsMgr.Instance;
GUILayout.Label("");
GUILayout.Label("The current version: " + mgr.nowVersion);
if (mgr.needUpdate && !mgr.isCheck)
{
GUILayout.Label("The remote version: " + mgr.newVersion);
GUILayout.Label("");
if (mgr.isCheck) GUILayout.Label("check ...");
else if (mgr.isNetworkError) GUILayout.Label("check failed: " + mgr.networkError);
else
{
GUILayout.Label("There is a new version to upgrade!");
}
GUILayout.Label("");
if (!string.IsNullOrEmpty(mgr.desc))
{
GUILayout.Label(mgr.desc);
}
if (GUILayout.Button("Github Homepage"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
}
if (GUILayout.Button("Star Support"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/stargazers");
}
if (GUILayout.Button("Issues"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/issues");
}
if (!string.IsNullOrEmpty(mgr.changeLog))
{
scrollPos = GUILayout.BeginScrollView(scrollPos);
GUILayout.TextArea(mgr.changeLog);
GUILayout.EndScrollView();
}
}
else
{
if (mgr.isCheck) GUILayout.Label("The remote version: checking ...");
else if (mgr.isNetworkError) GUILayout.Label("check failed: " + mgr.networkError);
else GUILayout.Label("The remote version: " + mgr.newVersion);
GUILayout.Label("");
if (!mgr.isNetworkError && !mgr.needUpdate && !mgr.isCheck)
{
GUILayout.Label("It is the latest version!");
}
GUILayout.Label("");
if (!string.IsNullOrEmpty(mgr.desc))
{
GUILayout.Label(mgr.desc);
}
if (GUILayout.Button("Github Homepage"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
}
if (GUILayout.Button("Star Support"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/stargazers");
}
if (GUILayout.Button("Issues"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/issues");
}
if (mgr.isNetworkError && GUILayout.Button("Check Again"))
{
XChartsMgr.Instance.CheckVersion();
}
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b2a04cd68c07645d9bb4234680c5200a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,62 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEditor;
using UnityEngine;
namespace XCharts
{
/// <summary>
/// Editor class used to edit UI XChartsMgr.
/// </summary>
[CustomEditor(typeof(XChartsMgr), false)]
public class XChartsMgrEditor : Editor
{
protected XChartsMgr m_Target;
protected SerializedProperty m_Script;
protected SerializedProperty m_NowVersion;
protected SerializedProperty m_NewVersion;
protected virtual void OnEnable()
{
m_Target = (XChartsMgr)target;
m_Script = serializedObject.FindProperty("m_Script");
m_NowVersion = serializedObject.FindProperty("m_NowVersion");
m_NewVersion = serializedObject.FindProperty("m_NewVersion");
}
public override void OnInspectorGUI()
{
if (m_Target == null && target == null)
{
base.OnInspectorGUI();
return;
}
serializedObject.Update();
EditorGUILayout.PropertyField(m_NowVersion);
EditorGUILayout.PropertyField(m_NewVersion);
if (GUILayout.Button("Check Update"))
{
CheckVersionEditor.ShowWindow();
}
if (GUILayout.Button("Github Homepage"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
}
if (GUILayout.Button("Star Support"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/stargazers");
}
if (GUILayout.Button("Issues"))
{
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/issues");
}
serializedObject.ApplyModifiedProperties();
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 69cbbe551cf1f45c984e6b4febc9f697
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8353edb72702e4cdda6af0248101d2cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,309 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
public class Example00_CheatSheet : MonoBehaviour
{
private LineChart chart;
private float speed = 100f;
void Awake()
{
LoopDemo();
}
private void OnEnable()
{
LoopDemo();
}
void LoopDemo()
{
StopAllCoroutines();
StartCoroutine(CheatSheet());
}
IEnumerator CheatSheet()
{
StartCoroutine(InitChart());
StartCoroutine(ComponentTitle());
yield return new WaitForSeconds(2);
StartCoroutine(ComponentAxis());
yield return new WaitForSeconds(2);
StartCoroutine(ComponentGrid());
yield return new WaitForSeconds(2);
StartCoroutine(ComponentSerie());
yield return new WaitForSeconds(4);
StartCoroutine(ComponentLegend());
yield return new WaitForSeconds(4);
StartCoroutine(ComponentTheme());
yield return new WaitForSeconds(4);
StartCoroutine(ComponentDataZoom());
yield return new WaitForSeconds(5);
StartCoroutine(ComponentVisualMap());
yield return new WaitForSeconds(3);
LoopDemo();
}
IEnumerator InitChart()
{
chart = gameObject.GetComponent<LineChart>();
if (chart == null) gameObject.AddComponent<LineChart>();
chart.title.show = true;
chart.title.text = "术语解析-组件";
chart.grid.bottom = 30;
chart.grid.right = 30;
chart.grid.left = 50;
chart.grid.top = 80;
chart.dataZoom.enable = false;
chart.visualMap.enable = false;
chart.RemoveData();
chart.AddSerie(SerieType.Bar, "Bar");
chart.AddSerie(SerieType.Line, "Line");
for (int i = 0; i < 8; i++)
{
chart.AddXAxisData("x" + (i + 1));
chart.AddData(0, Random.Range(10, 100));
chart.AddData(1, Random.Range(30, 100));
}
yield return null;
}
IEnumerator ComponentTitle()
{
chart.title.text = "术语解析 - 组件";
chart.title.subText = "Title 标题:可指定主标题和子标题";
chart.xAxis0.show = true;
chart.yAxis0.show = true;
chart.series.list[0].show = false;
chart.series.list[1].show = false;
chart.legend.show = false;
for (int i = 0; i < 4; i++)
{
chart.title.show = !chart.title.show;
chart.RefreshChart();
yield return new WaitForSeconds(0.2f);
}
chart.title.show = true;
chart.RefreshChart();
}
IEnumerator ComponentAxis()
{
chart.title.subText = "Axis 坐标轴配置X和Y轴的轴线、刻度、标签等样式外观配置";
chart.series.list[0].show = false;
chart.series.list[1].show = false;
for (int i = 0; i < 4; i++)
{
chart.xAxis0.show = !chart.xAxis0.show;
chart.yAxis0.show = !chart.yAxis0.show;
chart.RefreshChart();
yield return new WaitForSeconds(0.2f);
}
chart.xAxis0.show = true;
chart.yAxis0.show = true;
chart.RefreshChart();
yield return new WaitForSeconds(1f);
}
IEnumerator ComponentGrid()
{
chart.title.subText = "Grid 网格:调整坐标系边距和颜色等";
for (int i = 0; i < 4; i++)
{
chart.grid.backgroundColor = i % 2 == 0 ? Color.clear : Color.grey;
chart.RefreshChart();
yield return new WaitForSeconds(0.2f);
}
chart.grid.backgroundColor = Color.clear;
chart.RefreshChart();
yield return new WaitForSeconds(1f);
}
IEnumerator ComponentSerie()
{
chart.title.subText = "Serie 系列:调整坐标系边距和颜色等";
chart.series.list[0].show = true;
chart.series.list[1].show = true;
chart.AnimationReset();
chart.RefreshChart();
yield return new WaitForSeconds(1.2f);
for (int i = 0; i < 4; i++)
{
chart.series.list[0].show = !chart.series.list[0].show;
chart.series.list[1].show = !chart.series.list[1].show;
chart.RefreshChart();
yield return new WaitForSeconds(0.2f);
}
chart.series.list[0].show = true;
chart.series.list[1].show = true;
chart.RefreshChart();
yield return new WaitForSeconds(1f);
}
IEnumerator ComponentLegend()
{
chart.title.subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等";
chart.legend.show = true;
chart.grid.top = 80;
chart.legend.location.top = 50;
chart.RefreshChart();
yield return new WaitForSeconds(1f);
for (int i = 0; i < 4; i++)
{
chart.legend.show = !chart.legend.show;
chart.RefreshChart();
yield return new WaitForSeconds(0.2f);
}
chart.legend.show = true;
chart.RefreshChart();
yield return new WaitForSeconds(1f);
chart.ClickLegendButton(0, "Line", false);
yield return new WaitForSeconds(0.2f);
chart.ClickLegendButton(0, "Line", true);
yield return new WaitForSeconds(0.5f);
chart.ClickLegendButton(1, "Bar", false);
yield return new WaitForSeconds(0.2f);
chart.ClickLegendButton(1, "Bar", true);
yield return new WaitForSeconds(0.5f);
}
IEnumerator ComponentTheme()
{
chart.title.subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
yield return new WaitForSeconds(1f);
chart.title.subText = "Theme 主题Light主题";
chart.UpdateTheme(Theme.Light);
yield return new WaitForSeconds(1f);
chart.title.subText = "Theme 主题Dark主题";
chart.UpdateTheme(Theme.Dark);
yield return new WaitForSeconds(1f);
chart.title.subText = "Theme 主题Default主题";
chart.UpdateTheme(Theme.Default);
yield return new WaitForSeconds(1f);
}
IEnumerator ComponentDataZoom()
{
chart.title.subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据";
chart.grid.bottom = 70;
chart.dataZoom.enable = true;
chart.dataZoom.supportInside = true;
chart.dataZoom.supportSlider = true;
chart.dataZoom.start = 0;
chart.dataZoom.end = 100;
chart.RefreshChart();
for (int i = 0; i < 4; i++)
{
chart.dataZoom.supportSlider = !chart.dataZoom.supportSlider;
chart.RefreshChart();
yield return new WaitForSeconds(0.2f);
}
chart.dataZoom.supportSlider = true;
chart.RefreshChart();
yield return new WaitForSeconds(1f);
while (chart.dataZoom.start < 40)
{
chart.dataZoom.start += speed * Time.deltaTime * 0.8f;
chart.RefreshDataZoom();
chart.RefreshChart();
yield return null;
}
while (chart.dataZoom.end > 60)
{
chart.dataZoom.end -= speed * Time.deltaTime * 0.8f;
chart.RefreshDataZoom();
chart.RefreshChart();
yield return null;
}
while (chart.dataZoom.start > 0)
{
chart.dataZoom.start -= speed * Time.deltaTime * 0.8f;
chart.dataZoom.end -= speed * Time.deltaTime * 0.8f;
chart.RefreshDataZoom();
chart.RefreshChart();
yield return null;
}
while (chart.dataZoom.end < 100)
{
chart.dataZoom.start += speed * Time.deltaTime * 0.8f;
chart.dataZoom.end += speed * Time.deltaTime * 0.8f;
chart.RefreshDataZoom();
chart.RefreshChart();
yield return null;
}
while (chart.dataZoom.start > 0 || chart.dataZoom.end < 100)
{
chart.dataZoom.start -= speed * Time.deltaTime * 0.8f;
chart.dataZoom.end += speed * Time.deltaTime * 0.8f;
chart.RefreshDataZoom();
chart.RefreshChart();
yield return null;
}
}
IEnumerator ComponentVisualMap()
{
chart.title.subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
chart.visualMap.enable = true;
chart.visualMap.show = true;
chart.visualMap.orient = Orient.Vertical;
chart.visualMap.calculable = true;
chart.visualMap.min = 0;
chart.visualMap.max = 100;
chart.visualMap.range[0] = 0;
chart.visualMap.range[1] = 100;
var colors = new List<string>{"#313695", "#4575b4", "#74add1", "#abd9e9", "#e0f3f8", "#ffffbf",
"#fee090", "#fdae61", "#f46d43", "#d73027", "#a50026"};
chart.visualMap.inRange.Clear();
foreach (var str in colors)
{
chart.visualMap.inRange.Add(ChartTheme.GetColor(str));
}
chart.grid.left = 80;
chart.grid.bottom = 100;
chart.RefreshChart();
yield return new WaitForSeconds(1f);
while (chart.visualMap.rangeMin < 40)
{
chart.visualMap.rangeMin += speed * Time.deltaTime;
chart.RefreshChart();
yield return null;
}
while (chart.visualMap.rangeMax > 60)
{
chart.visualMap.rangeMax -= speed * Time.deltaTime;
chart.RefreshChart();
yield return null;
}
while (chart.visualMap.rangeMin > 0 || chart.visualMap.rangeMax < 100)
{
chart.visualMap.rangeMin -= speed * Time.deltaTime;
chart.visualMap.rangeMax += speed * Time.deltaTime;
chart.RefreshChart();
yield return null;
}
}
}
}

View File

@@ -1,51 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example13_LineSimple : MonoBehaviour
{
void Awake()
{
var chart = gameObject.GetComponent<LineChart>();
if (chart == null)
{
chart = gameObject.AddComponent<LineChart>();
chart.SetSize(580, 300);//代码动态添加图表需要设置尺寸或直接操作chart.rectTransform
}
chart.title.show = true;
chart.title.text = "Line Simple";
chart.tooltip.show = true;
chart.legend.show = false;
chart.xAxes[0].show = true;
chart.xAxes[1].show = false;
chart.yAxes[0].show = true;
chart.yAxes[1].show = false;
chart.xAxes[0].type = Axis.AxisType.Category;
chart.yAxes[0].type = Axis.AxisType.Value;
chart.xAxes[0].splitNumber = 10;
chart.xAxes[0].boundaryGap = true;
chart.RemoveData();
chart.AddSerie(SerieType.Line);
chart.AddSerie(SerieType.Line);
for (int i = 0; i < 2000; i++)
{
chart.AddXAxisData("x" + i);
chart.AddData(0, Random.Range(10, 20));
chart.AddData(1, Random.Range(10, 20));
}
}
}
}

View File

@@ -1,124 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
public class Example40_Radar : MonoBehaviour
{
private RadarChart chart;
private Serie serie, serie1;
void Awake()
{
LoopDemo();
}
private void OnEnable()
{
LoopDemo();
}
void LoopDemo()
{
StopAllCoroutines();
StartCoroutine(RadarDemo());
}
IEnumerator RadarDemo()
{
StartCoroutine(RadarAdd());
yield return new WaitForSeconds(2);
StartCoroutine(RadarUpdate());
yield return new WaitForSeconds(2);
StartCoroutine(RadarAddMultiple());
yield return new WaitForSeconds(2);
LoopDemo();
}
IEnumerator RadarAdd()
{
chart = gameObject.GetComponent<RadarChart>();
if (chart == null) chart = gameObject.AddComponent<RadarChart>();
chart.RemoveRadar();
chart.RemoveData();
chart.title.text = "RadarChart - 雷达图";
chart.title.subText = "";
chart.legend.show = true;
chart.legend.location.align = Location.Align.TopLeft;
chart.legend.location.top = 60;
chart.legend.location.left = 2;
chart.legend.itemWidth = 70;
chart.legend.itemHeight = 20;
chart.legend.orient = Orient.Vertical;
chart.AddRadar(Radar.Shape.Polygon, new Vector2(0.5f, 0.4f), 0.4f);
chart.AddIndicator(0, "indicator1", 0, 100);
chart.AddIndicator(0, "indicator2", 0, 100);
chart.AddIndicator(0, "indicator3", 0, 100);
chart.AddIndicator(0, "indicator4", 0, 100);
chart.AddIndicator(0, "indicator5", 0, 100);
serie = chart.AddSerie(SerieType.Radar, "test");
serie.radarIndex = 0;
chart.AddData(0, new List<float> { 10, 20, 60, 40, 20 }, "data1");
chart.AddData(0, new List<float> { 40, 60, 90, 80, 70 }, "data2");
yield return new WaitForSeconds(1);
}
IEnumerator RadarUpdate()
{
chart.UpdateIndicator(0, 0, "new1", 0, 100);
chart.UpdateData(0, 0, new List<float> { 15, 30, 50, 60, 50 });
chart.UpdateDataName(0, 0, "new1");
yield return new WaitForSeconds(1);
}
IEnumerator RadarAddMultiple()
{
chart.RemoveRadar();
chart.RemoveData();
chart.title.text = "RadarChart - 多雷达图";
chart.title.subText = "";
chart.legend.show = true;
chart.legend.location.align = Location.Align.TopLeft;
chart.legend.location.top = 60;
chart.legend.location.left = 2;
chart.legend.itemWidth = 70;
chart.legend.itemHeight = 20;
chart.legend.orient = Orient.Vertical;
chart.AddRadar(Radar.Shape.Polygon, new Vector2(0.25f, 0.4f), 0.25f);
for (int i = 1; i <= 5; i++)
{
chart.AddIndicator(0, "radar1" + i, 0, 100);
}
chart.AddRadar(Radar.Shape.Circle, new Vector2(0.75f, 0.4f), 0.25f);
for (int i = 1; i <= 5; i++)
{
chart.AddIndicator(1, "radar2" + i, 0, 100);
}
serie = chart.AddSerie(SerieType.Radar, "test1");
serie.radarIndex = 0;
chart.AddData(0, new List<float> { 10, 20, 60, 40, 20 }, "data1");
serie1 = chart.AddSerie(SerieType.Radar, "test2");
serie1.radarIndex = 1;
chart.AddData(1, new List<float> { 10, 20, 60, 40, 20 }, "data2");
yield return new WaitForSeconds(1);
}
}
}

View File

@@ -1,38 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example50_Scatter : MonoBehaviour
{
private ScatterChart chart;
void Awake()
{
chart = gameObject.GetComponent<ScatterChart>();
if (chart == null) return;
chart.series.SetSerieSymbolSizeCallback(SymbolSize, SymbolSelectedSize);
}
float SymbolSize(List<float> data)
{
//return Mathf.Clamp(data[1] * 10,1,100);
return (float)(Mathf.Sqrt(data[2]) / 6e2);
}
float SymbolSelectedSize(List<float> data)
{
//return Mathf.Clamp(data[1] * 10,1,100);
return (float)(Mathf.Sqrt(data[2]) / 5e2);
}
}
}

View File

@@ -1,104 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example60_Heatmap : MonoBehaviour
{
private HeatmapChart chart;
void Awake()
{
chart = gameObject.GetComponent<HeatmapChart>();
if (chart == null)
{
chart = gameObject.AddComponent<HeatmapChart>();
}
chart.title.text = "HeatmapChart";
chart.tooltip.type = Tooltip.Type.None;
chart.grid.left = 100;
chart.grid.right = 60;
chart.grid.bottom = 60;
//目前只支持Category
chart.xAxes[0].type = Axis.AxisType.Category;
chart.yAxes[0].type = Axis.AxisType.Category;
chart.xAxes[0].boundaryGap = true;
chart.xAxes[0].boundaryGap = true;
chart.xAxes[0].splitNumber = 10;
chart.yAxes[0].splitNumber = 10;
//清空数据重新添加
chart.RemoveData();
var serie = chart.AddSerie(SerieType.Heatmap, "serie1");
//设置样式
serie.itemStyle.show = true;
serie.itemStyle.borderWidth = 1;
serie.itemStyle.borderColor = Color.clear;
//设置高亮样式
serie.emphasis.show = true;
serie.emphasis.itemStyle.show = true;
serie.emphasis.itemStyle.borderWidth = 1;
serie.emphasis.itemStyle.borderColor = Color.black;
//设置视觉映射组件
chart.visualMap.enable = true;
chart.visualMap.max = 10;
chart.visualMap.range[0] = 0f;
chart.visualMap.range[1] = 10f;
chart.visualMap.orient = Orient.Vertical;
chart.visualMap.calculable = true;
chart.visualMap.location.align = Location.Align.BottomLeft;
chart.visualMap.location.bottom = 100;
chart.visualMap.location.left = 30;
//清空颜色重新添加
chart.visualMap.inRange.Clear();
var heatmapGridWid = 10f;
int xSplitNumber = (int)(chart.grid.runtimeWidth / heatmapGridWid);
int ySplitNumber = (int)(chart.grid.runtimeHeight / heatmapGridWid);
var colors = new List<string>{"#313695", "#4575b4", "#74add1", "#abd9e9", "#e0f3f8", "#ffffbf",
"#fee090", "#fdae61", "#f46d43", "#d73027", "#a50026"};
foreach (var str in colors)
{
chart.visualMap.inRange.Add(ChartTheme.GetColor(str));
}
//添加xAxis的数据
for (int i = 0; i < xSplitNumber; i++)
{
chart.AddXAxisData((i + 1).ToString());
}
//添加yAxis的数据
for (int i = 0; i < ySplitNumber; i++)
{
chart.AddYAxisData((i + 1).ToString());
}
for (int i = 0; i < xSplitNumber; i++)
{
for (int j = 0; j < ySplitNumber; j++)
{
var value = 0f;
var rate = Random.Range(0, 101);
if (rate > 70) value = Random.Range(8f, 10f);
else value = Random.Range(1f, 8f);
var list = new List<float> { i, j, value };
//至少是一个三位数据x,y,value
chart.AddData(0, list);
}
}
}
}
}

View File

@@ -1,70 +0,0 @@
using System.Runtime.InteropServices;
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example70_Gauge : MonoBehaviour
{
private GaugeChart chart;
private float updateTime;
void Awake()
{
chart = gameObject.GetComponent<GaugeChart>();
if (chart == null)
{
chart = gameObject.AddComponent<GaugeChart>();
}
chart.title.text = "GaugeChart";
chart.RemoveData();
var serie = chart.AddSerie(SerieType.Gauge, "速度");
serie.min = 0;
serie.max = 220;
serie.startAngle = -125;
serie.endAngle = 125;
serie.center[0] = 0.5f;
serie.center[1] = 0.5f;
serie.radius[0] = 80;
serie.splitNumber = 5;
serie.animation.dataChangeEnable = true;
serie.roundCap = true;
serie.titleStyle.show = true;
serie.titleStyle.textStyle.offset = new Vector2(0, 20);
serie.label.show = true;
serie.label.offset = new Vector3(0, -20);
serie.gaugeAxis.show = true;
serie.gaugeAxis.axisLine.lineStyle.width = 15;
serie.gaugePointer.show = true;
serie.gaugePointer.width = 15;
var value = UnityEngine.Random.Range(serie.min, serie.max);
chart.AddData(0, value, "km/h");
}
void Update()
{
updateTime += Time.deltaTime;
if (updateTime > 2)
{
updateTime = 0;
var value = UnityEngine.Random.Range(0, 220);
chart.UpdateData(0, 0, value);
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a3a7b70d5b66640dca4aaecf13d3769f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,57 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example80_Polar : MonoBehaviour
{
private PolarChart chart;
private float updateTime;
void Awake()
{
chart = gameObject.GetComponent<PolarChart>();
if (chart == null)
{
chart = gameObject.AddComponent<PolarChart>();
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
AddData();
}
}
void AddData()
{
chart.RemoveData();
chart.tooltip.type = Tooltip.Type.Corss;
chart.angleAxis.type = Axis.AxisType.Value;
chart.angleAxis.minMaxType = Axis.AxisMinMaxType.Custom;
chart.angleAxis.min = 0;
chart.angleAxis.max = 360;
chart.angleAxis.startAngle = Random.Range(0, 90);
chart.AddSerie(SerieType.Line, "line1");
var rate = Random.Range(1, 4);
for (int i = 0; i <= 360; i++)
{
var t = i / 180f * Mathf.PI;
var r = Mathf.Sin(2 * t) * Mathf.Cos(2 * t) * rate;
chart.AddData(0, Mathf.Abs(r), i);
}
}
}
}

View File

@@ -1,54 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
[RequireComponent(typeof(CoordinateChart))]
public class Example_LargeData : MonoBehaviour
{
public int maxCacheDataNumber = 3000;
public float initDataTime = 5;
private CoordinateChart chart;
private float initTime;
private int initCount = 0;
private System.DateTime timeNow;
void Awake()
{
chart = gameObject.GetComponentInChildren<CoordinateChart>();
timeNow = System.DateTime.Now;
chart.ClearAxisData();
chart.series.ClearData();
chart.SetMaxCache(maxCacheDataNumber);
chart.title.text = maxCacheDataNumber + "数据";
}
private void Update()
{
if (initCount < maxCacheDataNumber)
{
for (int i = 0; i < 10; i++)
{
initCount++;
if (initCount > maxCacheDataNumber) break;
chart.title.text = initCount + "数据";
timeNow = timeNow.AddSeconds(1);
float xvalue = Mathf.PI / 180 * initCount;
float yvalue = Mathf.Sin(xvalue);
chart.AddData(0, 15 + yvalue * 2);
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
}
}
}
}
}

View File

@@ -1,58 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using UnityEngine.UI;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example_Test : MonoBehaviour
{
LineChart chart;
void Awake()
{
chart = gameObject.GetComponent<LineChart>();
var btnTrans = transform.parent.Find("Button");
if (btnTrans)
{
btnTrans.gameObject.GetComponent<Button>().onClick.AddListener(OnTestBtn);
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
//AddData();
OnTestBtn();
}
}
void OnTestBtn()
{
int index = Random.Range(0, chart.series.Count);
var serie = chart.series.GetSerie(index);
chart.UpdateData(index, Random.Range(0, serie.dataCount), Random.Range(50, 100));
}
void AddData()
{
chart.ClearData();
int count = Random.Range(5, 100);
for (int i = 0; i < count; i++)
{
(chart as CoordinateChart).AddXAxisData("x" + i);
if (Random.Range(1, 3) == 2)
chart.AddData(0, Random.Range(-110, 200));
else
chart.AddData(0, Random.Range(-100, 100));
}
}
}
}

View File

@@ -1,208 +0,0 @@
<p align="center">
<a href="">
<img src="" alt="" width="" height="">
</a>
</p>
<h2 align="center">XCharts</h3>
<p align="center">
A powerful, easy-to-use, configurable charting and data visualization library for Unity.
<br>
一款基于UGUI的数据可视化图表插件。
<br>
</p>
<p align="center">
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
</a>
<a href="">
<img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/v/unity-ugui-xcharts.svg?label=npm">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/dt/unity-ugui-xcharts?label=npm%20downloads%20">
</a>
<a href="https://www.npmjs.org/package/unity-ugui-xcharts">
<img src="https://img.shields.io/npm/dm/unity-ugui-xcharts?label=%20">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
<img src="https://img.shields.io/github/v/release/monitor1394/unity-ugui-XCharts?include_prereleases&label=github">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
<img src="https://img.shields.io/github/downloads/monitor1394/unity-ugui-XCharts/total?label=github%20downloads">
</a>
<a href="">
<img src="https://img.shields.io/badge/Unity-5.6%20%7C%202017%20%7C%202018%20%7C%202019%20%7C%202020%20%7C%202021-green">
</a>
<a href="">
<img src="https://img.shields.io/badge/TextMeshPro-YES-green">
</a>
</p>
A powerful, easy-to-use, configurable charting and data visualization library for Unity. Supporting line, bar, pie, radar, scatter, heatmap, gauge, ring, polar, liquid and other common chart.
[XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
[Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
## XCharts 2.0
* Framework reconstruction, layered rendering, optimized scalability, support more data.
* Support for TextMeshPro.
* Support for multi-component patterns.
* Support for any combination of most charts.
* Support theme customization, import and export, and more theme configuration parameters.
* Support global adjustment of configuration parameters.
* Better editing interface.
* Other details optimized.
## Features
* Rich built-in examples and templates, parameter visualization configuration, effect real-time preview, pure code drawing.
* Support line, bar, pie, radar, scatter, heatmaps, gauge, ring, polar, liquid and other common chart.
* Support line graph, curve graph, area graph, step graph and other LineChart.
* Support parallel bar, stack bar, stack percentage bar, zebra bar and other BarChart.
* Support ring, rose and other PieChart.
* Support line-bar chart, scatter-line chart and other combination chart.
* Support solid line, curve, ladder line, dotted line, dash line, dot line, double dot line and other lines.
* Support custom theme, built-in theme switching.
* Support custom chart content drawing, drawing points, line, curve, triangle, quadrilateral, circle, ring, sector, border, arrow and other drawing API.
* Support interactive operations such as data filtering, view zooming and detail display on PC and mobile terminals.
* Support 10,000-level big data rendering.
## Screenshot
![linechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-line.png)
![barchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-bar.png)
![piechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-pie.png)
![radarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-radar.png)
![scatterchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-scatter.png)
![heatmapchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-heatmap.png)
![gaugechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-gauge.png)
![ringchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-ring.png)
![polarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-polar.png)
![liquidchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-liquid.png)
![combinations](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-combinations.png)
## Cheat Sheet
![cheatsheet](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-cheatsheet.gif)
`XCharts` consist of components and data. Different components and data can be combined into different types of charts. The component is divided into main component and sub component. The main component contains the sub components.
`XCharts` main components:
* `Theme` theme component, which can configure the default colors, fonts and so on.
* `Title` title component, which contains the main title and subtitle.
* `Legend` legend component, which represent different sets of symbols, colors, and names. You can control which series are not displayed by clicking on the legend.
* `Grid` grid component, drawing grid in rectangular coordinate system. Up to two X axes and two Y axes can be placed within a grid component. You can draw line, bar and scatter chart on the grid.
* `Axis` axis component, the axis of a rectangular coordinate system. Supports the upper and lower X axes and the left and right Y axes.
* `Series` series component, a list of serie. A chart can contain many different series, and each series determines its own chart type by type.
* `Tooltip` tooltip component, feedback more details of the data indicated by the mouse at the time.
* `DataZoom` data zoom component, used for area zooming so you can focus on detailed data information, or overview the data as a whole, or remove the impact of outliers.
* `VisualMap` visual mapping component, you can map data in different colors.
* `Radar` radar component, suitable for radar chart only.
* `Settings` global Settings component, Some global parameters can be adjusted. Use the default values in general and adjust them as needed.
`XCharts` support chart:
* `LineChart`
* `BarChart`
* `PieChart`
* `RadarChart`
* `ScatterChart`
* `HeatmapChart`
* `GuageChart`
* `RingChart`
* `PolarChart`
* `LiquidChart`
The following is the relationship structure of LineChart:
``` js
.
├── LineChart
. ├── ThemeInfo
├── Title
│ └── Location
├── Legend
│ └── Location
├── Tooltip
├── DataZoom
├── VisualMap
├── Grid
├── Axis
│ ├── AxisLine
│ ├── AxisName
│ ├── AxisLabel
│ ├── AxisTick
│ └── AxisSplitArea
├── Series
│ ├── ItemStyle
│ ├── AreaStyle
│ ├── SerieSymbol
│ ├── LineStyle
│ ├── LineArrow
│ ├── SerieLabel
│ ├── Emphasis
│ ├── Animation
│ └── SerieData
└── Settings
```
## Environment
* Unity2017.4.27f1
* .Net 3.5
* macOS 10.15.4
## Usage
* This project was developed under `Unity 2017.4.27f1` and `.net 3.5`, tested normally on `Unity 5`, `Unity 2018` and `Unity 2019`. It can theoretically run on any version that supports `UGUI`.
* Download the source code or `unitypackage` to import into your project. If `Unity` version are `2018.3` or above, it is recommended to import packages through `Package Manager`:
1. Open the `manifest.json` file under `Packages` directory and add under `dependencies`:
``` json
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#upm",
```
2. Going back to `Unity`, it may take 3 to 5 minutes to download.
3. If you want to delete `XCharts`, just delete the content added in step 1.
4. If you want to update `XCharts`, open `manifest.json` file , delete the content about `com.monitor1394.xcharts` under `lock`, it will download anagain. Also can check For update in `components-> XCharts -> Check For Update`.
* Add a chart in Editor quickly:
1. In `Hierarchy`, right-click menu `XChart->LineChart`.
2. In unity menu bar, `Component->XCharts->LineChart`.
3. In `Inspector`,`Add Component->LineChart`.
4. Then a simple line chart is done.
5. In `Inspector` you can adjust the parameters of components, and in `Game` will feedback the adjustment effect in realtime 。the detail of parameters go to see: [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md).
* See more examples of code dynamic control: [Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md).
* Enable TextMeshPro:
1. `XCharts -> TextMeshPro Enable` or `Project Setting -> XCharts -> Enable TextMeshPro`
2. `Project Setting -> XCharts -> Settings -> TMP Font` set the TextMeshPro font.
3. If the chart does not initialize properly, you can use the `Remove All Chart Object` button to clean up the chart and reinitialize it.
## Documents
* [XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
* [XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
* [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
* [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
* [XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
* [XCharts Tutorial: Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
## Changelog
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
## Licenses
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/LICENSE.md)
## Contact
gmail: monitor1394@gmail.com

View File

@@ -1,22 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using System;
using UnityEngine.EventSystems;
namespace XCharts
{
public partial class BarChart
{
/// <summary>
/// the callback function of click bar.
/// 点击柱形图柱条回调。参数eventData, dataIndex
/// </summary>
public Action<PointerEventData, int> onPointerClickBar { set { m_OnPointerClickBar = value; m_ForceOpenRaycastTarget = true; } }
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 73ae9e0b481fc4587828be9149026b0f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,698 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using System.Collections.Generic;
using System;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace XCharts
{
/// <summary>
/// The base class of all charts.
/// 所有Chart的基类。
/// </summary>
public partial class BaseChart
{
/// <summary>
/// The name of chart.
/// </summary>
public string chartName
{
get { return m_ChartName; }
set
{
if (!string.IsNullOrEmpty(value) && XChartsMgr.Instance.ContainsChart(value))
{
Debug.LogError("chartName repeated:" + value);
}
else
{
m_ChartName = value;
}
}
}
/// <summary>
/// The theme.
/// </summary>
public ChartTheme theme { get { return m_Theme; } set { m_Theme = value; } }
/// <summary>
/// The title setting of chart.
/// 标题组件
/// </summary>
public Title title { get { return m_Titles.Count > 0 ? m_Titles[0] : null; } }
public List<Title> titles { get { return m_Titles; } }
/// <summary>
/// The legend setting of chart.
/// 图例组件
/// </summary>
public Legend legend { get { return m_Legends.Count > 0 ? m_Legends[0] : null; } }
public List<Legend> legends { get { return m_Legends; } }
/// <summary>
/// The tooltip setting of chart.
/// 提示框组件
/// </summary>
public Tooltip tooltip { get { return m_Tooltips.Count > 0 ? m_Tooltips[0] : null; } }
/// <summary>
/// The series setting of chart.
/// 系列列表
/// </summary>
public Series series { get { return m_Series; } }
/// <summary>
/// Global parameter setting component.
/// 全局设置组件。
/// </summary>
public Settings settings { get { return m_Settings; } }
/// <summary>
/// The x of chart.
/// 图表的X
/// </summary>
public float chartX { get { return m_ChartX; } }
/// <summary>
/// The y of chart.
/// 图表的Y
/// </summary>
public float chartY { get { return m_ChartY; } }
/// <summary>
/// The width of chart.
/// 图表的宽
/// </summary>
public float chartWidth { get { return m_ChartWidth; } }
/// <summary>
/// The height of chart.
/// 图表的高
/// </summary>
public float chartHeight { get { return m_ChartHeight; } }
public Vector2 chartMinAnchor { get { return m_ChartMinAnchor; } }
public Vector2 chartMaxAnchor { get { return m_ChartMaxAnchor; } }
public Vector2 chartPivot { get { return m_ChartPivot; } }
public Vector2 chartSizeDelta { get { return m_ChartSizeDelta; } }
/// <summary>
/// The position of chart.
/// 图表的左下角起始坐标。
/// </summary>
public Vector3 chartPosition { get { return m_ChartPosition; } }
public Rect chartRect { get { return m_ChartRect; } }
/// <summary>
/// 自定义绘制回调。
/// </summary>
public Action<VertexHelper> onCustomDraw { set { m_OnCustomDrawCallback = value; } }
/// <summary>
/// the callback function of click pie area.
/// 点击饼图区域回调。参数PointerEventDataSerieIndexSerieDataIndex
/// </summary>
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickPie; } }
/// <summary>
/// Redraw chart in next frame.
/// 在下一帧刷新图表。
/// </summary>
public void RefreshChart()
{
m_RefreshChart = true;
if (m_Painter) m_Painter.Refresh();
}
/// <summary>
/// Remove all series and legend data.
/// It just emptying all of serie's data without emptying the list of series.
/// 清除所有数据,系列中只是移除数据,列表会保留。
/// </summary>
public virtual void ClearData()
{
m_Series.ClearData();
foreach (var legend in m_Legends) legend.ClearData();
tooltip.ClearValue();
m_CheckAnimation = false;
m_ReinitLabel = true;
RefreshChart();
}
/// <summary>
/// Remove all data from series and legend.
/// The series list is also cleared.
/// 清除所有系列和图例数据,系列的列表也会被清除。
/// </summary>
public virtual void RemoveData()
{
foreach (var legend in m_Legends) legend.ClearData();
foreach (var radar in m_Radars) radar.indicatorList.Clear();
m_Series.RemoveAll();
tooltip.ClearValue();
m_CheckAnimation = false;
m_ReinitLabel = true;
m_SerieLabelRoot = null;
RefreshChart();
}
/// <summary>
/// Remove legend and serie by name.
/// 清除指定系列名称的数据。
/// </summary>
/// <param name="serieName">the name of serie</param>
public virtual void RemoveData(string serieName)
{
m_Series.Remove(serieName);
foreach (var legend in m_Legends) legend.RemoveData(serieName);
m_SerieLabelRoot = null;
RefreshChart();
}
/// <summary>
/// Add a serie to serie list.
/// 添加一个系列到系列列表中。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="type">the type of serie</param>
/// <param name="show">whether to show this serie</param>
/// <returns>the added serie</returns>
public virtual Serie AddSerie(SerieType type, string serieName = null, bool show = true)
{
return m_Series.AddSerie(type, serieName);
}
/// <summary>
/// Add a data to serie.
/// If serieName doesn't exist in legend,will be add to legend.
/// 添加一个数据到指定的系列中。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="data">the data to add</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public virtual SerieData AddData(string serieName, float data, string dataName = null)
{
var serieData = m_Series.AddData(serieName, data, dataName);
if (serieData != null)
{
var serie = m_Series.GetSerie(serieName);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshPainter(serie);
}
return serieData;
}
/// <summary>
/// Add a data to serie.
/// 添加一个数据到指定的系列中。
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <param name="data">the data to add</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public virtual SerieData AddData(int serieIndex, float data, string dataName = null)
{
var serieData = m_Series.AddData(serieIndex, data, dataName);
if (serieData != null)
{
var serie = m_Series.GetSerie(serieIndex);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshPainter(serie);
}
return serieData;
}
/// <summary>
/// Add an arbitray dimension data to serie,such as (x,y,z,...).
/// 添加多维数据x,y,z...)到指定的系列中。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="multidimensionalData">the (x,y,z,...) data</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public virtual SerieData AddData(string serieName, List<float> multidimensionalData, string dataName = null)
{
var serieData = m_Series.AddData(serieName, multidimensionalData, dataName);
if (serieData != null)
{
var serie = m_Series.GetSerie(serieName);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshPainter(serie);
}
return serieData;
}
/// <summary>
/// Add an arbitray dimension data to serie,such as (x,y,z,...).
/// 添加多维数据x,y,z...)到指定的系列中。
/// </summary>
/// <param name="serieIndex">the index of serie,index starts at 0</param>
/// <param name="multidimensionalData">the (x,y,z,...) data</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public virtual SerieData AddData(int serieIndex, List<float> multidimensionalData, string dataName = null)
{
var serieData = m_Series.AddData(serieIndex, multidimensionalData, dataName);
if (serieData != null)
{
var serie = m_Series.GetSerie(serieIndex);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshPainter(serie);
}
return serieData;
}
/// <summary>
/// Add a (x,y) data to serie.
/// 添加x,y数据到指定系列中。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="xValue">x data</param>
/// <param name="yValue">y data</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public virtual SerieData AddData(string serieName, float xValue, float yValue, string dataName = null)
{
var serieData = m_Series.AddXYData(serieName, xValue, yValue, dataName);
if (serieData != null)
{
var serie = m_Series.GetSerie(serieName);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshPainter(serie);
}
return serieData;
}
/// <summary>
/// Add a (x,y) data to serie.
/// 添加x,y数据到指定系列中。
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <param name="xValue">x data</param>
/// <param name="yValue">y data</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public virtual SerieData AddData(int serieIndex, float xValue, float yValue, string dataName = null)
{
var serieData = m_Series.AddXYData(serieIndex, xValue, yValue, dataName);
if (serieData != null)
{
var serie = m_Series.GetSerie(serieIndex);
if (SerieHelper.GetSerieLabel(serie, serieData).show)
{
RefreshLabel();
}
RefreshPainter(serie);
}
return serieData;
}
/// <summary>
/// Update serie data by serie name.
/// 更新指定系列中的指定索引数据。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="dataIndex">the index of data</param>
/// <param name="value">the data will be update</param>
public virtual bool UpdateData(string serieName, int dataIndex, float value)
{
if (m_Series.UpdateData(serieName, dataIndex, value))
{
RefreshPainter(m_Series.GetSerie(serieName));
return true;
}
return false;
}
/// <summary>
/// Update serie data by serie index.
/// 更新指定系列中的指定索引数据。
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <param name="dataIndex">the index of data</param>
/// <param name="value">the data will be update</param>
public virtual bool UpdateData(int serieIndex, int dataIndex, float value)
{
if (m_Series.UpdateData(serieIndex, dataIndex, value))
{
RefreshPainter(m_Series.GetSerie(serieIndex));
return true;
}
return false;
}
/// <summary>
/// 更新指定系列指定索引的数据项的多维数据。
/// </summary>
/// <param name="serieName"></param>
/// <param name="dataIndex"></param>
/// <param name="multidimensionalData">一个数据项的多维数据列表,而不是多个数据项的数据</param>
public virtual bool UpdateData(string serieName, int dataIndex, List<float> multidimensionalData)
{
if (m_Series.UpdateData(serieName, dataIndex, multidimensionalData))
{
RefreshPainter(m_Series.GetSerie(serieName));
return true;
}
return false;
}
/// <summary>
/// 更新指定系列指定索引的数据项的多维数据。
/// </summary>
/// <param name="serieIndex"></param>
/// <param name="dataIndex"></param>
/// <param name="multidimensionalData">一个数据项的多维数据列表,而不是多个数据项的数据</param>
public virtual bool UpdateData(int serieIndex, int dataIndex, List<float> multidimensionalData)
{
if (m_Series.UpdateData(serieIndex, dataIndex, multidimensionalData))
{
RefreshPainter(m_Series.GetSerie(serieIndex));
return true;
}
return false;
}
/// <summary>
/// 更新指定系列指定索引指定维数的数据。维数从0开始。
/// </summary>
/// <param name="serieName"></param>
/// <param name="dataIndex"></param>
/// <param name="dimension">指定维数从0开始</param>
/// <param name="value"></param>
public virtual bool UpdateData(string serieName, int dataIndex, int dimension, float value)
{
if (m_Series.UpdateData(serieName, dataIndex, dimension, value))
{
RefreshPainter(m_Series.GetSerie(serieName));
return true;
}
return false;
}
/// <summary>
/// 更新指定系列指定索引指定维数的数据。维数从0开始。
/// </summary>
/// <param name="serieIndex"></param>
/// <param name="dataIndex"></param>
/// <param name="dimension">指定维数从0开始</param>
/// <param name="value"></param>
public virtual bool UpdateData(int serieIndex, int dataIndex, int dimension, float value)
{
if (m_Series.UpdateData(serieIndex, dataIndex, dimension, value))
{
RefreshPainter(m_Series.GetSerie(serieIndex));
return true;
}
return false;
}
/// <summary>
/// Update serie data name.
/// 更新指定系列中的指定索引数据名称。
/// </summary>
/// <param name="serieName"></param>
/// <param name="dataIndex"></param>
/// <param name="dataName"></param>
public virtual bool UpdateDataName(string serieName, int dataIndex, string dataName)
{
return m_Series.UpdateDataName(serieName, dataIndex, dataName);
}
/// <summary>
/// Update serie data name.
/// 更新指定系列中的指定索引数据名称。
/// </summary>
/// <param name="serieIndex"></param>
/// <param name="dataName"></param>
/// <param name="dataIndex"></param>
public virtual bool UpdateDataName(int serieIndex, int dataIndex, string dataName)
{
return m_Series.UpdateDataName(serieIndex, dataIndex, dataName);
}
/// <summary>
/// Whether to show serie.
/// 设置指定系列是否显示。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="active">Active or not</param>
public virtual void SetActive(string serieName, bool active)
{
var serie = m_Series.GetSerie(serieName);
if (serie != null)
{
SetActive(serie.index, active);
}
}
/// <summary>
/// Whether to show serie.
/// 设置指定系列是否显示。
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <param name="active">Active or not</param>
public virtual void SetActive(int serieIndex, bool active)
{
m_Series.SetActive(serieIndex, active);
var serie = m_Series.GetSerie(serieIndex);
if (serie != null && !string.IsNullOrEmpty(serie.name))
{
UpdateLegendColor(serie.name, active);
}
}
internal virtual void UpdateLegendColor(string legendName, bool active)
{
var legendIndex = m_LegendRealShowName.IndexOf(legendName);
if (legendIndex >= 0)
{
foreach (var legend in m_Legends)
{
var iconColor = LegendHelper.GetIconColor(legend, legendIndex, m_Theme, m_Series, legendName, active);
var contentColor = LegendHelper.GetContentColor(legend, m_Theme, active);
legend.UpdateButtonColor(legendName, iconColor);
legend.UpdateContentColor(legendName, contentColor);
}
}
}
/// <summary>
/// Whether serie is activated.
/// 获取指定系列是否显示。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <returns>True when activated</returns>
public virtual bool IsActive(string serieName)
{
return m_Series.IsActive(serieName);
}
/// <summary>
/// Whether serie is activated.
/// 获取指定系列是否显示。
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <returns>True when activated</returns>
public virtual bool IsActive(int serieIndex)
{
return m_Series.IsActive(serieIndex);
}
/// <summary>
/// Whether serie is activated.
/// 获得指定图例名字的系列是否显示。
/// </summary>
/// <param name="legendName"></param>
/// <returns></returns>
public virtual bool IsActiveByLegend(string legendName)
{
foreach (var serie in m_Series.list)
{
if (serie.show && legendName.Equals(serie.name))
{
return true;
}
else
{
foreach (var serieData in serie.data)
{
if (serieData.show && legendName.Equals(serieData.name))
{
return true;
}
}
}
}
return false;
}
/// <summary>
/// 刷新文本标签Label重新初始化当有改动Label参数时手动调用改接口
/// </summary>
public void RefreshLabel()
{
m_ReinitLabel = true;
m_SerieLabelRoot = null;
}
/// <summary>
/// 刷新Tooltip组件。
/// </summary>
public void RefreshTooltip()
{
InitTooltip();
}
/// <summary>
/// Update chart theme.
/// 切换内置主题。
/// </summary>
/// <param name="theme">theme</param>
public bool UpdateTheme(Theme theme)
{
if (theme == Theme.Custom)
{
Debug.LogError("UpdateTheme: not support switch to Custom theme.");
return false;
}
m_Theme.theme = theme;
return true;
}
/// <summary>
/// Update chart theme info.
/// 切换图表主题。
/// </summary>
/// <param name="theme">theme</param>
public void UpdateTheme(ChartTheme theme)
{
m_Theme.CopyTheme(theme);
}
/// <summary>
/// Whether series animation enabel.
/// 启用或关闭起始动画。
/// </summary>
/// <param name="flag"></param>
public void AnimationEnable(bool flag)
{
m_Series.AnimationEnable(flag);
}
/// <summary>
/// fadeIn animation.
/// 开始渐入动画。
/// </summary>
public void AnimationFadeIn()
{
m_Series.AnimationFadeIn();
RefreshChart();
}
/// <summary>
/// fadeIn animation.
/// 开始渐出动画。
/// </summary>
public void AnimationFadeOut()
{
m_Series.AnimationFadeOut();
RefreshChart();
}
/// <summary>
/// Pause animation.
/// 暂停动画。
/// </summary>
public void AnimationPause()
{
m_Series.AnimationPause();
RefreshChart();
}
/// <summary>
/// Stop play animation.
/// 继续动画。
/// </summary>
public void AnimationResume()
{
m_Series.AnimationResume();
RefreshChart();
}
/// <summary>
/// Reset animation.
/// 重置动画。
/// </summary>
public void AnimationReset()
{
m_Series.AnimationReset();
RefreshChart();
}
/// <summary>
/// 点击图例按钮
/// </summary>
/// <param name="legendIndex">图例按钮索引</param>
/// <param name="legendName">图例按钮名称</param>
/// <param name="show">显示还是隐藏</param>
public void ClickLegendButton(int legendIndex, string legendName, bool show)
{
OnLegendButtonClick(legendIndex, legendName, show);
RefreshChart();
}
/// <summary>
/// 坐标是否在图表范围内
/// </summary>
/// <param name="local"></param>
/// <returns></returns>
public bool IsInChart(Vector2 local)
{
return IsInChart(local.x, local.y);
}
public bool IsInChart(float x, float y)
{
if (x < m_ChartX || x > m_ChartX + m_ChartWidth ||
y < m_ChartY || y > m_ChartY + m_ChartHeight)
{
return false;
}
return true;
}
public void ClampInChart(ref Vector3 pos)
{
if (!IsInChart(pos.x, pos.y))
{
if (pos.x < m_ChartX) pos.x = m_ChartX;
if (pos.x > m_ChartX + m_ChartWidth) pos.x = m_ChartX + m_ChartWidth;
if (pos.y < m_ChartY) pos.y = m_ChartY;
if (pos.y > m_ChartY + m_ChartHeight) pos.y = m_ChartY + m_ChartHeight;
}
}
public Vector3 GetTitlePosition(Title title)
{
return chartPosition + title.location.GetPosition(chartWidth, chartHeight);
}
public bool ContainsSerie(SerieType serieType)
{
return SeriesHelper.ContainsSerie(m_Series, serieType);
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d078e85e5877d4d0f990c8dc43006247
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e17adfd3dc62d435cb79fa8c330fe186
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,293 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
/// <summary>
/// The basic class of rectangular coordinate chartsuch as LineChart,BarChart and ScatterChart.
/// 直角坐标系类型图表的基类如折线图LineChart柱状图BarChart散点图ScatterChart都属于这类型的图表。
/// 不可用直接将CoordinateChart绑定到GameObject上。
/// </summary>
public partial class CoordinateChart
{
/// <summary>
/// grid component.
/// 网格组件。
/// </summary>
public Grid grid { get { return m_Grids.Count > 0 ? m_Grids[0] : null; } }
public List<Grid> grids { get { return m_Grids; } }
/// <summary>
/// the x AxesxAxes[0] is the first x axis, xAxes[1] is the second x axis.
/// 两个x轴。
/// </summary>
public List<XAxis> xAxes { get { return m_XAxes; } }
/// <summary>
/// the y Axes, yAxes[0] is the first y axis, yAxes[1] is the second y axis.
/// 两个y轴。
/// </summary>
public List<YAxis> yAxes { get { return m_YAxes; } }
/// <summary>
/// dataZoom component.
/// 区域缩放组件。
/// </summary>
public DataZoom dataZoom { get { return m_DataZooms.Count > 0 ? m_DataZooms[0] : null; } }
/// <summary>
/// visualMap component.
/// 视觉映射组件。
/// </summary>
public VisualMap visualMap { get { return m_VisualMaps.Count > 0 ? m_VisualMaps[0] : null; } }
/// <summary>
/// X轴
/// </summary>
public XAxis xAxis0 { get { return m_XAxes.Count > 0 ? m_XAxes[0] : null; } }
/// <summary>
/// X轴
/// </summary>
public XAxis xAxis1 { get { return m_XAxes.Count > 1 ? m_XAxes[1] : null; } }
/// <summary>
/// Y轴
/// </summary>
public YAxis yAxis0 { get { return m_YAxes.Count > 0 ? m_YAxes[0] : null; } }
/// <summary>
/// Y轴
/// </summary>
public YAxis yAxis1 { get { return m_YAxes.Count > 1 ? m_YAxes[1] : null; } }
/// <summary>
/// Remove all data from series,legend and axis.
/// It just emptying all of serie's data without emptying the list of series.
/// 清空所有图例,系列和坐标轴类目数据。系列中指示清空系列中的数据,会保留系列列表。
/// </summary>
public override void ClearData()
{
base.ClearData();
ClearAxisData();
}
/// <summary>
/// Remove all data from series,legend and axis.
/// The series list is also cleared.
/// 清空所有图例,系列和坐标轴类目数据。系列的列表也会被清空。
/// </summary>
public override void RemoveData()
{
base.RemoveData();
ClearAxisData();
}
/// <summary>
/// Remove all data of Axes.
/// 清除所有x轴和y轴的类目数据。
/// </summary>
public void ClearAxisData()
{
foreach (var item in m_XAxes) item.data.Clear();
foreach (var item in m_YAxes) item.data.Clear();
}
/// <summary>
/// Add a category data to xAxis.
/// 添加一个类目数据到指定的x轴。
/// </summary>
/// <param name="category">the category data</param>
/// <param name="xAxisIndex">which xAxis should category add to</param>
public void AddXAxisData(string category, int xAxisIndex = 0)
{
m_XAxes[xAxisIndex].AddData(category);
}
/// <summary>
/// Add a category data to yAxis.
/// 添加一个类目数据到指定的y轴。
/// </summary>
/// <param name="category">the category data</param>
/// <param name="yAxisIndex">which yAxis should category add to</param>
public void AddYAxisData(string category, int yAxisIndex = 0)
{
m_YAxes[yAxisIndex].AddData(category);
}
/// <summary>
/// reutrn true when all the show axis is `Value` type.
/// 纯数值坐标轴(数值轴或对数轴)。
/// </summary>
public bool IsValue()
{
foreach (var axis in m_XAxes)
{
if (axis.show && !axis.IsValue() && !axis.IsLog()) return false;
}
foreach (var axis in m_YAxes)
{
if (axis.show && !axis.IsValue() && !axis.IsLog()) return false;
}
return true;
}
/// <summary>
/// 纯类目轴。
/// </summary>
public bool IsCategory()
{
foreach (var axis in m_XAxes)
{
if (axis.show && !axis.IsCategory()) return false;
}
foreach (var axis in m_YAxes)
{
if (axis.show && !axis.IsCategory()) return false;
}
return true;
}
/// <summary>
/// 坐标是否在坐标轴内。
/// </summary>
public bool IsInGrid(Grid grid, Vector2 local)
{
return IsInGrid(grid, local.x, local.y);
}
public bool IsInGrid(Grid grid, Vector3 local)
{
return IsInGrid(grid, local.x, local.y);
}
public bool IsInGrid(Grid grid, float x, float y)
{
if (x < grid.runtimeX - 1 || x > grid.runtimeX + grid.runtimeWidth + 1 ||
y < grid.runtimeY - 1 || y > grid.runtimeY + grid.runtimeHeight + 1)
{
return false;
}
return true;
}
public bool IsInAnyGrid(Vector2 local)
{
foreach (var grid in m_Grids)
{
if (IsInGrid(grid, local)) return true;
}
return false;
}
public Grid GetGrid(Vector2 local)
{
for (int i = 0; i < m_Grids.Count; i++)
{
var grid = m_Grids[i];
grid.index = i;
if (IsInGrid(grid, local)) return grid;
}
return null;
}
/// <summary>
/// 在下一帧刷新DataZoom
/// </summary>
public void RefreshDataZoom()
{
RefreshDataZoomLabel();
}
/// <summary>
/// 立即刷新数值坐标轴的最大最小值
/// </summary>
public void RefreshAxisMinMaxValue()
{
CheckMinMaxValue();
}
public Vector3 ClampInGrid(Grid grid, Vector3 pos)
{
if (IsInGrid(grid, pos)) return pos;
else
{
// var pos = new Vector3(pos.x, pos.y);
if (pos.x < grid.runtimeX) pos.x = grid.runtimeX;
if (pos.x > grid.runtimeX + grid.runtimeWidth) pos.x = grid.runtimeX + grid.runtimeWidth;
if (pos.y < grid.runtimeY) pos.y = grid.runtimeY;
if (pos.y > grid.runtimeY + grid.runtimeHeight) pos.y = grid.runtimeY + grid.runtimeHeight;
return pos;
}
}
/// <summary>
/// 转换X轴和Y轴的配置
/// </summary>
/// <param name="index">坐标轴索引0或1</param>
public void CovertXYAxis(int index)
{
if (index >= 0 && index <= 1)
{
var xAxis = m_XAxes[index];
var yAxis = m_YAxes[index];
var tempX = m_XAxes[index].Clone();
xAxis.Copy(m_YAxes[index]);
yAxis.Copy(tempX);
xAxis.runtimeZeroXOffset = 0;
xAxis.runtimeZeroYOffset = 0;
yAxis.runtimeZeroXOffset = 0;
yAxis.runtimeZeroYOffset = 0;
xAxis.runtimeMinValue = 0;
xAxis.runtimeMaxValue = 0;
yAxis.runtimeMinValue = 0;
yAxis.runtimeMaxValue = 0;
RefreshChart();
}
}
/// <summary>
/// 更新坐标系原点和宽高
/// </summary>
public void UpdateCoordinate()
{
foreach (var grid in m_Grids)
{
grid.UpdateRuntimeData(m_ChartX, m_ChartY, m_ChartWidth, m_ChartHeight);
}
foreach (var dataZoom in m_DataZooms)
{
dataZoom.UpdateRuntimeData(m_ChartX, m_ChartY, m_ChartWidth, m_ChartHeight);
}
}
/// <summary>
/// 设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。
/// </summary>
public void SetMaxCache(int maxCache)
{
foreach (var serie in m_Series.list) serie.maxCache = maxCache;
foreach (var axis in m_XAxes) axis.maxCache = maxCache;
foreach (var axis in m_YAxes) axis.maxCache = maxCache;
}
public Grid GetGrid(int index)
{
if (index >= 0 && index < m_Grids.Count) return m_Grids[index];
else return null;
}
public XAxis GetXAxis(int index)
{
if (index >= 0 && index < m_XAxes.Count) return m_XAxes[index];
else return null;
}
public YAxis GetYAxis(int index)
{
if (index >= 0 && index < m_YAxes.Count) return m_YAxes[index];
else return null;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 032e5d8f514854bf39f5fd7052119271
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,62 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
public partial class BaseChart
{
public Vessel vessel { get { return m_Vessels.Count > 0 ? m_Vessels[0] : null; } }
/// <summary>
/// 容器组件列表。
/// </summary>
public List<Vessel> vessels { get { return m_Vessels; } }
/// <summary>
/// 移除所有容器组件。
/// </summary>
public void RemoveVessel()
{
m_Vessels.Clear();
}
/// <summary>
/// 添加容器组件。
/// </summary>
public void AddVessel(Vessel vessel)
{
m_Vessels.Add(vessel);
}
/// <summary>
/// 添加容器组件。
/// </summary>
public Vessel AddVessel(Vessel.Shape shape, Vector2 center, float radius)
{
var vessel = new Vessel();
vessel.shape = shape;
vessel.radius = radius;
vessel.center[0] = center.x;
vessel.center[1] = center.y;
AddVessel(vessel);
return vessel;
}
/// <summary>
/// 获得指定索引的容器组件。
/// </summary>
/// <param name="radarIndex"></param>
/// <returns></returns>
public Vessel GetVessel(int vesselIndex)
{
if (vesselIndex < 0 || vesselIndex > m_Vessels.Count - 1) return null;
return m_Vessels[vesselIndex];
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: fd14dec4102b848f699bbf42babbe4c4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,27 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
namespace XCharts
{
public partial class BaseChart
{
/// <summary>
/// 极坐标。
/// </summary>
public Polar polar { get { return m_Polars.Count > 0 ? m_Polars[0] : null; } }
/// <summary>
/// Angle axis of Polar Coordinate.
/// 极坐标系的角度轴。
/// </summary>
public AngleAxis angleAxis { get { return m_AngleAxes.Count > 0 ? m_AngleAxes[0] : null; } }
/// <summary>
/// Radial axis of polar coordinate.
/// 极坐标系的径向轴。
/// </summary>
public RadiusAxis radiusAxis { get { return m_RadiusAxes.Count > 0 ? m_RadiusAxes[0] : null; } }
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 42960f04fcc2442baa061d32386aaaa8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,138 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
public partial class BaseChart
{
public Radar radar { get { return m_Radars.Count > 0 ? m_Radars[0] : null; } }
/// <summary>
/// 雷达坐标系组件列表。
/// </summary>
public List<Radar> radars { get { return m_Radars; } }
/// <summary>
/// 移除所有雷达坐标系组件。
/// </summary>
public void RemoveRadar()
{
m_Radars.Clear();
}
/// <summary>
/// 移除指定Radar的所有Indicator。
/// </summary>
/// <param name="radarIndex"></param>
public void RemoveIndicator(int radarIndex)
{
var radar = GetRadar(radarIndex);
if (radar == null) return;
radar.indicatorList.Clear();
}
/// <summary>
/// 添加雷达坐标系组件。
/// </summary>
public void AddRadar(Radar radar)
{
m_Radars.Add(radar);
}
/// <summary>
/// 添加雷达坐标系组件。
/// </summary>
/// <param name="shape">形状,圆形还是多边形</param>
/// <param name="center">中心点0-1浮点数时表示百分比</param>
/// <param name="radius">半径0-1浮点数时表示百分比</param>
/// <param name="splitNumber">指示器轴的分割段数</param>
/// <param name="lineWidth">线条宽</param>
/// <param name="showIndicator">是否显示指示器名称</param>
/// <param name="showSplitArea">是否显示分割区域</param>
/// <returns></returns>
public Radar AddRadar(Radar.Shape shape, Vector2 center, float radius, int splitNumber = 5,
float lineWidth = 0f, bool showIndicator = true, bool showSplitArea = true)
{
var radar = new Radar();
radar.shape = shape;
radar.splitNumber = splitNumber;
radar.radius = radius;
radar.indicator = showIndicator;
radar.center[0] = center.x;
radar.center[1] = center.y;
radar.splitArea.show = showSplitArea;
radar.splitLine.lineStyle.width = lineWidth;
m_Radars.Add(radar);
return radar;
}
public bool AddIndicator(int radarIndex, Radar.Indicator indicator)
{
var radar = GetRadar(radarIndex);
if (radar == null) return false;
radar.AddIndicator(indicator);
return true;
}
/// <summary>
/// 添加指示器。
/// </summary>
/// <param name="radarIndex">雷达坐标系组件索引从0开始</param>
/// <param name="name">指示器名称</param>
/// <param name="min">指示器最小值</param>
/// <param name="max">指示器最大值</param>
/// <returns></returns>
public Radar.Indicator AddIndicator(int radarIndex, string name, float min, float max)
{
var radar = GetRadar(radarIndex);
if (radar == null) return null;
return radar.AddIndicator(name, min, max);
}
/// <summary>
/// 更新指示器。
/// </summary>
/// <param name="radarIndex">雷达坐标系组件的索引从0开始</param>
/// <param name="indicatorIndex">指示器索引从0开始</param>
/// <param name="name">指示器名称</param>
/// <param name="min">指示器最小值</param>
/// <param name="max">指示器最大值</param>
/// <returns></returns>
public bool UpdateIndicator(int radarIndex, int indicatorIndex, string name, float min, float max)
{
var radar = GetRadar(radarIndex);
if (radar == null) return false;
return radar.UpdateIndicator(indicatorIndex, name, min, max);
}
/// <summary>
/// 获得指定索引的雷达坐标系组件。
/// </summary>
/// <param name="radarIndex"></param>
/// <returns></returns>
public Radar GetRadar(int radarIndex)
{
if (radarIndex < 0 || radarIndex > m_Radars.Count - 1) return null;
return m_Radars[radarIndex];
}
/// <summary>
/// 获得指定雷达坐标系组件指定索引的指示器。
/// </summary>
/// <param name="radarIndex"></param>
/// <param name="indicatorIndex"></param>
/// <returns></returns>
public Radar.Indicator GetIndicator(int radarIndex, int indicatorIndex)
{
var radar = GetRadar(radarIndex);
if (radar != null) return radar.GetIndicator(indicatorIndex);
else return null;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f17a7aa35fdd3417dab9414f10fe2886
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,88 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
namespace XCharts
{
public partial class RingChart
{
/// <summary>
/// 更新指定系列执行数据项的最大值
/// </summary>
/// <param name="serieIndex"></param>
/// <param name="dataIndex"></param>
/// <param name="value"></param>
/// <returns></returns>
public bool UpdateMax(int serieIndex, int dataIndex, float value)
{
var serie = m_Series.GetSerie(serieIndex);
if (serie != null)
{
return serie.UpdateData(dataIndex, 1, value);
}
return false;
}
/// <summary>
/// 更新指定系列的所有数据项的最大值
/// </summary>
/// <param name="serieIndex"></param>
/// <param name="value"></param>
/// <returns></returns>
public bool UpdateMax(int serieIndex, float value)
{
var serie = m_Series.GetSerie(serieIndex);
if (serie != null)
{
var flag = true;
for (int i = 0; i < serie.dataCount; i++)
{
if (serie.UpdateData(i, 1, value)) flag = false;
}
return flag;
}
return false;
}
/// <summary>
/// 更新第一个系列第一个数据项的最大值
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public bool UpdateMax(float value)
{
return UpdateMax(0, 0, value);
}
/// <summary>
/// Adds the data with the specified maximum value to the specified serie.
/// 添加指定最大值的数据到指定系列中。
/// </summary>
/// <param name="serieName">the name of serie</param>
/// <param name="value">the data</param>
/// <param name="max">the max data</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public override SerieData AddData(string serieName, float value, float max, string dataName = null)
{
return base.AddData(serieName, value, max, dataName);
}
/// <summary>
/// Adds the data with the specified maximum value to the specified serie.
/// 添加指定最大值的数据到指定系列中。
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <param name="value">the data</param>
/// <param name="max">the max data</param>
/// <param name="dataName">the name of data</param>
/// <returns>Returns True on success</returns>
public override SerieData AddData(int serieIndex, float value, float max, string dataName = null)
{
return base.AddData(serieIndex, value, max, dataName);
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7a1cd7e0dade8470cb91d6a7971ff022
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,53 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System;
using UnityEngine;
using UnityEngine.EventSystems;
namespace XCharts
{
[AddComponentMenu("XCharts/BarChart", 14)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
public partial class BarChart : CoordinateChart
{
protected override void Awake()
{
base.Awake();
raycastTarget = false;
}
#if UNITY_EDITOR
protected override void Reset()
{
base.Reset();
title.text = "BarChart";
tooltip.type = Tooltip.Type.Shadow;
RemoveData();
SerieTemplate.AddDefaultBarSerie(this, "serie1");
for (int i = 0; i < 5; i++)
{
AddXAxisData("x" + (i + 1));
}
}
#endif
public override void OnPointerDown(PointerEventData eventData)
{
base.OnPointerDown(eventData);
if (m_OnPointerClickBar == null) return;
if (pointerPos == Vector2.zero) return;
UpdateTooltipValue(pointerPos);
var dataIndex = tooltip.runtimeDataIndex[0];
if (dataIndex >= 0)
{
m_OnPointerClickBar(eventData, dataIndex);
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b0af5e768fe0e407cb5b023b37c41597
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d1d3ce01c4a6f4e3482c1dc22f388889
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,965 +0,0 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace XCharts
{
/// <summary>
/// The axis in rectangular coordinate.
/// 直角坐标系的坐标轴组件。
/// </summary>
[System.Serializable]
public class Axis : MainComponent
{
/// <summary>
/// the type of axis.
/// 坐标轴类型。
/// </summary>
public enum AxisType
{
/// <summary>
/// Numerical axis, suitable for continuous data.
/// 数值轴。适用于连续数据。
/// </summary>
Value,
/// <summary>
/// Category axis, suitable for discrete category data. Data should only be set via data for this type.
/// 类目轴。适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。
/// </summary>
Category,
/// <summary>
/// Log axis, suitable for log data.
/// 对数轴。适用于对数数据。
/// </summary>
Log
}
/// <summary>
/// the type of axis min and max value.
/// 坐标轴最大最小刻度显示类型。
/// </summary>
public enum AxisMinMaxType
{
/// <summary>
/// 0 - maximum.
/// 0-最大值。
/// </summary>
Default,
/// <summary>
/// minimum - maximum.
/// 最小值-最大值。
/// </summary>
MinMax,
/// <summary>
/// Customize the minimum and maximum.
/// 自定义最小值最大值。
/// </summary>
Custom
}
/// <summary>
/// the position of axis in grid.
/// 坐标轴在Grid中的位置
/// </summary>
public enum AxisPosition
{
Left,
Right,
Bottom,
Top
}
[SerializeField] protected bool m_Show = true;
[SerializeField] protected AxisType m_Type;
[SerializeField] protected AxisMinMaxType m_MinMaxType;
[SerializeField] protected int m_GridIndex;
[SerializeField] protected int m_PolarIndex;
[SerializeField] protected AxisPosition m_Position;
[SerializeField] protected float m_Offset;
[SerializeField] protected float m_Min;
[SerializeField] protected float m_Max;
[SerializeField] protected int m_SplitNumber = 5;
[SerializeField] protected float m_Interval = 0;
[SerializeField] protected bool m_BoundaryGap = true;
[SerializeField] protected int m_MaxCache = 0;
[SerializeField] protected float m_LogBase = 10;
[SerializeField] protected bool m_LogBaseE = false;
[SerializeField] protected int m_CeilRate = 0;
[SerializeField] protected bool m_Inverse = false;
[SerializeField] private bool m_Clockwise = 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 AxisSplitLine m_SplitLine = AxisSplitLine.defaultSplitLine;
[SerializeField] protected AxisSplitArea m_SplitArea = AxisSplitArea.defaultSplitArea;
[NonSerialized] private float m_MinMaxValueRange;
[NonSerialized] private bool m_NeedUpdateFilterData;
/// <summary>
/// Whether to show axis.
/// 是否显示坐标轴。
/// </summary>
public bool show
{
get { return m_Show; }
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetAllDirty(); }
}
/// <summary>
/// the type of axis.
/// 坐标轴类型。
/// </summary>
public AxisType type
{
get { return m_Type; }
set { if (PropertyUtil.SetStruct(ref m_Type, value)) SetAllDirty(); }
}
/// <summary>
/// the type of axis minmax.
/// 坐标轴刻度最大最小值显示类型。
/// </summary>
public AxisMinMaxType minMaxType
{
get { return m_MinMaxType; }
set { if (PropertyUtil.SetStruct(ref m_MinMaxType, value)) SetAllDirty(); }
}
/// <summary>
/// The index of the grid on which the axis are located, by default, is in the first grid.
/// 坐标轴所在的 grid 的索引,默认位于第一个 grid。
/// </summary>
public int gridIndex
{
get { return m_GridIndex; }
set { if (PropertyUtil.SetStruct(ref m_GridIndex, value)) SetAllDirty(); }
}
/// <summary>
/// The index of the polar on which the axis are located, by default, is in the first polar.
/// 坐标轴所在的 ploar 的索引,默认位于第一个 polar。
/// </summary>
public int polarIndex
{
get { return m_PolarIndex; }
set { if (PropertyUtil.SetStruct(ref m_PolarIndex, value)) SetAllDirty(); }
}
/// <summary>
/// the position of axis in grid.
/// 坐标轴在Grid中的位置。
/// </summary>
public AxisPosition position
{
get { return m_Position; }
set { if (PropertyUtil.SetStruct(ref m_Position, value)) SetAllDirty(); }
}
/// <summary>
/// the offset of axis from the default position. Useful when the same position has multiple axes.
/// 坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
/// </summary>
public float offset
{
get { return m_Offset; }
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetAllDirty(); }
}
/// <summary>
/// The minimun value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最小值当minMaxType为Custom时有效。
/// </summary>
public float min
{
get { return m_Min; }
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetAllDirty(); }
}
/// <summary>
/// The maximum value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最大值当minMaxType为Custom时有效。
/// </summary>
public float max
{
get { return m_Max; }
set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetAllDirty(); }
}
/// <summary>
/// Number of segments that the axis is split into.
/// 坐标轴的分割段数。
/// </summary>
public int splitNumber
{
get { return m_SplitNumber; }
set { if (PropertyUtil.SetStruct(ref m_SplitNumber, value)) SetAllDirty(); }
}
/// <summary>
/// Compulsively set segmentation interval for axis.This is unavailable for category axis.
/// 强制设置坐标轴分割间隔。无法在类目轴中使用。
/// </summary>
public float interval
{
get { return m_Interval; }
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetAllDirty(); }
}
/// <summary>
/// The boundary gap on both sides of a coordinate axis, which is valid only for category axis with type: 'Category'.
/// 坐标轴两边是否留白。只对类目轴有效。
/// </summary>
public bool boundaryGap
{
get { return IsCategory() ? m_BoundaryGap : false; }
set { if (PropertyUtil.SetStruct(ref m_BoundaryGap, value)) SetAllDirty(); }
}
/// <summary>
/// Base of logarithm, which is valid only for numeric axes with type: 'Log'.
/// 对数轴的底数只在对数轴type:'Log')中有效。
/// </summary>
public float logBase
{
get { return m_LogBase; }
set
{
if (value <= 0 || value == 1) value = 10;
if (PropertyUtil.SetStruct(ref m_LogBase, value)) SetAllDirty();
}
}
/// <summary>
/// On the log axis, if base e is the natural number, and is true, logBase fails.
/// 对数轴是否以自然数 e 为底数,为 true 时 logBase 失效。
/// </summary>
public bool logBaseE
{
get { return m_LogBaseE; }
set { if (PropertyUtil.SetStruct(ref m_LogBaseE, value)) SetAllDirty(); }
}
/// <summary>
/// The max number of axis data cache.
/// The first data will be remove when the size of axis data is larger then maxCache.
/// 可缓存的最大数据量。默认为0没有限制大于0时超过指定值会移除旧数据再插入新数据。
/// </summary>
public int maxCache
{
get { return m_MaxCache; }
set { if (PropertyUtil.SetStruct(ref m_MaxCache, value < 0 ? 0 : value)) SetAllDirty(); }
}
/// <summary>
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
/// 最大最小值向上取整的倍率。默认为0时自动计算。
/// </summary>
public int ceilRate
{
get { return m_CeilRate; }
set { if (PropertyUtil.SetStruct(ref m_CeilRate, value < 0 ? 0 : value)) SetAllDirty(); }
}
/// <summary>
/// Whether the axis are reversed or not. Invalid in `Category` axis.
/// 是否反向坐标轴。在类目轴中无效。
/// </summary>
public bool inverse
{
get { return m_Inverse; }
set { if (m_Type == AxisType.Value && PropertyUtil.SetStruct(ref m_Inverse, value)) SetAllDirty(); }
}
/// <summary>
/// Whether the positive position of axis is in clockwise. True for clockwise by default.
/// 刻度增长是否按顺时针,默认顺时针。
/// </summary>
public bool clockwise
{
get { return m_Clockwise; }
set { if (PropertyUtil.SetStruct(ref m_Clockwise, value)) SetAllDirty(); }
}
/// <summary>
/// Category data, available in type: 'Category' axis.
/// 类目数据在类目轴type: 'category')中有效。
/// </summary>
public List<string> data
{
get { return m_Data; }
set { if (value != null) { m_Data = value; SetAllDirty(); } }
}
/// <summary>
/// axis Line.
/// 坐标轴轴线。
/// /// </summary>
public AxisLine axisLine
{
get { return m_AxisLine; }
set { if (value != null) { m_AxisLine = value; SetVerticesDirty(); } }
}
/// <summary>
/// axis name.
/// 坐标轴名称。
/// </summary>
public AxisName axisName
{
get { return m_AxisName; }
set { if (value != null) { m_AxisName = value; SetComponentDirty(); } }
}
/// <summary>
/// axis tick.
/// 坐标轴刻度。
/// </summary>
public AxisTick axisTick
{
get { return m_AxisTick; }
set { if (value != null) { m_AxisTick = value; SetVerticesDirty(); } }
}
/// <summary>
/// axis label.
/// 坐标轴刻度标签。
/// </summary>
public AxisLabel axisLabel
{
get { return m_AxisLabel; }
set { if (value != null) { m_AxisLabel = value; SetComponentDirty(); } }
}
/// <summary>
/// axis split line.
/// 坐标轴分割线。
/// </summary>
public AxisSplitLine splitLine
{
get { return m_SplitLine; }
set { if (value != null) { m_SplitLine = value; SetVerticesDirty(); } }
}
/// <summary>
/// axis split area.
/// 坐标轴分割区域。
/// </summary>
public AxisSplitArea splitArea
{
get { return m_SplitArea; }
set { if (value != null) { m_SplitArea = value; SetVerticesDirty(); } }
}
public override bool vertsDirty
{
get { return m_VertsDirty || axisLine.anyDirty || axisTick.anyDirty || splitLine.anyDirty || splitArea.anyDirty; }
}
public override bool componentDirty
{
get { return m_ComponentDirty || axisName.anyDirty || axisLabel.anyDirty; }
}
internal override void ClearComponentDirty()
{
base.ClearComponentDirty();
axisName.ClearComponentDirty();
axisLabel.ClearComponentDirty();
}
internal override void ClearVerticesDirty()
{
base.ClearVerticesDirty();
axisLine.ClearVerticesDirty();
axisTick.ClearVerticesDirty();
splitLine.ClearVerticesDirty();
splitArea.ClearVerticesDirty();
}
public int index { get; internal set; }
/// <summary>
/// the axis label text list.
/// 坐标轴刻度标签的Text列表。
/// </summary>
public List<ChartText> axisLabelTextList { get { return m_AxisLabelTextList; } set { m_AxisLabelTextList = value; } }
/// <summary>
/// the current minimun value.
/// 当前最小值。
/// </summary>
public float runtimeMinValue
{
get { return m_RuntimeMinValue; }
internal set
{
m_RuntimeMinValue = value;
m_RuntimeLastMinValue = value;
m_RuntimeMinValueUpdateTime = Time.time;
m_RuntimeMinValueChanged = true;
}
}
/// <summary>
/// the current maximum value.
/// 当前最大值。
/// </summary>
public float runtimeMaxValue
{
get { return m_RuntimeMaxValue; }
internal set
{
m_RuntimeMaxValue = value;
m_RuntimeLastMaxValue = value;
m_RuntimeMaxValueUpdateTime = Time.time;
m_RuntimeMaxValueChanged = false;
}
}
/// <summary>
/// the x offset of zero position.
/// 坐标轴原点在X轴的偏移。
/// </summary>
public float runtimeZeroXOffset { get; internal set; }
/// <summary>
/// the y offset of zero position.
/// 坐标轴原点在Y轴的偏移。
/// </summary>
public float runtimeZeroYOffset { get; internal set; }
public int runtimeMinLogIndex { get { return logBaseE ? (int)Mathf.Log(runtimeMinValue) : (int)Mathf.Log(runtimeMinValue, logBase); } }
public int runtimeMaxLogIndex { get { return logBaseE ? (int)Mathf.Log(runtimeMaxValue) : (int)Mathf.Log(runtimeMaxValue, logBase); } }
internal bool runtimeLastCheckInverse { get; set; }
internal float runtimeMinMaxRange { get { return m_MinMaxValueRange; } set { m_MinMaxValueRange = value; } }
private int filterStart;
private int filterEnd;
private int filterMinShow;
private List<string> filterData;
private List<ChartText> m_AxisLabelTextList = new List<ChartText>();
private GameObject m_TooltipLabel;
private ChartText m_TooltipLabelText;
private RectTransform m_TooltipLabelRect;
private float m_RuntimeMinValue;
private float m_RuntimeLastMinValue;
private bool m_RuntimeMinValueChanged;
private float m_RuntimeMinValueUpdateTime;
private float m_RuntimeMaxValue;
private float m_RuntimeLastMaxValue;
private bool m_RuntimeMaxValueChanged;
private float m_RuntimeMaxValueUpdateTime;
private bool m_RuntimeMinValueFirstChanged = true;
private bool m_RuntimeMaxValueFirstChanged = true;
public Axis Clone()
{
var axis = new Axis();
axis.show = show;
axis.type = type;
axis.gridIndex = 0;
axis.minMaxType = minMaxType;
axis.min = min;
axis.max = max;
axis.splitNumber = splitNumber;
axis.interval = interval;
axis.boundaryGap = boundaryGap;
axis.maxCache = maxCache;
axis.logBase = logBase;
axis.logBaseE = logBaseE;
axis.ceilRate = ceilRate;
axis.axisLine = axisLine.Clone();
axis.axisName = axisName.Clone();
axis.axisTick = axisTick.Clone();
axis.axisLabel = axisLabel.Clone();
axis.splitLine = splitLine.Clone();
axis.splitArea = splitArea.Clone();
axis.data = new List<string>();
ChartHelper.CopyList(axis.data, data);
return axis;
}
public void Copy(Axis axis)
{
show = axis.show;
type = axis.type;
minMaxType = axis.minMaxType;
gridIndex = axis.gridIndex;
min = axis.min;
max = axis.max;
splitNumber = axis.splitNumber;
interval = axis.interval;
boundaryGap = axis.boundaryGap;
maxCache = axis.maxCache;
logBase = axis.logBase;
logBaseE = axis.logBaseE;
ceilRate = axis.ceilRate;
axisLine.Copy(axis.axisLine);
axisName.Copy(axis.axisName);
axisTick.Copy(axis.axisTick);
axisLabel.Copy(axis.axisLabel);
splitLine.Copy(axis.splitLine);
splitArea.Copy(axis.splitArea);
ChartHelper.CopyList(data, axis.data);
}
/// <summary>
/// 清空类目数据
/// </summary>
public void ClearData()
{
m_Data.Clear();
SetAllDirty();
}
/// <summary>
/// 是否为类目轴。
/// </summary>
/// <returns></returns>
public bool IsCategory()
{
return type == AxisType.Category;
}
/// <summary>
/// 是否为数值轴。
/// </summary>
/// <returns></returns>
public bool IsValue()
{
return type == AxisType.Value;
}
/// <summary>
/// 是否为对数轴。
/// </summary>
/// <returns></returns>
public bool IsLog()
{
return type == AxisType.Log;
}
/// <summary>
/// 添加一个类目到类目数据列表
/// </summary>
/// <param name="category"></param>
public void AddData(string category)
{
if (maxCache > 0)
{
while (m_Data.Count > maxCache)
{
m_NeedUpdateFilterData = true;
m_Data.RemoveAt(0);
}
}
m_Data.Add(category);
SetAllDirty();
}
/// <summary>
/// 获得指定索引的类目数据
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public string GetData(int index)
{
if (index >= 0 && index < m_Data.Count)
return m_Data[index];
else
return null;
}
/// <summary>
/// 获得在dataZoom范围内指定索引的类目数据
/// </summary>
/// <param name="index">类目数据索引</param>
/// <param name="dataZoom">区域缩放</param>
/// <returns></returns>
public string GetData(int index, DataZoom dataZoom)
{
var showData = GetDataList(dataZoom);
if (index >= 0 && index < showData.Count)
return showData[index];
else
return "";
}
/// <summary>
/// 获得指定区域缩放的类目数据列表
/// </summary>
/// <param name="dataZoom">区域缩放</param>
/// <returns></returns>
internal List<string> GetDataList(DataZoom dataZoom)
{
if (dataZoom != null && dataZoom.enable && dataZoom.IsContainsAxisIndex(index))
{
UpdateFilterData(dataZoom);
return filterData;
}
else
{
return m_Data;
}
}
private List<string> emptyFliter = new List<string>();
/// <summary>
/// 更新dataZoom对应的类目数据列表
/// </summary>
/// <param name="dataZoom"></param>
internal void UpdateFilterData(DataZoom dataZoom)
{
if (dataZoom != null && dataZoom.enable && dataZoom.IsContainsAxisIndex(index))
{
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
if (endIndex < startIndex) endIndex = startIndex;
if (startIndex != filterStart || endIndex != filterEnd || dataZoom.minShowNum != filterMinShow || m_NeedUpdateFilterData)
{
filterStart = startIndex;
filterEnd = endIndex;
filterMinShow = dataZoom.minShowNum;
m_NeedUpdateFilterData = false;
if (m_Data.Count > 0)
{
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
if (count < dataZoom.minShowNum)
{
if (dataZoom.minShowNum > m_Data.Count) count = m_Data.Count;
else count = dataZoom.minShowNum;
}
if (startIndex + count > m_Data.Count)
{
int start = endIndex - count;
filterData = m_Data.GetRange(start < 0 ? 0 : start, count);
}
else filterData = m_Data.GetRange(startIndex, count);
}
else
{
filterData = m_Data;
}
}
else if (endIndex == 0)
{
filterData = emptyFliter;
}
}
}
/// <summary>
/// 获得类目数据个数
/// </summary>
/// <param name="dataZoom"></param>
/// <returns></returns>
internal int GetDataNumber(DataZoom dataZoom)
{
return GetDataList(dataZoom).Count;
}
/// <summary>
/// 更新刻度标签文字
/// </summary>
/// <param name="dataZoom"></param>
internal void UpdateLabelText(float coordinateWidth, DataZoom dataZoom, bool forcePercent, float duration)
{
var minValue = GetCurrMinValue(duration);
var maxValue = GetCurrMaxValue(duration);
for (int i = 0; i < axisLabelTextList.Count; i++)
{
if (axisLabelTextList[i] != null)
{
var text = AxisHelper.GetLabelName(this, coordinateWidth, i, minValue, maxValue, dataZoom, forcePercent);
axisLabelTextList[i].SetText(text);
}
}
}
internal void SetTooltipLabel(GameObject label)
{
m_TooltipLabel = label;
m_TooltipLabelRect = label.GetComponent<RectTransform>();
m_TooltipLabelText = new ChartText(label);
ChartHelper.SetActive(m_TooltipLabel, true);
}
internal void SetTooltipLabelColor(Color bgColor, Color textColor)
{
m_TooltipLabel.GetComponent<Image>().color = bgColor;
m_TooltipLabelText.SetColor(textColor);
}
internal void SetTooltipLabelActive(bool flag)
{
ChartHelper.SetActive(m_TooltipLabel, flag);
}
internal void UpdateTooptipLabelText(string text)
{
if (m_TooltipLabelText != null)
{
m_TooltipLabelText.SetText(text);
m_TooltipLabelRect.sizeDelta = new Vector2(m_TooltipLabelText.GetPreferredWidth() + 8,
m_TooltipLabelText.GetPreferredHeight() + 8);
}
}
internal void UpdateTooltipLabelPos(Vector2 pos)
{
if (m_TooltipLabel)
{
m_TooltipLabel.transform.localPosition = pos;
}
}
internal void UpdateMinValue(float value, bool check)
{
if (value != m_RuntimeMaxValue)
{
if (check && Application.isPlaying)
{
if (m_RuntimeMinValueFirstChanged)
{
m_RuntimeMinValueFirstChanged = false;
}
else
{
m_RuntimeLastMinValue = m_RuntimeMinValue;
m_RuntimeMinValueChanged = true;
m_RuntimeMinValueUpdateTime = Time.time;
}
m_RuntimeMinValue = value;
}
else
{
m_RuntimeMinValue = value;
m_RuntimeLastMinValue = value;
m_RuntimeMinValueUpdateTime = Time.time;
m_RuntimeMinValueChanged = true;
}
}
}
internal void UpdateMaxValue(float value, bool check)
{
if (value != m_RuntimeMaxValue)
{
if (check && Application.isPlaying)
{
if (m_RuntimeMaxValueFirstChanged)
{
m_RuntimeMaxValueFirstChanged = false;
}
else
{
m_RuntimeLastMaxValue = m_RuntimeMaxValue;
m_RuntimeMaxValueChanged = true;
m_RuntimeMaxValueUpdateTime = Time.time;
}
m_RuntimeMaxValue = value;
}
else
{
m_RuntimeMaxValue = value;
m_RuntimeLastMaxValue = value;
m_RuntimeMaxValueUpdateTime = Time.time;
m_RuntimeMaxValueChanged = false;
}
}
}
internal float GetCurrMinValue(float duration)
{
if (!Application.isPlaying) return m_RuntimeMinValue;
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
if (!m_RuntimeMinValueChanged) return m_RuntimeMinValue;
var time = Time.time - m_RuntimeMinValueUpdateTime;
if (time == 0) return m_RuntimeMinValue;
var total = duration / 1000;
if (duration > 0 && time <= total)
{
var curr = Mathf.Lerp(m_RuntimeLastMinValue, m_RuntimeMinValue, time / total);
return curr;
}
else
{
m_RuntimeMinValueChanged = false;
return m_RuntimeMinValue;
}
}
internal float GetCurrMaxValue(float duration)
{
if (!Application.isPlaying) return m_RuntimeMaxValue;
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
if (!m_RuntimeMaxValueChanged) return m_RuntimeMaxValue;
var time = Time.time - m_RuntimeMaxValueUpdateTime;
if (time == 0) return m_RuntimeMaxValue;
var total = duration / 1000;
if (duration > 0 && time < total)
{
var curr = Mathf.Lerp(m_RuntimeLastMaxValue, m_RuntimeMaxValue, time / total);
return curr;
}
else
{
m_RuntimeMaxValueChanged = false;
return m_RuntimeMaxValue;
}
}
public bool IsValueChanging(float duration)
{
if (!Application.isPlaying) return false;
if (GetCurrMinValue(duration) != m_RuntimeMinValue || GetCurrMaxValue(duration) != m_RuntimeMaxValue)
{
return true;
}
else
{
return false;
}
}
public float GetLogValue(float value)
{
if (value <= 0 || value == 1) return 0;
return logBaseE ? Mathf.Log(value) : Mathf.Log(value, logBase);
}
public bool IsLeft()
{
return position == AxisPosition.Left;
}
public bool IsRight()
{
return position == AxisPosition.Right;
}
public bool IsTop()
{
return position == AxisPosition.Top;
}
public bool IsBottom()
{
return position == AxisPosition.Bottom;
}
}
/// <summary>
/// The x axis in cartesian(rectangular) coordinate. a grid component can place at most 2 x axis,
/// one on the bottom and another on the top.
/// <para>直角坐标系 grid 中的 x 轴,单个 grid 组件最多只能放上下两个 x 轴。</para>
/// </summary>
[System.Serializable]
public class XAxis : Axis
{
public 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_BoundaryGap = true,
m_Position = AxisPosition.Bottom,
m_Offset = 0,
m_Data = new List<string>()
{
"x1","x2","x3","x4","x5"
}
};
axis.splitLine.show = false;
axis.splitLine.lineStyle.type = LineStyle.Type.None;
axis.axisLabel.textLimit.enable = true;
return axis;
}
}
}
/// <summary>
/// The x axis in cartesian(rectangular) coordinate. a grid component can place at most 2 x axis,
/// one on the bottom and another on the top.
/// <para>直角坐标系 grid 中的 y 轴,单个 grid 组件最多只能放左右两个 y 轴</para>
/// </summary>
[System.Serializable]
public class YAxis : Axis
{
public 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_BoundaryGap = false,
m_Position = AxisPosition.Left,
m_Data = new List<string>(5),
};
axis.splitLine.show = true;
axis.splitLine.lineStyle.type = LineStyle.Type.None;
axis.axisLabel.textLimit.enable = false;
return axis;
}
}
}
/// <summary>
/// Radial axis of polar coordinate.
/// 极坐标系的径向轴。
/// </summary>
[System.Serializable]
public class RadiusAxis : Axis
{
public static RadiusAxis defaultRadiusAxis
{
get
{
var axis = new RadiusAxis
{
m_Show = true,
m_Type = AxisType.Value,
m_Min = 0,
m_Max = 0,
m_SplitNumber = 5,
m_BoundaryGap = false,
m_Data = new List<string>(5),
};
axis.splitLine.show = true;
axis.splitLine.lineStyle.type = LineStyle.Type.Solid;
axis.axisLabel.textLimit.enable = false;
return axis;
}
}
}
/// <summary>
/// Angle axis of Polar Coordinate.
/// 极坐标系的角度轴。
/// </summary>
[System.Serializable]
public class AngleAxis : Axis
{
[SerializeField] private float m_StartAngle = 90;
/// <summary>
/// Starting angle of axis. 90 degrees by default, standing for top position of center. 0 degree stands for right position of center.
/// 起始刻度的角度,默认为 90 度即圆心的正上方。0 度为圆心的正右方。
/// </summary>
public float startAngle
{
get { return m_StartAngle; }
set { if (PropertyUtil.SetStruct(ref m_StartAngle, value)) SetAllDirty(); }
}
public float runtimeStartAngle { get; set; }
public static AngleAxis defaultAngleAxis
{
get
{
var axis = new AngleAxis
{
m_Show = true,
m_Type = AxisType.Value,
m_SplitNumber = 12,
m_BoundaryGap = false,
m_Data = new List<string>(12),
};
axis.splitLine.show = true;
axis.splitLine.lineStyle.type = LineStyle.Type.Solid;
axis.axisLabel.textLimit.enable = false;
axis.minMaxType = AxisMinMaxType.Custom;
axis.min = 0;
axis.max = 360;
return axis;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More