Compare commits

...

239 Commits

Author SHA1 Message Date
monitor1394
e4e1a69e76 3.14.0 2025-03-16 10:45:38 +08:00
monitor1394
a1c7e1a64b update doc 2025-03-13 23:33:09 +08:00
monitor1394
1c3afc0255 update doc 2025-03-13 23:00:52 +08:00
monitor1394
42059d9ab9 update readme 2025-03-12 23:25:43 +08:00
monitor1394
24d13a36d3 update readme 2025-03-12 23:14:20 +08:00
monitor1394
247abb2e3f update readme 2025-03-12 23:05:41 +08:00
monitor1394
e8ea30a9fb 更新订阅服务 2025-03-12 08:49:04 +08:00
monitor1394
a1ba6b095d 增加BarrealtimeSort支持实时排序 2025-03-10 08:40:22 +08:00
monitor1394
e4923ea598 修复Bar在同一个Chart不同Grid里时绘制有些异常的问题 2025-03-09 23:14:26 +08:00
monitor1394
ffd2521360 增加Animationspeed可指定动画速度 2025-03-07 22:59:32 +08:00
monitor1394
e7aae593bf 优化Animation的新增动画表现 2025-03-07 22:32:27 +08:00
monitor1394
aea4aa7c8d 修复Treemaplabel显示异常的问题 2025-03-04 08:33:07 +08:00
monitor1394
f9f2428142 增加TooltipcolumnGapWidths参数设置列文本间隙距离 2025-03-02 20:57:58 +08:00
monitor1394
ffed67d8ee 增加BarrealtimeSort支持实时排序 2025-03-01 22:30:51 +08:00
monitor1394
063b5529d7 增加BarrealtimeSort支持实时排序 2025-02-23 21:47:15 +08:00
monitor1394
a54c50d947 增加TooltipitemFormatter\n换行的支持 2025-02-19 22:52:38 +08:00
monitor1394
9ddc543ed7 优化Tooltip的对齐方式 2025-02-18 23:30:56 +08:00
monitor1394
214b84c71d 修复SaveAsImage保存图片时不支持透明度的问题 (#337) 2025-02-09 20:21:42 +08:00
monitor1394
9fc75c78d7 增加GraphChart可单独设置data样式的支持 2025-02-06 22:11:13 +08:00
monitor1394
ec3d012f08 重构SerieSymbolsizeFunction参数 2025-02-06 21:23:58 +08:00
monitor1394
c6896677b8 修复TreemapLabel不显示的问题 2025-01-23 08:37:41 +08:00
monitor1394
29b1f8a8c2 修复Chart在运行时动态添加Component异常的问题 (#339) 2025-01-15 08:30:50 +08:00
monitor1394
ddbfd9b7ef 修复TextMeshPro关闭时残留组件影响Text初始化的问题 2025-01-08 22:28:47 +08:00
monitor1394
3db02b86b4 3.13.0 2025-01-01 22:52:48 +08:00
monitor1394
151ed168b5 3.13.0 2025-01-01 20:15:29 +08:00
monitor1394
be6a91b4c2 3.13.0 2024-12-31 08:44:57 +08:00
monitor1394
43de03951c 增加SymbolStylesize2参数支持长方形标记 2024-12-28 21:03:17 +08:00
monitor1394
21cd72b995 优化DrawBackground接口 2024-12-27 22:13:35 +08:00
monitor1394
d466ac2bc1 优化TextTextMeshPro下的居中对齐方式 2024-12-26 10:05:20 +08:00
monitor1394
6e9d9bfd3d 增加TooltipitemFormatter设置{f0}支持 2024-12-25 21:39:13 +08:00
monitor1394
d1438dd76f 修复YAxis在范围变更刷新时部分label可能不显示的问题 2024-12-25 16:30:25 +08:00
monitor1394
074c1a3992 增加UISlider扩展组件 2024-12-25 10:06:53 +08:00
monitor1394
5d24580725 增加SymbolStyleborderWidthemptyColor配置 2024-12-23 21:31:27 +08:00
monitor1394
301c66eccf 增加拖拽点击判断 2024-12-23 21:29:39 +08:00
monitor1394
2fc87d03cd 增加UISlider扩展组件 2024-12-17 22:19:22 +08:00
monitor1394
33b71dc711 增加UIToggle扩展组件 2024-12-10 08:49:41 +08:00
monitor1394
f5ec47c105 修复Chart节点下不能放自定义节点的问题 2024-12-07 22:21:55 +08:00
monitor1394
2e604529ee 处理Unity版本兼容问题 2024-12-04 09:18:38 +08:00
monitor1394
333dfb8e37 增加UIText扩展组件 2024-12-04 08:19:40 +08:00
monitor1394
7eddebd660 删除TextStyle的无用配置项tmpAlignment 2024-12-04 08:19:08 +08:00
monitor1394
19744ec124 3.12.1 2024-12-01 10:22:23 +08:00
monitor1394
1bdb756ad1 修复Tooltip在图表设置其他锚点时手机上显示位置异常的问题 2024-11-30 23:48:53 +08:00
monitor1394
bc1a11c4e3 修复Tooltip在图表设置其他锚点时手机上显示位置异常的问题 2024-11-30 23:45:28 +08:00
monitor1394
6c42fe6399 优化性能 2024-11-27 23:24:09 +08:00
monitor1394
ad77a79308 修复Unity6的一些代码警告问题 2024-11-27 22:28:47 +08:00
monitor1394
d5647a448d 修复Tooltip在特殊情况下可能会超出屏幕显示不完整的问题 2024-11-26 23:18:49 +08:00
monitor1394
756df47fe3 修复UITable在拖拽时也会点选的问题 2024-11-25 08:39:48 +08:00
monitor1394
1dd31f747e 修复Time时间轴在开启Animation时动态变更效果异常的问题 2024-11-22 22:10:12 +08:00
monitor1394
6568595abb 优化Line在数据点过密时有更好的绘制效果 2024-11-18 23:14:51 +08:00
monitor1394
61fb717d20 修复Animation无法通过代码开启的问题 (#334) 2024-11-16 17:22:40 +08:00
monitor1394
0a923400b2 修复Animation无法通过代码开启的问题 2024-11-16 17:18:06 +08:00
monitor1394
7fb0765c6c 修复DataZoom的start和end在代码动态修改时图表不刷新的问题 2024-11-13 08:40:56 +08:00
monitor1394
e6c68be728 更新文档 2024-11-05 22:17:23 +08:00
monitor1394
fdc7b41e8e 修复Title设置隐藏后运行还显示的问题 2024-11-05 08:28:57 +08:00
monitor1394
45972a4cd9 更新文档 2024-11-01 08:22:36 +08:00
monitor1394
d0d25b0221 更新文档 2024-10-31 23:28:46 +08:00
monitor1394
143a037761 更新文档 2024-10-28 22:25:14 +08:00
monitor1394
dc254fb722 更新文档 2024-10-21 08:44:16 +08:00
monitor1394
b0d6bea256 更新文档 2024-10-19 23:23:38 +08:00
monitor1394
4f38b59288 3.12.0 2024-10-01 22:59:59 +08:00
monitor1394
ad3a8f9ad8 3.12.0 2024-09-30 18:12:57 +08:00
monitor1394
8c1dc44e1e 3.11.2 2024-09-30 18:04:46 +08:00
monitor1394
25a06afb50 3.11.2 2024-09-30 17:42:55 +08:00
monitor1394
df4223421f 完善教程 2024-09-27 19:08:25 +08:00
monitor1394
f9b1eadd40 完善Legendformatter对多Serie的支持 (#332) 2024-09-24 18:28:21 +08:00
monitor1394
c61ad794a7 调整文档显示样式 2024-09-24 18:26:45 +08:00
monitor1394
3b6ce91c65 调整文档显示样式 2024-09-22 09:54:11 +08:00
monitor1394
c2a19ee47b 调整文档显示样式 2024-09-21 13:31:16 +08:00
monitor1394
768cf8d404 增加numericFormatterdatetime的支持 2024-09-11 08:12:14 +08:00
monitor1394
9a98d6a5df 完善AreaStyleorigin参数设置区域填充起始位置 2024-09-03 08:41:09 +08:00
monitor1394
e40e19c197 增加RingradiusGradient参数设置渐变方向 2024-08-31 22:22:33 +08:00
monitor1394
59cd12d0eb 优化Axis为时间轴时首个Label的位置 2024-08-31 22:22:16 +08:00
monitor1394
e7978cbc30 3.11.2 2024-07-31 22:52:33 +08:00
monitor1394
10a36e0295 3.11.2 2024-07-31 22:43:35 +08:00
monitor1394
5853376a44 修复Tooltip在微信小游戏平台上报错的兼容问题 (#326) 2024-07-29 22:51:02 +08:00
monitor1394
1bb9b455b4 调整AxisAxisName的默认位置 2024-07-27 23:06:02 +08:00
monitor1394
de4f650e4f 优化Axis的轴动画在初始化时关闭 2024-07-27 11:34:13 +08:00
monitor1394
feb5e7fc32 优化Axis的轴动画在初始化时关闭 2024-07-25 23:26:30 +08:00
monitor1394
378fccf8b4 优化PieLabelTooltip触发时的表现 2024-07-22 22:58:27 +08:00
monitor1394
9e1dd027e9 修复Tooltip在开启DataZoom时指示内容不准确的问题 2024-07-21 15:13:08 +08:00
monitor1394
71ecebb466 优化AxisTime时间轴时的分割效果 2024-07-20 22:21:22 +08:00
monitor1394
4903ac53f0 优化AxisTime时间轴时的分割效果 2024-07-20 21:02:24 +08:00
monitor1394
35e8f3e902 修复MarkLineLabel在初始化时可能会闪烁的问题 2024-07-17 23:16:22 +08:00
monitor1394
d5fbd33534 优化AxisTime时间轴时的Tooltip默认效果 2024-07-16 23:03:31 +08:00
monitor1394
c458846990 优化AxisTime时间轴的splitNumber为0时的表现 2024-07-14 15:23:13 +08:00
monitor1394
e3098e6e16 优化AxisTime时间轴的滚动表现 2024-07-14 15:07:26 +08:00
monitor1394
b22288eac4 优化Label显示体验 2024-07-12 21:22:53 +08:00
monitor1394
99d824e3a0 修复Label在初始化时会堆积的问题 2024-07-12 19:53:30 +08:00
monitor1394
6d41daa678 修复Label在初始化时会堆积的问题 2024-07-12 08:48:01 +08:00
monitor1394
cdac6acd8c 修复Label在初始化时会堆积的问题 2024-07-09 23:16:08 +08:00
monitor1394
94d1398bd3 修复Chart在动态创建时背景没有自适应的问题 (#323) 2024-07-06 11:33:47 +08:00
monitor1394
e2c7779493 3.11.1 2024-07-01 08:24:02 +08:00
monitor1394
9e95b8daa7 修复Serie有多个时颜色异常的问题 2024-07-01 08:15:08 +08:00
monitor1394
6d16a9c16a 修复Label在初始化时会堆积的问题 2024-06-23 22:03:09 +08:00
monitor1394
3b7e8184b0 3.11.0 2024-06-16 21:59:31 +08:00
monitor1394
33b7e5c1a4 3.11.0 2024-06-16 19:21:25 +08:00
monitor1394
24270e5c69 3.11.0 2024-06-16 19:05:40 +08:00
monitor1394
e3fb5685bf 增加EditorData的添加、删除、上下移动操作按钮 2024-06-15 13:21:38 +08:00
monitor1394
89e7a09e64 增加Edge判断接口 2024-06-13 23:04:35 +08:00
monitor1394
ee5efa9f8d 增加DrawEdge绘制由上下坐标列表组成的边 2024-06-13 22:59:37 +08:00
monitor1394
2fe9a40f42 3.11.0-preview2 2024-06-11 08:28:46 +08:00
monitor1394
ddbd82bebf 修复AxisIndicatorLabel可能会遮挡住Tooltip的问题 2024-06-11 08:14:34 +08:00
monitor1394
549ee43a37 修复TooltipCrossAxisIndicatorLabel可能不显示的问题 (#315) 2024-06-11 08:11:27 +08:00
monitor1394
3b9af0f8ec 调整TooltipCorss重命名为Cross 2024-06-10 22:42:20 +08:00
monitor1394
caee79630b 增加Axism_MinCategorySpacing设置类目轴默认的最小类目间距 2024-06-09 22:59:38 +08:00
monitor1394
a12c98b1a5 修复TooltipCross在开启DataZoom时指示位置不准确的问题 2024-06-09 22:13:26 +08:00
monitor1394
8617475808 优化一个Chart里有多个Serie时的Tooltip显示问题 2024-06-08 13:24:24 +08:00
monitor1394
922901380e 修复SerieClone时动画异常问题 (#320) 2024-06-06 13:07:34 +08:00
monitor1394
96cb7ffc74 修复Seriestate在代码动态设置时不刷新的问题 2024-06-04 08:40:43 +08:00
monitor1394
74cf4fe4ce 优化坐标轴Tick最小间距 2024-06-03 08:13:17 +08:00
monitor1394
eb948f03d5 完善关系图初始化 2024-06-03 08:12:32 +08:00
monitor1394
6a6ab72ed8 调整XChartsHierarchy视图下的右键菜单到UI/XCharts 2024-05-29 21:58:31 +08:00
monitor1394
df66f5c7ee 增加3D坐标系显示边框参数 2024-05-29 13:14:21 +08:00
monitor1394
042f9d3c01 增加3D坐标系对类目轴的支持 2024-05-29 08:33:00 +08:00
monitor1394
1e6140a138 3.11.0-preview1 2024-05-20 08:33:09 +08:00
monitor1394
86125c597e 优化Editor下编辑性能 2024-05-19 11:02:03 +08:00
monitor1394
fc346d30fb 优化第三方数据导入 2024-05-19 11:01:46 +08:00
monitor1394
3e8bf7caee 优化Line3D绘制 2024-05-15 13:19:34 +08:00
monitor1394
4e3182edfc 增加JsonUtil工具类 2024-05-09 13:13:51 +08:00
monitor1394
b86cae6717 Merge pull request #311 from stefanbursuc/fix-gc-allocations-in-tooltiphandler
Fix for GC Allocations inside TooltipHandler
2024-05-01 22:22:04 +08:00
monitor1394
0c92d08f0d 修复ConvertXYAxis()多次调用后图表异常的问题 2024-04-23 22:16:28 +08:00
monitor1394
b1522a27d4 修复DataZoom控制多个轴时的GridCoord获取可能不正确的问题 (#317) 2024-04-22 22:35:39 +08:00
monitor1394
120c6d5408 增加GridCoord3D3D坐标系 2024-04-22 22:25:12 +08:00
monitor1394
e2120b3da6 优化DateTimeUtil时间戳转DateTime接口时区的问题 2024-04-16 22:30:04 +08:00
monitor1394
58e6108bb2 优化GridCoord在开启GridLayout时也显示Left Right Top Bottom参数 (#316) 2024-04-15 08:18:12 +08:00
monitor1394
3ef2e7c23c 修复TooltipCross在开启DataZoom的情况下label位置不正确的问题 (#315) 2024-04-14 19:09:08 +08:00
monitor1394
a361e191da 修复Candlesticks效果不对的问题 (#313) 2024-04-12 08:30:34 +08:00
Stefan Bursuc
f5a41b5119 Fix for GC Allocations inside TooltipHandler
In the case where the pointer is not in the chart, both calls to
ListPool<Serie>.Get() from inside the function UpdateTooltipData
are executed.

And because the pointer is not in the chart, m_ShowTooltip is set to
false in the last else clause.

This makes UpdateTooltip to skip all logic and miss the chance to release
the list back to the pool.
2024-04-08 11:24:28 +02:00
monitor1394
42079848dc 优化桑吉图折叠显示 2024-03-20 22:23:58 +08:00
monitor1394
4b8374b1ae 修复Pie在设置ItemStyleopacity时颜色不对的问题 (#309) 2024-03-20 13:36:31 +08:00
monitor1394
0990b11c1c 增加TooltiptriggerOn指定触发条件 2024-03-20 13:34:21 +08:00
monitor1394
99b1624b54 增加数据图的折叠和展开支持 2024-03-20 08:31:05 +08:00
monitor1394
113c3887ae 3.10.2 2024-03-11 08:12:28 +08:00
monitor1394
9f5040435f 修复Tooltip移出坐标系后还显示的问题 2024-03-11 08:04:07 +08:00
monitor1394
f21e9c6a32 修复Legendformatter在设置{d}通配符时显示可能不匹配的问题 (#304) 2024-03-11 08:04:00 +08:00
monitor1394
a071956675 修复Legendformatter在设置{d}通配符时显示可能不匹配的问题 2024-03-11 08:03:53 +08:00
monitor1394
eab4f9530b 修复Tooltiptitle从旧版本升级后可能不显示的问题 2024-03-11 08:03:48 +08:00
monitor1394
ce8b03b692 3.10.1 2024-02-21 08:38:45 +08:00
monitor1394
2505a48ac2 修复Tooltip的圆点标记不会自适应颜色的问题 2024-02-19 08:53:31 +08:00
monitor1394
74e75e93af 修复Tooltip的圆点标记不会自适应颜色的问题 2024-02-19 08:51:06 +08:00
monitor1394
4f8390b515 3.10.0 2024-02-01 13:23:04 +08:00
monitor1394
d91ebeee3a 修复divide by zero的问题 2024-01-31 22:40:50 +08:00
monitor1394
b9c5623687 修复Tooltip在设置itemFormatter-后整个不显示的问题 2024-01-31 13:21:20 +08:00
monitor1394
34b4096482 修复Attempted to divide by zero报错 #302 2024-01-30 23:40:27 +08:00
monitor1394
bc75865a5e 修复TextLimit在开启TextMeshPro后无效的问题 (#301) 2024-01-27 13:40:16 +08:00
monitor1394
c987cb1ef7 修复TextLimit在开启TextMeshPro后无效的问题 (#301) 2024-01-27 13:35:47 +08:00
monitor1394
d93f7830de 增加Bar支持X轴和Y轴都为Category类目轴 2024-01-24 13:31:06 +08:00
monitor1394
61a2da10ba 增加{y}通配符用于获取Y轴的类目名 2024-01-23 22:56:03 +08:00
monitor1394
9e39150009 增加Line支持X轴和Y轴都为Category类目轴 2024-01-23 22:55:46 +08:00
monitor1394
653b81cc48 3.10.0 2024-01-21 22:33:45 +08:00
monitor1394
e68e41a939 3.10.0 2024-01-21 21:17:34 +08:00
monitor1394
d0448a5b11 修复Animationtype代码动态修改无效的问题 2024-01-18 22:41:32 +08:00
monitor1394
daec83c4a5 调整UI组件相关代码 2024-01-16 22:29:15 +08:00
monitor1394
6aa11249c5 Editor上添加第二个X轴或Y轴时自动设置位置 2024-01-14 10:56:36 +08:00
monitor1394
9a56985b3a 增加Chart的更多快捷创建图表菜单 2024-01-13 22:37:13 +08:00
monitor1394
fff04347fa 增加Chart的更多快捷创建图表菜单 2024-01-13 22:16:16 +08:00
monitor1394
5a5ad1e108 优化图表细节 2024-01-13 22:11:01 +08:00
monitor1394
3c233d1cb1 屏蔽ChartInit()接口,动态创建图表不再需要调用 2024-01-12 13:23:46 +08:00
monitor1394
c44583772c 完善动态创建图表功能 2024-01-12 08:29:02 +08:00
monitor1394
29e9593179 增加MainComponent的order设置执行优先级 2024-01-11 22:34:18 +08:00
monitor1394
318bdcb1f2 增加BackgroundborderStyle,给图表默认设置圆角 2024-01-11 08:03:36 +08:00
monitor1394
c3489fbc1e 修复Tooltop的第一个ContentLabelStyle设置color无效的问题 2024-01-07 22:13:03 +08:00
monitor1394
91db00a173 增加BorderStyle边框样式 2024-01-01 22:57:50 +08:00
monitor1394
a3533dbc02 增加DrawRoundRectangleWithBorder接口 2024-01-01 22:55:50 +08:00
monitor1394
f1c504e81a 增加HeatmapmaxCache参数支持 2023-12-26 23:08:41 +08:00
monitor1394
178215d980 修复Line开启clip时绘制的顶点数可能反而增加的问题 2023-12-25 23:05:06 +08:00
monitor1394
cbd527316e 修复Scatter散点图部分边界数据不显示的问题 2023-12-22 17:16:21 +08:00
monitor1394
3580df9117 修复TriggerTooltip()接口在指定0或最大index时可能无法触发的问题 2023-12-21 22:41:12 +08:00
monitor1394
11bdbba286 update doc 2023-12-20 13:26:29 +08:00
monitor1394
4ed22190d6 update doc 2023-12-20 13:19:07 +08:00
monitor1394
06ef86a9d6 修复LegendLabelStyleformatter不生效的问题 2023-12-19 22:02:05 +08:00
monitor1394
3d73578063 更新FAQ 2023-12-17 22:11:35 +08:00
monitor1394
07caa54631 更新FAQ 2023-12-17 22:05:57 +08:00
monitor1394
023eeb9ea8 优化border 2023-12-16 22:34:00 +08:00
monitor1394
2431a001b1 优化border 2023-12-16 22:31:34 +08:00
monitor1394
e83eeabf9c 优化Bar的边框绘制 2023-12-16 10:03:28 +08:00
monitor1394
9c5b83dc22 修复settings的lineSmoothness用代码设置无效的问题 2023-12-14 19:33:11 +08:00
monitor1394
9d2b14afef 代码优化 2023-12-14 19:22:02 +08:00
monitor1394
63173cdce6 代码优化 2023-12-14 10:20:48 +08:00
monitor1394
922a944881 增加LegendTextLimit可限制图例显示文本的长度 2023-12-12 10:22:32 +08:00
monitor1394
53c7ddf9d4 修复Serie添加double.MaxValue时坐标绘制失败的问题 2023-12-11 13:43:03 +08:00
monitor1394
a50bda5344 增加SerieminShowLabel可隐藏小于指定值的label 2023-12-10 21:23:57 +08:00
monitor1394
e8c8ab87aa 增加桑基图相关支持 2023-12-09 23:22:00 +08:00
monitor1394
1c6904f074 增加ResetChartStatus()可主动重置图表状态 2023-12-05 22:43:49 +08:00
monitor1394
225fc69e70 3.9.0 2023-12-01 21:26:27 +08:00
monitor1394
546077459f 3.9.0 2023-12-01 21:19:24 +08:00
monitor1394
bdc6c3b289 3.9.0 2023-12-01 21:16:28 +08:00
monitor1394
bbf1dc862c 3.9.0 2023-12-01 20:54:11 +08:00
monitor1394
c841ac4a93 3.9.0 2023-12-01 20:52:57 +08:00
monitor1394
bece2eb564 修复TooltiptitleFormatter设置为{b}后显示不准确的问题 2023-12-01 08:39:27 +08:00
monitor1394
735e36d6e5 增加SerieData可单独添加Label的支持 2023-11-30 22:36:24 +08:00
monitor1394
0a19b2a6cc 修复Tooltip在对数轴时指示不准确的问题 2023-11-28 10:04:15 +08:00
monitor1394
7ea260b986 修复报错 (#293) 2023-11-25 21:57:49 +08:00
monitor1394
cdc182191b 修复ChartUpdateData()接口返回值不准确的问题 2023-11-24 08:36:54 +08:00
monitor1394
45be0748aa 修复Axis的更新数据时效果不顺畅的问题 2023-11-24 08:29:55 +08:00
monitor1394
1f970cbb36 增加AxisAnimation支持动画效果 2023-11-24 08:29:42 +08:00
monitor1394
4aee1b0a92 3.9.0 2023-11-21 08:34:18 +08:00
monitor1394
079d1030ae 完善注释和文档 2023-11-16 13:15:09 +08:00
monitor1394
ddf44a8c1d 取消Legendformatter,用LabelStyle的代替 2023-11-16 08:40:28 +08:00
monitor1394
f94f678661 完善注释和文档 2023-11-16 08:20:26 +08:00
monitor1394
9816c34701 3.8.2 2023-11-14 13:23:32 +08:00
monitor1394
b959b15c71 完善LabelStyleformatter的注释和文档(#291) 2023-11-14 13:18:31 +08:00
monitor1394
c9ac0daed9 修复Documentation部分注释生成文档不完整的问题 (#290) 2023-11-11 23:36:28 +08:00
monitor1394
65684f2952 调整中英文注释的分隔符为|| 2023-11-11 23:32:24 +08:00
monitor1394
509bd97741 修复Legendformatter在数据变更时没有自动刷新的问题 2023-11-11 22:46:08 +08:00
monitor1394
83db4dd951 修复SerieEventDatavalue一直是0的问题 (#287) 2023-11-05 20:09:28 +08:00
monitor1394
a730404935 修复Bar设置渐变色时鼠标移出效果异常的问题 (#285) 2023-11-03 08:25:10 +08:00
monitor1394
f51e5f1859 优化SerieData设置ignoreformatter的忽略问题 2023-11-02 22:37:11 +08:00
monitor1394
e8204fc41e update doc 2023-11-02 08:43:08 +08:00
monitor1394
304726debf 增加MarkLineonTop设置是否显示在最上层 2023-11-01 22:41:47 +08:00
monitor1394
d8ecb94dd9 完善UIComponent 2023-11-01 08:53:18 +08:00
monitor1394
573f9efcaf 修复Pie有0数据时Label的位置异常的问题 2023-10-21 22:08:03 +08:00
monitor1394
985f70c3c9 增加Axis的对数轴支持子刻度 2023-10-21 13:29:50 +08:00
monitor1394
68d5bc36d6 优化Log对数轴 2023-10-19 23:06:26 +08:00
monitor1394
6b931497ab 修复Pie设置玫瑰图时引导线异常的问题 2023-10-19 22:51:22 +08:00
monitor1394
4bbedc8ef6 update doc 2023-10-17 22:16:37 +08:00
monitor1394
7f2de53af9 优化UIComponent 2023-10-17 21:39:57 +08:00
monitor1394
48a4fb470a 增加数据刷新接口SetDataDirty() 2023-10-17 14:51:16 +08:00
monitor1394
c67d3a3a80 3.8.2 2023-10-16 08:15:27 +08:00
monitor1394
6a5026e907 修复Line设置AnimationAlongPath时动画异常的问题 (#281) 2023-10-15 21:04:01 +08:00
monitor1394
38716facba 修复MarkLine指定yValue时对数值轴无效的问题 2023-10-13 08:15:25 +08:00
monitor1394
86f0ae5739 修复MarkLine指定yValue时对数值轴无效的问题 2023-10-12 21:55:16 +08:00
monitor1394
fea5ab34c0 修复SerieshowDataDimension设置无效的问题 2023-10-11 22:21:16 +08:00
monitor1394
789ab008f6 update doc 2023-10-11 08:32:48 +08:00
monitor1394
7f525ebaf0 update LICENSE 2023-10-11 08:32:21 +08:00
monitor1394
4fd7650726 3.8.1 2023-10-02 10:22:10 +08:00
monitor1394
66c01d55b9 修复Bar在水平方向时Label设置为Bottom不生效的问题 2023-09-29 23:52:50 +08:00
monitor1394
54bb49dfa7 3.8.1 2023-09-23 22:25:55 +08:00
monitor1394
c065245e00 增加Line平滑曲线对Dash虚线的支持 2023-09-22 08:34:06 +08:00
monitor1394
51697a54f4 修复Pie无数据时绘制异常的问题 (#278) 2023-09-21 08:11:31 +08:00
monitor1394
00123e0f94 修复Pie无数据时绘制异常的问题 (#279) 2023-09-21 08:10:00 +08:00
monitor1394
8c840404e0 修复Tooltip在类目轴无数据时异常报错的问题 (#279) 2023-09-16 20:57:39 +08:00
monitor1394
c5d7e5369d 修复Pie无数据时绘制异常的问题 2023-09-16 10:04:59 +08:00
monitor1394
8750bbc22a 增加PieradiusGradient可设置半径方向的渐变效果 2023-09-12 22:42:36 +08:00
monitor1394
680b9d5c20 update README.md 2023-09-12 08:03:19 +08:00
monitor1394
23dee8bd44 update support.md 2023-09-09 23:28:27 +08:00
monitor1394
6c1b402d2d 优化LabelLinelineEndXPie中的表现 2023-09-05 23:21:17 +08:00
monitor1394
c6e78f9cb9 修复RingTriggerTooltip()接口无效的问题 2023-09-05 13:34:11 +08:00
monitor1394
7402925512 修复Radar数据全为0时绘制报错的问题 2023-09-05 13:13:44 +08:00
306 changed files with 37639 additions and 7735 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,23 @@
---
sidebar_position: 61
slug: /changelog
---
# 更新日志
# Changelog
[master](#master)
[v3.14.0](#v3140)
[v3.13.0](#v3130)
[v3.12.1](#v3121)
[v3.12.0](#v3120)
[v3.11.2](#v3112)
[v3.11.1](#v3111)
[v3.11.0](#v3110)
[v3.10.2](#v3102)
[v3.10.1](#v3101)
[v3.10.0](#v3100)
[v3.9.0](#v390)
[v3.8.1](#v381)
[v3.8.0](#v380)
[v3.7.0](#v370)
[v3.6.0](#v360)
@@ -63,6 +79,266 @@
## master
## v3.14.0
**Key Highlights:**
* Added real-time sorting functionality for `Bar`
* Added support for `\n` line breaks in `itemFormatter` for `Tooltip`
* Added support for `{index}` formatting in `AxisLabel`
* Added `speed` to `Animation` to specify animation speed
* Optimized column alignment in `Tooltip`
**Detailed Changelog:**
* (2025.03.15) Released version `v3.14.0`
* (2025.03.09) Fixed an issue where `Bar` displayed abnormally when placed in different `Grids` within the same `Chart`
* (2025.03.07) Added `speed` to `Animation` to specify animation speed
* (2025.03.06) Optimized the performance of newly added animations in `Animation`
* (2025.03.04) Fixed an issue where `label` in `Treemap` displayed abnormally
* (2025.03.02) Added `columnGapWidths` parameter to `Tooltip` to set the gap distance between column texts
* (2025.03.01) Optimized the refresh of `Comment` component
* (2025.02.23) Added support for `{index}`, `{index-1}`, `{-index}`, and `{-index-1}` wildcards in `formatter` for `Label` in `Axis`
* (2025.02.23) Added `realtimeSort` to `Bar` to support real-time sorting
* (2025.02.19) Added support for `\n` line breaks in `itemFormatter` for `Tooltip`
* (2025.02.18) Optimized the alignment of `Tooltip`
* (2025.02.09) Fixed an issue where `SaveAsImage` did not support transparency when saving images (#337)
* (2025.02.05) Added support for setting `data` styles separately in `GraphChart`
* (2025.02.05) Refactored the `sizeFunction` parameter in `SerieSymbol`
* (2025.01.23) Fixed an issue where `Label` in `Treemap` was not displayed
* (2025.01.15) Fixed an issue where dynamically adding `Component` to `Chart` at runtime caused exceptions (#339)
* (2025.01.08) Fixed an issue where residual components affected `Text` initialization when `TextMeshPro` was turned off
## v3.13.0
Key Features:
* Added the `UIText` extension component
* Added the `UIToggle` extension component
* Added the `UISlider` extension component
* Refactored the `UIProgress` extension component
* Added `borderWidth` and `emptyColor` configurations to `SymbolStyle`
* Added the `size2` parameter to `SymbolStyle` to support rectangular markers
* Other optimizations and bug fixes
Detailed Changelog:
* (2025.01.01) Released `v3.13.0`
* (2024.12.27) Added the `size2` parameter to `SymbolStyle` to support rectangular markers
* (2024.12.26) Optimized `Text` alignment in `TextMeshPro` for proper centering
* (2024.12.25) Added support for `{f0}` in the `Tooltip`'s `itemFormatter` setting
* (2024.12.25) Fixed an issue where some labels on the `YAxis` might not display during range refresh
* (2024.12.23) Added `borderWidth` and `emptyColor` configurations to `SymbolStyle`
* (2024.12.17) Added the `UISlider` extension component
* (2024.12.10) Added the `UIToggle` extension component
* (2024.12.09) Fixed an issue where the `UITable`'s `scrollbar` could not be dragged
* (2024.12.07) Fixed an issue where custom nodes could not be placed under the `Chart` node
* (2024.12.05) Added the `UIText` extension component
* (2024.12.04) Removed the unused `tmpAlignment` option from `TextStyle`
## v3.12.1
Version Highlights:
* Enhanced Chinese and English support for the official website documentation.
* Optimized the rendering performance of line charts when data points are densely packed.
* Other issue fixes.
Log Details:
* (2024.12.01) Released `v3.12.1` version.
* (2024.11.30) Fixed an issue where the `Tooltip` displayed incorrectly on mobile devices when setting other anchors in charts.
* (2024.11.27) Resolved some code warning issues in `Unity6`.
* (2024.11.26) Fixed a problem where the `Tooltip` might exceed the screen and appear incomplete under specific circumstances.
* (2024.11.24) Fixed an issue where `UITable` would also select items during dragging.
* (2024.11.22) Fixed an abnormal effect issue when dynamically changing the `Time` timeline with `Animation` enabled.
* (2024.11.18) Optimized `Line` rendering for better performance when data points are densely packed.
* (2024.11.16) Fixed an issue where `Animation` could not be enabled through code (#334).
* (2024.11.13) Fixed a problem where dynamically modifying the `start` and `end` of `DataZoom` through code did not refresh the chart.
* (2024.11.05) Fixed an issue where the `Title` remained visible after being set to hidden.
* (2024.11.01) Improved `website` documentation in both English and Chinese.
## v3.12.0
Version Highlights:
* Added `radiusGradient` parameter for `Ring` to set the gradient direction
* Added support for `date` and `time` in `numericFormatter`
* Improved `origin` parameter setting for `AreaStyle` to define the starting position of area filling
* Adjusted and perfected the documentation
* Other optimizations and fixes
Log Details:
* (2024.09.30) Released version `v3.12.0`
* (2024.09.27) Improved the `5-minute tutorial`
* (2024.09.24) Improved support for multiple Series in `Legend`'s `formatter` (#332)
* (2024.09.22) Adjusted the display style of the `Documentation`
* (2024.09.09) Added support for `date` and `time` in `numericFormatter`
* (2024.09.03) Improved the setting of the `origin` parameter for `AreaStyle` to define the starting position of area filling
* (2024.09.01) Added `radiusGradient` parameter for `Ring` to set the gradient direction
* (2024.09.01) Optimized the position of the first Label when `Axis` is used as a time axis
## v3.11.2
* (2024.08.01) Release `v3.11.2`
* (2024.07.29) Fixed compatibility issue with `Tooltip` reporting error on wechat mini game platform (#326)
* (2024.07.27) Adjust the default position of `AxisName` for `Axis`
* (2024.07.22) Improved the behavior of `Pie`'s `Label` when `Tooltip` is triggered
* (2024.07.21) Fix to `Tooltip` indicating inaccurate content when opening `DataZoom`
* (2024.07.17) Fixed an issue where `Label` of `MarkLine` could flash during initialization
* (2024.07.16) Optimized the default effect of `Tooltip` when `Axis` is `Time` timeline
* (2024.07.15) Optimized segmentation when Axis is Time
* (2024.07.14) Improved movement performance when `Axis` is `Time`
* (2024.07.12) Optimized the initial display effect of `Label`
* (2024.07.06) Fix to `Chart` background not adaptive when dynamically created (#323)
## v3.11.1
* (2024.07.01) Release `v3.11.1`
* (2024.07.01) Fixed an issue where `Serie` has multiple abnormal colors
* (2024.06.23) Fixed an issue where `labels` would pile up during initialization
## v3.11.0
Release Highlights:
* Added `Line3DChart` for 3D line charts
* Added `GraphChart` for relationship graphs
* Added support for 3D coordinate systems
* Added `triggerOn` setting for `Tooltip` to define trigger conditions
* Various bug fixes and optimizations
Changelog Details:
* (2024.06.16) Released version `v3.11.0`
* (2024.06.15) Added buttons for adding, deleting, and moving data up and down under `Editor`
* (2024.06.11) Fixed issue where `Axis`'s `IndicatorLabel` might overlap with `Tooltip`
* (2024.06.11) Fixed issue where `Tooltip`'s `Axis` `IndicatorLabel` might not display when in `Cross` mode (#315)
* (2024.06.10) Renamed `Tooltip`'s `Corss` to `Cross`
* (2024.06.09) Added `minCategorySpacing` setting for `Axis` to define the default minimum category spacing
* (2024.06.09) Fixed inaccurate indicator position of `Tooltip`'s `Cross` when `Axis` is a category axis and `DataZoom` is enabled
* (2024.06.06) Fixed animation issue when `Serie` is cloned (#320)
* (2024.06.04) Fixed issue where `Serie`'s `state` does not refresh when set dynamically via code
* (2024.05.29) Adjusted the right-click menu of `XCharts` in the `Hierarchy` view to `UI/XCharts`
* (2024.05.29) Added support for 3D coordinate systems to category axes
* (2024.05.19) Optimized editing performance in `Editor`
* (2024.05.09) Added utility class `JsonUtil`
* (2024.05.01) Fixed the issue where `Tooltip` caused garbage collection (GC) on every frame (#311) (by @stefanbursuc)
* (2024.04.23) Fixed chart exception issue after multiple calls to `ConvertXYAxis()`
* (2024.04.22) Fixed potential incorrect retrieval of `GridCoord` when `DataZoom` controls multiple axes (#317)
* (2024.04.22) Added 3D coordinate system
* (2024.04.15) Optimized `DateTimeUtil` for timezone issues when converting timestamps to `DateTime`
* (2024.04.15) Optimized `GridCoord` to display `Left` `Right` `Top` `Bottom` parameters even when `GridLayout` is enabled (#316)
* (2024.04.14) Fixed incorrect label position of `Tooltip`'s `Cross` when `DataZoom` is enabled (#315)
* (2024.04.12) Fixed incorrect effect of `Candlesticks` (#313)
* (2024.03.20) Added `triggerOn` setting for `Tooltip` to define trigger conditions
* (2024.03.19) Fixed color issue when setting `opacity` in `Pie`'s `ItemStyle` (#309)
## v3.10.2
* (2024.03.11) Release `v3.10.2`
* (2024.03.11) Fix to `Legend`'s `formatter` showing possible mismatches when setting `{d}` (#304)
* (2024.03.11) Fix to `Tooltip` still showing after moving out of coordinate system
* (2024.03.08) Fixed an issue where `Tooltip`'s title might not appear after upgrading from an older version
## v3.10.1
* (2024.02.21) Release `v3.10.1`
* (2024.02.19) Fix to `Tooltip` dot markers not adapting to color
## v3.10.0
Highlights:
* Added bi-category axis support
* Added more segmentation shortcut menu to create charts, which can create dozens of charts with one click
* Added chart border Settings to support rounded corner charts
* Fixed several issues
Extension features:
* Added `SankeyChart` Sankey chart
* Added `border` Settings for `UITable`
Log details:
* (2024.02.01) Release `v3.10.0`
* (2024.01.31) Fix to Tooltip not displaying after itemFormatter is set to -
* (2024.01.27) Fix to TextLimit not working after TextMeshPro is enabled (#301)
* (2024.01.24) Added `Bar` to support both X and Y axes as` Category `axes
* (2024.01.23) Added `{y}` wildcard to get the class name of the Y-axis
* (2024.01.23) Added `Line` to support both X and Y axes as` Category `axes
* (2024.01.18) Fixed dynamic modification of `Animation`s `type` code
* (2024.01.13) Added more quick Chart creation menus for Chart
* (2024.01.09) added `borderStyle` to `Background` to give the chart rounded corners by default
* (2024.01.07) Fix to invalid first ContentLabelStyle setting color for Tooltop
* (2024.01.01) Added `BorderStyle` border style
* (2023.12.26) Added support for Heatmap's maxCache parameter
* (2023.12.25) Optimizes the number of vertices drawn when `Line`` opens clip
* (2023.12.22) Fixed an issue where some border data of `Scatter` map was not displayed
* (2023.12.21) Fix to `TriggerTooltip()` interface may not fire when 0 or maximum index is specified
* (2023.12.19) Fixed an issue where `Legend`'s `LabelStyle` does not take effect after setting its formatter
* (2023.12.12) Added TextLimit for Legend to limit the length of the text displayed in the legend
* (2023.12.11) Fix to coordinate drawing failure when `Serie` was added with `double-maxvalue`
* (2023.12.10) Add `Serie` to `minShowLabel` to hide `labels` that are less than the specified value
* (2023.12.09) Add depth to `LevelStyle` to specify the level to which it belongs
* (2023.12.09) Added `LevelStyle` `LineStyle` to set line styles
* (2023.12.09) Adding `Serie` to `Link` can be used to add node-edge relationships to Sankey diagrams
* (2023.12.05) added `ResetChartStatus()` to actively reset chart status
## v3.9.0
Highlights:
* Added `Animation` in `Axis` to improve the animation effect of data changes
* Added `minorTick` for `Log` type of `Axis`
* Added MarkLine's `onTop` setting to displayed at the top level
* Perfect code comments and documentation
* Fixed several issues
Extension features:
* `UITable` adds the carousel function
* `UITable` adds data api and callback functions
* `Pie3DChart` optimizes rendering performance
Log details:
* (2023.12.01) Release `v3.9.0`
* (2023.12.01) Fixed inaccurate display of Tooltip's `titleFormatter` set to `{b}`
* (2023.11.30) Added support for `SerieData` to add `Label` separately
* (2023.11.28) Fix to `Tooltip` incorrectly indicating the number line
* (2023.11.24) fixed inaccurate return values in Chart's `UpdateData()` interface
* (2023.11.24) Fix to `Axis` not working smoothly when updating data
* (2023.11.23) Added Animation support for Axis
* (2023.11.16) Cancel `Legend`'s `formatter` and replace it with `LabelStyle`
* (2023.11.14) Improved annotation and documentation for LabelStyle's formatter (#291)
* (2023.11.11) Fix to comments Documentation for some comments in `Documentation` (#290)
* (2023.11.11) fixed an issue where Legend's formatter didn't refresh automatically when data was changed
* (2023.11.05) Fix to SerieEventData's value always being 0 (#287)
* (2023.11.03) Fix to abnormal mouse movement when setting `Bar` gradient (#285)
* (2023.11.02) Optimizes ignoring of formatter when SerieData is set to ignore
* (2023.11.01) Added whether MarkLine's `onTop` setting is displayed at the top level
* (2023.10.21) Fix to `Label` location exception when `Pie` has 0 data
* (2023.10.21) Added subscale support for `Axis`
* (2023.10.19) Fixed abnormal lead line when `Pie` set rose chart
* (2023.10.15) Fixed Animation exception when `Line` was set to `AlongPath` (#281)
* (2023.10.12) Fixed invalid value axis when `MarkLine` specified `yValue`
* (2023.10.11) Fixed invalid setting of `Serie` `showDataDimension`
## v3.8.1
* (2023.10.02) Release `v3.8.1` version
* (2023.09.29) Fixed issue where `Bar` is set to `Bottom` when horizontal does not take effect
* (2023.09.22) Added support for dashed lines in `Line`'s smooth curves
* (2023.09.16) Fix to `Tooltip` reporting an exception when there is no data in the category axis (#279)
* (2023.09.16) Fix to `Pie` drawing exception with no data (#278)
* (2023.09.12) Added `Pie` `radiusGradient` to set the gradient effect in the radius direction
* (2023.09.05) Improved the performance of LabelLine`s lineEndX in Pie
* (2023.09.05) Fixed `TriggerTooltip()` interface not working for `Ring`
* (2023.09.05) Fixed drawing error when `Radar` data is all zeros
## v3.8.0
Highlights:
@@ -91,7 +367,7 @@ Log details:
* (2023.08.22) Fixed `Bar` display hidden drawing performance exception
* (2023.08.22) Improved Zebra histogram rendering performance (#276)
* (2023.08.16) Added Daemon daemon to resolve an error after TMP is enabled locally
* (2023.08.15) Fixed `Data` displaying axes incorrectly when data is between -1 and 1 (#273) (by __Ambitroc__)
* (2023.08.15) Fixed `Data` displaying axes incorrectly when data is between -1 and 1 (#273) (b y@Ambitroc)
* (2023.08.14) Fixed `XCharts` updating error after` TextMeshPro `and` NewInputSystem `are enabled locally (#272)
* (2023.08.12) Fixed `Chart` error when deleted at runtime (#269)
* (2023.08.11) Fixed an issue where data could not be added when DataZoom was enabled
@@ -132,7 +408,7 @@ Log details:
* (2022.06.08) Release v3.7.0
* (2023.06.04) Added `HelpDoc` help document skip
* (2023.05.30) Fixed Serie name with `_` line causing `Legend` to not fire (#252) (by __svr2kos2__)
* (2023.05.30) Fixed Serie name with `_` line causing `Legend` to not fire (#252) (by @svr2kos2)
* (2023.05.10) Added `MinMaxAuto` range type for `Axis`
* (2023.05.10) Added support for `Clip` for `Line`
* (2023.05.04) Fixed `Axis` setting` CeilRate `not taking effect in range -1 to 1
@@ -151,9 +427,9 @@ Log details:
* (2023.04.01) Release `v3.6.0` version
* (2023.03.14) Fix for Tooltip's `titleFormater` setting `{b}` may not take effect
* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by __Ambitroc__)
* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by @Ambitroc)
* (2023.03.12) Added `LabelStyle` `autoRotate` to set automatic rotation of angled vertical text
* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by __Ambitroc__)
* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by @Ambitroc)
* (2023.03.09) Adds callbacks to Chart's `onSerieClick`, `onSerieDown`, `onSerieEnter` and `onSerieExit`
* (2023.03.09) Fixed click-check offset for `Pie` not taking effect
* (2023.03.04) Added Positions for Legend to customize legend positions
@@ -167,7 +443,7 @@ Log details:
* (2023.02.02) Fixed bug where datazoom xaxis label could be displayed off-chart when datazoom is turned on
* (2023.02.02) Optimizes the `ignore` setting of `SerieData` to ignore data
* (2023.02.01) Fix `XChartsMgr.ContainsChart()` interface exception
* (2023.01.31) Added support for `InputSystem` (#242) (by __Bian-Sh__)
* (2023.01.31) Added support for `InputSystem` (#242) (by @Bian-Sh)
* (2023.01.11) Fixed chart not refreshing after removing Component from Inspector (#241)
* (2023.01.06) Fixed bug with `Pie` displaying abnormal Label when the last few values are 0 (#240)
* (2023.01.03) deletes serie `MarkColor` and adds ItemStyle `MarkColor`
@@ -186,7 +462,7 @@ Log details:
Highlights:
* Updated documentation structure, added [Official XCharts Homepage](https://xcharts-team.github.io)
* Updated documentation structure, added [Official XCharts Homepage](https://xcharts-team.github.io/en)
* Added support for the DataZoom box selected.
* Added support for maximum width Settings for bars.
* Other optimizations.
@@ -438,7 +714,7 @@ Details:
* (2022.03.20) Release `v2.7.0` version
* (2022.02.21) Fixed chart name repeat check error #183
* (2022.02.17) Fixed bug where axis split line might be displayed outside the coordinate system #181
* (2022.02.08) Fixed {d} formatter error when value is 0
* (2022.02.08) Fixed `{d}` formatter error when value is 0
* (2022.02.08) Fixed `YAxis` `AxisLabel`'s `onZero` does not work
* (2022.01.06) Improved `Zebra` bar chart

File diff suppressed because it is too large Load Diff

View File

@@ -1,150 +1,152 @@
# XCharts FAQ
---
sidebar_position: 41
slug: /faq
---
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)<br/>
[XCharts API](XChartsAPI-EN.md)<br/>
[XCharts Configuration](XChartsConfiguration-EN.md)
# FAQ
[QA 1: How to adjust the margin between the axis and the background?](#How-to-adjust-the-margin-between-the-axis-and-the=-background)
[QA 2: How to play agian the fadeIn animation?](#How-to-play-agian-the-fadeIn-animation)
[QA 3: How to customize the color of data item in line chart and pie chart?](#How-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
[QA 4: How to formatter the text of axis label, such as add a units text?](#How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
[QA 5: How to stack the bar of bar chart](#How-to-stack-the-bar-of-bar-chart)
[QA 6: How to make the bar serie in the same bar but not stack?](#How-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
[QA 7: How to adjust the bar width and gap of barchart?](#How-to-adjust-the-bar-width-and-gap-of-barchart)
[QA 8: How to adjust the color of bar?](#How-to-adjust-the-color-of-bar)
[QA 9: Can I adjust the anchor of chart?](#Can-I-adjust-the-anchor-of-chart)
[QA 10: Can display more than 1000 data?](#Can-display-more-than-1000-data)
[QA 11: Can line chart drawing be dash, dot and dash-dot?](#Can-line-chart-drawing-be-dash-dot-and-dash-dot)
[QA 12: How to limit the value range of the Y-axis?](#How-to-limit-the-value-range-of-the-Y-axis)
[QA 13: How to customize the tick value range of value axis?](#How-to-customize-the-tick-value-range-of-value-axis)
[QA 14: How to display text at the top of data items?](#How-to-display-text-at-the-top-of-data-items)
[QA 15: How do I customize icons for data items?](#How-do-I-customize-icons-for-data-items)
[QA 16: How to anti-aliasing and make the chart smoother?](#How-to-anti-aliasing-and-make-the-chart-smoother)
[QA 17: Why does mouse over chart Tooltip not show?](#Why-does-mouse-over-chart-Tooltip-not-show)
[QA 18: How not to display the bar line of Tooltip?](#How-not-to-display-the-bar-line-of-Tooltip)
[QA 19: How do I customize the display of Tooltip?](#How-do-I-customize-the-display-of-Tooltip)
[QA 20: How do I get the Y-axis to display multiple decimal places?](#How-do-I-get-the-Y-axis-to-display-multiple-decimal-places)
[QA 21: How do I dynamically update data with code?](#How-do-I-dynamically-update-data-with-code)
[QA 22: How to display legend? Why are legends sometimes not displayed?](#How-to-display-legend?Why-are-legends-sometimes-not-displayed)
[QA 23: How to make chart as prefab?](#How-to-make-chart-as-prefab)
[QA 24: How do I draw custom graphic in chart,such as line or dot?](#How-do-I-draw-custom-content-in-chart-such-as-line-or-dot)
[QA 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram)
[QA 26: How do I use the background component? What are the conditions?](#How-do-I-use-the-background-component-What-are-the-conditions)
[QA 27: Mesh can not have more than 65000 vertices?](#Mesh-cannot-have-more-than-65000-vertices)
[QA 28: Why are the parameters set in Serie reset after they run?](#Why-are-the-parameters-set-in-Serie-reset-after-they-run)
## FAQ 1: How to adjust the margin between the axis and the background?
## How-to-adjust-the-margin-between-the-axis-and-the=-background
`Grid` conponentwhich can adjust the left, right, up, down margins of chart.
A: `Grid` conponentwhich can adjust the left, right, up, down margins of chart.
## FAQ 2: How to play agian the fadeIn animation?
## How-to-play-agian-the-fadeIn-animation
call the `chart.AnimationReset()` API.
A: call the `chart.AnimationReset()` API.
## FAQ 3: How to customize the color of data item in line chart and pie chart?
## How-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
`Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
A: `Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
## FAQ 4: How to formatter the text of axis label, such as add a units text?
## How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
A: Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
## FAQ 5: How to stack the bar of bar chart?
## How-to-stack-the-bar-of-bar-chart
Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
A: Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
## FAQ 6: How to make the bar serie in the same bar but not stack?
## How-to-make-the-bar-serie-in-the-same-bar-but-not-stack
Set the `barGap` of `Serie` to `-1``stack` to null.
A: Set the `barGap` of `Serie` to `-1``stack` to null.
## FAQ 7: How to adjust the bar width and gap of barchart?
## How-to-adjust-the-bar-width-and-gap-of-barchart
Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
A: Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
## FAQ 8: How to adjust the color of bar?
## How-to-adjust-the-color-of-bar
Adjust the `ItemStyle` of `Data` in `inspector`.
A: Adjust the `ItemStyle` of `Data` in `inspector`.
## FAQ 9: Can I adjust the anchor of chart?
## Can-I-adjust-the-anchor-of-chart
Yes, you can set any one of 16 anchors but the value use default.
A: Yes, you can set any one of 16 anchors but the value use default.
## FAQ 10: Can display more than 1000 data?
## Can-display-more-than-1000-data
Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
A: Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
## FAQ 11: Can line chart drawing be dash, dot and dash-dot?
## Can-line-chart-drawing-be-dash-dot-and-dash-dot
Yes. Adjust the `lineType` of `Serie`.
A: Yes. Adjust the `lineType` of `Serie`.
## FAQ 12: How to limit the value range of the Y-axis?
## How-to-limit-the-value-range-of-the-Y-axis
Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
A: Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
## FAQ 13: How to customize the tick value range of value axis?
## How-to-customize-the-tick-value-range-of-value-axis
By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
A: By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
## FAQ 14: How to display text at the top of data items?
## How-to-display-text-at-the-top-of-data-items
Adjust the `Label` of `Serie`.
A: Adjust the `Label` of `Serie`.
## FAQ 15: How do I customize icons for data items?
## How-do-I-customize-icons-for-data-items
Set the `Icon` of `Data` in `Serie`.
A: Set the `Icon` of `Data` in `Serie`.
## FAQ 16: How to anti-aliasing and make the chart smoother?
## How-to-anti-aliasing-and-make-the-chart-smoother
Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
A: Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
## FAQ 17: Why does mouse over chart Tooltip not show?
## Why-does-mouse-over-chart-Tooltip-not-show
Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
A: Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
## FAQ 18: How not to display the bar line of Tooltip?
## How-not-to-display-the-bar-line-of-Tooltip
Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
A: Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
## FAQ 19: How do I customize the display of Tooltip?
## How-do-I-customize-the-display-of-Tooltip
See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
A: See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
## FAQ 20: How do I get the Y-axis to display multiple decimal places?
## How-do-I-get-the-Y-axis-to-display-multiple-decimal-places
Set the `numericFormatter` parameter of `AxisLabel`.
A: Set the `numericFormatter` parameter of `AxisLabel`.
## FAQ 21: How do I dynamically update data with code?
## How-do-I-dynamically-update-data-with-code
See example: `Example01_UpdateData.cs`
A: See example: `Example01_UpdateData.cs`
## FAQ 22: How to display legend? Why are legends sometimes not displayed?
## How-to-display-legend?Why-are-legends-sometimes-not-displayed
First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
A: First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
## FAQ 23: How to make chart as prefab?
## How-to-make-chart-as-prefab
Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
A: Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
## FAQ 24: How do I draw custom graphic in chart,such as line or dot?
## How-do-I-draw-custom-content-in-chart-such-as-line-or-dot
Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
A: Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
## FAQ 25: How to achieve similar data movement effect of ELECTRO cardiogram?
## How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram
See `Example_Dynamic.cs`.
A: See `Example_Dynamic.cs`.
## FAQ 26: How do I use the background component? What are the conditions?
## How-do-I-use-the-background-component-What-are-the-conditions
Setting `show` to `true` for the `background` component.
A: Setting `show` to `true` for the `background` component.
## FAQ 27: Mesh can not have more than 65000 vertices?
## Mesh-cannot-have-more-than-65000-vertices
This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [FAQ 10: Can display more than 1000 data?](#FAQ-10-can-display-more-than-1000-data)
A: This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [QA 10: Can display more than 1000 data](#Can-display-more-than-1000-data)
## FAQ 28: Why are the parameters set in Serie reset after they run?
## Why-are-the-parameters-set-in-Serie-reset-after-they-run
Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
## FAQ 29: How to change the color of serie symbol?
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)<br/>
[XCharts API](XChartsAPI-EN.md)<br/>
[XCharts Configuration](XChartsConfiguration-EN.md)
The color of 'Symbol' is the color of 'ItemStyle' used.
## FAQ 30: How to deal with TMP errors when importing or updating XCharts?
XCharts does not enable TMP by default, so there are no references to TMP on asmdef. This issue may occur when updating XCharts after TMP is enabled locally. It can be solved in the following two ways:
1. Find `XCharts.Runtime.asmdef` and `XCharts.Editor.asmdef` and manually add references to `TextMeshPro`
2. Remove the `dUI_TextMeshPro` macro for Scripting Define Symbols in PlayerSetting
Version ` 3.8.0 ` after adding Daemon [XCharts - Daemon](https://github.com/XCharts-Team/XCharts-Daemon), will be XCharts - Daemon import project, When updating XCharts, the daemon automatically refreshes the asmdef based on the locally enabled TMP to ensure proper compilation.
## FAQ 31: Support empty data? How to achieve the effect of line chart disconnection?
`data` of `Serie` is of type `double`, so it cannot represent empty data. Empty data can be achieved by turning on Serie's ignore and specifying ignoreValue. You can also set the ignore parameter for each SerieData. The ignoreLineBreak parameter can be set to disconnect or connect after ignoring data.
## FAQ 32: 2.x What are the common problems when upgrading version 3.x?
1. `XCharts.Runtime.XChartsMgr` is missing the class attribute `ExtensionOfNativeClass`!
3.x version does not need to mount XChartsMgr, directly delete the `_xcharts_` node on the scene.
## FAQ 33: How to display a line chart without white space on both sides and start from the 0 coordinate?
Set the `boundaryGap` parameter of the X-axis.
## FAQ 34: How to set some Series not to display Tooltips?
Setting the `itemFormatter` of `itemStyle` in `serie` to `'-'` can ignore `tooltip`.
## FAQ 35: Sometimes an overlapping line appears in the area line chart when using semi-transparent colors
This is a bug in the drawing of the area line chart. You can use light opaque colors instead of semi-transparent colors.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 KiB

After

Width:  |  Height:  |  Size: 704 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 660 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

View File

@@ -0,0 +1,9 @@
---
title: Support
sidebar_position: 51
slug: /support
---
# Support
For technical support and to purchase additional charts, you can subscribe to the `VIP` service. For details, please send an email to `monitor1394@gmail.com` for consultation.

View File

@@ -1,105 +1,172 @@
---
title: Introductory tutorial: Get started with XCharts 3.0 in 5 minutes
title: Getting Started
sidebar_position: 11
slug: /tutorial01
---
# Tutorial: Get started with XCharts 3.0 in 5 minutes
# Getting Started with XCharts in 5 Minutes
> Note: This tutorial is for XCharts 3.x version only
:::warning
## What do I need to know before using XCharts
Note: This tutorial is only applicable to the XCharts 3.x version. For the 2.x version, please refer to [Tutorial: Mastering XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
- Have used Unity, know the basic operation of Unity.
- Understand UGUI and can use UGUI.
- Understand MonoBehavior script usage in Unity, know how to hang scripts, manipulate scripts with code.
:::
## Get and import XCharts
## Prerequisites for XCharts
XCharts can be imported into a project in any of the following ways:
XCharts is a Unity chart plugin, currently only available for use on the Unity platform.
- Source XCharts directly into the project
Before using XCharts, you need to:
After downloading the XCharts source code, copy the XCharts directory directly to the Assets directory of the Unity project.
- Have a basic understanding of how to use Unity.
- Understand the basic usage of UGUI for making UI.
- Know how to use Unity's MonoBehavior scripts, how to attach scripts, and how to manipulate scripts with code.
- Import XCharts through `Assets/Import Package`
If you are new to Unity, it is recommended to learn some basic Unity tutorials before using XCharts.
After downloading the.unitypackage file for XCharts, open Unity and go to the menu bar Assets--&gt; Import Package--&gt; Select.unitypackage import to start using XCharts.
## Obtaining and Importing XCharts
- Import XCharts through the Package Manager
XCharts is primarily maintained and released through Github. You can download the source code and Package from the [Github Homepage](https://github.com/XCharts-Team).
For Unity 2018.3 and later, XCharts can be imported through the Package Manager. After opening the Package Manager, run the `Add package form git URL...`, input XCharts dead simple URL: ` https://github.com/XCharts-Team/XCharts.git use XCharts after ` wait a moment.
XCharts can be imported into your project in any of the following ways:
You can also add the package directly to the manifest.json file: Open the manifest.json file in the Packages directory and add it under dependencies:
### Copying the XCharts Source Code Directly into the Project
``` json
"com.monitor1394.xcharts" : "https://github.com/XCharts-Team/XCharts.git",
```
After downloading the XCharts source code, simply copy the XCharts directory into the Assets directory of your Unity project. Once compiled, it is ready to use.
To update XCharts, remove com.monitor1394.xcharts from the manifest.json file under lock (some versions of Unity may be packages-lock.json) and re-download and compile.
### Importing XCharts through Import Package
- Recommended daemon into XCharts (not required)
After downloading the .unitypackage file of XCharts, open Unity, go to the menu bar Assets-->Import Package-->select the downloaded .unitypackage to import. After the import is complete and compiled, you can start using XCharts.
[XCharts Daemon](https://github.com/XCharts-Team/XCharts-Daemon) can ensure update compilation is normal, when the local open TextMeshPro or NewInputSystem would be very useful. After importing Xchart-daemon into a project, when updating XCharts, the Daemon will automatically refresh asmdef according to the status of local TMP, etc., to ensure normal compilation and facilitate the execution of automated processes such as CI-CD.
### Importing XCharts through Package Manager
## Add a simple chart
For Unity versions above 2018.3, you can import XCharts through the Package Manager. Open the Package Manager, then use `Add package from git URL...`, enter the GitHub URL of XCharts: `https://github.com/XCharts-Team/XCharts.git`. After compiling, you can use XCharts.
Right-click in `Hierarchy` view or menu bar `GameObject` drop down and select `XCharts->LineChart`, can quickly create a default line chart out:
For some Unity versions, you can also directly add the package to the `manifest.json` file: Open the `manifest.json` file under the `Packages` directory, and add the following under `dependencies`:
>"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git",
If you need to update `XCharts`, delete the relevant content of `com.monitor1394.xcharts` under the `lock` of the `manifest.json` file (some Unity versions may be the packages-lock.json file), and it will re-download and compile.
### Recommended Import of XCharts Daemon
The daemon [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon) ensures that the compilation is normal when updating. It is very useful when TextMeshPro or NewInputSystem is turned on locally. After importing XCharts-Daemon into the project, the daemon will automatically refresh XCharts' asmdef according to the local situation of TMP when updating XCharts, ensuring that the compilation is normal without manual intervention, which is convenient for automated processes such as CI/CD.
The import method of XCharts-Daemon can refer to the previous import method of XCharts. It can be imported into the project through source code or Package. The GitHub URL of XCharts-Daemon: https://github.com/XCharts-Team/XCharts-Daemon.git
## Basic Usage of XCharts
After importing XCharts and compiling, the XCharts menu will appear in the Unity editor's menu bar, and you can start using XCharts.
:::tip
Note: The XCharts menu in the Unity menu bar indicates that XCharts is available.
:::
### Adding a Simple Chart
In the `Hierarchy` view, right-click `UI->XCharts->LineChart` or select `LineChart` from the menu bar `XCharts` to quickly create a default line chart:
![linechart1](img/tutorial01_linechart1.png)
## Add multiple Seire
If you need to create a chart under a certain node, you can select the node and right-click `UI->XCharts->LineChart` to create a chart under the node.
In the Inspector view, locate LineChart's panel, and with the `Add Serie` button, you can add a second Line line:
### Modifying Chart Data
For the newly created chart, its data can be modified on the Inspector panel.
For X-axis data, you can add, delete, and modify by expanding: `XAxis->Data`:
![op_axisdata](img/tutorial01_axisdata.png)
For Serie data, you can add, delete, and modify by expanding: `Serie->Data`:
![op_seriedata](img/tutorial01_seriedata.png)
Serie supports multi-dimensional data, and generally, a line chart only uses two-dimensional data: the first dimension represents the ID of the X-axis category data, and the second dimension represents the corresponding value.
### Adding Multiple Series
In the `Inspector` view, find the `LineChart` panel, and click the `Add Serie` button to add a second `Line` line:
![op_addserie](img/tutorial01_addserie.png)
![linechart2](img/tutorial01_linechart2.png)
## Add other components
:::tip
The default chart does not have a `Legend`, and a `Legend` Component can be added via the `Add Component` button:
Series are added through the `Add Serie` button. Different types of Series can be added. [What kinds of Series does XCharts have?](https://xcharts-team.github.io/en/docs/configuration#serie-系列)
:::
### Adding Other Main Components
By default, the chart does not have a `Legend`. If you need a `Legend` component, you can add it through the `Add Component` button:
![op_addcomponent](img/tutorial01_addcomponent.png)
## Add Serie components
:::tip
Serie comes with only a few common components, and others are added as needed. For example, if you need to fill a line chart area with color, you can add a separate `AreaStyle` component to Serie:
Main components are added through the `Add Component` button. [What main components does XCharts have?](https://xcharts-team.github.io/en/docs/configuration/#maincomponent-主组件)
:::
### Adding Serie Components
Serie only comes with a few common components, and other components need to be added when used. For example, if you need to fill the area color for the line chart, you can add an `AreaStyle` component to `Serie` separately:
![op_addseriecomponent](img/tutorial01_addseriecomponent.png)
![linechart3](img/tutorial01_linechart3.png)
## Add the SerieData component
:::tip
If you need to personalize the configuration of each data item, you can add a Component to each SerieData separately. For example, we give the second data of the line chart a separate display `Label`:
Serie components are added through the button on the right side of Serie. [What components can be added to Serie in XCharts?](https://xcharts-team.github.io/en/docs/configuration/#iseriecomponent-可添加到serie的组件)
:::
### Adding SerieData Components
If you need to customize the configuration of each data item individually, you can add components to each `SerieData` separately. For example, we can display `Label` for the second data of the line chart individually:
![op_addseriedatacomponent](img/tutorial01_addseriedatacomponent.png)
![linechart4](img/tutorial01_linechart4.png)
## More components and configuration parameters
:::tip
XCharts has been iteratively optimized and now has dozens of main and sub-components, each with a few to dozens of configurable parameters to support a variety of flexible and complex functions.
SerieData components are added through the button on the right side of SerieData after expanding. [What components can be added to SerieData in XCharts?](https://xcharts-team.github.io/en/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
Using XCharts for the first time, you can add various charts in the `Inspector` view, add or adjust the components in the chart, and the `Game` view gives real-time feedback on the effects of adjustments to familiarize yourself with the use of various components. Detailed parameter descriptions of each component can be found in the [XCharts Configuration](Configuration.md).
:::
## How to adjust parameters quickly
### More Components and Configuration Parameters
XCharts is configuration and data driven. Want what effect, only need to adjust the configuration parameters under the corresponding component can be, do not need to change the nodes under the `Hierarchy` view, because those nodes are generated by the `XCharts` internal according to the configuration and data, even if changed will be restored in the refresh.
XCharts has been continuously iterated and optimized, and now has dozens of main components and sub-components, each with several to dozens of configurable parameters to support a variety of functions.
How to quickly locate the component corresponding to the effect you want to change requires a certain understanding of the component. For example, if we want to show an arrow at the end of the X-axis, how do we position it? First, position the X-axis to `XAxis0`; Second, locate the axis to `AxisLine`; Finally, check to see if there are any parameters in the AxisLine component that can achieve this effect, and check [XCharts configuration](Configuration.md) for uncertain parameters.
When using XCharts for the first time, it is recommended to personally test the actual effects of each chart, each component. The `Inspector` view can directly add various charts, components, and adjust various configuration parameters, and the `Game` view will provide real-time feedback on the adjustments. A detailed description of each component's parameters can be found in the [XCharts Configuration Manual](configuration.md).
`XCharts` provides a full range of parameter configuration from the global` Theme `, series` Serie `, and single data item `SerieData`. The priority in descending order is: `SerieData` -> `Serie` -> `Theme`. Take the color of `ItemStyle` for example:
### How to Quickly Adjust Parameters
1. If the `ItemStyle` of `SerieData` has a color value other than `0000`, this color value is preferred.
2. If the ItemStyle of `Serie` is configured with a color value other than `0000`, this color value takes precedence.
3. Otherwise, the Color value is taken from the Color Palette of the Theme.
XCharts is driven by data and parameters. To achieve the desired effect, simply adjust the configuration parameters under the corresponding component. Do not modify the nodes under the `Hierarchy` view, as those nodes are generated by XCharts internally based on configuration and data, and will be restored upon refresh.
Usually, `0000` indicates the theme default color, and 0 or null indicates the theme default.
To quickly locate the component corresponding to the effect you want to change, you need to have a certain understanding of the components. For example, we want to display an arrow at the end of the X-axis line. How to locate it? The first step, the X-axis is located at `XAxis0`; the second step, the axis line is located at `AxisLine`; finally, check if there is such a parameter under the `AxisLine` component to achieve this effect. If you are not sure about the parameters, you can refer to the [XCharts Configuration Manual](configuration.md).
## Add line charts with code
`XCharts` provides comprehensive parameter configuration from the global `Theme`, series `Serie`, and individual data items `SerieData`. The priority order from high to low is: `SerieData`->`Serie`->`Theme`. Take the color of `ItemStyle` as
an example:
Attach the `LineChart` script to the gameObject:
1. If the `ItemStyle` of `SerieData` has a color value other than `0000`, this color value is used first.
2. If the `ItemStyle` of `Serie` has a color value other than `0000`, this color value is used.
3. Otherwise, the color value is taken from the `Color Palette` of the theme `Theme`.
```C#
:::tip
The color value is usually `0000` when using the default color of the theme; other parameters are `0` or null when using the default configuration of the theme; pay attention to transparency when setting colors.
:::
### Adding a Line Chart with Code
Attach the `LineChart` script to `gameObject`:
```csharp
var chart = gameObject.GetComponent<LineChart>();
if (chart == null)
{
@@ -108,22 +175,22 @@ if (chart == null)
}
```
Resize:
Adjust the size:
```C#
chart.SetSize(580, 300);//代码动态设置尺寸或直接操作chart.rectTransform或直接在Inspector上改
```csharp
chart.SetSize(580, 300);//Dynamically set the size with code, or directly operate chart.rectTransform, or directly change it in the Inspector
```
Set the title:
```C#
```csharp
var title = chart.EnsureChartComponent<Title>();
title.text = "Simple Line";
```
Set whether prompt boxes and legends are displayed:
Set whether to display the tooltip and legend:
```C#
```csharp
var tooltip = chart.EnsureChartComponent<Tooltip>();
tooltip.show = true;
@@ -131,9 +198,9 @@ var legend = chart.EnsureChartComponent<Legend>();
legend.show = false;
```
Set axes:
Set the coordinate axis:
```C#
```csharp
var xAxis = chart.EnsureChartComponent<XAxis>();
xAxis.splitNumber = 10;
xAxis.boundaryGap = true;
@@ -143,16 +210,24 @@ var yAxis = chart.EnsureChartComponent<YAxis>();
yAxis.type = Axis.AxisType.Value;
```
Clear default data and add `Line` type `Serie` for receiving data:
Clear all default data (including Series), add a `Line` type `Serie` to receive data:
```C#
```csharp
chart.RemoveData();
chart.AddSerie<Line>("line");
```
Add 10 data:
If the Serie is fixed, it is recommended to only clear the data, not to remove the Serie:
```C#
```csharp
chart.ClearData();
```
This way, you can set the configuration parameters of Serie in the UI in advance.
Add 10 data points:
```csharp
for (int i = 0; i < 10; i++)
{
chart.AddXAxisData("x" + i);
@@ -160,61 +235,88 @@ for (int i = 0; i < 10; i++)
}
```
So a simple line chart comes out:
Now, a simple line chart is ready:
![tutorial01_linechart_simple](img/tutorial01_linechart_simple.png)
If there are multiple series in a Chart, the data of Axis only needs to be added once, rather than repeated in multiple cycles. Remember: the number of data in Axis should be the same as the number in Serie.
If there are multiple series in a Chart, the data of Axis only needs to be added once, and should not be repeated in multiple loops.
See `Examples`: `Example13_LineSimple.cs` for the complete code
:::tip
You can also use code to control more parameters, there are more Examples under `Examples`, all the configurable parameters seen in the `Inspector` can be set by code. All parameters in [XCharts configuration](Configuration.md) can be controlled by code.
Remember: The number of Axis data should be consistent with the number of Serie data.
In addition, unless customized, it is recommended to call the `public` interface provided under `Chart`, especially in the data-related operations section. These interfaces do some associated processing inside, such as refreshing charts. Common interfaces are:
:::
1. `Chart.ClearData()` : Clear chart data (without removing Series)
2. `Chart.RemoveData()` : Clear chart data (will remove all Serie)
3. `chart.AddSerie()` : AddSerie
4. `chart.AddXAxisData()` : Add X-axis data
5. `chart.AddData()` : Adds Serie data
6. `chart.UpdateData()` : Updates Serie data
7. `chart.UpdateXAxisData()` : Updates the X-axis data
8. `chart.UpdateDataName()` : Updates the Serie data name
For the complete code, please refer to `Examples`: `Example13_LineSimple.cs`
XCharts has an automatic refresh mechanism inside, but it only triggers under certain conditions. If you call the interface of the internal component, encounter the component did not refresh, and indeed can not find the reason, you can use the following two interfaces to force refresh:
You can also control more parameters with code. There are more examples in `Examples`. All parameters that can be configured in the `Inspector` can be set with code. All parameters in the [XCharts Configuration Manual](configuration.md) can be controlled by code.
1. `chart.RefreshAllComponent()` : refresh chart component, to initialize all of the components, often is not recommended.
2. `chart.RefreshChart()` : refreshes the chart drawing, only the drawing part is refreshed, and the component text, position, etc., is not refreshed.
3. Individual components can also refresh only themselves by `SetAllDirty()`.
### Setting the Default Font
## Use TextMeshPro
The default font used by XCharts is Unity's default font `Arial`, which may not display Chinese characters on the WebGL platform. When using XCharts in your project, it is recommended to set the font first:
XCharts supports TextMeshPro, but it is disabled by default and needs to be switched manually. It can be turned on and off in the following ways:
- Find the `XCharts/Resources/XCSetting.asset` resource and modify the `Font` inside and save.
- Find the `XCharts/Resources/XCTheme-Default.asset` and `XCharts/Resources/XCTheme-Dark.asset` font configurations, and click the `Sync Font from Setting` and `Sync Font to Sub Theme` buttons to synchronize the font to the theme configuration files.
After the font is set, newly created charts will use the newly set font. For old charts, you can click the `Rebuild Chart Object` button to refresh.
:::tip
It is recommended to set the font before using XCharts; when updating XCharts, pay attention to the potential restoration of the set font.
:::
### Using TextMeshPro
XCharts supports TextMeshPro, but it is not enabled by default and needs to be switched on manually. It can be turned on and off in the following ways:
![textmeshpro1](img/tutorial01_textmeshpro.png)
After opening, you need to set the global font used by TextMeshPro, or you can set it separately in the Theme:
After turning it on, you need to set the global font to be used by TextMeshPro, and it can also be set individually in the Theme:
![textmeshpro-font](img/tutorial01_textmeshpro_font.png)
It is recommended to plan whether to use TextMeshPro at the beginning of the project and set the font. When switching TMP with many existing charts, some charts may not refresh automatically. You can manually click the `Rebuild Chart Object` button to rebuild the chart, which can be initialized normally.
It is recommended to plan whether to use TextMeshPro at the beginning of the project and set the font accordingly. When switching to TMP in a project with many charts, some charts may not refresh automatically, and you can manually click the `Rebuild Chart Object` button to rebuild the chart, which will initialize normally.
When updating XCharts for TMP projects, you may encounter problems with missing TMP references and failing to compile. These problems can be solved in one of two ways:
If you have enabled TMP in your project, you may encounter compilation failures due to lost TMP references when updating XCharts. This can be solved in the following two ways:
1. Find `XCharts.Runtime.asmdef` and `XCharts.Editor.asmdef` and manually add references to `TextMeshPro`
2. Remove the `dUI_TextMeshPro` macro for Scripting Define Symbols in PlayerSetting
1. Find `XCharts.Runtime.asmdef` and `XCharts.Editor.asmdef`, and manually add references to `TextMeshPro`.
2. Remove the `dUI_TextMeshPro` macro from the `Scripting Define Symbols` in `PlayerSetting`.
Version `3.8.0` after adding daemon[XCharts - Daemon](https://github.com/XCharts-Team/XCharts-Daemon), will be XCharts-Daemon import project, When updating XCharts, the daemon automatically refreshes the asmdef based on the locally enabled TMP to ensure proper compilation.
After the `3.8.0` version, the [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon) daemon was added. After importing XCharts-Daemon into the project, the daemon will automatically refresh the asmdef based on the local situation of the enabled TMP when updating XCharts, ensuring normal compilation.
## Change chart parameters with code
## XCharts Code Control
All parameters seen on Inspector can be modified with code, the key is to identify whether the parameters you want to change are on the component, on the Serie, or on the specific data item SerieData.
All parameters seen in the `Inspector` can be modified with code. The key is to locate the parameter you want to change, whether it is on the component, the Serie, or the specific data item SerieData.
### Change the parameters on the main component
In addition, unless customized, it is recommended to call the `public` interfaces provided under `Chart`, especially for data-related and list operations. These interfaces will do some associated processing internally, such as refreshing the chart. Common interfaces include:
You need to obtain the component first, and then modify the parameters in it:
1. `chart.ClearData()`: Clear chart data (does not remove Series)
2. `chart.RemoveData()`: Clear chart data (will remove all Series)
3. `chart.AddSerie()`: Add Serie
4. `chart.AddXAxisData()`: Add X-axis data
5. `chart.AddData()`: Add Serie data
6. `chart.UpdateData()`: Update Serie data
7. `chart.UpdateXAxisData()`: Update X-axis data
8. `chart.UpdateDataName()`: Update the name of Serie data
```C#
XCharts has an automatic refresh mechanism, but it is also triggered under certain conditions. If you have called the internal component interfaces and encountered components that have not been refreshed, and you cannot find the reason, you can use the following two interfaces to force a refresh:
1. `chart.RefreshAllComponent()`: Refresh chart components, which will re-initialize all components. It is not recommended to use it frequently.
2. `chart.RefreshChart()`: Refresh chart rendering, which only refreshes the rendering part and will not refresh component text, position, etc.
3. Each component can also refresh itself by calling `SetAllDirty()`.
:::tip
Use APIs to manipulate data and various lists, not directly access the list for processing.
:::
### Changing Parameters on Main Components
You need to obtain the component first, then modify its parameters:
```csharp
var title = chart.EnsureChartComponent<Title>();
title.text = "Simple LineChart";
title.subText = "normal line";
@@ -225,13 +327,17 @@ xAxis.boundaryGap = true;
xAxis.type = Axis.AxisType.Category;
```
> Note: When the earlier version does not have the EnsureChartComponent() interface, GetOrAddChartComponent() is used.
:::tip
### Change Serie parameters
In older versions without the `EnsureChartComponent()` interface, use `GetOrAddChartComponent()`
For newly added Serie:
:::
```C#
### Changing Serie Parameters
For newly added Series:
```csharp
var serie = chart.AddSerie<Pie>();
serie.center[0] = 0.5f;
serie.center[1] = 0.5f;
@@ -241,9 +347,9 @@ serie.animation.dataChangeEnable = true;
serie.roundCap = true;
```
For existing Serie:
For existing Series:
```C#
```csharp
var serie = chart.GetSerie<Pie>();
serie.center[0] = 0.5f;
serie.center[1] = 0.5f;
@@ -253,23 +359,23 @@ serie.animation.dataChangeEnable = true;
serie.roundCap = true;
```
Add additional components to Serie:
Adding additional components to Serie:
```C#
```csharp
serie.EnsureComponent<AreaStyle>();
var label = serie1.EnsureComponent<LabelStyle>();
label.offset = new Vector3(0,20,0);
```
### Change the parameter on the data item SerieData
### Changing Parameters on Data Item SerieData
```C#
```csharp
var serieData = chart.AddData(0, 20);
//var serieData = serie.GetSerieData(0); //从已有数据中获取
//var serieData = serie.GetSerieData(0); //To get from existing data
serieData.radius = 10;
var itemStyle = serieData.EnsureComponent<ItemStyle>(); //给数据项添加ItemStyle组件
var itemStyle = serieData.EnsureComponent<ItemStyle>(); //Add ItemStyle component to the data item
itemStyle.color = Color.blue;
```
```

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,18 @@ slug: /changelog
# 更新日志
[master](#master)
[v3.14.0](#v3140)
[v3.13.0](#v3130)
[v3.12.1](#v3121)
[v3.12.0](#v3120)
[v3.11.2](#v3112)
[v3.11.1](#v3111)
[v3.11.0](#v3110)
[v3.10.2](#v3102)
[v3.10.1](#v3101)
[v3.10.0](#v3100)
[v3.9.0](#v390)
[v3.8.1](#v381)
[v3.8.0](#v380)
[v3.7.0](#v370)
[v3.6.0](#v360)
@@ -68,6 +80,285 @@ slug: /changelog
## master
## v3.14.0
版本要点:
* 新增`Bar`的实时排序功能
* 新增`Tooltip``itemFormatter`支持`\n`换行
* 新增`AxisLabel`的格式化支持`{index}`
* 新增`Animation``speed`可指定动画速度
* 优化`Tooltip`的列对齐方式
日志详情:
* (2025.03.15) 发布`v3.14.0`版本
* (2025.03.09) 修复`Bar`在同一个`Chart`不同`Grid`里时绘制有些异常的问题
* (2025.03.07) 增加`Animation``speed`可指定动画速度
* (2025.03.06) 优化`Animation`的新增动画表现
* (2025.03.04) 修复`Treemap``label`显示异常的问题
* (2025.03.02) 增加`Tooltip``columnGapWidths`参数设置列文本间隙距离
* (2025.03.01) 优化`Comment`的组件刷新
* (2025.02.23) 增加`Axis``Label``formatter`支持`{index}``{index-1}``{-index}``{-index-1}`通配符
* (2025.02.23) 增加`Bar``realtimeSort`支持实时排序
* (2025.02.19) 增加`Tooltip``itemFormatter``\n`换行的支持
* (2025.02.18) 优化`Tooltip`的对齐方式
* (2025.02.09) 修复`SaveAsImage`保存图片时不支持透明度的问题 (#337)
* (2025.02.05) 增加`GraphChart`可单独设置`data`样式的支持
* (2025.02.05) 重构`SerieSymbol``sizeFunction`参数
* (2025.01.23) 修复`Treemap``Label`不显示的问题
* (2025.01.15) 修复`Chart`在运行时动态添加`Component`异常的问题 (#339)
* (2025.01.08) 修复`TextMeshPro`关闭时残留组件影响`Text`初始化的问题
## v3.13.0
版本要点:
* 新增`UIText`扩展组件
* 新增`UIToggle`扩展组件
* 新增`UISlider`扩展组件
* 重构`UIProgress`扩展组件
* 增加`SymbolStyle``borderWidth``emptyColor`配置
* 增加`SymbolStyle``size2`参数支持长方形标记
* 其他优化和问题修复
日志详情:
* (2025.01.01) 发布`v3.13.0`版本
* (2024.12.27) 增加`SymbolStyle``size2`参数支持长方形标记
* (2024.12.26) 优化`Text``TextMeshPro`下的居中对齐方式
* (2024.12.25) 增加`Tooltip``itemFormatter`设置`{f0}`支持
* (2024.12.25) 修复`YAxis`在范围变更刷新时部分label可能不显示的问题
* (2024.12.23) 增加`SymbolStyle``borderWidth``emptyColor`配置
* (2024.12.17) 增加`UISlider`扩展组件
* (2024.12.10) 增加`UIToggle`扩展组件
* (2024.12.09) 修复`UITable``scrollbar`无法拖动的问题
* (2024.12.07) 修复`Chart`节点下不能放自定义节点的问题
* (2024.12.05) 增加`UIText`扩展组件
* (2024.12.04) 删除`TextStyle`的无用配置项`tmpAlignment`
## v3.12.1
版本要点:
* 完善官网文档的中英文支持
* 优化折线图数据密集时的绘制效果
* 其他问题修复
日志详情:
* (2024.12.01) 发布`v3.12.1`版本
* (2024.11.30) 修复`Tooltip`在图表设置其他锚点时手机上显示位置异常的问题
* (2024.11.27) 修复`Unity6`的一些代码警告问题
* (2024.11.26) 修复`Tooltip`在特殊情况下可能会超出屏幕显示不完整的问题
* (2024.11.24) 修复`UITable`在拖拽时也会点选的问题
* (2024.11.22) 修复`Time`时间轴在开启`Animation`时动态变更效果异常的问题
* (2024.11.18) 优化`Line`在数据点过密时有更好的绘制效果
* (2024.11.16) 修复`Animation`无法通过代码开启的问题 (#334)
* (2024.11.13) 修复`DataZoom`的start和end在代码动态修改时图表不刷新的问题
* (2024.11.05) 修复`Title`设置隐藏后运行还显示的问题
* (2024.11.01) 完善`website`中英文文档
## v3.12.0
版本要点:
* 增加`Ring``radiusGradient`参数设置渐变方向
* 增加`numericFormatter``date``time`的支持
* 完善`AreaStyle``origin`参数设置区域填充起始位置
* 调整和完善文档
* 其他优化和修复
日志详情:
* (2024.09.30) 发布`v3.12.0`版本
* (2024.09.27) 完善`5分钟教程`
* (2024.09.24) 完善`Legend``formatter`对多Serie的支持 (#332)
* (2024.09.22) 调整`Documentation`文档显示样式
* (2024.09.09) 增加`numericFormatter``date``time`的支持
* (2024.09.03) 完善`AreaStyle``origin`参数设置区域填充起始位置
* (2024.09.01) 增加`Ring``radiusGradient`参数设置渐变方向
* (2024.09.01) 优化`Axis`为时间轴时首个Label的位置
## v3.11.2
* (2024.08.01) 发布`v3.11.2`版本
* (2024.07.29) 修复`Tooltip`在微信小游戏平台上报错的兼容问题 (#326)
* (2024.07.27) 调整`Axis``AxisName`的默认位置
* (2024.07.22) 优化`Pie``Label``Tooltip`触发时的表现
* (2024.07.21) 修复`Tooltip`在开启`DataZoom`时指示内容不准确的问题
* (2024.07.17) 修复`MarkLine``Label`在初始化时可能会闪烁的问题
* (2024.07.16) 优化`Axis``Time`时间轴时的`Tooltip`默认效果
* (2024.07.15) 优化`Axis``Time`时间轴时的分割效果
* (2024.07.14) 优化`Axis``Time`时间轴时的移动表现
* (2024.07.12) 优化`Label`的初始化显示效果
* (2024.07.06) 修复`Chart`在动态创建时背景没有自适应的问题 (#323)
## v3.11.1
* (2024.07.01) 发布`v3.11.1`版本
* (2024.07.01) 修复`Serie`有多个时颜色异常的问题
* (2024.06.23) 修复`Label`在初始化时会堆积的问题
## v3.11.0
版本要点:
* 增加`Line3DChart`3D折线图
* 增加`GraphChart`关系图
* 增加`3D`坐标系支持
* 增加`Tooltip``triggerOn`设置触发条件
* 其他问题修复和优化
日志详情:
* (2024.06.16) 发布`v3.11.0`版本
* (2024.06.15) 增加`Editor``Data`的添加、删除、上下移动操作按钮
* (2024.06.11) 修复`Axis``IndicatorLabel`可能会遮挡住`Tooltip`的问题
* (2024.06.11) 修复`Tooltip``Cross``Axis``IndicatorLabel`可能不显示的问题 (#315)
* (2024.06.10) 调整`Tooltip``Corss`重命名为`Cross`
* (2024.06.09) 增加`Axis``minCategorySpacing`设置类目轴默认的最小类目间距
* (2024.06.09) 修复`Tooltip``Cross``Axis`是类目轴并且开启`DataZoom`的情况下指示位置不准确的问题
* (2024.06.06) 修复`Serie``Clone`时动画异常问题 (#320)
* (2024.06.04) 修复`Serie``state`在代码动态设置时不刷新的问题
* (2024.05.29) 调整`XCharts``Hierarchy`视图下的右键菜单到`UI/XCharts`
* (2024.05.29) 增加`3D`坐标系对类目轴的支持
* (2024.05.19) 优化`Editor`下的编辑性能
* (2024.05.09) 增加`JsonUtil`工具类
* (2024.05.01) 修复`Tooltip`每帧产生GC的问题 (#311) (by @stefanbursuc)
* (2024.04.23) 修复`ConvertXYAxis()`多次调用后图表异常的问题
* (2024.04.22) 修复`DataZoom`控制多个轴时的`GridCoord`获取可能不正确的问题 (#317)
* (2024.04.22) 增加`3D`坐标系
* (2024.04.15) 优化`DateTimeUtil`时间戳转`DateTime`接口时区的问题
* (2024.04.15) 优化`GridCoord`在开启`GridLayout`时也显示`Left` `Right` `Top` `Bottom`参数 (#316)
* (2024.04.14) 修复`Tooltip``Cross`在开启`DataZoom`的情况下`label`位置不正确的问题 (#315)
* (2024.04.12) 修复`Candlesticks`效果不对的问题 (#313)
* (2024.03.20) 增加`Tooltip``triggerOn`设置触发条件
* (2024.03.19) 修复`Pie`在设置`ItemStyle``opacity`时颜色不对的问题 (#309)
## v3.10.2
* (2024.03.11) 发布`v3.10.2`版本
* (2024.03.11) 修复`Legend``formatter`在设置`{d}`通配符时显示可能不匹配的问题 (#304)
* (2024.03.11) 修复`Tooltip`移出坐标系后还显示的问题
* (2024.03.08) 修复`Tooltip``title`从旧版本升级后可能不显示的问题
## v3.10.1
* (2024.02.21) 发布`v3.10.1`版本
* (2024.02.19) 修复`Tooltip`的圆点标记不会自适应颜色的问题
## v3.10.0
版本要点:
* 增加双类目轴支持
* 增加更多细分快捷菜单创建图表,可一键创建几十种图表
* 增加图表边框设置,支持圆角图表
* 修复若干问题
扩展功能:
* 增加`SankeyChart`桑基图
* 增加`UITable`的边框设置
日志详情:
* (2024.02.01) 发布`v3.10.0`版本
* (2024.01.31) 修复`Tooltip`在设置`itemFormatter``-`后整个不显示的问题
* (2024.01.27) 修复`TextLimit`在开启`TextMeshPro`后无效的问题 (#301)
* (2024.01.24) 增加`Bar`支持X轴和Y轴都为`Category`类目轴
* (2024.01.23) 增加`{y}`通配符用于获取Y轴的类目名
* (2024.01.23) 增加`Line`支持X轴和Y轴都为`Category`类目轴
* (2024.01.18) 修复`Animation``type`代码动态修改无效的问题
* (2024.01.16) 增加`UIImage`图片组件
* (2024.01.16) 优化`Background`组件,可设置圆角和边框
* (2024.01.13) 增加`Chart`的更多快捷创建图表菜单
* (2024.01.09) 增加`Background``borderStyle`,给图表默认设置圆角
* (2024.01.07) 修复`Tooltop`的第一个`ContentLabelStyle`设置`color`无效的问题
* (2024.01.03) 增加`UITable``carouselStyle``hoverPause`
* (2024.01.02) 增加`UITable``scrollStyle``borderStyle`
* (2024.01.02) 增加`UITable``columnHeadStyle``opaque`
* (2024.01.01) 调整`UITable``border`边框相关设置,用`BorderStyle`代替
* (2024.01.01) 增加`BorderStyle`边框样式
* (2023.12.26) 增加`Heatmap``maxCache`参数支持
* (2023.12.25) 优化`Line`开启`clip`时绘制的顶点数
* (2023.12.22) 增加`UITable`的行边框
* (2023.12.22) 修复`Scatter`散点图部分边界数据不显示的问题
* (2023.12.21) 修复`TriggerTooltip()`接口在指定0或最大index时可能无法触发的问题
* (2023.12.19) 修复`Legend``LabelStyle`设置`formatter`后不生效的问题
* (2023.12.12) 增加`Legend``TextLimit`可限制图例显示文本的长度
* (2023.12.11) 修复`Serie`添加`double.MaxValue`时坐标绘制失败的问题
* (2023.12.10) 增加`Serie``minShowLabel`可隐藏小于指定值的`label`
* (2023.12.09) 增加`LevelStyle``depth`指定所属层次
* (2023.12.09) 增加`LevelStyle``LineStyle`设置线条样式
* (2023.12.09) 增加`Serie``Link`可用于桑基图添加节点边关系
* (2023.12.05) 增加`ResetChartStatus()`可主动重置图表状态
## v3.9.0
版本要点:
* 增加`Axis``Animation`,完善数据变更动画效果
* 增加`Axis`的对数轴子刻度的支持
* 增加`MarkLine``onTop`设置是否显示在最上层
* 完善代码注释和手册文档
* 修复若干问题
扩展功能:
* `UITable`增加轮播功能
* `UITable`增加数据操作接口和回调函数
* `Pie3DChart`优化绘制表现
日志详情:
* (2023.12.01) 发布`v3.9.0`版本
* (2023.12.01) 修复`Tooltip``titleFormatter`设置为`{b}`后显示不准确的问题
* (2023.11.30) 增加`SerieData`可单独添加`Label`的支持
* (2023.11.28) 修复`Tooltip`在对数轴时指示不准确的问题
* (2023.11.24) 修复`Chart``UpdateData()`接口返回值不准确的问题
* (2023.11.24) 修复`Axis`的更新数据时效果不顺畅的问题
* (2023.11.23) 增加`Axis``Animation`支持动画效果
* (2023.11.16) 取消`Legend``formatter`,用`LabelStyle`的代替
* (2023.11.14) 完善`LabelStyle``formatter`的注释和文档(#291)
* (2023.11.14) 增加`UITable``GetData()``GetContent()`接口
* (2023.11.12) 增加`UITable``onTableClick`点击表格回调
* (2023.11.11) 重构`UITable``SeparatorStyle`,可分开设置行列的分割线
* (2023.11.11) 修复`Documentation`部分注释生成文档不完整的问题 (#290)
* (2023.11.11) 修复`Legend``formatter`在数据变更时没有自动刷新的问题
* (2023.11.05) 增加`UITable``ColumnStyle`重构Column相关参数
* (2023.11.05) 增加`UITable``RowStyle`重构Row相关参数
* (2023.11.05) 修复`SerieEventData``value`一直是0的问题 (#287)
* (2023.11.03) 修复`Bar`设置渐变色时鼠标移出效果异常的问题 (#285)
* (2023.11.02) 优化`SerieData`设置`ignore``formatter`的忽略问题
* (2023.11.01) 增加`UITable``CarouselStyle`轮播功能
* (2023.11.01) 增加`UITable``AddColumn()``UpdateColumn()`接口
* (2023.11.01) 增加`MarkLine``onTop`设置是否显示在最上层
* (2023.10.23) 修复`UITable`点击`Rebuild Object`异常的问题
* (2023.10.23) 修复`UITable`尺寸变化时不刷新的问题
* (2023.10.21) 修复`Pie`有0数据时`Label`的位置异常的问题
* (2023.10.21) 增加`Axis`的对数轴支持子刻度
* (2023.10.19) 修复`Pie`设置玫瑰图时引导线异常的问题
* (2023.10.17) 修复`UITable`首次初始化异常的问题
* (2023.10.17) 增加`UITable`的数据操作接口
* (2023.10.17) 增加`UITable``RefreshTable()`刷新接口
* (2023.10.15) 修复`Line`设置`Animation``AlongPath`时动画异常的问题 (#281)
* (2023.10.12) 修复`MarkLine`指定`yValue`时对数值轴无效的问题
* (2023.10.11) 修复`Serie``showDataDimension`设置无效的问题
## v3.8.1
* (2023.10.02) 发布`v3.8.1`版本
* (2023.09.29) 修复`Bar`在水平方向时`Label`设置为`Bottom`不生效的问题
* (2023.09.22) 增加`Line`的平滑曲线对`Dash`虚线的支持
* (2023.09.16) 修复`Tooltip`在类目轴无数据时异常报错的问题 (#279)
* (2023.09.16) 修复`Pie`无数据时绘制异常的问题 (#278)
* (2023.09.12) 增加`Pie``radiusGradient`可设置半径方向的渐变效果
* (2023.09.05) 优化`LabelLine``lineEndX``Pie`中的表现
* (2023.09.05) 修复`TriggerTooltip()`接口对`Ring`无效的问题
* (2023.09.05) 修复`Radar`数据全为0时绘制报错的问题
## v3.8.0
版本要点:
@@ -96,7 +387,7 @@ slug: /changelog
* (2023.08.22) 修复`Bar`显示隐藏时绘制表现异常的问题
* (2023.08.22) 优化`Zebra`斑马柱图的绘制表现 (#276)
* (2023.08.16) 增加`Daemon`守护程序解决本地开启TMP后更新版本报错问题
* (2023.08.15) 修复`Data`数据在-1到1之间时坐标轴显示错误的问题 (#273) (by __Ambitroc__)
* (2023.08.15) 修复`Data`数据在-1到1之间时坐标轴显示错误的问题 (#273) (by @Ambitroc)
* (2023.08.14) 修复`XCharts`本地开启`TextMeshPro``NewInputSystem`后更新版本会报错的问题 (#272)
* (2023.08.12) 修复`Chart`在运行时被删除时会异常报错的问题 (#269)
* (2023.08.11) 修复`DataZoom`开启时可能会导致无法添加数据的问题
@@ -137,7 +428,7 @@ slug: /changelog
* (2023.06.08) 发布`v3.7.0`版本
* (2023.06.04) 增加`HelpDoc`帮助文档跳转
* (2023.05.30) 修复`Serie`的名字带`_`线导致`Legend`无法触发的问题 (#259) (by __svr2kos2__)
* (2023.05.30) 修复`Serie`的名字带`_`线导致`Legend`无法触发的问题 (#259) (by @svr2kos2)
* (2023.05.10) 增加`Axis``MinMaxAuto`范围类型
* (2023.05.10) 增加`Line``Clip`的支持
* (2023.05.04) 优化`Axis`在-1到1范围时设置`CeilRate`不生效的问题
@@ -156,9 +447,9 @@ slug: /changelog
版本要点:
* 增加`InputSystem`支持 (by __Bian-Sh__)
* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by __SHL-COOL__)
* 完善对`VR`的支持 (by __Ambitroc__)
* 增加`InputSystem`支持 (by @Bian-Sh)
* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by @SHL-COOL)
* 完善对`VR`的支持 (by @Ambitroc)
* 增加`UITable``UIStatistic`等[扩展UI组件](https://xcharts-team.github.io/docs/ui)
* 增加`ItemStyle``MarkColor`
* 增加通配符`{h}`的支持
@@ -174,9 +465,9 @@ slug: /changelog
* (2023.04.01) 发布`v3.6.0`版本
* (2023.03.14) 修复`Tooltip``titleFormater`设置`{b}`可能不生效的问题
* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by __Ambitroc__)
* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by @Ambitroc)
* (2023.03.12) 增加`LabelStyle``autoRotate`可设置有角度的竖版文本的自动旋转
* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by __Ambitroc__)
* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by @Ambitroc)
* (2023.03.09) 增加`Chart``onSerieClick``onSerieDown``onSerieEnter``onSerieExit`回调
* (2023.03.09) 修复`Pie`的点击选中偏移不生效的问题
* (2023.03.04) 增加`Legend``Positions`可自定义图例的位置
@@ -190,7 +481,7 @@ slug: /changelog
* (2023.02.02) 修复`DataZoom`开启时`X轴``Label`可能会显示在图表外的问题
* (2023.02.02) 优化`SerieData``ignore`设置时的忽略数据判断
* (2023.02.01) 修复`XChartsMgr.ContainsChart()`接口异常
* (2023.01.31) 增加`InputSystem`的支持 (#242) (by __Bian-Sh__)
* (2023.01.31) 增加`InputSystem`的支持 (#242) (by @Bian-Sh)
* (2023.01.11) 修复`Inspector`上移除`Component`后图表没有及时刷新的问题 (#241)
* (2023.01.06) 修复`Pie`在最后的几个数据都为0时`Label`显示不正常的问题 (#240)
* (2023.01.03) 删除`Serie``MarkColor`,增加`ItemStyle``MarkColor`

File diff suppressed because it is too large Load Diff

View File

@@ -5,167 +5,147 @@ slug: /faq
# 常见问题
[QA 1如何调整坐标轴与背景的边距](#如何调整坐标轴与背景的边距)
[QA 2如何让初始动画重新播放](#如何让初始动画重新播放)
[QA 3如何自定义折线图饼图的颜色](#如何自定义折线图饼图的颜色)
[QA 4如何给坐标轴上的文本加上单位](#如何给坐标轴上的文本加上单位)
[QA 5如何让柱形图的柱子堆叠显示](#如何让柱形图的柱子堆叠显示)
[QA 6如何让柱形图的柱子同柱但不重叠](#如何让柱形图的柱子同柱但不重叠)
[QA 7如何调整柱形图的柱子宽度和间距](#如何调整柱形图的柱子宽度和间距)
[QA 8如何调整柱形图单个柱子的颜色](#如何调整柱形图单个柱子的颜色)
[QA 9如何调整图表的对齐方式](#如何调整图表的对齐方式)
[QA 10可以显示超过1000以上的大数据吗](#可以显示超过1000以上的大数据吗)
[QA 11折线图可以画虚线、点线、点划线吗](#折线图可以画虚线点线点划线吗)
[QA 12如何限定Y轴的值范围](#如何限定Y轴的值范围)
[QA 13如何自定义数值轴刻度大小](#如何自定义数值轴刻度大小)
[QA 14如何在数据项顶上显示文本](#如何在数据项顶上显示文本)
[QA 15如何给数据项自定义图标](#如何给数据项自定义图标)
[QA 16锯齿太严重如何让图表更顺滑](#锯齿太严重如何让图表更顺滑)
[QA 17为什么鼠标移上图表 Tooltip 不显示?](#为什么鼠标移上图表Tooltip不显示)
[QA 18如何取消 Tooltip 的竖线?](#如何取消Tooltip的竖线)
[QA 19如何自定义 Tooltip 的显示内容?](#如何自定义Tooltip的显示内容)
[QA 20如何让Y轴显示多位小数](#如何让Y轴显示多位小数)
[QA 21如何用代码动态更新数据](#如何用代码动态更新数据)
[QA 22如何显示图例为什么有时候图例无法显示](#如何显示图例为什么有时候图例无法显示)
[QA 23如何做成预设](#如何做成预设)
[QA 24如何在图表上画点画线等自定义内容](#如何在图表上画点画线等自定义内容)
[QA 25如何实现心电图类似的数据移动效果](#如何实现心电图类似的数据移动效果)
[QA 26如何使用背景组件有什么条件限制](#如何使用背景组件有什么条件限制)
[QA 27Mesh can not have more than 65000 vertices?](#Mesh_cannot_have_more_than_65000_vertices)
[QA 28为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
[QA 29如何修改Serie的Symbol的颜色?](#如何修改Serie的Symbol的颜色)
[QA 30导入或更新XCharts时TMP报错如何处理?](#导入或更新XCharts时TMP报错怎么办)
[QA 31支持空数据吗如何实现折线图断开的效果?](#支持空数据吗如何实现折线图断开的效果)
## FAQ 1如何调整坐标轴与背景的边距
## 如何调整坐标轴与背景的边距
调整`Grid`组件,可调整上下左右边距
答:调整`Grid`组件,可调整上下左右边距。
## FAQ 2如何让初始动画重新播放
## 如何让初始动画重新播放
调用`chart.AnimationReset()`接口。
答:调用`chart.AnimationReset()`接口。
## FAQ 3如何自定义折线图饼图的颜色
## 如何自定义折线图饼图的颜色
通过`Theme``colorPalette`调整,或者部分`Serie`下的`LineStyle``ItemStyle`
答:通过`Theme``colorPalette`调整,或者部分`Serie`下的`LineStyle``ItemStyle`
## FAQ 4如何给坐标轴上的文本加上单位
## 如何给坐标轴上的文本加上单位
通过`formatter``numericFormatter`参数,在`Legend``Axis``AxisLabel``Tooltop``Serie``Label`都提供该参数的配置。
答:通过`formatter``numericFormatter`参数,在`Legend``Axis``AxisLabel``Tooltop``Serie``Label`都提供该参数的配置。
## FAQ 5如何让柱形图的柱子堆叠显示
## 如何让柱形图的柱子堆叠显示
设置`Serie`下的`stack``stack`相同的`serie`会堆叠显示在一个柱子上。
答:设置`Serie`下的`stack``stack`相同的`serie`会堆叠显示在一个柱子上。
## FAQ 6如何让柱形图的柱子同柱但不重叠
## 如何让柱形图的柱子同柱但不重叠
设置`Serie`下的`barGap``-1``stack`为空。
答:设置`Serie`下的`barGap``-1``stack`为空。
## FAQ 7如何调整柱形图的柱子宽度和间距
## 如何调整柱形图的柱子宽度和间距
调整`Serie`下的`barWidth``barGap`,多个`serie`时最后一个`serie``barWidth``barGap`有效。
答:调整`Serie`下的`barWidth``barGap`,多个`serie`时最后一个`serie``barWidth``barGap`有效。
## FAQ 8如何调整柱形图单个柱子的颜色
## 如何调整柱形图单个柱子的颜色
可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
答:可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
## FAQ 9如何调整图表的对齐方式
## 如何调整图表的对齐方式
调整RectTransform的锚点和UGUI的其他组件的用法一致。
调整RectTransform的锚点和UGUI的其他组件的用法一致。
## FAQ 10可以显示超过1000以上的大数据吗
## 可以显示超过1000以上的大数据吗
可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie``symbol``label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large``largeThreshold`参数来开启性能模式。
答:可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie``symbol``label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large``largeThreshold`参数来开启性能模式。
## FAQ 11折线图可以画虚线、点线、点划线吗
## 折线图可以画虚线点线点划线吗
可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
答:可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
## FAQ 12如何限定Y轴的值范围
## 如何限定Y轴的值范围
设置`Axis`下的`minMaxType``Custom`,自定义`min``max`
答:设置`Axis`下的`minMaxType``Custom`,自定义`min``max`
## FAQ 13如何自定义数值轴刻度大小
## 如何自定义数值轴刻度大小
默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小
答:默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
## FAQ 14如何在数据项顶上显示文本
## 如何在数据项顶上显示文本
通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
答:通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
## FAQ 15如何给数据项自定义图标
## 如何给数据项自定义图标
通过设置`Serie``data`下的数据项可单独设置`icon`相关参数。
答:通过设置`Serie``data`下的数据项可单独设置`icon`相关参数。
## FAQ 16锯齿太严重如何让图表更顺滑
## 锯齿太严重如何让图表更顺滑
开启抗锯齿设置(在`Unity`里设置。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
答:开启抗锯齿设置(在`Unity`里设置。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
## FAQ 17为什么鼠标移上图表Tooltip不显示
## 为什么鼠标移上图表Tooltip不显示
确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
答:确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
## FAQ 18如何取消Tooltip的竖线
## 如何取消Tooltip的竖线
设置`Tooltip``type``None`。或者调整`lineStyle`的参数。
答:设置`Tooltip``type``None`。或者调整`lineStyle`的参数。
## FAQ 19如何自定义Tooltip的显示内容
## 如何自定义Tooltip的显示内容
自定义总的内容可以通过`Tooltip``formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter``titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie``itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
答:自定义总的内容可以通过`Tooltip``formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter``titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie``itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
## FAQ 20如何让y轴显示多位小数
## 如何让Y轴显示多位小数
设置`Axis`下的`AxisLabel`中的`formatter``{value:f1}``{value:f2}``1.5.0`及以上版本通过`numericFormatter`设置。
答:设置`Axis`下的`AxisLabel`中的`formatter``{value:f1}``{value:f2}``1.5.0`及以上版本通过`numericFormatter`设置。
## FAQ 21如何用代码动态更新数据
## 如何用代码动态更新数据
请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能相关API请查看文档[XChartsAPI接口](api.md) 。
答:请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能相关API请查看文档[XChartsAPI接口](api.md) 。
## FAQ 22如何显示图例为什么有时候图例无法显示
## 如何显示图例为什么有时候图例无法显示
首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示图例`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示
答:首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
## FAQ 23如何做成预设
## 如何做成预设
做成prefab前执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
做成prefab前执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
## FAQ 24如何在图表上画点画线等自定义内容
## 如何在图表上画点画线等自定义内容
`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
答:`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
## FAQ 25如何实现心电图类似的数据移动效果
## 如何实现心电图类似的数据移动效果
参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis``serie`都设置相同的`maxCache``maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果
答:参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis``serie`都设置相同的`maxCache``maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
## FAQ 26如何使用背景组件有什么条件限制
## 如何使用背景组件有什么条件限制
设置`background`组件的`show``true`
答:设置`background`组件的`show``true`
## FAQ 27Mesh can not have more than 65000 vertices
## 区域折线图在用半透明颜色时有时候会一条叠加的线
这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[FAQ 10可以显示超过1000以上的大数据吗](#可以显示超过1000以上的大数据吗)
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
## FAQ 28为什么serie里设置的参数运行后又被重置了
## Mesh_cannot_have_more_than_65000_vertices
检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
答:这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[QA 10可以显示超过1000以上的大数据吗](#可以显示超过1000以上的大数据吗)
## FAQ 29如何修改serie的symbol的颜色
## 为什么serie里设置的参数运行后又被重置了
`Symbol` 的颜色是使用的 `ItemStyle``color`
答:检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
## FAQ 30导入或更新XCharts时TMP报错如何处理
## 如何修改Serie的Symbol的颜色
答:`Symbol` 的颜色是使用的 `ItemStyle``color`
## 导入或更新XCharts时TMP报错怎么办
XCharts默认时不开启TMP所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决
XCharts默认时不开启TMP所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式的任意一种解决
1. 找到`XCharts.Runtime.asmdef``XCharts.Editor.asmdef`,手动加上 `TextMeshPro`的引用
2. 移除`PlayerSetting``Scripting Define Symbols``dUI_TextMeshPro`
`3.8.0`版本后增加[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)守护程序将XCharts-Daemon导入项目后在更新XCharts时守护程序会自动根据本地开启的TMP情况刷新asmdef确保编译正常。
## 支持空数据吗如何实现折线图断开的效果
## FAQ 31支持空数据吗如何实现折线图断开的效果
答:`Serie``data``double`类型,所以无法表示空数据。可通过开启`Serie``ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
`Serie``data``double`类型,所以无法表示空数据。可通过开启`Serie``ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
## FAQ 322.x版本升级3.x版本时常见的问题有哪些
1. 出现:`'XCharts.Runtime.XChartsMgr' is missing the class attribute 'ExtensionOfNativeClass'!`的问题时是因为3.x版本时不需要挂载XChartsMgr直接删掉场景上的`_xcharts_`节点即可。
## FAQ 33折线图如何两边不留空白而从0坐标开始显示
设置X轴的`boundaryGap`参数。
## FAQ 34如何设置部分Serie不显示Tooltip
`serie``itemStyle``itemFormatter`设置为`-`可以忽略该`serie``tooltip`
## FAQ 35区域折线图在用半透明颜色时有时候会一条叠加的线
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 KiB

After

Width:  |  Height:  |  Size: 704 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 660 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

View File

@@ -6,91 +6,87 @@ slug: /support
# 订阅服务
如需技术支持和购买扩展图表,可订阅`VIP`服务。详情可查看以下内容,也可以加QQ`3525422251XCharts技术支持`或发邮件到`monitor1394@gmail.com`进行咨询
如需技术支持和扩展图表购买,可通过订阅 VIP 服务获取专属权益。企业商务合作请联系 QQ `3525422251` 或邮件至 `monitor1394@gmail.com`
企业商务合作可QQ和邮件咨询。
## 订阅计划
## 订阅VIP服务
### 订阅类型
订阅服务分`个人订阅``企业订阅`
- **个人订阅**
- 归属个人,不可转让,服务仅限订阅者本人使用。
- **企业订阅**
- 归属企业,席位可分配给指定员工,支持席位变更(如员工离职后重新分配)。
- 通过企业专属群组提供技术支持。
- __个人订阅__`个人VIP`属于个人,不可转让,`XCharts`团队只服务于订阅当事人。
- __企业订阅__`企业VIP`属于企业,席位内可安排固定职员,职员离职后席位可重新安排,`XCharts`团队通过专属企业群为企业服务。
### 订阅优势
订阅服务有哪些优势?
- **高效支持**:快速定位技术问题,节省开发时间。
- **深度交流**:与 XCharts 核心团队及开发者社区直接互动,获取行业经验。
- **扩展功能**:解锁高级图表和 UI 组件,持续获得更新支持。
- **社区共建**:加入 GitHub 组织,访问私有仓库,参与项目生态建设。
- **专属标识**:在交流群中享有 VIP 身份标识,优先响应需求。
- __提高工作效率节省时间成本__。`XCharts`功能强大,配置项众多,`VIP`服务可快速帮您定位,节省查找和核对的时间;`VIP`的即时回答服务可快速为您答疑解惑,快速上手,提高工作效率。
- __更多技术交流更多经验交流__。`XCharts`团队成员从业多年,有丰富的技术和工作经验。`VIP`服务不仅可以交流`XCharts`相关的内容,也可以咨询其他方面内容。`VIP`群也有更多的交流碰撞。
- __订阅扩展图表获得更新支持__。扩展图表需要订阅`VIP`服务后才能购买扩展图表超过1年后的更新支持也需要持续订阅`VIP`服务。
- __加入团队组织参与社区建设__。订阅`VIP`后可加入`GitHub`组织,参与社区建设,访问专有仓库,扩展图表仓库等其他私有仓库。
- __专属高级功能专属身份标识__。订阅`VIP`后可以享有扩展UI组件扩展图表等其他高级功能XCharts后续也会陆续推出更多高级功能。在`XCharts交流群`里拥有`专属头衔`方便快速识别优先响应第一时间回复VIP用户的各种问题。
## 服务详情
| |免费用户|付费咨询|个人`VIP` | 个人`SVIP` | 企业`VIP` | 企业`SVIP` |
| ----- |--|--|--|--|--|--|
| 订阅费用 | -- | `98`¥ | `298`¥ | 首年`1298`¥<br/>后续`298¥`* | 首年`1698`¥<br/>后续`298¥`* | `联系我们` |
| 订阅时长 | -- | `7`天* | `1`年 | `1`年 | `1`年 | `1` |
| 订阅席位 | -- | `1`个席位 | `1`个席位 |`1`个席位|`1`个席位|`5`个以上席位|
| 订阅条件 | -- | | Github帐号 | Github帐号 |Github帐号<br/>企业银行帐号|Github帐号<br/>企业银行帐号|
| __`服务方式:`__|
| 官方QQ群交流 | √ | √ | √ | √ | √ | √ |
| QQ一对一交流 | | √ | √ | √ | √ | √ |
| 专属VIP群交流 | | | √ | √ | √ | |
| 微信交流 | | | | | √ | √(企业专属群) |
| __`服务内容:`__|
| 可商用 | √ | √ | √ | √ | √ | √ |
| 可二次开发 | √ | √ | √ | √ | √ | √ |
| 有问即答 | | √ | √ | √ | √ | √ |
| 新手入门指导 | | √ | √ | √ | √ | √ |
| 开发优化指导 | | √ | √ | √ | √ | √ |
| 其他技术支持 | | | √ | √ | √ | √ |
| 问题及时处理 | | | √ | √ | √ | √ |
| 需求优先考虑 | | | √ | √ | √ | √ |
| 可另付费定制 | | | √ | √ | √ | √ |
| 可另付费加急 | | | √ | √ | √ | √ |
| 扩展UI组件 | | | √ | √ | √ | √ |
| 付费方式 | | | 二维码 | 二维码 | __对公转账__* | __对公转账__* |
| 支持开发票 | | | 普票 | 普票 | __专票__ | __专票__ |
| 扩展图表购买 | | | 按需购买 | __全部免费__* | __全部免费__* | __全部免费__* |
| 扩展图表源码 | | | 永久持有 | 永久持有 | 永久持有 | 永久持有 |
| 扩展图表更新 | | | 1年更新支持 | 1年更新支持 | 1年更新支持 | 1年更新支持 |
| 权益/服务 | 免费用户 | 个人 VIP | 个人 SVIP | 企业 VIP | 企业 SVIP |
|-------------------|----------|----------|-----------------|-----------------|----------------|
| **订阅费用** | — | 298¥/年 | 首年 1298¥<br/>续费 298¥/年 | 首年 1698¥<br/>续费 298¥/年 | 定制报价 |
| **服务时长** | — | 1 年 | 1 年 | 1 年 | 1 年 |
| **服务席位** | — | 1 个 | 1 个 | 1 个 | ≥5 个 |
| **增加席位** | — | — | — | 支持298¥/席位/年) | 支持(定制报价)|
| **支持方式** | | | | | |
| - Github Issues | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| - 官方 QQ 群 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| - QQ 一对一支持 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 专属 VIP 群 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 微信支持 | — | — | — | ✔️ | ✔️ |
| - 电话支持 | — | — | — | — | ✔️ |
| - 专属企业群 | — | — | — | — | ✔️ |
| **核心权益** | | | | | |
| - 商用与二次开发 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| - 即时技术支持 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 开发优化指导 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 需求优先处理 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 付费定制 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 扩展 UI 组件 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 扩展图表免费使用 | — | 按需购买 | ✔️(全量) | ✔️(全量) | ✔️(全量) |
| **企业专属权益** | | | | | |
| - 电子发票 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 专用发票 | | | — | ✔️ | ✔️ |
| - 首页赞助展示 | | — | — | — | ✔️ |
| **源码与更新** | | | | | |
| - 永久持有源码 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| - 1 年更新支持 | — | ✔️ | ✔️ | ✔️ | ✔️ |
| **GitHub 仓库权限**| 公开仓库 | +UI 扩展组件 | +Pro 扩展图表 | +Pro 扩展图表 | +Pro 扩展图表 |
>备注:
>*__`付费定制`__ 用户可根据自己的需求可付费定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
>*__`付费加急`__ 用户可对已在开发计划中或正在开发中的功能进行付费加急,将开发优先级提到最高,并可要求在指定`截止日期`内交付,只有`VIP`用户才享有`付费加急`权利。
>*__`付费咨询`__ 付费咨询有效期`7`天,且总咨询时长不超过`7`个小时。
>*__`扩展图表`__ 购买后代码可永久持有和商用1年的更新和技术支持。可继续订阅VIP延长服务时间。
>*__`全部免费`__ 是指在订阅期间的`个人SVIP``企业VIP`的订阅用户,可免费使用全部的扩展图表。
>*__`次年付费`__ 个人SVIP和企业VIP的首年和次年付费不一样次年付费都是`298¥`
>*__`对公转账`__ 有开专票需求时,可用企业银行帐号进行公对公转账支付。二维码支付不支持开专票,只能开普票。发票默认都是电子发票。
>*__`登记资料`__ 订阅成功后需提供手机号和Github帐号进行登记手机号用于确认归属Github帐号用于下载源码。
## 扩展图表
## 购买扩展图表
以下扩展图表需订阅 VIP 后购买个人SVIP 及企业 VIP 用户可免费使用全量图表):
扩展图表为另付费购买图表,只对订阅了`VIP`服务的用户开放购买。对于`个人SVIP``企业VIP`的订阅用户,所有扩展图表仓库在订阅期间可全部免费使用,不用再单独购买。
对所有已购买的扩展图表,源码可永久持有,并获得持续一年的更新支持和技术服务,一年后如需更新支持服务,可再继续订阅`VIP`服务。
|编号|扩展图表|扩展图表|价格|
|编号|扩展图表|图表类名|价格|
|--|--|--|--|
| 101 | [象形柱图](https://xcharts-team.github.io/docs/pictorialbar) |PictorialBarChart | 98¥ |
| 102 | [漏斗图](https://xcharts-team.github.io/docs/funnel) |FunnelChart | 98¥ |
| 103 | [3D金字塔](https://xcharts-team.github.io/docs/pyramid) |PyramidChart | 98¥ |
| 104 | [树形矩图](https://xcharts-team.github.io/docs/treemap) |TreemapChart | 98¥ |
| 105 | [桑基图](https://xcharts-team.github.io/docs/sankey) |SankeyChart | 98¥ |
| 201 | [3D柱图](https://xcharts-team.github.io/docs/bar3d) |Bar3DChart | 198¥ |
| 202 | [3D饼图](https://xcharts-team.github.io/docs/pie3d) |Pie3DChart | 198¥ |
| 203 | [甘特图](https://xcharts-team.github.io/docs/gantt) |GanttChart | 198¥ |
| 204 | [仪表盘](https://xcharts-team.github.io/docs/gauge) |GaugeChart | 198¥ |
| 205 | [水位图](https://xcharts-team.github.io/docs/liquid) |LiquidChart | 198¥ |
| 206 | [3D折线图](https://xcharts-team.github.io/docs/line3d) |Line3DChart | 198¥ |
| 207 | [关系图](https://xcharts-team.github.io/docs/graph) |GraphChart | 198¥ |
扩展图表的在线效果图也可以查看[WebGL在线Demo](https://xcharts-team.github.io/examples/)
## 附注说明
## 捐助支持
1. **扩展图表更新**:购买后享 1 年免费更新,续订 VIP 可延长服务周期。
2. **企业订阅**:支持公对公转账与专用发票,席位可灵活调整。
3. **定制服务**VIP 用户可额外付费定制功能或加急需求开发。
如果这个项目对您有帮助,请右上方点 `Star` 予以支持也欢迎扫后面的二维码进行任意金额的捐助XCharts需要您的支持和帮助。
## 支持我们
## 二维码
如果看不到二维码图片可以加Q联系`XCharts技术支持:3525422251`或邮件`monitor1394@gmail.com`咨询。
![alipay-qrcode](img/support_alipay.png)
![wechat-qrcode](img/support_wechat.png)
- **社区支持**:欢迎在 GitHub 为 XCharts 点 ⭐️ [Star 支持](https://github.com/XCharts-Team/XCharts)
- **扫码捐助**
![微信支付](img/support_wechat.png)
![支付宝](img/support_alipay.png)

View File

@@ -6,84 +6,146 @@ slug: /tutorial01
# 教程5分钟上手 XCharts 3.0
> 本教程适用XCharts 3.x版本2.x版本请看 [教程5分钟上手XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/教程5分钟上手XCharts.md)
:::warning
## 使用 XCharts 前需要掌握什么
Note本教程仅适用XCharts 3.x版本2.x版本请看 [教程5分钟上手XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/教程5分钟上手XCharts.md)
- 会简单使用Unity
- 了解UGUI会使用UGUI
- 了解Unity的MonoBehavior脚本用法知道怎么挂脚本用代码操作脚本
:::
## 获取和导入 XCharts
## XCharts的前提条件
XCharts可通过以下任意一种方式导入到项目:
XCharts是一个Unity图表插件目前只能在Unity平台使用。
- 直接将XCharts源码到项目
使用XCharts前,你需要:
下载好XCharts源码后直接将XCharts目录拷贝到Unity项目工程的Assets目录下
- 掌握Unity的基本用法
- 掌握UGUI制作UI的基本用法。
- 了解Unity的MonoBehavior脚本用法知道怎么挂脚本和用代码操作脚本。
- 通过`Assets/Import Package`导入XCharts
如果你刚接触Unity建议先学习Unity相关的基础教程再使用XCharts
下载好XCharts的.unitypackage文件后打开Unity菜单栏 Assets-->Import Package-->选中.unitypackage导入即可开始使用XCharts。
## XCharts的获取和导入
- 通过`Package Manager`导入XCharts
XCharts主要通过Github来维护更新和发布可以到[【Github主页】](https://github.com/XCharts-Team)进行下载获取源码和Pacakge对于无Github访问条件的用户可以访问[【国内镜像】](https://gitee.com/monitor1394/unity-ugui-XCharts)进行下载。国内镜像的版本更新可能会相对滞后。
对于Unity 2018.3以上版本,可通过 Package Manager来导入XCharts打开Package Manager后通过 `Add package form git URL...`输入XCharts3.0的GitHub URL: `https://github.com/XCharts-Team/XCharts.git#3.0` 稍等片刻后即可使用XCharts。
XCharts可通过以下任意一种方式导入到你的项目
也可以直接将package加入到`manifest.json`文件:打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
### 直接将XCharts源码拷贝到项目
``` json
"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git#3.0",
```
下载好XCharts源码后直接将XCharts目录拷贝到Unity项目工程的Assets目录下。编译通过后即可使用。
如需更新`XCharts`,删除`manifest.json`文件部分Unity版本可能是packages-lock.json文件的`lock`下的`com.monitor1394.xcharts`相关内容即会重新下载编译。
### 通过Import Package导入XCharts
- 建议先导入XCharts的守护程序非必须
下载好XCharts的.unitypackage文件后打开Unity菜单栏 Assets-->Import Package-->选中下载好的.unitypackage进行导入。导入完成并通过编译后即可开始使用XCharts。
守护程序[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)可以确保更新时编译正常当本地开启TextMeshPro或NewInputSystem时将会非常有用。将XCharts-Daemon导入项目后在更新XCharts时守护程序会自动根据本地TMP等的开启情况刷新asmdef确保编译正常不用手动去解决方便CI-CD等自动化流程执行。
### 通过Package Manager导入XCharts
## 添加一个简单图表
对于2018.3以上的Unity版本可通过Package Manager来导入XCharts打开Package Manager后通过 `Add package form git URL...`输入XCharts的GitHub URL: `https://github.com/XCharts-Team/XCharts.git` 编译通过后即可使用XCharts。
在`Hierarchy`视图下右键或菜单栏`GameObject`下拉选择`XCharts->LineChart`,即可快速创建一个默认的折线图出来
对于部分Unity版本也可以直接将package加入到`manifest.json`文件:打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入
>"com.monitor1394.xcharts": "https://github.com/XCharts-Team/XCharts.git",
如需更新`XCharts`,删除`manifest.json`文件部分Unity版本可能是packages-lock.json文件`lock`下的`com.monitor1394.xcharts`相关内容即会重新下载编译。
### 建议导入XCharts的守护程序
守护程序[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)可以确保更新时编译正常当本地开启TextMeshPro或NewInputSystem时将会非常有用。将XCharts-Daemon导入项目后在更新XCharts时守护程序会自动根据本地TMP等的开启情况刷新XCharts的asmdef确保编译正常不用手动去解决方便CI/CD等自动化流程执行。
XCharts-Daemon的导入方式可参考刚才的XCharts导入方式。可以通过源码或Package的方式导入项目XCharts-Daemon的Github URLhttps://github.com/XCharts-Team/XCharts-Daemon.git
## XCharts的基本使用
导入XCharts并编译通过后Unity编辑器的菜单栏会显示XCharts这时可以开始使用XCharts了。
:::tip
Unity的菜单栏出现XCharts菜单时才表示XCharts可用。
:::
### 添加一个简单图表
`Hierarchy`视图下右键`UI->XCharts->LineChart`或菜单栏`XCharts`下拉选择`LineChart`,即可快速创建一个默认的折线图:
![linechart1](img/tutorial01_linechart1.png)
## 添加多个Seire
如需在某个节点下创建图表,可以选中节点右键`UI->XCharts->LineChart`即可在节点下创建图表。
### 修改图表数据
刚创建的图表它的数据可以在Inspector视图面板上进行修改。
对于X轴数据可通过`XAxis->Data`展开后进行增删和修改:
![op_axisdata](img/tutorial01_axisdata.png)
对于Serie数据可通过`Serie->Data`展开后进行增删和修改:
![op_seriedata](img/tutorial01_seriedata.png)
Serie支持多维数据一般折线图只用到二维数据第一维表示X轴类目数据的编号第二维表示对应的数值。
### 添加多个Seire
`Inspector`视图,找到`LineChart`的面板,通过`Add Serie`按钮,可以添加第二条`Line`折线:
![op_addserie](img/tutorial01_addserie.png)
![linechart2](img/tutorial01_linechart2.png)
## 添加其他组件
:::tip
Serie通过`Add Serie`按钮添加。可添加不同类型的Serie。[XCharts有哪些Serie](https://xcharts-team.github.io/docs/configuration#serie-系列)
:::
### 添加其他主组件
默认图表没有`Legend`,需要`Legend`组件可通过`Add Component`按钮添加:
![op_addcomponent](img/tutorial01_addcomponent.png)
## 添加Serie组件
:::tip
Serie只自带了几个常见的组件其他组件按需额外添加。比如需要给折线图区域填充颜色可单独给`Serie`添加`AreaStyle`组件:
主组件通过`Add Component`按钮添加。[XCharts有哪些主组件](https://xcharts-team.github.io/docs/configuration/#maincomponent-主组件)
:::
### 添加Serie组件
Serie只自带了几个常见的组件其他组件用到时需额外添加。比如需要给折线图进行区域填充颜色可单独给`Serie`添加`AreaStyle`组件:
![op_addseriecomponent](img/tutorial01_addseriecomponent.png)
![linechart3](img/tutorial01_linechart3.png)
## 添加SerieData组件
:::tip
如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加`Component`。比如我们给折线图的第二个数据单独显示`Label`
Serie组件通过Serie右边的按钮添加。[XCharts有哪些Serie组件](https://xcharts-team.github.io/docs/configuration/#iseriecomponent-可添加到serie的组件)
:::
### 添加SerieData组件
如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加组件。比如我们给折线图的第二个数据单独显示`Label`
![op_addseriedatacomponent](img/tutorial01_addseriedatacomponent.png)
![linechart4](img/tutorial01_linechart4.png)
## 更多组件和配置参数
:::tip
XCharts经过不断的迭代优化目前已有多达几十种的主组件和子组件每个组件有几个至几十个不等的可配置参数以支持各种灵活而复杂的功能。
SerieData组件通过展开SerieData后Component右边的按钮添加。[XCharts有哪些SerieData组件](https://xcharts-team.github.io/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
首次使用XCharts可在 `Inspector` 视图添加各种图表,给图表添加或调整里面组件,`Game` 视图会实时反馈调整后的效果,以熟悉各种组件的使用。各个组件的详细参数说明可查阅[XCharts配置项手册](configuration.md)。
:::
## 如何快速调整参数
### 更多组件和配置参数
`XCharts`是配置和数据来驱动的。想要什么效果,只需要去调整对应组件下的配置参数就可以,不需要去改`Hierarchy`视图下的节点,因为那些节点是由`XCharts`内部根据配置和数据生成的,即使改了也会在刷新时还原回来
XCharts经过不断的迭代优化,目前已有多达几十种的主组件和子组件,每个组件有几个到几十个的可配置参数,用来支持多样化的功能
首次使用XCharts建议亲自去测试下各个图表各个组件的实际效果。`Inspector` 视图可以直接添加各种图表,各种组件以及调整各个配置参数,`Game` 视图会实时反馈调整后的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](configuration.md)。
### 如何快速调整参数
XCharts是数据和参数驱动的。想要什么效果只需要去调整对应组件下的配置参数就可以不能去改`Hierarchy`视图下的节点因为那些节点是由XCharts内部根据配置和数据生成的即使改了也会在刷新时被还原掉。
如何快速定位你想要改的效果所对应的组件这就需要对组件有一定的了解。比如我们想要让X轴的轴线末端显示箭头如何定位第一步X轴定位到`XAxis0`;第二步,轴线定位到`AxisLine`;最后,再去看`AxisLine`组件下有没有这样的参数可以实现这个效果,对于不太确定的参数可以查阅[XCharts配置项手册](configuration.md)。
@@ -93,13 +155,17 @@ XCharts经过不断的迭代优化目前已有多达几十种的主组件和
2. 如果`Serie``ItemStyle`配置有非`0000`颜色值,则优先用这个颜色值。
3. 否则颜色值取自主题`Theme``Color Palette`
通常颜色值为0000时表示用主题默认颜色配置为0或null时表示用主题默认配置。
:::tip
## 用代码添加折线图
通常颜色值为0000时表示用主题默认颜色其他参数为0或null时表示用主题默认配置设置颜色时注意透明度。
:::
### 用代码添加折线图
`gameObject`挂上`LineChart`脚本:
```C#
```csharp
var chart = gameObject.GetComponent<LineChart>();
if (chart == null)
{
@@ -110,20 +176,20 @@ if (chart == null)
调整大小:
```C#
```csharp
chart.SetSize(580, 300);//代码动态设置尺寸或直接操作chart.rectTransform或直接在Inspector上改
```
设置标题:
```C#
```csharp
var title = chart.EnsureChartComponent<Title>();
title.text = "Simple Line";
```
设置提示框和图例是否显示:
```C#
```csharp
var tooltip = chart.EnsureChartComponent<Tooltip>();
tooltip.show = true;
@@ -133,7 +199,7 @@ legend.show = false;
设置坐标轴:
```C#
```csharp
var xAxis = chart.EnsureChartComponent<XAxis>();
xAxis.splitNumber = 10;
xAxis.boundaryGap = true;
@@ -143,16 +209,24 @@ var yAxis = chart.EnsureChartComponent<YAxis>();
yAxis.type = Axis.AxisType.Value;
```
清空默认数据,添加`Line`类型的`Serie`用于接收数据:
清空所有默认数据包含Serie,添加`Line`类型的`Serie`用于接收数据:
```C#
```csharp
chart.RemoveData();
chart.AddSerie<Line>("line");
```
如果Serie是固定的建议只是清空数据不用把Serie也清掉
```csharp
chart.ClearData();
```
这样可以提前在UI上设置好Serie的配置参数。
添加10个数据
```C#
```csharp
for (int i = 0; i < 10; i++)
{
chart.AddXAxisData("x" + i);
@@ -164,30 +238,34 @@ for (int i = 0; i < 10; i++)
![tutorial01_linechart_simple](img/tutorial01_linechart_simple.png)
如果一个Chart里面有多个系列时则Axis的data只需要加一次不要多个循环加重复了。记住Axis的数据个数要和Serie的数据个数一致。
如果一个Chart里面有多个系列时则Axis的data只需要加一次不要多个循环加重复了。
:::danger
请确保Axis的数据个数和Serie的数据个数一致。
:::
完整代码请查阅`Examples``Example13_LineSimple.cs`
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](configuration.md)里面的所有参数都是可以通过代码控制的。
另外,除非定制,建议调用`Chart`下提供的`public`接口,特别是数据相关操作部分。这些接口内部会做一些关联处理,比如刷新图表等。常见的接口有:
### 设置默认字体
1. `chart.ClearData()`清空图表数据不移除Series
2. `chart.RemoveData()`清除图表数据会移除所有Serie
3. `chart.AddSerie()`添加Serie
4. `chart.AddXAxisData()`添加X轴数据
5. `chart.AddData()`添加Serie数据
6. `chart.UpdateData()`更新Serie数据
7. `chart.UpdateXAxisData()`更新X轴数据
8. `chart.UpdateDataName()`更新Serie数据的名字
XCharts默认使用的是Unity默认字体`Arial`在WebGL平台上可能无法显示中文。在将XCharts用在你的项目时建议先设置好字体
XCharts内部有自动刷新机制但也是在一定条件才会触发。如果自己调用了内部组件的接口碰到组件没有刷新确实找不到原因的话可以用以下两个接口强制刷新
- 找到`XCharts/Resources/XCSetting.asset`资源,修改里面的`Font`并保存。
- 找到`XCharts/Resources/XCTheme-Default.asset``XCharts/Resources/XCTheme-Default.asset`两个字体配置,点击`Sync Font from Setting``Sync Font to Sub Theme`按钮将字体同步到主题配置文件上。
1. `chart.RefreshAllComponent()`:刷新图表组件,会重新初始化所有组件,不建议频繁待用
2. `chart.RefreshChart()`:刷新图表绘制,只刷新绘制部分,不会刷新组件文本,位置等部分。
3. 各个组件也可以通过`SetAllDirty()`只刷新自己。
字体设置好后,新创建的图表就会用新设置的字体了。对于旧图表,可以点击`Rebuild Chart Object`进行刷新
## 使用TextMeshPro
:::warning
使用XCharts前建议先设置好字体更新XCharts时注意设置的字体可能被还原的问题。
:::
### 使用TextMeshPro
XCharts支持TextMeshPro但默认是不开启的需要自己手动切换。可通过以下方式开启和关闭
@@ -206,15 +284,38 @@ XCharts支持TextMeshPro但默认是不开启的需要自己手动切换
`3.8.0`版本后增加[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)守护程序将XCharts-Daemon导入项目后在更新XCharts时守护程序会自动根据本地开启的TMP情况刷新asmdef确保编译正常。
## 用代码改图表参数
## XCharts的代码控制
`Inspector`上看到的所有参数都可以用代码来修改关键是要定位好你要改的参数是在组件上、还是Serie上、还是在具体的数据项SerieData上。
另外,除非定制,建议调用`Chart`下提供的`public`接口,特别是数据相关和列表的操作。这些接口内部会做一些关联处理,比如刷新图表等。常见的接口有:
1. `chart.ClearData()`清空图表数据不移除Series
2. `chart.RemoveData()`清除图表数据会移除所有Serie
3. `chart.AddSerie()`添加Serie
4. `chart.AddXAxisData()`添加X轴数据
5. `chart.AddData()`添加Serie数据
6. `chart.UpdateData()`更新Serie数据
7. `chart.UpdateXAxisData()`更新X轴数据
8. `chart.UpdateDataName()`更新Serie数据的名字
XCharts内部有自动刷新机制但也是在一定条件才会触发。如果自己调用了内部组件的接口碰到组件没有刷新确实找不到原因的话可以用以下两个接口强制刷新
1. `chart.RefreshAllComponent()`:刷新图表组件,会重新初始化所有组件,不建议频繁待用。
2. `chart.RefreshChart()`:刷新图表绘制,只刷新绘制部分,不会刷新组件文本,位置等部分。
3. 各个组件也可以通过`SetAllDirty()`只刷新自己。
:::danger
用API去操作数据和各种list而不是直接访问list进行处理
:::
### 改主组件上的参数
需要先获取组件,再修改里面的参数:
```C#
```csharp
var title = chart.EnsureChartComponent<Title>();
title.text = "Simple LineChart";
title.subText = "normal line";
@@ -225,13 +326,17 @@ xAxis.boundaryGap = true;
xAxis.type = Axis.AxisType.Category;
```
> 注:低版本没有`EnsureChartComponent()`接口时,用`GetOrAddChartComponent()`
:::note
低版本没有`EnsureChartComponent()`接口时,用`GetOrAddChartComponent()`
:::
### 改Serie的参数
对于新添加的Serie
```C#
```csharp
var serie = chart.AddSerie<Pie>();
serie.center[0] = 0.5f;
serie.center[1] = 0.5f;
@@ -243,7 +348,7 @@ serie.roundCap = true;
对于已存在的Serie
```C#
```csharp
var serie = chart.GetSerie<Pie>();
serie.center[0] = 0.5f;
serie.center[1] = 0.5f;
@@ -255,7 +360,7 @@ serie.roundCap = true;
给Serie添加额外组件
```C#
```csharp
serie.EnsureComponent<AreaStyle>();
var label = serie1.EnsureComponent<LabelStyle>();
@@ -264,7 +369,7 @@ label.offset = new Vector3(0,20,0);
### 改数据项SerieData上的参数
```C#
```csharp
var serieData = chart.AddData(0, 20);
//var serieData = serie.GetSerieData(0); //从已有数据中获取
serieData.radius = 10;

View File

@@ -15,6 +15,7 @@ namespace XCharts.Editor
++EditorGUI.indentLevel;
PropertyField(prop, "m_Delay");
PropertyField(prop, "m_Duration");
PropertyField(prop, "m_Speed");
--EditorGUI.indentLevel;
}
}
@@ -30,6 +31,7 @@ namespace XCharts.Editor
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Duration");
PropertyField(prop, "m_Speed");
--EditorGUI.indentLevel;
}
}
@@ -45,6 +47,7 @@ namespace XCharts.Editor
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Duration");
PropertyField(prop, "m_Speed");
--EditorGUI.indentLevel;
}
}

View File

@@ -0,0 +1,28 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Background), true)]
public class BackgroundDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Background"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_ImageColor");
PropertyField(prop, "m_ImageWidth");
PropertyField(prop, "m_ImageHeight");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_BorderStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fe10ee35a038646b6aedfffb30f84024
guid: 88c83fad35bc544cab4106096d171189
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,25 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(BorderStyle), true)]
public class BorderStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Border"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_RoundedCorner");
PropertyListField(prop, "m_CornerRadius", true);
--EditorGUI.indentLevel;
}
}
}
}

View File

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

View File

@@ -27,11 +27,16 @@ namespace XCharts.Editor
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
++EditorGUI.indentLevel;
PropertyField(prop, "m_Label");
PropertyField(prop, "m_UpperLabel");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
if (MakeComponentFoldout(prop, "m_Depth", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Depth");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_UpperLabel");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -46,6 +46,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_ShowStartLine");
PropertyField(prop, "m_ShowEndLine");
PropertyField(prop, "m_ShowZLine");
}
}

View File

@@ -21,6 +21,9 @@ namespace XCharts.Editor
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Length");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_DashLength");
PropertyField(prop, "m_DotLength");
PropertyField(prop, "m_GapLength");
--EditorGUI.indentLevel;
}
}

View File

@@ -27,7 +27,10 @@ namespace XCharts.Editor
}
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Size");
PropertyField(prop, "m_Size2");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_EmptyColor");
PropertyField(prop, "m_Offset");
--EditorGUI.indentLevel;
}

View File

@@ -27,14 +27,13 @@ namespace XCharts.Editor
PropertyField(prop, "m_Color");
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_LineSpacing");
PropertyField(prop, "m_Alignment");
PropertyField(prop, "m_AutoAlign");
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFontStyle");
PropertyField(prop, "m_TMPSpriteAsset");
PropertyField(prop, "m_TMPAlignment");
#else
PropertyField(prop, "m_FontStyle");
PropertyField(prop, "m_Alignment");
PropertyField(prop, "m_AutoAlign");
PropertyField(prop, "m_AutoWrap");
#endif
--EditorGUI.indentLevel;

View File

@@ -0,0 +1,23 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ViewControl), true)]
public class ViewControlDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ViewControl"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Alpha");
PropertyField(prop, "m_Beta");
--EditorGUI.indentLevel;
}
}
}
}

View File

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

View File

@@ -12,7 +12,7 @@ namespace XCharts.Editor
var m_Type = baseProperty.FindPropertyRelative("m_Type");
var m_LogBase = baseProperty.FindPropertyRelative("m_LogBase");
var m_MinMaxType = baseProperty.FindPropertyRelative("m_MinMaxType");
var type = (Axis.AxisType) m_Type.enumValueIndex;
var type = (Axis.AxisType)m_Type.enumValueIndex;
EditorGUI.indentLevel++;
if (component is ParallelAxis)
{
@@ -40,7 +40,7 @@ namespace XCharts.Editor
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
{
PropertyField("m_MinMaxType");
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType) m_MinMaxType.enumValueIndex;
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
switch (minMaxType)
{
case Axis.AxisMinMaxType.Default:
@@ -63,8 +63,8 @@ namespace XCharts.Editor
PropertyField("m_SplitNumber");
if (type == Axis.AxisType.Category)
{
//PropertyField("m_InsertDataToHead");
PropertyField("m_MaxCache");
PropertyField("m_MinCategorySpacing");
PropertyField("m_BoundaryGap");
}
else
@@ -72,6 +72,10 @@ namespace XCharts.Editor
PropertyField("m_Interval");
}
DrawExtendeds();
if (type != Axis.AxisType.Category)
{
PropertyField("m_Animation");
}
PropertyField("m_AxisLine");
PropertyField("m_AxisName");
PropertyField("m_AxisTick");
@@ -89,7 +93,7 @@ namespace XCharts.Editor
{
PropertyListField("m_Data", true, new HeaderMenuInfo("Import ECharts Axis Data", () =>
{
PraseExternalDataEditor.UpdateData(chart, null, component as Axis);
PraseExternalDataEditor.UpdateData(chart, null, component as Axis, false);
PraseExternalDataEditor.ShowWindow();
}));
}
@@ -103,6 +107,15 @@ namespace XCharts.Editor
[ComponentEditor(typeof(YAxis))]
public class YAxisEditor : AxisEditor { }
[ComponentEditor(typeof(XAxis3D))]
public class XAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(YAxis3D))]
public class YAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(ZAxis3D))]
public class ZAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(SingleAxis))]
public class SingleAxisEditor : AxisEditor
{
@@ -204,4 +217,21 @@ namespace XCharts.Editor
}
}
}
[CustomPropertyDrawer(typeof(AxisAnimation), true)]
public class AxisAnimationDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Animation"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_UnscaledTime");
PropertyField(prop, "m_Duration");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -14,6 +14,7 @@ namespace XCharts.Editor
PropertyField("m_ImageType");
PropertyField("m_ImageColor");
PropertyField("m_AutoColor");
PropertyField("m_BorderStyle");
--EditorGUI.indentLevel;
}
}

View File

@@ -0,0 +1,112 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Assertions;
using XCharts.Runtime;
namespace XCharts.Editor
{
public class BaseGraphEditor : UnityEditor.Editor
{
class Styles
{
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", "");
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
}
public BaseGraph m_BaseGraph;
public static T AddUIComponent<T>(string chartName) where T : BaseGraph
{
return XChartsEditor.AddGraph<T>(chartName);
}
protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>();
protected virtual void OnEnable()
{
m_Properties.Clear();
m_BaseGraph = (BaseGraph)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
PropertyField("m_Script");
OnStartInspectorGUI();
OnDebugInspectorGUI();
serializedObject.ApplyModifiedProperties();
}
protected virtual void OnStartInspectorGUI() { }
protected virtual void OnDebugInspectorGUI()
{
EditorGUILayout.Space();
OnDebugStartInspectorGUI();
OnDebugEndInspectorGUI();
}
protected virtual void OnDebugStartInspectorGUI() { }
protected virtual void OnDebugEndInspectorGUI() { }
protected void PropertyField(string name)
{
if (!m_Properties.ContainsKey(name))
{
var prop = serializedObject.FindProperty(name);
if (prop == null)
{
Debug.LogError("Property " + name + " not found!");
return;
}
m_Properties.Add(name, prop);
}
EditorGUILayout.PropertyField(m_Properties[name]);
}
protected void PropertyField(SerializedProperty property)
{
Assert.IsNotNull(property);
var title = ChartEditorHelper.GetContent(property.displayName);
PropertyField(property, title);
}
protected void PropertyField(SerializedProperty property, GUIContent title)
{
EditorGUILayout.PropertyField(property, title);
}
protected void PropertyListField(string relativePropName, bool showOrder = true, params HeaderMenuInfo[] menus)
{
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
var height = 0f;
var prop = FindProperty(relativePropName);
prop.isExpanded = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
prop, prop.isExpanded, showOrder, true, menus);
if (prop.isExpanded)
{
GUILayoutUtility.GetRect(1f, height - 17);
}
}
protected void PropertyTwoFiled(string relativePropName)
{
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
var prop = FindProperty(relativePropName);
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName);
}
protected SerializedProperty FindProperty(string path)
{
if (!m_Properties.ContainsKey(path))
{
m_Properties.Add(path, serializedObject.FindProperty(path));
}
return m_Properties[path];
}
}
}

View File

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

View File

@@ -0,0 +1,23 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridCoord3D))]
public class GridCoord3DEditor : MainComponentEditor<GridCoord3D>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Left");
PropertyField("m_Bottom");
PropertyField("m_BoxWidth");
PropertyField("m_BoxHeight");
PropertyField("m_BoxDepth");
PropertyField("m_XYExchanged");
PropertyField("m_ShowBorder");
PropertyField("m_ViewControl");
--EditorGUI.indentLevel;
}
}
}

View File

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

View File

@@ -11,13 +11,10 @@ namespace XCharts.Editor
++EditorGUI.indentLevel;
var layoutIndex = baseProperty.FindPropertyRelative("m_LayoutIndex").intValue;
PropertyField("m_LayoutIndex");
if (layoutIndex < 0)
{
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
}
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_BackgroundColor");
PropertyField("m_ShowBorder");
PropertyField("m_BorderWidth");

View File

@@ -17,9 +17,9 @@ namespace XCharts.Editor
PropertyField("m_ItemOpacity");
PropertyField("m_SelectedMode");
PropertyField("m_Orient");
PropertyField("m_Formatter");
PropertyField("m_Location");
PropertyField("m_LabelStyle");
PropertyField("m_TextLimit");
PropertyField("m_Background");
PropertyField("m_Padding");
PropertyListField("m_Icons");

View File

@@ -133,7 +133,26 @@ namespace XCharts.Editor
public void AddChartComponent(Type type)
{
chart.AddChartComponent(type);
var component = chart.AddChartComponent(type);
if (component != null)
{
if (component is YAxis)
{
var yAxis = component as YAxis;
if (yAxis.index == 1)
{
yAxis.position = Axis.AxisPosition.Right;
}
}
else if (component is XAxis)
{
var xAxis = component as XAxis;
if (xAxis.index == 1)
{
xAxis.position = Axis.AxisPosition.Top;
}
}
}
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
RefreshEditors();
EditorUtility.SetDirty(chart);

View File

@@ -11,6 +11,7 @@ namespace XCharts.Editor
{
++EditorGUI.indentLevel;
PropertyField("m_SerieIndex");
PropertyField("m_OnTop");
PropertyField("m_Animation");
PropertyListField("m_Data", true);
--EditorGUI.indentLevel;

View File

@@ -11,6 +11,7 @@ namespace XCharts.Editor
++EditorGUI.indentLevel;
PropertyField("m_Type");
PropertyField("m_Trigger");
PropertyField("m_TriggerOn");
PropertyField("m_Position");
PropertyField("m_FixedX");
PropertyField("m_FixedY");
@@ -40,6 +41,7 @@ namespace XCharts.Editor
});
PropertyField("m_LineStyle");
PropertyField("m_TitleLabelStyle");
PropertyListField("m_ColumnGapWidths");
PropertyListField("m_ContentLabelStyles");
--EditorGUI.indentLevel;
}

View File

@@ -22,6 +22,11 @@ namespace XCharts.Editor
PropertyField("m_BarWidth");
PropertyField("m_BarGap");
PropertyField("m_BarMaxWidth");
PropertyField("m_RealtimeSort");
if(serie.useSortData)
{
PropertyField("m_DataSortType");
}
if (serie.IsUseCoord<PolarCoord>())
{
PropertyField("m_RoundCap");
@@ -48,6 +53,8 @@ namespace XCharts.Editor
PropertyField("m_Large");
PropertyField("m_LargeThreshold");
PropertyField("m_PlaceHolder");
PropertyField("m_MinShowLabel");
PropertyField("m_MinShowLabelValue");
});
PropertyField("m_ItemStyle");
PropertyField("m_Animation");

View File

@@ -19,6 +19,8 @@ namespace XCharts.Editor
PropertyField("m_HeatmapType");
PropertyField("m_Ignore");
PropertyField("m_IgnoreValue");
PropertyField("m_MaxCache");
PropertyField("m_Symbol");
PropertyField("m_ItemStyle");

View File

@@ -22,6 +22,9 @@ namespace XCharts.Editor
PropertyField("m_Ignore");
PropertyField("m_IgnoreValue");
PropertyField("m_ClickOffset");
PropertyField("m_RadiusGradient");
PropertyField("m_MinShowLabel");
PropertyField("m_MinShowLabelValue");
});
PropertyField("m_ItemStyle");
PropertyField("m_Animation");

View File

@@ -16,6 +16,7 @@ namespace XCharts.Editor
PropertyField("m_RoundCap");
PropertyField("m_Clockwise");
PropertyField("m_AvoidLabelOverlap");
PropertyField("m_RadiusGradient");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");

View File

@@ -9,8 +9,8 @@ namespace XCharts.Editor
{
public class SerieBaseEditor
{
internal BaseChart chart { get; private set; }
internal Serie serie { get; private set; }
public BaseChart chart { get; private set; }
public Serie serie { get; private set; }
//Editor m_Inspector;
internal SerializedProperty baseProperty;

View File

@@ -0,0 +1,24 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(SerieDataLink), true)]
public class SerieDataLinkDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Link"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Source");
PropertyField(prop, "m_Target");
PropertyField(prop, "m_Value");
--EditorGUI.indentLevel;
}
}
}
}

View File

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

View File

@@ -12,6 +12,8 @@ namespace XCharts.Editor
private bool m_DataFoldout = false;
private bool m_DataComponentFoldout = true;
private Dictionary<int, bool> m_DataElementFoldout = new Dictionary<int, bool>();
private bool m_LinksFoldout = false;
private Dictionary<int, bool> m_LinksElementFoldout = new Dictionary<int, bool>();
public override void OnInspectorGUI()
{
@@ -31,12 +33,16 @@ namespace XCharts.Editor
OnCustomInspectorGUI();
OnExtraInspectorGUI();
PropertyFieldData();
OnEndCustomInspectorGUI();
--EditorGUI.indentLevel;
}
public virtual void OnCustomInspectorGUI()
{ }
public virtual void OnEndCustomInspectorGUI()
{ }
private void OnExtraInspectorGUI()
{
foreach (var kv in Serie.extraComponentMap)
@@ -47,14 +53,18 @@ namespace XCharts.Editor
}
}
private HeaderMenuInfo headMenuInfo = new HeaderMenuInfo("Import ECharts Data", null);
private void HeadMenuInfoCallback()
{
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
PraseExternalDataEditor.ShowWindow();
}
private void PropertyFieldData()
{
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null,
new HeaderMenuInfo("Import ECharts Data", () =>
{
PraseExternalDataEditor.UpdateData(chart, serie, null);
PraseExternalDataEditor.ShowWindow();
}));
headMenuInfo.action = HeadMenuInfoCallback;
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null, headMenuInfo);
if (!m_DataFoldout) return;
EditorGUI.indentLevel++;
var m_Datas = FindProperty("m_Data");
@@ -97,6 +107,52 @@ namespace XCharts.Editor
EditorGUI.indentLevel--;
}
private HeaderMenuInfo linkHeadMenuInfo = new HeaderMenuInfo("Import ECharts Link", null);
private void LinkHeadMenuInfoCallback()
{
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
PraseExternalDataEditor.ShowWindow();
}
protected void PropertyFieldLinks()
{
linkHeadMenuInfo.action = LinkHeadMenuInfoCallback;
m_LinksFoldout = ChartEditorHelper.DrawHeader("Links", m_LinksFoldout, false, null, null, linkHeadMenuInfo);
if (!m_LinksFoldout) return;
EditorGUI.indentLevel++;
var m_Links = FindProperty("m_Links");
var listSize = m_Links.arraySize;
listSize = EditorGUILayout.IntField("Size", listSize);
if (listSize < 0) listSize = 0;
if (listSize != m_Links.arraySize)
{
while (listSize > m_Links.arraySize) m_Links.arraySize++;
while (listSize < m_Links.arraySize) m_Links.arraySize--;
}
if (listSize > 30) // && !XCSettings.editorShowAllListData)
{
int num = listSize > 10 ? 10 : listSize;
for (int i = 0; i < num; i++)
{
DrawSerieDataLink(m_Links, i);
}
if (num >= 10)
{
ChartEditorHelper.DrawHeader("... ", false, false, null, null);
DrawSerieDataLink(m_Links, listSize - 1);
}
}
else
{
for (int i = 0; i < m_Links.arraySize; i++)
{
DrawSerieDataLink(m_Links, i);
}
}
EditorGUI.indentLevel--;
}
protected void PropertyFiledMore(System.Action action)
{
m_MoreFoldout = ChartEditorHelper.DrawHeader(MORE, m_MoreFoldout, false, null, null);
@@ -106,6 +162,84 @@ namespace XCharts.Editor
}
}
private void DrawSerieDataHeader(Rect drawRect, HeaderCallbackContext context)
{
var serieData = context.serieData;
var fieldCount = context.fieldCount;
var showName = context.showName;
var index = context.index;
var dimension = context.dimension;
//drawRect.width -= 2f;
var maxX = drawRect.xMax;
var currentWidth = drawRect.width;
var lastX = drawRect.x;
var lastWid = drawRect.width;
var lastFieldWid = EditorGUIUtility.fieldWidth;
var lastLabelWid = EditorGUIUtility.labelWidth;
var sereName = serieData.FindPropertyRelative("m_Name");
var data = serieData.FindPropertyRelative("m_Data");
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
var buttomLength = 30;
#else
var gap = 0;
var namegap = 0;
var buttomLength = 30;
#endif
if (showName)
{
buttomLength += 12;
}
if (fieldCount <= 1)
{
while (2 > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
drawRect.x = startX;
drawRect.xMax = maxX - buttomLength;
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
else
{
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
var dataWidTotal = currentWidth - (startX + 20.5f + 1) - buttomLength;
var dataWid = dataWidTotal / fieldCount;
var xWid = dataWid - 0;
for (int i = 0; i < dimension; i++)
{
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + 25;
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
if (showName)
{
drawRect.x = startX + (fieldCount - 1) * xWid;
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
}
drawRect.x = lastX;
drawRect.width = lastWid;
ChartEditorHelper.UpDownAddDeleteButton(drawRect, context.listProp, index);
EditorGUIUtility.fieldWidth = lastFieldWid;
EditorGUIUtility.labelWidth = lastLabelWid;
}
}
private void DrawSerieData(int dimension, SerializedProperty m_Datas, int index, bool showName)
{
bool flag;
@@ -117,70 +251,16 @@ namespace XCharts.Editor
var fieldCount = dimension + (showName ? 1 : 0);
var serieData = m_Datas.GetArrayElementAtIndex(index);
var dataIndex = serieData.FindPropertyRelative("m_Index").intValue;
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + dataIndex, flag, false, null,
delegate(Rect drawRect)
{
//drawRect.width -= 2f;
var maxX = drawRect.xMax;
var currentWidth = drawRect.width;
var lastX = drawRect.x;
var lastWid = drawRect.width;
var lastFieldWid = EditorGUIUtility.fieldWidth;
var lastLabelWid = EditorGUIUtility.labelWidth;
//var serieData = m_Datas.GetArrayElementAtIndex(index);
var sereName = serieData.FindPropertyRelative("m_Name");
var data = serieData.FindPropertyRelative("m_Data");
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
#else
var gap = 0;
var namegap = 0;
#endif
if (fieldCount <= 1)
{
while (2 > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
drawRect.x = startX;
drawRect.xMax = maxX;
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
else
{
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
var dataWid = dataWidTotal / fieldCount;
var xWid = dataWid - 0;
for (int i = 0; i < dimension; i++)
{
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + 25;
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
if (showName)
{
drawRect.x = startX + (fieldCount - 1) * xWid;
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
}
EditorGUIUtility.fieldWidth = lastFieldWid;
EditorGUIUtility.labelWidth = lastLabelWid;
}
});
var callbackContext = new HeaderCallbackContext()
{
serieData = serieData,
fieldCount = fieldCount,
showName = showName,
index = index,
dimension = dimension,
listProp = m_Datas
};
m_DataElementFoldout[index] = ChartEditorHelper.DrawSerieDataHeader("SerieData " + dataIndex, flag, false, null, callbackContext, DrawSerieDataHeader);
if (m_DataElementFoldout[index])
{
if (!(serie is ISimplifiedSerie))
@@ -242,5 +322,41 @@ namespace XCharts.Editor
}
EditorGUI.indentLevel--;
}
private void DrawSerieDataLink(SerializedProperty m_Datas, int index)
{
bool flag;
if (!m_LinksElementFoldout.TryGetValue(index, out flag))
{
flag = false;
m_LinksElementFoldout[index] = false;
}
var dataLink = m_Datas.GetArrayElementAtIndex(index);
m_LinksElementFoldout[index] = ChartEditorHelper.DrawHeader("Link " + index, flag, false, null,
delegate (Rect drawRect)
{
var sourceIndex = dataLink.FindPropertyRelative("m_Source");
var targetIndex = dataLink.FindPropertyRelative("m_Target");
var value = dataLink.FindPropertyRelative("m_Value");
var hig = ChartEditorHelper.MakeThreeField(ref drawRect, drawRect.width, sourceIndex, targetIndex, value, "");
var btnRect = drawRect;
btnRect.y -= hig;
ChartEditorHelper.UpDownAddDeleteButton(btnRect, m_Datas, index);
});
if (m_LinksElementFoldout[index])
{
DrawSerieDataLinkDetail(m_Datas, index);
}
}
private void DrawSerieDataLinkDetail(SerializedProperty m_Links, int index)
{
EditorGUI.indentLevel++;
var dataLink = m_Links.GetArrayElementAtIndex(index);
PropertyField(dataLink.FindPropertyRelative("m_Source"));
PropertyField(dataLink.FindPropertyRelative("m_Target"));
PropertyField(dataLink.FindPropertyRelative("m_Value"));
EditorGUI.indentLevel--;
}
}
}

View File

@@ -6,6 +6,16 @@ using XCharts.Runtime;
namespace XCharts.Editor
{
public class HeaderCallbackContext
{
public int fieldCount = 0;
public SerializedProperty serieData;
public bool showName;
public int index;
public int dimension;
public SerializedProperty listProp;
}
public class HeaderMenuInfo
{
public string name;
@@ -43,6 +53,8 @@ namespace XCharts.Editor
public const float GAP_WIDTH = 0;
public const float DIFF_WIDTH = 1;
#endif
public const float ICON_WIDHT = 10;
public const float ICON_GAP = 0;
static Dictionary<string, GUIContent> s_GUIContentCache;
static ChartEditorHelper()
@@ -96,16 +108,35 @@ namespace XCharts.Editor
{
EditorGUI.LabelField(drawRect, name);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
var diff = 13 + EditorGUI.indentLevel * 14;
var diff = 12 + EditorGUI.indentLevel * 14;
var offset = diff - INDENT_WIDTH;
var tempWidth = (rectWidth - startX + diff) / 2;
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
var centerYRect = new Rect(centerXRect.x + tempWidth - offset + 3.4f, drawRect.y, tempWidth - 1, drawRect.height - 1);
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public static float MakeThreeField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
SerializedProperty prop2, SerializedProperty prop3, string name, bool btnSpacing = true)
{
EditorGUI.LabelField(drawRect, name);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
var diff = 13f + EditorGUI.indentLevel * 14;
var offset = diff - INDENT_WIDTH;
var tempWidth = (rectWidth - startX + diff - (btnSpacing ? (ICON_WIDHT + ICON_GAP) * 4 : 0)) / 3 + 8.5f;
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
var centerZRect = new Rect(centerYRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
EditorGUI.PropertyField(centerZRect, prop3, GUIContent.none);
var hig = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.y += hig;
return hig;
}
public static void MakeVector2(ref Rect drawRect, float rectWidth, SerializedProperty prop, string name)
{
EditorGUI.LabelField(drawRect, name);
@@ -295,7 +326,13 @@ namespace XCharts.Editor
var foldoutRect = drawRect;
foldoutRect.xMax -= 10;
bool flag = EditorGUI.Foldout(foldoutRect, foldout, listProp.displayName, true);
ChartEditorHelper.DrawMenu(drawRect, menus);
if (!flag)
{
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
var sizeRect = new Rect(startX, drawRect.y + 1f, (EditorGUI.indentLevel + 1) * 15, drawRect.height - 1);
EditorGUI.IntField(sizeRect, GUIContent.none, listProp.arraySize);
DrawMenu(drawRect, menus);
}
height += headerHeight;
drawRect.y += headerHeight;
drawRect.width = rawWidth;
@@ -318,15 +355,12 @@ namespace XCharts.Editor
{
EditorGUI.indentLevel++;
var listSize = listProp.arraySize;
var iconWidth = 10;
var iconGap = 0f;
if (showSize)
{
var headerHeight = DrawSplitterAndBackground(drawRect);
if (showOrder)
{
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth + 2, drawRect.height);
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - ICON_WIDHT + 2, drawRect.height);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
GUI.contentColor = oldColor;
@@ -379,40 +413,14 @@ namespace XCharts.Editor
DrawSplitterAndBackground(drawRect);
if (showOrder)
{
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var isSerie = "Serie".Equals(element.type);
var elementRect = isSerie ?
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height) :
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * iconWidth, drawRect.height);
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * ICON_GAP, drawRect.height) :
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * ICON_WIDHT, drawRect.height);
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
var iconRect = new Rect(drawRect.width - 4 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
}
iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
}
iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
}
iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
}
else
{
drawRect.y += EditorGUI.GetPropertyHeight(element);
height += EditorGUI.GetPropertyHeight(element);
}
GUI.contentColor = oldColor;
UpDownAddDeleteButton(drawRect, listProp, i);
drawRect.y += EditorGUI.GetPropertyHeight(element);
height += EditorGUI.GetPropertyHeight(element);
}
else
{
@@ -425,6 +433,34 @@ namespace XCharts.Editor
EditorGUI.indentLevel--;
}
public static void UpDownAddDeleteButton(Rect drawRect, SerializedProperty listProp, int i)
{
var temp = INDENT_WIDTH + GAP_WIDTH + ICON_GAP;
var iconRect = new Rect(drawRect.width - 4 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
}
iconRect = new Rect(drawRect.width - 3 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
}
iconRect = new Rect(drawRect.width - 2 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
}
iconRect = new Rect(drawRect.width - ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
}
GUI.contentColor = oldColor;
}
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop)
{
@@ -569,6 +605,31 @@ namespace XCharts.Editor
return state;
}
public static bool DrawSerieDataHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
HeaderCallbackContext context, Action<Rect, HeaderCallbackContext> drawCallback, params HeaderMenuInfo[] menus)
{
var rect = GUILayoutUtility.GetRect(1f, HEADER_HEIGHT);
var labelRect = DrawHeaderInternal(rect, title, ref state, drawBackground, activeField);
DrawMenu(rect, menus);
if (drawCallback != null)
{
drawCallback(rect, context);
}
var e = Event.current;
if (e.type == EventType.MouseDown)
{
if (labelRect.Contains(e.mousePosition))
{
if (e.button == 0)
{
state = !state;
e.Use();
}
}
}
return state;
}
internal static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
Action<Rect> drawCallback, List<HeaderMenuInfo> menus)
{

View File

@@ -8,9 +8,12 @@ namespace XCharts.Editor
{
public class PraseExternalDataEditor : UnityEditor.EditorWindow
{
[SerializeField] private int m_DataDimension = 1;
[SerializeField] private double m_DefaultYValue = 0;
private static BaseChart s_Chart;
private static Serie s_Serie;
private static Axis s_Axis;
private static bool s_LinksData;
private static PraseExternalDataEditor window;
private static string inputJsonText = "";
@@ -23,11 +26,12 @@ namespace XCharts.Editor
window.Show();
}
public static void UpdateData(BaseChart chart, Serie serie, Axis axis)
public static void UpdateData(BaseChart chart, Serie serie, Axis axis, bool linksData)
{
s_Chart = chart;
s_Serie = serie;
s_Axis = axis;
s_LinksData = linksData;
inputJsonText = UnityEngine.GUIUtility.systemCopyBuffer;
}
@@ -44,8 +48,13 @@ namespace XCharts.Editor
return;
}
EditorGUILayout.LabelField("Input external data (echarts data):");
m_DataDimension = EditorGUILayout.IntField("Data Dimension", m_DataDimension);
if (m_DataDimension < 1)
m_DataDimension = 1;
else if (m_DataDimension == 2)
m_DefaultYValue = EditorGUILayout.DoubleField("Default Y Value", m_DefaultYValue);
inputJsonText = EditorGUILayout.TextArea(inputJsonText, GUILayout.Height(400));
if (GUILayout.Button("Add"))
if (GUILayout.Button("Try Add"))
{
if (s_Serie != null)
{
@@ -74,7 +83,7 @@ namespace XCharts.Editor
}
}
private static bool ParseArrayData(Axis axis, string arrayData)
private bool ParseArrayData(Axis axis, string arrayData)
{
arrayData = arrayData.Trim();
if (!arrayData.StartsWith("data: Array")) return false;
@@ -93,11 +102,12 @@ namespace XCharts.Editor
return true;
}
private static bool ParseArrayData(Serie serie, string arrayData)
private bool ParseArrayData(Serie serie, string arrayData)
{
arrayData = arrayData.Trim();
if (!arrayData.StartsWith("data: Array")) return false;
serie.ClearData();
if (s_LinksData) serie.ClearLinks();
else serie.ClearData();
var list = arrayData.Split('\n');
for (int i = 1; i < list.Length; i++)
{
@@ -117,7 +127,7 @@ namespace XCharts.Editor
return true;
}
private static bool ParseJsonData(Axis axis, string jsonData)
private bool ParseJsonData(Axis axis, string jsonData)
{
if (!CheckJsonData(ref jsonData)) return false;
axis.data.Clear();
@@ -137,10 +147,11 @@ namespace XCharts.Editor
/// 从json中导入数据
/// </summary>
/// <param name="jsonData"></param>
private static bool ParseJsonData(Serie serie, string jsonData)
private bool ParseJsonData(Serie serie, string jsonData)
{
if (!CheckJsonData(ref jsonData)) return false;
serie.ClearData();
if (s_LinksData) serie.ClearLinks();
else serie.ClearData();
if (jsonData.IndexOf("],") > -1 || jsonData.IndexOf("] ,") > -1)
{
string[] datas = jsonData.Split(new string[] { "],", "] ," }, StringSplitOptions.RemoveEmptyEntries);
@@ -152,7 +163,10 @@ namespace XCharts.Editor
if (data.Length == 2 && !double.TryParse(data[0], out value))
{
double.TryParse(data[1], out value);
serieData.data = new List<double>() { i, value };
if (m_DataDimension == 2)
serieData.data = new List<double>() { i, m_DefaultYValue, value };
else
serieData.data = new List<double>() { i, value };
serieData.name = data[0].Replace("\"", "").Trim();
}
else
@@ -183,7 +197,10 @@ namespace XCharts.Editor
if (a.StartsWith("value:"))
{
double value = double.Parse(a.Substring(6, a.Length - 6));
serieData.data = new List<double>() { i, value };
if (m_DataDimension == 2)
serieData.data = new List<double>() { i, m_DefaultYValue, value };
else
serieData.data = new List<double>() { i, value };
}
else if (a.StartsWith("name:"))
{
@@ -209,7 +226,10 @@ namespace XCharts.Editor
if (flag)
{
var serieData = new SerieData();
serieData.data = new List<double>() { i, value };
if (m_DataDimension == 2)
serieData.data = new List<double>() { i, m_DefaultYValue, value };
else
serieData.data = new List<double>() { i, value };
serie.AddSerieData(serieData);
}
}

View File

@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using XCharts.Runtime;
using ADB = UnityEditor.AssetDatabase;
namespace XCharts.Editor
{
public partial class XChartsEditor
{
[MenuItem("XCharts/BarChart/Baisc Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Column", priority = 45)]
public static void AddBarChart()
{
AddChart<BarChart>("BarChart");
}
[MenuItem("XCharts/BarChart/Zebra Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Column", priority = 45)]
public static void AddBarChart_ZebraColumn()
{
var chart = AddChart<BarChart>("BarChart", "Zebra Column");
chart.DefaultZebraColumnChart();
}
[MenuItem("XCharts/BarChart/Capsule Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Column", priority = 45)]
public static void AddBarChart_CapsuleColumn()
{
var chart = AddChart<BarChart>("BarChart", "Capsule Column");
chart.DefaultCapsuleColumnChart();
}
[MenuItem("XCharts/BarChart/Grouped Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Column", priority = 45)]
public static void AddBarChart_GroupedColumn()
{
var chart = AddChart<BarChart>("BarChart", "Grouped Column");
chart.DefaultGroupedColumnChart();
}
[MenuItem("XCharts/BarChart/Stacked Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Column", priority = 45)]
public static void AddBarChart_StackedColumn()
{
var chart = AddChart<BarChart>("BarChart", "Stacked Column");
chart.DefaultStackedColumnChart();
}
[MenuItem("XCharts/BarChart/Percent Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Column", priority = 45)]
public static void AddBarChart_PercentColumn()
{
var chart = AddChart<BarChart>("BarChart", "Percent Column");
chart.DefaultPercentColumnChart();
}
[MenuItem("XCharts/BarChart/Baisc Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Bar", priority = 45)]
public static void AddBarChart_BasicBar()
{
var chart = AddChart<BarChart>("BarChart");
chart.DefaultBarChart();
}
[MenuItem("XCharts/BarChart/Zebra Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Bar", priority = 45)]
public static void AddBarChart_ZebraBar()
{
var chart = AddChart<BarChart>("BarChart", "Zebra Bar");
chart.DefaultZebraBarChart();
}
[MenuItem("XCharts/BarChart/Capsule Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Bar", priority = 45)]
public static void AddBarChart_CapsuleBar()
{
var chart = AddChart<BarChart>("BarChart", "Capsule Bar");
chart.DefaultCapsuleBarChart();
}
[MenuItem("XCharts/BarChart/Grouped Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Bar", priority = 45)]
public static void AddBarChart_GroupedBar()
{
var chart = AddChart<BarChart>("BarChart", "Grouped Bar");
chart.DefaultGroupedBarChart();
}
[MenuItem("XCharts/BarChart/Stacked Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Bar", priority = 45)]
public static void AddBarChart_StackedBar()
{
var chart = AddChart<BarChart>("BarChart", "Stacked Bar");
chart.DefaultStackedBarChart();
}
[MenuItem("XCharts/BarChart/Percent Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Bar", priority = 45)]
public static void AddBarChart_PercentBar()
{
var chart = AddChart<BarChart>("BarChart", "Percent Bar");
chart.DefaultPercentBarChart();
}
}
}

View File

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

View File

@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using XCharts.Runtime;
using ADB = UnityEditor.AssetDatabase;
namespace XCharts.Editor
{
public partial class XChartsEditor
{
[MenuItem("XCharts/LineChart/Basic Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Basic Line", priority = 44)]
public static void AddLineChart()
{
AddChart<LineChart>("LineChart");
}
[MenuItem("XCharts/LineChart/Area Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Area Line", priority = 44)]
public static void AddLineChart_Area()
{
var chart = AddChart<LineChart>("LineChart_Area", "Area Line");
chart.DefaultAreaLineChart();
}
[MenuItem("XCharts/LineChart/Smooth Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Line", priority = 44)]
public static void AddLineChart_Smooth()
{
var chart = AddChart<LineChart>("LineChart_Smooth", "Smooth Line");
chart.DefaultSmoothLineChart();
}
[MenuItem("XCharts/LineChart/Smooth Area", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Area Line", priority = 44)]
public static void AddLineChart_SmoothArea()
{
var chart = AddChart<LineChart>("LineChart_SmoothArea", "Smooth Area Line");
chart.DefaultSmoothAreaLineChart();
}
[MenuItem("XCharts/LineChart/Stack Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Line", priority = 44)]
public static void AddLineChart_Stack()
{
var chart = AddChart<LineChart>("LineChart_Stack", "Stack Line");
chart.DefaultStackLineChart();
}
[MenuItem("XCharts/LineChart/Stack Area Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Area Line", priority = 44)]
public static void AddLineChart_StackArea()
{
var chart = AddChart<LineChart>("LineChart_StackArea", "Stack Area Line");
chart.DefaultStackAreaLineChart();
}
[MenuItem("XCharts/LineChart/Step Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Step Line", priority = 44)]
public static void AddLineChart_Step()
{
var chart = AddChart<LineChart>("LineChart_Step", "Step Line");
chart.DefaultStepLineChart();
}
[MenuItem("XCharts/LineChart/Dashed Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Dashed Line", priority = 44)]
public static void AddLineChart_Dash()
{
var chart = AddChart<LineChart>("LineChart_Dashed", "Dashed Line");
chart.DefaultDashLineChart();
}
[MenuItem("XCharts/LineChart/Time Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Time Line", priority = 44)]
public static void AddLineChart_Time()
{
var chart = AddChart<LineChart>("LineChart_Time", "Time Line");
chart.DefaultTimeLineChart();
}
[MenuItem("XCharts/LineChart/Log Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Log Line", priority = 44)]
public static void AddLineChart_Log()
{
var chart = AddChart<LineChart>("LineChart_Log", "Log Line");
chart.DefaultLogLineChart();
}
}
}

View File

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

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using XCharts.Runtime;
using ADB = UnityEditor.AssetDatabase;
namespace XCharts.Editor
{
public partial class XChartsEditor
{
[MenuItem("XCharts/PieChart/Pie", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Pie", priority = 46)]
public static void AddPieChart()
{
AddChart<PieChart>("PieChart");
}
[MenuItem("XCharts/PieChart/Pie With Label", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Pie With Label", priority = 46)]
public static void AddPieChart_WithLabel()
{
var chart = AddChart<PieChart>("PieChart");
chart.DefaultLabelPieChart();
}
[MenuItem("XCharts/PieChart/Donut", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Donut", priority = 46)]
public static void AddPieChart_Donut()
{
var chart = AddChart<PieChart>("PieChart");
chart.DefaultDonutPieChart();
}
[MenuItem("XCharts/PieChart/Donut With Label", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Donut With Label", priority = 46)]
public static void AddPieChart_DonutWithLabel()
{
var chart = AddChart<PieChart>("PieChart");
chart.DefaultLabelDonutPieChart();
}
[MenuItem("XCharts/PieChart/Radius Rose", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Radius Rose", priority = 46)]
public static void AddPieChart_RadiusRose()
{
var chart = AddChart<PieChart>("PieChart");
chart.DefaultRadiusRosePieChart();
}
[MenuItem("XCharts/PieChart/Area Rose", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Area Rose", priority = 46)]
public static void AddPieChart_AreaRose()
{
var chart = AddChart<PieChart>("PieChart");
chart.DefaultAreaRosePieChart();
}
}
}

View File

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

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using XCharts.Runtime;
using ADB = UnityEditor.AssetDatabase;
namespace XCharts.Editor
{
public partial class XChartsEditor
{
[MenuItem("XCharts/PolarChart/Line", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Line", priority = 54)]
public static void PolarChart()
{
AddChart<PolarChart>("PolarChart");
}
[MenuItem("XCharts/PolarChart/Radial Bar", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Radial Bar", priority = 54)]
public static void PolarChart_RadialBar()
{
var chart = AddChart<PolarChart>("PolarChart");
chart.DefaultRadialBarPolarChart();
}
[MenuItem("XCharts/PolarChart/Tangential Bar", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Tangential Bar", priority = 54)]
public static void PolarChart_TangentialBar()
{
var chart = AddChart<PolarChart>("PolarChart");
chart.DefaultTangentialBarPolarChart();
}
[MenuItem("XCharts/PolarChart/Heatmap", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Heatmap", priority = 54)]
public static void PolarChart_Heatmap()
{
var chart = AddChart<PolarChart>("PolarChart");
chart.DefaultHeatmapPolarChart();
}
}
}

View File

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

View File

@@ -12,14 +12,18 @@ using ADB = UnityEditor.AssetDatabase;
namespace XCharts.Editor
{
public class XChartsEditor : UnityEditor.Editor
public partial class XChartsEditor : UnityEditor.Editor
{
private static Transform GetParent()
{
GameObject selectObj = Selection.activeGameObject;
if (selectObj == null)
{
#if UNITY_2023_1_OR_NEWER
var canvas = UnityEngine.Object.FindFirstObjectByType<Canvas>();
#else
var canvas = GameObject.FindObjectOfType<Canvas>();
#endif
if (canvas != null) return canvas.transform;
else
{
@@ -61,13 +65,19 @@ namespace XCharts.Editor
return name;
}
public static T AddChart<T>(string chartName) where T : BaseChart
public static T AddChart<T>(string chartName, string titleName = null) where T : BaseChart
{
XCThemeMgr.CheckReloadTheme();
return AddGraph<T>(chartName);
var chart = AddGraph<T>(chartName);
if (!string.IsNullOrEmpty(titleName))
{
var title = chart.GetChartComponent<Title>();
title.text = titleName;
}
return chart;
}
public static T AddGraph<T>(string graphName) where T : BaseGraph
public static T AddGraph<T>(string graphName) where T : Graphic
{
var parent = GetParent();
if (parent == null) return null;
@@ -90,99 +100,102 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/EmptyChart", priority = 43)]
[MenuItem("GameObject/XCharts/EmptyChart", priority = 43)]
[MenuItem("GameObject/UI/XCharts/EmptyChart", priority = 43)]
public static void AddBaseChart()
{
var chart = AddChart<BaseChart>("EmptyChart");
chart.GetChartComponent<Title>().text = "EmptyChart";
AddChart<BaseChart>("EmptyChart");
}
[MenuItem("XCharts/LineChart", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart", priority = 44)]
public static void AddLineChart()
{
AddChart<LineChart>("LineChart");
}
[MenuItem("XCharts/BarChart", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart", priority = 45)]
public static void AddBarChart()
{
AddChart<BarChart>("BarChart");
}
[MenuItem("XCharts/PieChart", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart", priority = 46)]
public static void AddPieChart()
{
AddChart<PieChart>("PieChart");
}
[MenuItem("XCharts/RadarChart", priority = 47)]
[MenuItem("GameObject/XCharts/RadarChart", priority = 47)]
[MenuItem("XCharts/RadarChart/Polygon Radar", priority = 47)]
[MenuItem("GameObject/UI/XCharts/RadarChart/Polygon Radar", priority = 47)]
public static void AddRadarChart()
{
AddChart<RadarChart>("RadarChart");
}
[MenuItem("XCharts/ScatterChart", priority = 48)]
[MenuItem("GameObject/XCharts/ScatterChart", priority = 48)]
[MenuItem("XCharts/RadarChart/Cirle Radar", priority = 47)]
[MenuItem("GameObject/UI/XCharts/RadarChart/Cirle Radar", priority = 47)]
public static void AddRadarChart_CirleRadar()
{
var chart = AddChart<RadarChart>("RadarChart");
chart.DefaultCircleRadarChart();
}
[MenuItem("XCharts/ScatterChart/Scatter", priority = 48)]
[MenuItem("GameObject/UI/XCharts/ScatterChart/Scatter", priority = 48)]
public static void AddScatterChart()
{
AddChart<ScatterChart>("ScatterChart");
}
[MenuItem("XCharts/HeatmapChart", priority = 49)]
[MenuItem("GameObject/XCharts/HeatmapChart", priority = 49)]
[MenuItem("XCharts/ScatterChart/Bubble", priority = 48)]
[MenuItem("GameObject/UI/XCharts/ScatterChart/Bubble", priority = 48)]
public static void AddScatterChart_Bubble()
{
var chart = AddChart<ScatterChart>("ScatterChart");
chart.DefaultBubbleChart();
}
[MenuItem("XCharts/HeatmapChart/Heatmap", priority = 49)]
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Heatmap", priority = 49)]
public static void AddHeatmapChart()
{
AddChart<HeatmapChart>("HeatmapChart");
}
[MenuItem("XCharts/RingChart", priority = 51)]
[MenuItem("GameObject/XCharts/RingChart", priority = 51)]
[MenuItem("XCharts/HeatmapChart/Count Heatmap", priority = 49)]
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Count Heatmap", priority = 49)]
public static void AddHeatmapChart_Count()
{
var chart = AddChart<HeatmapChart>("HeatmapChart");
chart.DefaultCountHeatmapChart();
}
[MenuItem("XCharts/RingChart/Ring", priority = 51)]
[MenuItem("GameObject/UI/XCharts/RingChart/Ring", priority = 51)]
public static void AddRingChart()
{
AddChart<RingChart>("RingChart");
}
[MenuItem("XCharts/CandlestickChart", priority = 54)]
[MenuItem("GameObject/XCharts/CandlestickChart", priority = 54)]
[MenuItem("XCharts/RingChart/Multiple Ring", priority = 51)]
[MenuItem("GameObject/UI/XCharts/RingChart/Multiple Ring", priority = 51)]
public static void AddRingChart_MultiRing()
{
var chart = AddChart<RingChart>("RingChart");
chart.DefaultMultipleRingChart();
}
[MenuItem("XCharts/CandlestickChart/Candlestick", priority = 54)]
[MenuItem("GameObject/UI/XCharts/CandlestickChart/Candlestick", priority = 54)]
public static void CandlestickChart()
{
AddChart<CandlestickChart>("CandlestickChart");
}
[MenuItem("XCharts/PolarChart", priority = 54)]
[MenuItem("GameObject/XCharts/PolarChart", priority = 54)]
public static void PolarChart()
{
AddChart<PolarChart>("PolarChart");
}
[MenuItem("XCharts/ParallelChart", priority = 55)]
[MenuItem("GameObject/XCharts/ParallelChart", priority = 55)]
[MenuItem("XCharts/ParallelChart/Parallel", priority = 55)]
[MenuItem("GameObject/UI/XCharts/ParallelChart/Parallel", priority = 55)]
public static void ParallelChart()
{
AddChart<ParallelChart>("ParallelChart");
}
[MenuItem("XCharts/SimplifiedLineChart", priority = 56)]
[MenuItem("GameObject/XCharts/SimplifiedLineChart", priority = 56)]
[MenuItem("XCharts/SimplifiedChart/Line", priority = 56)]
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Line", priority = 56)]
public static void SimplifiedLineChart()
{
AddChart<SimplifiedLineChart>("SimplifiedLineChart");
}
[MenuItem("XCharts/SimplifiedBarChart", priority = 57)]
[MenuItem("GameObject/XCharts/SimplifiedBarChart", priority = 57)]
[MenuItem("XCharts/SimplifiedChart/Bar", priority = 57)]
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Bar", priority = 57)]
public static void SimplifiedBarChart()
{
AddChart<SimplifiedBarChart>("SimplifiedBarChart");
}
[MenuItem("XCharts/SimplifiedCandlestickChart", priority = 58)]
[MenuItem("GameObject/XCharts/SimplifiedCandlestickChart", priority = 58)]
[MenuItem("XCharts/SimplifiedChart/Candlestick", priority = 58)]
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Candlestick", priority = 58)]
public static void SimplifiedCandlestickChart()
{
AddChart<SimplifiedCandlestickChart>("SimplifiedCandlestickChart");

View File

@@ -17,24 +17,52 @@ namespace XCharts.Example
public bool loopUpdate = false;
public float loopUpadteTime = 1f;
public int maxCache = 0;
public bool insertDataToHead = false;
BaseChart chart;
float lastAddTime;
float lastUpdateTime;
int dataCount;
int lastMaxCache = 0;
bool lastInsertDataToHead = false;
void Awake()
{
chart = gameObject.GetComponent<BaseChart>();
chart.onInit = () =>
{
dataCount = chart.GetSerie(0).dataCount;
SetMaxCache(maxCache);
SetInsertDataToHead(insertDataToHead);
lastMaxCache = maxCache;
lastInsertDataToHead = insertDataToHead;
};
}
void Start()
void SetMaxCache(int maxCache)
{
if (maxCache > 0)
chart.SetMaxCache(maxCache);
}
void SetInsertDataToHead(bool insertDataToHead)
{
foreach (var serie in chart.series)
serie.insertDataToHead = insertDataToHead;
var coms = chart.GetChartComponents<XAxis>();
if (coms != null)
{
chart.SetMaxCache(maxCache);
foreach (var com in coms)
{
var axis = com as XAxis;
if (axis.type == Axis.AxisType.Category)
{
axis.insertDataToHead = insertDataToHead;
Debug.LogError("axis:" + axis + "," + insertDataToHead);
}
}
}
dataCount = chart.GetSerie(0).dataCount;
}
void Update()
@@ -47,6 +75,20 @@ namespace XCharts.Example
{
UpdateData();
}
else if (Input.GetKeyDown(KeyCode.C))
{
chart.ClearData();
}
if (lastMaxCache != maxCache)
{
lastMaxCache = maxCache;
SetMaxCache(maxCache);
}
if (lastInsertDataToHead != insertDataToHead)
{
lastInsertDataToHead = insertDataToHead;
SetInsertDataToHead(insertDataToHead);
}
lastAddTime += Time.deltaTime;
if (loopAdd && lastAddTime >= loopAddTime)
{
@@ -70,24 +112,18 @@ namespace XCharts.Example
var yAxis = chart.GetChartComponent<YAxis>();
if (xAxis != null && yAxis != null)
{
chart.AddXAxisData((xAxis.data.Count + 1).ToString());
chart.AddXAxisData((xAxis.GetAddedDataCount() + 1).ToString());
for (int i = 0; i < yAxis.data.Count; i++)
{
chart.AddData(0, xAxis.data.Count - 1, i, Random.Range(10, 90));
chart.AddData(0, xAxis.GetAddedDataCount() - 1, i, Random.Range(10, 90));
}
}
return;
}
else
{
AddXAxisData();
var xAxis = chart.GetChartComponent<XAxis>();
if (xAxis != null)
{
if (xAxis.type == Axis.AxisType.Category)
{
chart.AddXAxisData("x" + (xAxis.data.Count + 1));
}
}
foreach (var serie in chart.series)
{
AddSerieRandomData(serie, xAxis);
@@ -95,6 +131,19 @@ namespace XCharts.Example
}
}
void AddXAxisData()
{
var xAxes = chart.GetChartComponents<XAxis>();
foreach (var com in xAxes)
{
var xAxis = com as XAxis;
if (xAxis.type == Axis.AxisType.Category)
{
chart.AddXAxisData("x" + (xAxis.GetAddedDataCount() + 1), xAxis.index);
}
}
}
void UpdateData()
{
foreach (var serie in chart.series)
@@ -143,7 +192,7 @@ namespace XCharts.Example
var yAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
for (int i = 0; i < yAxis.data.Count; i++)
{
chart.AddData(serie.index, xAxis.data.Count - 1, i, Random.Range(0, 150));
chart.AddData(serie.index, xAxis.GetAddedDataCount() - 1, i, Random.Range(0, 150));
}
}
else

View File

@@ -65,17 +65,17 @@ namespace XCharts.Example
void OnSerieClick(SerieEventData data)
{
Debug.Log("OnSerieClick: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension);
Debug.Log("OnSerieClick: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
}
void OnSerieEnter(SerieEventData data)
{
Debug.Log("OnSerieEnter: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension);
Debug.Log("OnSerieEnter: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
}
void OnSerieExit(SerieEventData data)
{
Debug.Log("OnSerieExit: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension);
Debug.Log("OnSerieExit: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
}
void OnDraw(VertexHelper vh)
@@ -93,7 +93,7 @@ namespace XCharts.Example
//Debug.Log("OnDrawAfterSerie: " + serie.index);
if (serie.index != 0) return;
var dataPoints = serie.context.dataPoints;
if (dataPoints.Count > 0)
if (dataPoints.Count > 4)
{
var pos = dataPoints[3];
var grid = chart.GetChartComponent<GridCoord>();

View File

@@ -15,6 +15,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<BarChart>();
chart.Init();
}
var serie = chart.GetSerie(0);
serie.animation.enable = true;

View File

@@ -42,7 +42,6 @@ namespace XCharts.Example
{
var chartObject = CreateChartObject(chartName);
var chart = chartObject.AddComponent<PieChart>();
chart.Init();
chart.SetSize(580, 300);
chart.EnsureChartComponent<Title>().show = true;
@@ -64,7 +63,6 @@ namespace XCharts.Example
{
var chartObject = CreateChartObject(chartName);
var chart = chartObject.AddComponent<PieChart>();
chart.Init();
chart.SetSize(580, 300);
chart.EnsureChartComponent<Title>().show = true;

View File

@@ -40,7 +40,10 @@ namespace XCharts.Example
IEnumerator AddSimpleLine()
{
chart = gameObject.GetComponent<LineChart>();
if (chart == null) chart = gameObject.AddComponent<LineChart>();
if (chart == null){
chart = gameObject.AddComponent<LineChart>();
chart.Init();
}
chart.GetChartComponent<Title>().text = "LineChart - 折线图";
chart.GetChartComponent<Title>().subText = "普通折线图";

View File

@@ -16,6 +16,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<LineChart>();
chart.Init();
}
chart.EnsureChartComponent<Title>().show = true;
chart.EnsureChartComponent<Title>().text = "Sin Curve";

View File

@@ -25,12 +25,11 @@ namespace XCharts.Example
void AddData()
{
var chart = gameObject.GetComponent<SimplifiedLineChart>();
var chart = gameObject.GetComponent<LineChart>();
if (chart == null)
{
chart = gameObject.AddComponent<SimplifiedLineChart>();
chart = gameObject.AddComponent<LineChart>();
chart.Init();
chart.SetSize(580, 300);
}
chart.EnsureChartComponent<Title>().show = true;
chart.EnsureChartComponent<Title>().text = "Line Simple";
@@ -49,9 +48,9 @@ namespace XCharts.Example
xAxis.boundaryGap = true;
chart.RemoveData();
chart.AddSerie<SimplifiedLine>();
chart.AddSerie<SimplifiedLine>();
for (int i = 0; i < 200; i++)
chart.AddSerie<Line>();
chart.AddSerie<Line>();
for (int i = 0; i < 20; i++)
{
chart.AddXAxisData("x" + i);
chart.AddData(0, Random.Range(10, 20));

View File

@@ -38,7 +38,11 @@ namespace XCharts.Example
IEnumerator AddSimpleBar()
{
chart = gameObject.GetComponent<BarChart>();
if (chart == null) chart = gameObject.AddComponent<BarChart>();
if (chart == null)
{
chart = gameObject.AddComponent<BarChart>();
chart.Init();
}
chart.EnsureChartComponent<Title>().text = "BarChart - 柱状图";
chart.EnsureChartComponent<Title>().subText = "普通柱状图";

View File

@@ -38,7 +38,11 @@ namespace XCharts.Example
IEnumerator PieAdd()
{
chart = gameObject.GetComponent<PieChart>();
if (chart == null) chart = gameObject.AddComponent<PieChart>();
if (chart == null)
{
chart = gameObject.AddComponent<PieChart>();
chart.Init();
}
yield return null;
chart.GetChartComponent<Title>().text = "PieChart - 饼图";
chart.GetChartComponent<Title>().subText = "基础饼图";

View File

@@ -17,6 +17,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<PieChart>();
chart.Init();
}
var serieIndex = 0;
var serie = chart.GetSerie(serieIndex);

View File

@@ -40,7 +40,11 @@ namespace XCharts.Example
IEnumerator RadarAdd()
{
chart = gameObject.GetComponent<RadarChart>();
if (chart == null) chart = gameObject.AddComponent<RadarChart>();
if (chart == null)
{
chart = gameObject.AddComponent<RadarChart>();
chart.Init();
}
chart.RemoveChartComponents<RadarCoord>();
chart.RemoveData();

View File

@@ -19,6 +19,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<RadarChart>();
chart.Init();
}
}

View File

@@ -21,9 +21,9 @@ namespace XCharts.Example
}
}
float SymbolSize(List<double> data)
float SymbolSize(float defaultSize, SerieData serieData)
{
return (float) (Math.Sqrt(data[2]) / 6e2);
return defaultSize;
}
}
}

View File

@@ -16,6 +16,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<HeatmapChart>();
chart.Init();
}
chart.GetChartComponent<Title>().text = "HeatmapChart";
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.None;

View File

@@ -18,6 +18,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<BaseChart>();
chart.Init();
}
chart.EnsureChartComponent<PolarCoord>();
}
@@ -33,7 +34,7 @@ namespace XCharts.Example
void AddData()
{
chart.RemoveData();
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.Corss;
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.Cross;
var angleAxis = chart.GetChartComponent<AngleAxis>();
angleAxis.type = Axis.AxisType.Value;
angleAxis.minMaxType = Axis.AxisMinMaxType.Custom;

View File

@@ -19,6 +19,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<CandlestickChart>();
chart.Init();
}
AddData();
}

View File

@@ -23,11 +23,19 @@ namespace XCharts.Example
{
AddData();
}
else if(Input.GetKeyDown(KeyCode.R))
else if (Input.GetKeyDown(KeyCode.R))
{
chart.AnimationReset();
chart.AnimationFadeIn();
}
else if (Input.GetKeyDown(KeyCode.U))
{
chart.UpdateData(0, 2, 99);
}
else if (Input.GetKeyDown(KeyCode.C))
{
chart.UpdateData(0, 2, 22);
}
}
void AddData()

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 - 2022 monitor1394
Copyright (c) 2018-present, monitor1394
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,80 +1,71 @@
<h2 align="center">XCharts</h2>
<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>
Unity数据可视化图表插件。
<br>
<a href="https://github.com/XCharts-Team/XCharts">中文文档</a>
A powerful, easy-to-use, configurable charting and data visualization library for Unity.<br/>Unity数据可视化图表插件。<br/>
<a href="https://github.com/XCharts-Team/XCharts">中文文档</a>
</p>
<p align="center">
<a href="https://github.com/XCharts-Team/XCharts/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/XCharts-Team/XCharts">
<img src="https://img.shields.io/github/license/XCharts-Team/XCharts"></img>
</a>
<a href="https://github.com/XCharts-Team/XCharts/releases">
<img src="https://img.shields.io/github/v/release/XCharts-Team/XCharts?include_prereleases">
<img src="https://img.shields.io/github/v/release/XCharts-Team/XCharts?include_prereleases"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/repo-size/monitor1394/unity-ugui-xcharts">
<img src="https://img.shields.io/github/repo-size/monitor1394/unity-ugui-xcharts"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts">
<img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts"></img>
</a>
<a href="">
<img src="https://img.shields.io/badge/Unity-5.6+-green">
<img src="https://img.shields.io/badge/Unity-5.6+-green"></img>
</a>
<a href="">
<img src="https://img.shields.io/badge/TextMeshPro-YES-green">
<img src="https://img.shields.io/badge/TextMeshPro-YES-green"></img>
</a>
</p>
<p align="center">
<a href="">
<img src="https://img.shields.io/github/stars/XCharts-Team/XCharts?style=social">
<img src="https://img.shields.io/github/stars/XCharts-Team/XCharts?style=social"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/forks/XCharts-Team/XCharts?style=social">
<img src="https://img.shields.io/github/forks/XCharts-Team/XCharts?style=social"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/issues-closed/XCharts-Team/XCharts?color=green&label=%20%20%20%20issues&logoColor=green&style=social">
<img src="https://img.shields.io/github/issues-closed/XCharts-Team/XCharts?color=green&label=%20%20%20%20issues&logoColor=green&style=social"></img>
</a>
</p>
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extended charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, and treemap.
![XCharts](Documentation~/zh/img/xcharts.png)
[XCharts3.0 Homepage](https://xcharts-team.github.io)
## Overview
[XCharts3.0 Tutorial](Documentation~/en/tutorial01.md)
[XCharts3.0 API](Documentation~/en/api.md)
[XCharts3.0 FAQ](Documentation~/en/faq.md)
[XCharts3.0 Configurate](Documentation~/en/configuration.md)
[XCharts3.0 Changelog](Documentation~/en/changelog.md)
[XCharts3.0 Support](Documentation~/en/support.md)
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extension charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, treemap, sankey, line3d and graph chart.
## Features
## Key Features
* __Pure code rendering__: The chart is completely rendered with pure code, without the need for additional texture or shader resources.
* __Visual configuration__: Visual configuration of parameters with real-time preview of the effect, and support for dynamic modification of configuration and data during runtime.
* __High customizability__: Supports arbitrary adjustments from theme and configuration parameters; supports custom drawing, callback functions, and custom implementations of charts.
* __Multiple built-in charts__: Supports various built-in charts such as line charts, bar charts, pie charts, radar charts, scatter plots, heat maps, polar charts, K-line charts, parallel coordinates, etc.
* __Multiple extended charts__: Supports extended charts such as 3D column charts, 3D pie charts, funnel charts, pyramids, dashboards, water level charts, iconic bar charts, Gantt charts, and tree maps.
* __Multiple extended features__: Supports extended UI components such as tables and statistical values.
* __Multiple chart combinations__: Supports arbitrary combinations of built-in charts, with multiple same or different types of charts displayed simultaneously in the same chart.
* __Various coordinate systems__: Supports coordinate systems such as Cartesian coordinates, polar coordinates, and single axes.
* __Rich components__: Supports common components such as titles, legends, tooltips, markings, marking areas, data area zooming, and visual mapping.
* __Rich line charts__: Supports various line charts such as straight line charts, curved line charts, dashed line charts, area charts, step line charts, etc.
* __Rich bar charts__: Supports various bar charts such as stacked bar charts, stacked percentage bar charts, zebra bar charts, and capsule bar charts.
* __Rich pie charts__: Supports various pie charts such as ring charts, rose charts, ring rose charts, etc.
* __Rich lines__: Supports various lines such as solid lines, curves, step lines, dashed lines, dot lines, dotted lines, and double dot-dashed lines.
* __Custom drawing__: Supports custom chart content drawing with powerful drawing APIs for drawing points, lines, and other graphics.
* __Large data rendering__: Supports rendering of tens of thousands of data points; supports sampling rendering; special simplified charts support better performance.
* __Custom themes__: Supports theme customization and import/export; includes both light and dark default themes.
* __Animations and interactions__: Supports various animations such as fade-in animation, fade-out animation, change animation, addition animation, and * interactive animation; supports interactive operations such as data filtering, view zooming, and detailed display on multiple platforms.
* __Third-party extensions__: Supports integration with TexMeshPro and New Input System.
* __Version and compatibility__: Supports all Unity versions above 5.6 and runs on all platforms.
- __Pure Code Rendering__: Charts are rendered with pure code, eliminating the need for extra texture or shader resources.
- __Visual Configuration__: Configure parameters visually with real-time preview and support for dynamic configuration and data adjustments at runtime.
- __High Customizability__: Themes and configuration parameters can be adjusted as needed, with support for custom drawing and callbacks.
- __Built-in and Extension Charts__: Supports a variety of chart types, including 3D charts and special chart types like gauges and treemaps.
- __Multiple Chart Combinations__: Combine multiple charts of the same or different types within a single instance.
- __Various Coordinate Systems__: Supports different coordinate systems such as Cartesian, polar, and single axes.
- __Rich Components__: Includes titles, legends, tooltips, and more.
- __Custom Drawing__: Utilize a powerful API for custom drawing of points, lines, and other graphics.
- __Large Data Rendering__: Capable of rendering tens of thousands of data points with support for sampling rendering.
- __Custom Themes__: Customize themes and use the included light and dark default themes.
- __Animations and Interactions__: Supports various animations and interactions for a dynamic user experience.
- __Third-Party Extensions__: Integrates with TextMeshPro and the New Input System.
- __Version and Compatibility__: Compatible with all Unity versions above 5.6 and runs on all platforms.
## Documentation
- [XCharts3.0 Homepage](https://xcharts-team.github.io/en)
- [XCharts3.0 Tutorial](Documentation~/en/tutorial01.md)
- [XCharts3.0 API](Documentation~/en/api.md)
- [XCharts3.0 FAQ](Documentation~/en/faq.md)
- [XCharts3.0 Configurate](Documentation~/en/configuration.md)
- [XCharts3.0 Changelog](Documentation~/en/changelog.md)
- [XCharts3.0 Support](Documentation~/en/support.md)
## Screenshots
@@ -82,55 +73,43 @@ A powerful and easy-to-use data visualization library for Unity. It supports mo
![extendchart](Documentation~/en/img/readme_extendchart.png)
## Attention
## Important Notes
* `XCharts3.0` is not fully compatible with `XCharts2.0` version, upgrading `3.0` may require some code adjustments, and some chart configurations need to be readjusting. It is recommended that old projects can continue to use `XCharts2.0`, and new projects are recommended to use `XCharts3.0`.
* `XCharts2.0` enters the maintenance phase, and only serious `bugs` will be fixed later, in principle, no more new features will be added.
* `XCharts` theoretically supports `Unity 5.6` and above, but due to limited version testing, it is inevitable to slip up, and version compatibility issues can be raised.
* This repository only contains `XCharts` source code, does not contain `Demo` sample section. Need to look at ` Demo ` please go to the sample source code [XCharts - Demo](https://github.com/XCharts-Team/XCharts-Demo) repo. You can also view the running effect of `WebGL` in your browser [Online Demo](https://xcharts-team.github.io/examples/).
- `XCharts3.0` is not fully compatible with `XCharts2.0`. Upgrading to 3.0 may require code adjustments and reconfiguration of some charts.
- `XCharts2.0` is in the maintenance phase with only critical bug fixes applied.
- While XCharts supports Unity 5.6 and above, compatibility issues may arise due to limited testing.
- This repository contains only the `XCharts` source code. For demos, visit the [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) repo or the [Online Demo](https://xcharts-team.github.io/en/examples/).
## Use
## Getting Started
* Import `XCharts` unitypackage or source code into the project.
* Right-click `Hierarchy` view and choose `XCharts->LineChart` to create a default LineChart.
* You can adjust the parameters of each component in `Inspector` and see the real-time effects in `Game` view.
* For more details, see [[XCharts Tutorial: 5-minute tutorial]](Documentation~/zh/tutorial01.md)
* For the first time, it is recommended to read the tutorial carefully.
1. Import the `XCharts` unitypackage or source code into your Unity project.
2. Create a chart by right-clicking in the `Hierarchy` view and selecting `UI->XCharts->LineChart`.
3. Adjust component parameters in the `Inspector` to see real-time effects in the `Game` view.
4. For more details, refer to the [5-minute tutorial](Documentation~/en/tutorial01.md).
## Branch
## Branch Information
* `master` : indicates the development branch. The latest changes and new features are first committed to the `master` branch, and after some time from the `master` branch `merge` to the `3.0` branch, and the `release` version.
* `3.0` : Stable branch of XCharts 3.0. It is generally updated once a month, with the latest changes from the `master` branch `merge`, and the `release` version is released.
* `2.0` : A stable branch of XCharts 2.0. With Demo, currently no longer maintenance, only to modify serious bugs.
* `2.0-upm` : Stable UMP branch of XCharts 2.0. Only the Package part is included without Demo. It is dedicated to the UMP and is not maintained.
* `1.0` : Stable branch of XCharts 1.0. With Demo, no maintenance.
* `1.0-upm` : stable UMP branch of XCharts 1.0. No Demo, no maintenance.
- __master__ indicates the development branch. The latest changes and new features are first committed to the `master` branch, and after some time from the `master` branch `merge` to the `3.0` branch, and the `release` version.
- __3.0__ Stable branch of XCharts 3.0. It is generally updated once a month, with the latest changes from the `master` branch `merge`, and the `release` version is released.
- __2.0__ A stable branch of XCharts 2.0. With Demo, currently no longer maintenance, only to modify serious bugs.
- __2.0-upm__ Stable UMP branch of XCharts 2.0. Only the Package part is included without Demo. It is dedicated to the UMP and is not maintained.
- __1.0__ Stable branch of XCharts 1.0. With Demo, no maintenance.
- __1.0-upm__ stable UMP branch of XCharts 1.0. No Demo, no maintenance.
## FAQ
* Is `XCharts` free to use?
A: `XCharts` uses the `MIT` licence and is free to use. You can also subscribe to `VIP` to enjoy more value-added services.
* Does `XCharts` support code to dynamically add and modify data? Does it support getting data from `Excel` or a database?
A: Support code to dynamically add and modify data, but data needs to be parsed or retrieved by itself, and then added to `XCharts` by calling the public interface of `XCharts`.
* Does this plugin work on other platforms (e.g. Winform or WPF) besides Unity?
A: It is currently only supported on Unity. Theoretically any version of Unity that supports `UGUI` can run `XCharts`.
* What about the jags? What magnitude of data is supported?
A: XCharts is based on UGUI implementation, so the problems encountered in UGUI will also exist in XCharts. For example, the sawtooth problem, such as the number of vertices in `Mesh` exceeds `65535`. Solutions to these two problems can be found in [Q&A 16](Documentation~/zh/faq.md) and [Q&A 27](Documentation~/zh/faq.md).
Due to the `Mesh` of the `65535` vertex limit, the current `XCharts` single `Line` supports about `20,000` of data, of course, open sampling can support more data to draw, but at the same time it will consume more CPU.
- __Is XCharts free to use?__ Yes, XCharts is free under the MIT license and includes value-added VIP services.
- __Does XCharts support dynamic data addition and modification?__ Yes, but data must be parsed or retrieved by the user.
- __Does this plugin work on platforms other than Unity?__ No, it is designed for Unity only.
## Changelog
* [Changelog](Documentation~/en/changelog.md)
- [Changelog](Documentation~/en/changelog.md)
## Licenses
* [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md)
* Free commercial, secondary development
* The extended charts and advanced features sections require a separate purchase license
- XCharts is released under the [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md).
## Other
## Contact
email: `monitor1394@gmail.com`
- For more information or support, contact us at `monitor1394@gmail.com`.

149
README.md
View File

@@ -1,15 +1,8 @@
<p align="center">
<a href="">
<img src="" alt="" width="" height=""></img>
</a>
</p>
<h2 align="center">XCharts</h2>
<p align="center">
A powerful, easy-to-use, configurable charting and data visualization library for Unity.
<br/>
Unity数据可视化图表插件。
<br/>
<a href="README-en.md">English README</a>
A powerful, easy-to-use, configurable charting and data visualization library for Unity.<br/>Unity数据可视化图表插件。<br/>
<a href="README-en.md">English README</a>
</p>
<p align="center">
<a href="https://github.com/XCharts-Team/XCharts/blob/master/LICENSE">
@@ -43,39 +36,40 @@
</a>
</p>
一款基于`UGUI`的功能强大、简单易用的数据可视化图表插件。支持`折线图``柱状图``饼图``雷达图``散点图``热力图``环形图``K线图``极坐标``平行坐标`等十多种内置图表,以及`3D饼图``3D柱图``3D金字塔``漏斗图``仪表盘``水位图``象形柱图``甘特图``矩形树图`等扩展图表。
![XCharts](Documentation~/zh/img/xcharts.png)
XCharts 是一款基于 UGUI 的功能强大、简单易用的 Unity 数据可视化图表插件。它提供了丰富的图表类型和灵活的配置选项帮助开发者快速实现专业级的数据可视化效果。支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十多种常用的内置图表。提供3D饼图、3D柱图、3D金字塔、漏斗图、仪表盘、水位图、象形柱图、甘特图、矩形树图、桑基图、3D折线图、关系图等十多种高级扩展图表。
[XCharts 官方主页](https://xcharts-team.github.io)
[XCharts 在线示例](https://xcharts-team.github.io/examples)
[XCharts 教程5分钟上手 XCharts](Documentation~/zh/tutorial01.md)
[XCharts API文档](Documentation~/zh/api.md)
[XCharts 问答](Documentation~/zh/faq.md)
[XCharts 常见问题](Documentation~/zh/faq.md)
[XCharts 配置项手册](Documentation~/zh/configuration.md)
[XCharts 更新日志](Documentation~/zh/changelog.md)
[XCharts 订阅服务](Documentation~/zh/support.md)
## 特性
- __纯代码绘制__图表完全纯代码绘制,无需额外贴图Shader资源。
- __可视化配置__参数可视化配置,效果实时预览,也支持运行时代码动态修改配置和数据。
- __高自由定制__支持从主题和配置参数上任意调整;支持代码自定义绘制,自定义回调以及自定义实现图表
- __多内置图表__支持线图、状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等多种内置图表。
- __多扩展图表__支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种扩展图表。
- __多扩展功能__支持表格、统计数值等扩展UI组件
- __多图表组合__支持内置图表的任意组合,同一图中可同时显示多个相同或不同类型的图表。
- __多种坐标系__支持直角坐标系、极坐标系、单轴等多种坐标系。
- __丰富的组件__支持标题、图例、提示框、标线、标域、数据区域缩放、视觉映射等常用组件。
- __丰富的线图__支持直线、曲线、虚线、面积图、阶梯线图等多种线图。
- __丰富的柱图__支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图、胶囊柱图等多种柱状图。
- __丰富的饼图__支持环形图、玫瑰图、环形玫瑰图等多种饼图。
- __丰富的线条__支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条
- __自定义绘制__支持自定义图表内容绘制提供绘制点、线、面等其他图形的强大的绘图API
- __大数据绘制__支持万级大数据量绘制支持采样绘制特殊的简化图表支持更优的性能
- __自定义主题__支持主题定制、导入和导出内置明暗两种默认主题
- __动画和交互__支持渐入动画、渐出动画、变更动画、新增动画、交互动画等多种动画支持多平台的数据筛选、视图缩放、细节展示等交互操作
- __第三方扩展__支持接入`TexMeshPro``New Input System`
- __版本和兼容__支持所有`5.6`以上的`Unity`版本;支持全平台运行。
- __纯代码绘制__图表完全通过代码生成,无需额外贴图Shader 资源,轻量高效
- __可视化配置__提供直观的参数配置界面,支持实时预览效果,并可在运行时动态修改配置和数据。
- __高定制__支持从主题、组件到数据项的全面参数设置,同时允许通过代码自定义绘制逻辑、回调函数及图表实现
- __多内置图表__支持线图、状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等多种常用的内置图表。
- __多扩展图表__支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图、桑基图、3D折线图、关系图等多种高级扩展图表,满足复杂数据可视化需求
- __多扩展组件__支持多种实用 UI 组件,如表格、统计数值、滑动条、进度条等,增强图表交互性
- __多图表组合__支持在同一图表中组合显示多个相同或不同类型的图表,满足复杂场景需求
- __多种坐标系__支持直角坐标系、极坐标系、单轴等多种坐标系,适应不同数据展示需求
- __丰富的组件__提供标题、图例、提示框、标线、标域、数据区域缩放、视觉映射等常用组件,提升图表可读性
- __多样式线图__支持直线、曲线、虚线、面积图、阶梯线图等多种线图样式,满足不同数据趋势展示需求
- __多样式柱图__支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图、胶囊柱图等多种柱状图样式
- __多样式饼图__支持环形图、玫瑰图、环形玫瑰图等多种饼图样式,直观展示数据占比
- __自定义绘制__提供强大的绘图 API支持自定义绘制点、线、面等图形满足个性化需求
- __大数据绘制__支持万级数据量绘制,优化性能表现;支持采样绘制,进一步提升大数据场景下的性能
- __自定义主题__支持主题定制、导入和导出内置明暗两种默认主题轻松适配不同应用场景
- __动画和交互__支持渐入、渐出、变更、新增等多种动画效果以及数据筛选、视图缩放、细节展示等交互操作提升用户体验
- __第三方扩展__无缝集成TexMeshPro和New Input System扩展功能兼容性
- __版本和兼容__支持 Unity 5.6 及以上版本,兼容全平台运行
## 截图
@@ -83,65 +77,76 @@
![扩展图表](Documentation~/zh/img/readme_extendchart.png)
## 注意
- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,升级`3.0`可能需要调整部分代码,图表部分配置需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`
- `XCharts2.0` 进入维护阶段,后续只修复严重`bug`,原则上不再加新功能。
- `XCharts` 理论上支持`Unity 5.6`及以上版本,但由于版本测试有限难免疏漏,发现版本兼容问题可提`Issue`
- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`示例源码请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。也可以在浏览器查看`WebGL`下的运行效果 [在线Demo](https://xcharts-team.github.io/examples/) 。
## 使用
- 导入`XCharts``unitypackage`或者源码到项目。
- 导入`XCharts``unitypackage`或者源码到项目。建议也导入`XCharts`守护程序 [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)。
-`Hierarchy`视图下右键选择`XCharts->LineChart`,即可创建一个默认的折线图。
- `Inspector`视图可以调整各个组件的参数,`Game`视图可看到实时效果
- 更多细节,请看[【XCharts教程5分钟上手教程】](Documentation~/zh/tutorial01.md)
- `Inspector`视图下的`Add Serie``Add Main Component`按钮可以添加`Serie``组件`
- `Inspector`视图下可以调整各个组件的参数,`Game`视图可看到实时效果。
- 更多细节,请看[【XCharts教程5分钟上手教程】](Documentation~/zh/tutorial01.md)。
- 首次使用,建议先认真看一遍教程。
## 分支
## 常见问题 (FAQ)
- `master`:开发分支。最新的修改和新功能都先提交到`master`分支,一段时间后再从`master`分支`merge``3.0`分支,并发布`release`版本。
- `3.0`XCharts 3.0的稳定分支。一般一个月一更新,从`master`分支`merge`最新改动过来,并发布`release`版本
- `2.0`XCharts 2.0的稳定分支。带Demo目前基本不再维护仅修改严重bug。
- `2.0-upm`XCharts 2.0的稳定UMP分支。不带Demo只包含Package部分专门给UMP用不再维护。
- `1.0`XCharts 1.0的稳定分支。带Demo不再维护。
- `1.0-upm`XCharts 1.0的稳定UMP分支。不带Demo不再维护。
- __XCharts 可以免费使用吗__
XCharts 基于 MIT 协议,核心功能完全免费。您也可以订阅 VIP 服务,享受更多高级功能和专属技术支持
## FAQ
- __XCharts 支持代码动态添加和修改数据吗__
是的XCharts 提供了丰富的数据操作接口,支持代码动态修改配置和数据。但数据来源(如 Excel 或数据库)需要您自行解析后调用 XCharts 接口添加到图表中。
- `XCharts`可以免费使用吗?
答:`XCharts`使用`MIT`协议,可以免费使用。也可以订阅`VIP`享受更多增值服务
- __XCharts 支持哪些平台__
XCharts 专为 Unity 平台设计,支持 Unity 5.6 及以上版本。理论上,任何支持 UGUI 的 Unity 版本均可运行 XCharts。目前不支持 Winform 或 WPF 等其他平台
- `XCharts`支持代码动态添加和修改数据吗?支持从`Excel`或数据库中获取数据吗?
答:`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析和获取,再调用`XCharts`的接口添加到图表。
- __如何解决锯齿问题XCharts 支持多大的数据量__
XCharts 基于 UGUI 实现,因此 UGUI 的常见问题如锯齿、Mesh 顶点数限制)在 XCharts 中也会存在。
- __锯齿问题__可通过调整抗锯齿设置或使用更高分辨率解决。
- __数据量限制__单条折线图Line支持约 2 万数据点,开启采样后可支持更多数据,但会消耗更多 CPU 资源。
更多解决方案请参考 [问答 16](Documentation~/zh/faq.md) 和 [问答 27](Documentation~/zh/faq.md)。
- `XCharts`除了用在`Unity`平台,还能用在`Winform``WPF`等平台吗?
答:`XCharts`只支持在`Unity`平台使用。理论上任何支持`UGUI``Unity`版本都能运行`XCharts`
- 锯齿怎么解决?支持多大量级的数据?
答:`XCharts`是基于`UGUI`实现的,所以`UGUI`中碰到的问题,在`XCharts`中也会存在。比如锯齿问题,比如`Mesh`顶点数超`65535`的问题。这两个问题的解决可参考[问答16](Documentation~/zh/faq.md)和[问答27](Documentation~/zh/faq.md)。
由于`Mesh``65535`顶点数的限制,目前`XCharts`的单条`Line`支持约`2万`的数据量当然开启采样可以支持更多数据的绘制但同时也会更消耗CPU。
## Licenses
- [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md)
- 可免费商用,可二次开发
- 扩展图表和高级功能部分需单独购买授权
- __哪里可以查看 Demo__
本仓库仅包含 XCharts 源码Demo 示例请访问 [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) 仓库。您也可以在浏览器中查看 [在线 Demo](https://xcharts-team.github.io/examples/)
## 日志
- [更新日志](Documentation~/zh/changelog.md)
- 各版本的详细更新日志请查看 [更新日志](Documentation~/zh/changelog.md)
## 扩展
- __[XCharts](https://github.com/XCharts-Team/XCharts)__ 核心功能,完全开源免费
- __[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)__ 守护程序确保XCharts更新时的编译正常
- __[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)__ 官方示例(不包含扩展图表的示例)
- __[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)__ 专业版,包含所有扩展图表和扩展组件(需订阅 SVIP
- __[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo)__ 专业版官方示例(需订阅 SVIP
- __[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)__ 扩展UI组件需订阅 VIP
- __[XCharts-Bar3DChart](https://github.com/XCharts-Team/XCharts-Bar3DChart)__ 3D柱图需订阅 VIP
- __[XCharts-FunnelChart](https://github.com/XCharts-Team/XCharts-FunnelChart)__ 漏斗图(需订阅 VIP
- __[XCharts-GanttChart](https://github.com/XCharts-Team/XCharts-GanttChart)__ 甘特图(需订阅 VIP
- __[XCharts-GaugeChart](https://github.com/XCharts-Team/XCharts-GaugeChart)__ 仪表盘(需订阅 VIP
- __[XCharts-LiquidChart](https://github.com/XCharts-Team/XCharts-LiquidChart)__ 水位图(需订阅 VIP
- __[XCharts-PictorialBarChart](https://github.com/XCharts-Team/XCharts-PictorialBarChart)__ 象形住图(需订阅 VIP
- __[XCharts-Pie3DChart](https://github.com/XCharts-Team/XCharts-Pie3DChart)__ 3D饼图需订阅 VIP
- __[XCharts-PyramidChart](https://github.com/XCharts-Team/XCharts-PyramidChart)__ 3D金字塔需订阅 VIP
- __[XCharts-TreemapChart](https://github.com/XCharts-Team/XCharts-TreemapChart)__ 矩形树图(需订阅 VIP
- __[XCharts-SankeyChart](https://github.com/XCharts-Team/XCharts-SankeyChart)__ 桑基图(需订阅 VIP
- __[XCharts-Line3DChart](https://github.com/XCharts-Team/XCharts-Line3DChart)__ 3D折线图需订阅 VIP
- __[XCharts-GraphChart](https://github.com/XCharts-Team/XCharts-GraphChart)__ 关系图(需订阅 VIP
## 许可
- __[MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md)__XCharts 核心库基于 MIT 协议,允许免费商用和二次开发。
- __扩展功能授权__扩展图表和高级功能需订阅 VIP 或 SVIP 服务获得使用许可。
## 订阅
- `XCharts`核心库开源,可免费使用的。在此基础上,我们也提供多种订阅服务以满足不同用户的需求,订阅详情[☞ 请看这里](Documentation~/zh/support.md)
- 订阅不是必须的,不影响`XCharts`的常用功能使用
- 订阅是按年付费制,部分订阅服务的首年费用比次年要高,是因为包含了购买部分源码。次年的费用基本都是服务费
- 订阅到期后,不要求必须续订,但中断订阅期间无法享受技术支持服务。如需继续服务,可从当日继续续订即可。
- __核心功能免费__XCharts 核心库基于 MIT 协议完全开源,可免费使用
- __增值服务__为满足多样化需求我们提供多种订阅服务详情请查看 [订阅详情](Documentation~/zh/support.md)
- __灵活选择__订阅非强制不影响核心功能使用
- __按年付费__订阅服务按年计费到期后可选择续订。中断订阅后,将无法享受更新和技术支持服务。
## 其他
- 邮箱:`monitor1394@gmail.com`
- QQ群XCharts交流群`202030963`
- VIP群XCharts技术支持VIP群`867291970`
- 捐助、合作、订阅和技术支持:[☞ 看这里](Documentation~/zh/support.md)
- VIP群XCharts VIP群`867291970`
- 支持与合作:[订阅与支持](Documentation~/zh/support.md)

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Bar chart shows different data through the height of a bar, which is used in rectangular coordinate with at least 1 category axis.
/// || 柱状图(或称条形图)是一种通过柱形的高度(横向的情况下则是宽度)来表现数据大小的一种常用图表类型。
/// </summary>
[AddComponentMenu("XCharts/BarChart", 14)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -22,5 +26,153 @@ namespace XCharts.Runtime
AddXAxisData("x" + (i + 1));
}
}
/// <summary>
/// default zebra column chart.
/// || 斑马柱状图。
/// </summary>
public void DefaultZebraColumnChart()
{
CheckChartInit();
var serie = GetSerie(0);
if (serie == null) return;
serie.barType = BarType.Zebra;
}
/// <summary>
/// default capsule column chart.
/// || 胶囊柱状图。
/// </summary>
public void DefaultCapsuleColumnChart()
{
CheckChartInit();
var serie = GetSerie(0);
if (serie == null) return;
serie.barType = BarType.Capsule;
}
/// <summary>
/// default grouped column chart.
/// || 默认分组柱状图。
/// </summary>
public void DefaultGroupedColumnChart()
{
CheckChartInit();
Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
}
/// <summary>
/// default stacked column chart.
/// || 默认堆叠分组柱状图。
/// </summary>
public void DefaultStackedColumnChart()
{
CheckChartInit();
var serie1 = GetSerie(0);
serie1.stack = "stack1";
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
serie2.stack = "stack1";
}
/// <summary>
/// default percent column chart.
/// || 默认百分比柱状图。
/// </summary>
public void DefaultPercentColumnChart()
{
CheckChartInit();
var serie1 = GetSerie(0);
serie1.stack = "stack1";
serie1.barPercentStack = true;
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
serie2.stack = "stack1";
serie2.barPercentStack = true;
}
/// <summary>
/// default bar chart.
/// || 默认条形图。
/// </summary>
public void DefaultBarChart()
{
CheckChartInit();
CovertColumnToBar(this);
}
/// <summary>
/// default zebra bar chart.
/// || 默认斑马条形图。
/// </summary>
public void DefaultZebraBarChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.barType = BarType.Zebra;
CovertColumnToBar(this);
}
/// <summary>
/// default capsule bar chart.
/// || 默认胶囊条形图。
/// </summary>
public void DefaultCapsuleBarChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.barType = BarType.Capsule;
CovertColumnToBar(this);
}
/// <summary>
/// default grouped bar chart.
/// || 默认分组条形图。
/// </summary>
public void DefaultGroupedBarChart()
{
CheckChartInit();
Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
CovertColumnToBar(this);
}
/// <summary>
/// default stacked bar chart.
/// || 默认堆叠条形图。
/// </summary>
public void DefaultStackedBarChart()
{
CheckChartInit();
var serie1 = GetSerie(0);
serie1.stack = "stack1";
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
serie2.stack = "stack1";
CovertColumnToBar(this);
}
/// <summary>
/// default percent bar chart.
/// || 默认百分比条形图。
/// </summary>
public void DefaultPercentBarChart()
{
CheckChartInit();
var serie1 = GetSerie(0);
serie1.stack = "stack1";
serie1.barPercentStack = true;
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
serie2.stack = "stack1";
serie2.barPercentStack = true;
CovertColumnToBar(this);
}
private static void CovertColumnToBar(BarChart chart)
{
chart.ConvertXYAxis(0);
var xAxis = chart.GetChartComponent<XAxis>();
xAxis.axisLine.show = false;
xAxis.axisTick.show = false;
var yAxis = chart.GetChartComponent<YAxis>();
yAxis.axisTick.alignWithLabel = true;
}
}
}

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// A candlestick chart is a style of financial chart used to describe price movements of a security, derivative, or currency.
/// || 蜡烛图也叫K线图用于描述证券、衍生品或货币的价格走势的一种金融图表样式。
/// </summary>
[AddComponentMenu("XCharts/CandlestickChart", 23)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]

View File

@@ -3,6 +3,12 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Heat map mainly use colors to represent values, which must be used along with visualMap component.
/// It can be used in either rectangular coordinate or geographic coordinate. But the behaviour on them are quite different. Rectangular coordinate must have two categories to use it.
/// ||热力图主要通过颜色去表现数值的大小,必须要配合 visualMap 组件使用。
/// 可以应用在直角坐标系以及地理坐标系上,这两个坐标系上的表现形式相差很大,直角坐标系上必须要使用两个类目轴。
/// </summary>
[AddComponentMenu("XCharts/HeatmapChart", 18)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -13,23 +19,26 @@ namespace XCharts.Runtime
protected override void DefaultChart()
{
var grid = EnsureChartComponent<GridCoord>();
grid.UpdateRuntimeData(this);
grid.left = 0.12f;
var heatmapGridWid = 18f;
int xSplitNumber = (int)(grid.context.width / heatmapGridWid);
int ySplitNumber = (int)(grid.context.height / heatmapGridWid);
var xAxis = EnsureChartComponent<XAxis>();
xAxis.type = Axis.AxisType.Category;
xAxis.splitLine.show = false;
xAxis.boundaryGap = true;
xAxis.splitNumber = 10;
xAxis.splitNumber = xSplitNumber / 2;
var yAxis = EnsureChartComponent<YAxis>();
yAxis.type = Axis.AxisType.Category;
yAxis.splitLine.show = false;
yAxis.boundaryGap = true;
yAxis.splitNumber = 10;
yAxis.splitNumber = ySplitNumber;
RemoveData();
var heatmapGridWid = 10f;
int xSplitNumber = (int) (grid.context.width / heatmapGridWid);
int ySplitNumber = (int) (grid.context.height / heatmapGridWid);
Heatmap.AddDefaultSerie(this, GenerateDefaultSerieName());
var visualMap = EnsureChartComponent<VisualMap>();
@@ -72,5 +81,32 @@ namespace XCharts.Runtime
}
}
}
/// <summary>
/// default count heatmap chart.
/// || 默认计数热力图。
/// </summary>
public void DefaultCountHeatmapChart()
{
CheckChartInit();
var serie = GetSerie<Heatmap>(0);
serie.heatmapType = HeatmapType.Count;
var xAxis = GetChartComponent<XAxis>();
xAxis.type = Axis.AxisType.Value;
xAxis.splitNumber = 4;
var yAxis = GetChartComponent<YAxis>();
yAxis.type = Axis.AxisType.Value;
yAxis.splitNumber = 2;
serie.ClearData();
for (int i = 0; i < 100; i++)
{
var x = UnityEngine.Random.Range(0, 100);
var y = UnityEngine.Random.Range(0, 100);
AddData(0, x, y);
}
}
}
}

View File

@@ -2,6 +2,12 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Line chart relates all the data points symbol by broken lines, which is used to show the trend of data changing.
/// It could be used in both rectangular coordinate andpolar coordinate.
/// ||折线图是用折线将各个数据点标志连接起来的图表,用于展现数据的变化趋势。可用于直角坐标系和极坐标系上。
/// 设置 areaStyle 后可以绘制面积图。
/// </summary>
[AddComponentMenu("XCharts/LineChart", 13)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -22,5 +28,119 @@ namespace XCharts.Runtime
AddXAxisData("x" + (i + 1));
}
}
/// <summary>
/// default area line chart.
/// || 默认面积折线图。
/// </summary>
public void DefaultAreaLineChart()
{
CheckChartInit();
var serie = GetSerie(0);
if (serie == null) return;
serie.EnsureComponent<AreaStyle>();
}
/// <summary>
/// default smooth line chart.
/// || 默认平滑折线图。
/// </summary>
public void DefaultSmoothLineChart()
{
CheckChartInit();
var serie = GetSerie(0);
if (serie == null) return;
serie.lineType = LineType.Smooth;
}
/// <summary>
/// default smooth area line chart.
/// || 默认平滑面积折线图。
/// </summary>
public void DefaultSmoothAreaLineChart()
{
CheckChartInit();
var serie = GetSerie(0);
if (serie == null) return;
serie.EnsureComponent<AreaStyle>();
serie.lineType = LineType.Smooth;
}
/// <summary>
/// default stack line chart.
/// || 默认堆叠折线图。
/// </summary>
public void DefaultStackLineChart()
{
CheckChartInit();
var serie1 = GetSerie(0);
if (serie1 == null) return;
serie1.stack = "stack1";
var serie2 = Line.AddDefaultSerie(this, GenerateDefaultSerieName());
serie2.stack = "stack1";
}
/// <summary>
/// default stack area line chart.
/// || 默认堆叠面积折线图。
/// </summary>
public void DefaultStackAreaLineChart()
{
CheckChartInit();
var serie1 = GetSerie(0);
if (serie1 == null) return;
serie1.EnsureComponent<AreaStyle>();
serie1.stack = "stack1";
var serie2 = Line.AddDefaultSerie(this, GenerateDefaultSerieName());
serie2.EnsureComponent<AreaStyle>();
serie2.stack = "stack1";
}
/// <summary>
/// default step line chart.
/// || 默认阶梯折线图。
/// </summary>
public void DefaultStepLineChart()
{
CheckChartInit();
var serie = GetSerie(0);
if (serie == null) return;
serie.lineType = LineType.StepMiddle;
}
/// <summary>
/// default dash line chart.
/// || 默认虚线折线图。
/// </summary>
public void DefaultDashLineChart()
{
CheckChartInit();
var serie = GetSerie(0);
if (serie == null) return;
serie.lineType = LineType.Normal;
serie.lineStyle.type = LineStyle.Type.Dashed;
}
/// <summary>
/// default time line chart.
/// || 默认时间折线图。
/// </summary>
public void DefaultTimeLineChart()
{
CheckChartInit();
var xAxis = GetChartComponent<XAxis>();
xAxis.type = Axis.AxisType.Time;
}
/// <summary>
/// default logarithmic line chart.
/// || 默认对数轴折线图。
/// </summary>
public void DefaultLogLineChart()
{
CheckChartInit();
var yAxis = GetChartComponent<YAxis>();
yAxis.type = Axis.AxisType.Log;
}
}
}

View File

@@ -3,6 +3,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Parallel Coordinates is a common way of visualizing high-dimensional geometry and analyzing multivariate data.
/// || 平行坐标系,通过绘制垂直于坐标轴的平行线来显示数据的一种可视化图表。
/// </summary>
[AddComponentMenu("XCharts/ParallelChart", 25)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// The pie chart is mainly used for showing proportion of different categories. Each arc length represents the proportion of data quantity.
/// || 饼图主要用于显示不同类目占比的情况,通过弧长来反映数据的大小占比。
/// </summary>
[AddComponentMenu("XCharts/PieChart", 15)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -17,5 +21,69 @@ namespace XCharts.Runtime
RemoveData();
Pie.AddDefaultSerie(this, GenerateDefaultSerieName());
}
/// <summary>
/// default label pie chart.
/// || 默认带标签饼图。
/// </summary>
public void DefaultLabelPieChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.EnsureComponent<LabelStyle>();
serie.EnsureComponent<LabelLine>();
}
/// <summary>
/// default donut pie chart.
/// || 默认甜甜圈饼图。
/// </summary>
public void DefaultDonutPieChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.radius[0] = 0.20f;
serie.radius[1] = 0.28f;
}
/// <summary>
/// default label donut pie chart.
/// || 默认带标签甜甜圈饼图。
/// </summary>
public void DefaultLabelDonutPieChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.radius[0] = 0.20f;
serie.radius[1] = 0.28f;
serie.EnsureComponent<LabelStyle>();
serie.EnsureComponent<LabelLine>();
}
/// <summary>
/// default rose pie chart.
/// || 默认玫瑰饼图。
/// </summary>
public void DefaultRadiusRosePieChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.pieRoseType = RoseType.Radius;
serie.EnsureComponent<LabelStyle>();
serie.EnsureComponent<LabelLine>();
}
/// <summary>
/// default area rose pie chart.
/// || 默认面积玫瑰饼图。
/// </summary>
public void DefaultAreaRosePieChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.pieRoseType = RoseType.Area;
serie.EnsureComponent<LabelStyle>();
serie.EnsureComponent<LabelLine>();
}
}
}

View File

@@ -1,7 +1,12 @@
using UnityEngine;
using System.Collections.Generic;
namespace XCharts.Runtime
{
/// <summary>
/// Polar coordinates are usually used in a circular layout.
/// || 极坐标系,可以用于散点图和折线图。
/// </summary>
[AddComponentMenu("XCharts/PolarChart", 23)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -13,16 +18,18 @@ namespace XCharts.Runtime
{
EnsureChartComponent<PolarCoord>();
EnsureChartComponent<AngleAxis>();
EnsureChartComponent<RadiusAxis>();
var radiusAxis = EnsureChartComponent<RadiusAxis>();
radiusAxis.axisLabel.show = false;
var tooltip = EnsureChartComponent<Tooltip>();
tooltip.type = Tooltip.Type.Corss;
tooltip.type = Tooltip.Type.Cross;
tooltip.trigger = Tooltip.Trigger.Axis;
RemoveData();
var serie = Line.AddDefaultSerie(this, GenerateDefaultSerieName());
serie.SetCoord<PolarCoord>();
serie.ClearData();
serie.symbol.show = false;
for (int i = 0; i <= 360; i++)
{
var t = i / 180f * Mathf.PI;
@@ -30,5 +37,132 @@ namespace XCharts.Runtime
AddData(0, Mathf.Abs(r), i);
}
}
/// <summary>
/// default radial bar polar chart.
/// || 默认径向柱状极坐标图。
/// </summary>
public void DefaultRadialBarPolarChart()
{
CheckChartInit();
RemoveData();
var polarCoord = GetChartComponent<PolarCoord>();
polarCoord.radius[0] = 20;
var categorys = new string[] { "a", "b", "c", "d" };
var radiusAxis = GetChartComponent<RadiusAxis>();
radiusAxis.splitNumber = 4;
var angleAxis = GetChartComponent<AngleAxis>();
angleAxis.type = Axis.AxisType.Category;
angleAxis.startAngle = 75;
angleAxis.boundaryGap = true;
angleAxis.splitLine.show = false;
foreach (var category in categorys)
angleAxis.AddData(category);
var serie = AddSerie<Bar>(GenerateDefaultSerieName());
serie.SetCoord<PolarCoord>();
serie.ClearData();
serie.symbol.show = false;
for (int i = 0; i < categorys.Length; i++)
{
var x = UnityEngine.Random.Range(0f, 4f);
var y = i;
AddData(0, x, y, categorys[i]);
}
}
/// <summary>
/// default tangential bar polar chart.
/// || 默认切向柱状极坐标图。
/// </summary>
public void DefaultTangentialBarPolarChart()
{
CheckChartInit();
RemoveData();
var polarCoord = GetChartComponent<PolarCoord>();
polarCoord.radius[0] = 20;
var categorys = new string[] { "a", "b", "c", "d" };
var radiusAxis = GetChartComponent<RadiusAxis>();
radiusAxis.type = Axis.AxisType.Category;
radiusAxis.splitNumber = 4;
radiusAxis.boundaryGap = true;
var angleAxis = GetChartComponent<AngleAxis>();
angleAxis.type = Axis.AxisType.Value;
radiusAxis.splitNumber = 12;
angleAxis.startAngle = 75;
angleAxis.max = 4;
foreach (var category in categorys)
radiusAxis.AddData(category);
var serie = AddSerie<Bar>(GenerateDefaultSerieName());
serie.SetCoord<PolarCoord>();
serie.ClearData();
serie.symbol.show = false;
for (int i = 0; i < categorys.Length; i++)
{
var x = UnityEngine.Random.Range(0f, 4f);
var y = i;
AddData(0, y, x, categorys[i]);
}
}
/// <summary>
/// default heatmap polar chart.
/// || 默认极坐标色块图。
/// </summary>
public void DefaultHeatmapPolarChart()
{
CheckChartInit();
RemoveData();
var visualMap = EnsureChartComponent<VisualMap>();
var colors = new List<string> { "#BAE7FF", "#1890FF", "#1028ff" };
visualMap.AddColors(colors);
visualMap.autoMinMax = true;
var polarCoord = GetChartComponent<PolarCoord>();
polarCoord.radius[0] = 20;
var categorys = new string[] { "a", "b", "c", "d" };
var radiusAxis = GetChartComponent<RadiusAxis>();
radiusAxis.type = Axis.AxisType.Category;
radiusAxis.splitNumber = 4;
radiusAxis.boundaryGap = true;
var angleAxis = GetChartComponent<AngleAxis>();
angleAxis.type = Axis.AxisType.Category;
angleAxis.boundaryGap = true;
angleAxis.splitNumber = 24;
angleAxis.startAngle = 75;
angleAxis.max = 4;
foreach (var category in categorys)
radiusAxis.AddData(category);
for (int i = 0; i < 24; i++)
{
angleAxis.AddData(i + "h");
}
var serie = AddSerie<Heatmap>(GenerateDefaultSerieName());
serie.SetCoord<PolarCoord>();
serie.ClearData();
serie.symbol.show = false;
for (int x = 0; x < 4; x++)
{
for (int y = 0; y < 24; y++)
{
AddData(0, x, y, UnityEngine.Random.Range(0f, 4f));
}
}
}
}
}

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Radar chart is mainly used to show multi-variable data, such as the analysis of a football player's varied attributes. It relies radar component.
/// || 雷达图主要用于显示多变量的数据,例如足球运动员的各项属性分析。依赖雷达组件。
/// </summary>
[AddComponentMenu("XCharts/RadarChart", 16)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -16,5 +20,16 @@ namespace XCharts.Runtime
AddChartComponent<RadarCoord>();
Radar.AddDefaultSerie(this, GenerateDefaultSerieName());
}
/// <summary>
/// default circle radar chart.
/// || 默认圆形雷达图。
/// </summary>
public void DefaultCircleRadarChart()
{
CheckChartInit();
var radarCoord = GetChartComponent<RadarCoord>();
radarCoord.shape = RadarCoord.Shape.Circle;
}
}
}

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Ring chart is mainly used to show the proportion of each item and the relationship between the items.
/// || 环形图主要用于显示每一项的比例以及各项之间的关系。
/// </summary>
[AddComponentMenu("XCharts/RingChart", 20)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -15,5 +19,18 @@ namespace XCharts.Runtime
RemoveData();
Ring.AddDefaultSerie(this, GenerateDefaultSerieName());
}
/// <summary>
/// default multiple ring chart.
/// || 默认多圆环图。
/// </summary>
public void DefaultMultipleRingChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.label.show = false;
AddData(0, UnityEngine.Random.Range(30, 90), 100, "data2");
AddData(0, UnityEngine.Random.Range(30, 90), 100, "data3");
}
}
}

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// Scatter chart is mainly used to show the relationship between two data dimensions.
/// || 散点图主要用于展现两个数据维度之间的关系。
/// </summary>
[AddComponentMenu("XCharts/ScatterChart", 17)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
@@ -24,5 +28,21 @@ namespace XCharts.Runtime
RemoveData();
Scatter.AddDefaultSerie(this, GenerateDefaultSerieName());
}
/// <summary>
/// default bubble chart.
/// || 默认气泡图。
/// </summary>
public void DefaultBubbleChart()
{
CheckChartInit();
var serie = GetSerie(0);
serie.itemStyle.borderWidth = 2f;
serie.itemStyle.borderColor = theme.GetColor(0);
serie.itemStyle.opacity = 0.35f;
serie.symbol.sizeType = SymbolSizeType.FromData;
serie.symbol.dataScale = 0.3f;
serie.symbol.maxSize = 30f;
}
}
}

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// A simplified bar chart is a simplified mode of a bar chart that provides better performance by simplifying components and configurations.
/// || 简化柱状图是柱状图的简化模式,通过简化组件和配置,拥有更好的性能。
/// </summary>
[AddComponentMenu("XCharts/SimplifiedBarChart", 27)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]

View File

@@ -2,6 +2,10 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// A simplified candlestick chart is a simplified mode of a bar chart that provides better performance by simplifying components and configurations.
/// || 简化K线图是K线图的简化模式通过简化组件和配置拥有更好的性能。
/// </summary>
[AddComponentMenu("XCharts/SimplifiedCandlestickChart", 28)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]

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