Compare commits

..

32 Commits
v2.6.0 ... 2.0

Author SHA1 Message Date
monitor1394
1d2f83169d 修复Pie只有一个数据时设置border后显示异常的问题 (#237) 2022-12-28 18:17:00 +08:00
monitor1394
a7c4e24555 [bug][datazoom] fix datazoom range error (#221) 2022-08-30 08:10:18 +08:00
monitor1394
6fad4fcccc update to Unity2019.4.39f1 2022-08-16 06:54:04 +08:00
monitor1394
95e40c6f1a v2.8.2 2022-08-15 22:12:44 +08:00
monitor1394
8e30a370b5 support tooltip formatter for HeatmapChart 2022-08-15 22:11:36 +08:00
monitor1394
d94e304058 v2.8.2 2022-07-13 21:45:54 +08:00
monitor1394
34dc49004e fix serielabel refresh exception (#215) 2022-07-13 21:45:09 +08:00
monitor1394
61c6d68c4c set tooltip on heighest layer 2022-06-30 13:38:46 +08:00
monitor1394
50a666fecc v2.8.1 2022-05-06 08:20:32 +08:00
monitor1394
626a187758 v2.8.1 2022-05-06 08:16:48 +08:00
monitor1394
dee06f8d6f add delegate callback function for legend 2022-05-03 22:30:51 +08:00
monitor1394
e6eea34a45 fix ring tooltip bug #192 2022-04-21 22:07:30 +08:00
monitor1394
76b8146e53 fix datazoom exception 2022-04-21 22:07:07 +08:00
monitor1394
240eda0be2 v2.8.0 2022-04-10 22:34:04 +08:00
monitor1394
6fa093bc80 add debug info 2022-04-10 22:27:27 +08:00
monitor1394
5884fd99dd Fixed VisualMap not working in some cases 2022-04-09 13:13:02 +08:00
monitor1394
f177799202 Merge pull request #190 from DK-Kermit/patch-1
Update XChartsMgr.cs
2022-04-08 14:23:34 +08:00
Kermit
2d3f5dd51d Update XChartsMgr.cs
修复因XChartsMgr不存在,而创建新对象时导致的死循环问题。
由于Awake会在组件被创建时同步执行一次,而在执行Awake时m_XCharts并没有被赋值,所以导致死循环。
让对象处于关闭状态,添加组件时就不会同步执行Awake方法,而是延迟到下一次开启对象时执行。
在下一次开启对象时,m_XCharts已经被赋值,所以不会导致死循环问题。
死循环发生在Awake时调用XThemeMgr.ReloadThemeList,而ReloadThemeList方法中有调用了实例。
2022-04-08 14:12:15 +08:00
monitor1394
b9ca646e0c Merge pull request #188 from Sterling-zzp/2.0
修复Radar初始化时画线取色错误
2022-04-08 10:48:38 +08:00
Sterling
c157c07b0d 修复Radar初始化时画线取色错误 2022-04-08 09:37:44 +08:00
monitor1394
82d0788905 Fixed axis precision issue #184 2022-03-24 08:32:27 +08:00
monitor1394
a7ac0277a7 2.7.0 2022-03-20 19:18:28 +08:00
monitor1394
3f36c27384 update doc link 2022-03-18 13:12:01 +08:00
monitor1394
e4da5e30dc update doc link 2022-03-18 13:08:36 +08:00
monitor1394
bfa68fd037 refactor code to support 3d pie 2022-03-16 07:43:46 +08:00
monitor1394
c002ac071b Fixed chart name repeat check error #183 2022-02-21 21:30:33 +08:00
monitor1394
5c2ea52118 Fixed MissingReferenceException #183 2022-02-17 08:39:55 +08:00
monitor1394
0e25a23ed2 Fixed axis split line bug #181 2022-02-17 08:29:57 +08:00
monitor1394
41a9606bee Fixed {d} formatter error when value is 0 2022-02-09 22:02:16 +08:00
monitor1394
6f6248be77 fixed y axis label onZero does not work 2022-02-08 20:50:47 +08:00
monitor1394
2b5275b15d improve zebra bar chart 2022-01-06 21:47:21 +08:00
monitor1394
ca26fd7c21 Improved zebra bar chart 2022-01-06 21:25:18 +08:00
35 changed files with 580 additions and 187 deletions

View File

@@ -2,6 +2,10 @@
# 更新日志
[branch-2.0](#branch-2.0)
[v2.8.2](#v2.8.2)
[v2.8.1](#v2.8.1)
[v2.8.0](#v2.8.0)
[v2.7.0](#v2.7.0)
[v2.6.0](#v2.6.0)
[v2.5.0](#v2.5.0)
[v2.4.0](#v2.4.0)
@@ -42,6 +46,36 @@
## branch-2.0
## v2.8.2
* (2022.08.15) Release `v2.8.2` version
* (2022.08.15) Added support for the `HeatmapChart` formatter for custom Tooltip
* (2022.07.13) Fixed `SerieLabel` refresh exception #215
* (2022.06.30) Optimize `Radar` so that the `Tooltip` layer is above `Indicator`
## v2.8.1
* (2022.05.03) Added `onLegendClick`, `onLegendEnter` and `onLegendExit` delegate callbacks for `Legend`
* (2022.04.21) Fixed bug #192 with `RingChart` `Tooltip` exception
* (2022.04.21) Fixed error when setting `minShowNum` in `DataZoom`
## v2.8.0
* (2022.04.10) Added the debug information panel
* (2022.04.09) Fixed `VisualMap` not working in some cases
* (2022.04.08) Optimized `XCharts` initialization #190
* (2022.04.08) Fixed color error #187 in `Radar`
* (2022.03.24) Fixed `Axis` precision issue #184
## v2.7.0
* (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 `YAxis` `AxisLabel`'s `onZero` does not work
* (2022.01.06) Improved `Zebra` bar chart
## v2.6.0
* (2021.12.30) Release `v2.6.0` version
@@ -257,7 +291,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
## v1.6.0
* (2020.08.24) Release `v1.6.0` version
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md) to upgrade)
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md) to upgrade)
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
* (2020.08.11) Added `LiquidChart` data change animation#83
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85

View File

@@ -2,6 +2,10 @@
# 更新日志
[branch-2.0](#branch-2.0)
[v2.8.2](#v2.8.2)
[v2.8.1](#v2.8.1)
[v2.8.0](#v2.8.0)
[v2.7.0](#v2.7.0)
[v2.6.0](#v2.6.0)
[v2.5.0](#v2.5.0)
[v2.4.0](#v2.4.0)
@@ -42,6 +46,41 @@
## branch-2.0
* (2022.12.28) 修复`Pie`只有一个数据时设置`border`后显示异常的问题 (#237)
* (2022.08.30) 修复`DataZoom`在某些情况下计算范围不准确的问题 (#221)
## v2.8.2
* (2022.08.15) 发布`v2.8.2`版本
* (2022.08.15) 增加`HeatmapChart`对自定义`Tooltip``formatter`的支持
* (2022.07.13) 修复`SerieLabel`刷新异常的问题 #215
* (2022.06.30) 优化`Radar``Tooltip`的层在`Indicator`之上
## v2.8.1
* (2022.05.06) 发布`v2.8.1`版本
* (2022.05.03) 增加`Legend``onLegendClick`,`onLegendEnter``onLegendExit`委托回调
* (2022.04.21) 修复`RingChart``Tooltip`异常的问题 #192
* (2022.04.21) 修复`DataZoom`设置`minShowNum`时可能会报错的问题
## v2.8.0
* (2022.04.10) 发布`v2.8.0`版本
* (2022.04.10) 增加`Debug`调试信息面板
* (2022.04.09) 修复`VisualMap`某些情况下不生效的问题
* (2022.04.08) 优化`XCharts`初始化 #190
* (2022.04.08) 修复`Radar`的颜色异常问题 #187
* (2022.03.24) 修复`Axis`的精度问题 #184
## v2.7.0
* (2022.03.20) 发布`v2.7.0`版本
* (2022.02.21) 修复`Chart``chartName`重复检测问题 #183
* (2022.02.17) 修复`Axis``SplitLine`可能会显示在坐标系外的问题 #181
* (2022.02.08) 修复数据全0时`{d}`显示不正确的问题
* (2022.02.08) 修复`YAxis``AxisLabel``onZero`参数不生效的问题
* (2022.01.06) 优化`Zebra`斑马柱图
## v2.6.0
* (2021.12.30) 发布`v2.6.0`版本
@@ -259,7 +298,7 @@
## v1.6.0
* (2020.08.24) 发布`v1.6.0`版本
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)进行升级)
* (2020.08.15) 优化`PieChart`绘制表现效果#85
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85

View File

@@ -152,10 +152,10 @@
## 为什么升级到1_6_0版本后很多自定义颜色丢失了_应该如何升级
1.6.0版本为了减少隐式转换,将所有的绘制相关的`Color`都改为了`Color32`,所以会导致一些自定义的颜色的丢失。影响到的主要组件有:`ItemStyle``LineStyle``AreaStyle``Vessel``VisualMap``AxisSplitArea``AxisSplitLine``GaugeAxis``SerieLabel`等。可以用脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)进行升级。
1.6.0版本为了减少隐式转换,将所有的绘制相关的`Color`都改为了`Color32`,所以会导致一些自定义的颜色的丢失。影响到的主要组件有:`ItemStyle``LineStyle``AreaStyle``Vessel``VisualMap``AxisSplitArea``AxisSplitLine``GaugeAxis``SerieLabel`等。可以用脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)进行升级。
升级步骤如下:
1. 备份好你的项目。
2. 先不升级`XCharts`,只下载或拷贝脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)放到旧项目的`Editor`由于旧版本可能不存在某些新版本才有的图表或者属性配置可能会编译错误需要处理按34步骤处理一下。
2. 先不升级`XCharts`,只下载或拷贝脚本[UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs)放到旧项目的`Editor`由于旧版本可能不存在某些新版本才有的图表或者属性配置可能会编译错误需要处理按34步骤处理一下。
3. 若是由`itemStyle.toColor2`引起的编译报错,可将导出地方的`itemStyle.toColor2`改为`Color.clear`;导入的地方注释掉即可。
4. 若是由`LiquidChart`引起的编译报错,将所有涉及`LiquidChart`的地方都注释掉即可。
5. 编译通过后,通过`菜单栏->XCharts->ExportColorConfig`导出旧版本的颜色配置文件(配置文件默认保存到`Assets`下的`color.config`)。

View File

@@ -148,10 +148,10 @@ A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to
## Why_are_many_custom_colors_lost_after_upgrading_to_1_6_0_How_should_I_upgrade
A: In version `1.6.0`, in order to reduce implicit conversion, all drawing related `Color` was changed to `Color32`, so some custom colors were lost. The main components affected are: `ItemStyle`, `LineStyle`, `AreaStyle`, `Vessel`, `VisualMap`, `AxisSplitArea`, `AxisSplitLine`, `GaugeAxis`,`SerieLabel`, etc. Can use the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) to upgrade.
A: In version `1.6.0`, in order to reduce implicit conversion, all drawing related `Color` was changed to `Color32`, so some custom colors were lost. The main components affected are: `ItemStyle`, `LineStyle`, `AreaStyle`, `Vessel`, `VisualMap`, `AxisSplitArea`, `AxisSplitLine`, `GaugeAxis`,`SerieLabel`, etc. Can use the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) to upgrade.
The upgrade steps are as follows:
1. Back up the project.
2. Download or copy the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) in the old project `Editor`, Change the `color` field inside to `color.clear` (because some fields may not exist in the old version).
2. Download or copy the script [UpgradeChartColor.cs](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Editor/Tools/UpgradeChartColor.cs) in the old project `Editor`, Change the `color` field inside to `color.clear` (because some fields may not exist in the old version).
3. After compilation, the old version of color configuration file is exported through `menu bar -> XCharts-> ExportColorConfig` (the configuration file is saved by default to `color.config` under `Assets`).
4. Upgrade `XCharts` to the latest version.
5. The custom color can be restored by importing `color.config` through `menu bar -> XCharts-> ImportColorConfig` (if `color.config` is not under `Assets` of the upgraded project, copy it to this directory).

View File

@@ -137,6 +137,12 @@ namespace XCharts
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
}
}
if (XChartsMgr.Instance.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox("chart name is repeated:" + m_ChartName.stringValue, MessageType.Error);
EditorGUILayout.EndHorizontal();
}
}
BlockEnd();

View File

@@ -11,7 +11,7 @@
<br>
</p>
<p align="center">
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/LICENSE">
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
@@ -45,11 +45,11 @@
A powerful, easy-to-use, configurable charting and data visualization library for Unity. Supporting line, bar, pie, radar, scatter, heatmap, gauge, ring, polar, liquid and other common chart.
[XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
[Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG-EN.md)
[Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
## XCharts 2.0
@@ -78,21 +78,21 @@ A powerful, easy-to-use, configurable charting and data visualization library fo
## Screenshot
![linechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-line.png)
![barchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-bar.png)
![piechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-pie.png)
![radarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-radar.png)
![scatterchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-scatter.png)
![heatmapchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-heatmap.png)
![gaugechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-gauge.png)
![ringchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-ring.png)
![polarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-polar.png)
![liquidchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-liquid.png)
![combinations](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-combinations.png)
![linechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-line.png)
![barchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-bar.png)
![piechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-pie.png)
![radarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-radar.png)
![scatterchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-scatter.png)
![heatmapchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-heatmap.png)
![gaugechart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-gauge.png)
![ringchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-ring.png)
![polarchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-polar.png)
![liquidchart](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-liquid.png)
![combinations](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-combinations.png)
## Cheat Sheet
![cheatsheet](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/screenshot/xcharts-cheatsheet.gif)
![cheatsheet](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/screenshot/xcharts-cheatsheet.gif)
`XCharts` consist of components and data. Different components and data can be combined into different types of charts. The component is divided into main component and sub component. The main component contains the sub components.
@@ -179,9 +179,9 @@ The following is the relationship structure of LineChart:
2. In unity menu bar, `Component->XCharts->LineChart`.
3. In `Inspector`,`Add Component->LineChart`.
4. Then a simple line chart is done.
5. In `Inspector` you can adjust the parameters of components, and in `Game` will feedback the adjustment effect in realtime 。the detail of parameters go to see: [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md).
5. In `Inspector` you can adjust the parameters of components, and in `Game` will feedback the adjustment effect in realtime 。the detail of parameters go to see: [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md).
* See more examples of code dynamic control: [Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md).
* See more examples of code dynamic control: [Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md).
* Enable TextMeshPro:
1. `XCharts -> TextMeshPro Enable` or `Project Setting -> XCharts -> Enable TextMeshPro`
@@ -191,19 +191,19 @@ The following is the relationship structure of LineChart:
## Documents
* [XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
* [XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
* [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
* [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
* [XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG-EN.md)
* [XCharts Tutorial: Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
* [XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
* [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-api-EN.md)
* [XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
* [XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG-EN.md)
* [XCharts Tutorial: Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
## Changelog
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
[XCharts Changelog](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
## Licenses
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/LICENSE.md)
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/LICENSE.md)
## Contact

View File

@@ -132,7 +132,21 @@ namespace XCharts
/// 点击饼图区域回调。参数PointerEventDataSerieIndexSerieDataIndex
/// </summary>
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickPie; } }
/// <summary>
/// the callback function of click legend.
/// 点击图例按钮回调。参数legendIndex, legendName, show
/// </summary>
public Action<int, string, bool> onLegendClick { set { m_OnLegendClick = value; } }
/// <summary>
/// the callback function of enter legend.
/// 鼠标进入图例回调。参数legendIndex, legendName
/// </summary>
public Action<int, string> onLegendEnter { set { m_OnLegendEnter = value; } }
/// <summary>
/// the callback function of exit legend.
/// 鼠标退出图例回调。参数legendIndex, legendName
/// </summary>
public Action<int, string> onLegendExit { set { m_OnLegendExit = value; } }
/// <summary>
/// Redraw chart in next frame.
/// 在下一帧刷新图表。

View File

@@ -88,10 +88,10 @@ namespace XCharts
[SerializeField] protected int m_PolarIndex;
[SerializeField] protected AxisPosition m_Position;
[SerializeField] protected float m_Offset;
[SerializeField] protected float m_Min;
[SerializeField] protected float m_Max;
[SerializeField] protected double m_Min;
[SerializeField] protected double m_Max;
[SerializeField] protected int m_SplitNumber = 5;
[SerializeField] protected float m_Interval = 0;
[SerializeField] protected double m_Interval = 0;
[SerializeField] protected bool m_BoundaryGap = true;
[SerializeField] protected int m_MaxCache = 0;
[SerializeField] protected float m_LogBase = 10;
@@ -180,7 +180,7 @@ namespace XCharts
/// The minimun value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最小值当minMaxType为Custom时有效。
/// </summary>
public float min
public double min
{
get { return m_Min; }
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetAllDirty(); }
@@ -189,7 +189,7 @@ namespace XCharts
/// The maximum value of axis.Valid when `minMaxType` is `Custom`
/// 设定的坐标轴刻度最大值当minMaxType为Custom时有效。
/// </summary>
public float max
public double max
{
get { return m_Max; }
set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetAllDirty(); }
@@ -207,7 +207,7 @@ namespace XCharts
/// Compulsively set segmentation interval for axis.This is unavailable for category axis.
/// 强制设置坐标轴分割间隔。无法在类目轴中使用。
/// </summary>
public float interval
public double interval
{
get { return m_Interval; }
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetAllDirty(); }
@@ -712,13 +712,13 @@ namespace XCharts
int start = 0, end = 0;
if (dataZoom.runtimeInvert)
{
end = Mathf.CeilToInt(data.Count * dataZoom.end / 100);
end = Mathf.RoundToInt(data.Count * dataZoom.end / 100);
start = end - range;
if (start < 0) start = 0;
}
else
{
start = Mathf.FloorToInt(data.Count * dataZoom.start / 100);
start = Mathf.RoundToInt(data.Count * dataZoom.start / 100);
end = start + range;
if (end > data.Count) end = data.Count;
}
@@ -728,13 +728,15 @@ namespace XCharts
filterEnd = end;
filterMinShow = dataZoom.minShowNum;
m_NeedUpdateFilterData = false;
if (data.Count > 0)
if (data.Count > 0 && filterMinShow < data.Count)
{
if (range < dataZoom.minShowNum)
if (range < filterMinShow)
{
if (dataZoom.minShowNum > data.Count) range = data.Count;
else range = dataZoom.minShowNum;
if (filterMinShow > data.Count) range = data.Count;
else range = filterMinShow;
}
if (range > data.Count - start)
start = data.Count - range;
filterData = data.GetRange(start, range);
}
else

View File

@@ -0,0 +1,154 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine.UI;
namespace XCharts
{
[Serializable]
public class DebugInfo
{
private bool m_ShowDebugInfo = false;
private TextStyle m_DebugInfoTextStyle = new TextStyle()
{
fontSize = 18,
backgroundColor = new Color32(32, 32, 32, 170),
color = Color.white
};
private static StringBuilder s_Sb = new StringBuilder();
private static readonly float INTERVAL = 0.2f;
private static readonly float MAXCACHE = 20;
private int m_FrameCount = 0;
private float m_LastTime = 0f;
private float m_LastCheckShowTime = 0f;
private int m_LastRefreshCount = 0;
private BaseChart m_Chart;
private ChartLabel m_Label;
private List<float> m_FpsList = new List<float>();
public float fps { get; private set; }
public float avgFps { get; private set; }
public int refreshCount { get; internal set; }
internal int clickChartCount { get; set; }
public void Init(BaseChart chart)
{
m_Chart = chart;
m_Label = AddDebugInfoObject("debug", chart.transform, m_DebugInfoTextStyle, chart.theme);
}
public void Update()
{
if (clickChartCount >= 3)
{
m_ShowDebugInfo = !m_ShowDebugInfo;
ChartHelper.SetActive(m_Label.gameObject.transform, m_ShowDebugInfo);
clickChartCount = 0;
m_LastCheckShowTime = Time.realtimeSinceStartup;
return;
}
if (Time.realtimeSinceStartup - m_LastCheckShowTime > 0.5f)
{
m_LastCheckShowTime = Time.realtimeSinceStartup;
clickChartCount = 0;
}
if (!m_ShowDebugInfo || m_Label == null)
return;
m_FrameCount++;
if (Time.realtimeSinceStartup - m_LastTime >= INTERVAL)
{
fps = m_FrameCount / (Time.realtimeSinceStartup - m_LastTime);
m_FrameCount = 0;
m_LastTime = Time.realtimeSinceStartup;
if (m_LastRefreshCount == refreshCount)
{
m_LastRefreshCount = 0;
refreshCount = 0;
}
m_LastRefreshCount = refreshCount;
if (m_FpsList.Count > MAXCACHE)
{
m_FpsList.RemoveAt(0);
}
m_FpsList.Add(fps);
avgFps = GetAvg(m_FpsList);
if (m_Label != null)
{
s_Sb.Length = 0;
s_Sb.AppendFormat("v{0}\n", XChartsMgr.version);
s_Sb.AppendFormat("fps : {0:f0} / {1:f0}\n", fps, avgFps);
s_Sb.AppendFormat("draw : {0}\n", refreshCount);
var dataCount = m_Chart.series.GetAllSerieDataCount();
SetValueWithKInfo(s_Sb, "data", dataCount);
var vertCount = 0;
foreach (var serie in m_Chart.series.list)
vertCount += serie.runtimeVertCount;
SetValueWithKInfo(s_Sb, "b-vert", m_Chart.m_BasePainterVertCount);
SetValueWithKInfo(s_Sb, "s-vert", vertCount);
SetValueWithKInfo(s_Sb, "t-vert", m_Chart.m_TopPainterVertCount, false);
m_Label.SetText(s_Sb.ToString());
}
}
}
private static void SetValueWithKInfo(StringBuilder s_Sb, string key, int value, bool newLine = true)
{
if (value >= 1000)
s_Sb.AppendFormat("{0} : {1:f1}k", key, value * 0.001f);
else
s_Sb.AppendFormat("{0} : {1}", key, value);
if (newLine)
s_Sb.Append("\n");
}
private static float GetAvg(List<float> list)
{
var total = 0f;
foreach (var v in list) total += v;
return total / list.Count;
}
private ChartLabel AddDebugInfoObject(string name, Transform parent, TextStyle textStyle,
ChartTheme theme)
{
var anchorMax = new Vector2(0, 1);
var anchorMin = new Vector2(0, 1);
var pivot = new Vector2(0, 1);
var sizeDelta = new Vector2(130, 150);
var labelGameObject = ChartHelper.AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
labelGameObject.transform.SetAsLastSibling();
labelGameObject.hideFlags = m_Chart.chartHideFlags;
ChartHelper.SetActive(labelGameObject, m_ShowDebugInfo);
var image = ChartHelper.GetOrAddComponent<Image>(labelGameObject);
image.color = textStyle.backgroundColor;
var label = new ChartLabel();
label.gameObject = labelGameObject;
label.label = ChartHelper.AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax,
pivot, sizeDelta, textStyle, theme.common);
label.SetAutoSize(true);
label.label.SetActive(true);
label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.UpperLeft));
label.label.SetLocalPosition(new Vector2(3, -3));
label.SetText("30");
label.SetLabelColor(textStyle.color);
return label;
}
}
}

View File

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

View File

@@ -1142,12 +1142,12 @@ namespace XCharts
/// The index of serie,start at 0.
/// 系列的索引从0开始。
/// </summary>
public int index { get; internal set; }
public int index { get; set; }
/// <summary>
/// Whether the serie is highlighted.
/// 该系列是否高亮,一般由图例悬停触发。
/// </summary>
public bool highlighted { get; internal set; }
public bool highlighted { get; set; }
/// <summary>
/// the count of data list.
/// 数据项个数。
@@ -1160,27 +1160,27 @@ namespace XCharts
/// <summary>
/// 饼图的中心点位置。
/// </summary>
public Vector3 runtimeCenterPos { get; internal set; }
public Vector3 runtimeCenterPos { get; set; }
/// <summary>
/// 饼图的内径
/// </summary>
public float runtimeInsideRadius { get; internal set; }
public float runtimeInsideRadius { get; set; }
/// <summary>
/// 饼图的外径
/// </summary>
public float runtimeOutsideRadius { get; internal set; }
public float runtimeOutsideRadius { get; set; }
/// <summary>
/// 运行时的最大数据值
/// </summary>
public double runtimeDataMax { get; internal set; }
public double runtimeDataMax { get; set; }
/// <summary>
/// 运行时的最小数据值
/// </summary>
public double runtimeDataMin { get; internal set; }
public double runtimeDataMin { get; set; }
/// <summary>
/// 饼图的数据项之和
/// </summary>
public double runtimePieDataTotal { get; internal set; }
public double runtimePieDataTotal { get; set; }
public float runtimeWaveSpeed { get; internal set; }
public Painter runtimeCanvas { get; internal set; }
public double runtimeCheckValue { get; set; }
@@ -1190,6 +1190,7 @@ namespace XCharts
public float runtimeWidth { get; internal set; }
public float runtimeHeight { get; internal set; }
public Rect runtimeRect { get; internal set; }
public int runtimeVertCount { get; internal set; }
public List<SerieData> runtimeSortedData { get { return m_SortedData; } }
public List<SerieData> rootData { get { return m_RootData; } }
public bool nameDirty { get { return m_NameDirty; } }

View File

@@ -98,6 +98,16 @@ namespace XCharts
SeriesHelper.ClearNameDirty(this);
}
public int GetAllSerieDataCount()
{
var count = 0;
foreach (var serie in list)
{
count += serie.dataCount;
}
return count;
}
/// <summary>
/// 清空所有系列的数据
/// </summary>
@@ -259,7 +269,7 @@ namespace XCharts
/// </summary>
public void RemoveAll()
{
foreach(var serie in m_Series) serie.AnimationFadeIn();
foreach (var serie in m_Series) serie.AnimationFadeIn();
m_Series.Clear();
}

View File

@@ -383,7 +383,7 @@ namespace XCharts
else return dataIndex <= m_CurrDataProgress;
}
internal void CheckProgress(double total)
public void CheckProgress(double total)
{
if (IsFinish()) return;
if (!m_IsInit || m_IsPause || m_IsEnd) return;
@@ -411,7 +411,7 @@ namespace XCharts
}
}
internal float GetCurrAnimationDuration(int dataIndex = -1)
public float GetCurrAnimationDuration(int dataIndex = -1)
{
if (dataIndex >= 0)
{
@@ -422,7 +422,7 @@ namespace XCharts
else return m_FadeInDuration > 0 ? m_FadeInDuration / 1000 : 1f;
}
internal float CheckBarProgress(int dataIndex, float barHig, int dataCount, out bool isBarEnd)
public float CheckBarProgress(int dataIndex, float barHig, int dataCount, out bool isBarEnd)
{
isBarEnd = false;
var initHig = m_FadeOut ? barHig : 0;
@@ -468,7 +468,7 @@ namespace XCharts
End();
}
internal void CheckSymbol(float dest)
public void CheckSymbol(float dest)
{
if (!enable || m_IsEnd || m_IsPause || !m_IsInit) return;
if (IsInDelay()) return;

View File

@@ -143,23 +143,23 @@ namespace XCharts
/// <summary>
/// 饼图数据项的开始角度(运行时自动计算)
/// </summary>
public float runtimePieStartAngle { get; internal set; }
public float runtimePieStartAngle { get; set; }
/// <summary>
/// 饼图数据项的结束角度(运行时自动计算)
/// </summary>
public float runtimePieToAngle { get; internal set; }
public float runtimePieToAngle { get; set; }
/// <summary>
/// 饼图数据项的一半时的角度(运行时自动计算)
/// </summary>
public float runtimePieHalfAngle { get; internal set; }
public float runtimePieHalfAngle { get; set; }
/// <summary>
/// 饼图数据项的当前角度(运行时自动计算)
/// </summary>
public float runtimePieCurrAngle { get; internal set; }
public float runtimePieCurrAngle { get; set; }
/// <summary>
/// 饼图数据项的内半径
/// </summary>
public float runtimePieInsideRadius { get; internal set; }
public float runtimePieInsideRadius { get; set; }
/// <summary>
/// 饼图数据项的外半径
/// </summary>
@@ -170,7 +170,7 @@ namespace XCharts
if (radius > 0) return radius;
else return m_RtPieOutsideRadius;
}
internal set
set
{
m_RtPieOutsideRadius = value;
}
@@ -178,7 +178,7 @@ namespace XCharts
/// <summary>
/// 饼图数据项的偏移半径
/// </summary>
public float runtimePieOffsetRadius { get; internal set; }
public float runtimePieOffsetRadius { get; set; }
public Vector3 runtimePosition { get; set; }
/// <summary>
/// 绘制区域。

View File

@@ -35,8 +35,8 @@ namespace XCharts
m_YAxes[0].splitNumber = 10;
RemoveData();
var heatmapGridWid = 10f;
int xSplitNumber = (int)(grid.runtimeWidth / heatmapGridWid);
int ySplitNumber = (int)(grid.runtimeHeight / heatmapGridWid);
int xSplitNumber = (int) (grid.runtimeWidth / heatmapGridWid);
int ySplitNumber = (int) (grid.runtimeHeight / heatmapGridWid);
SerieTemplate.AddDefaultHeatmapSerie(this, "serie1");
@@ -49,8 +49,20 @@ namespace XCharts
visualMap.location.align = Location.Align.BottomLeft;
visualMap.location.bottom = 100;
visualMap.location.left = 30;
var colors = new List<string>{"#313695", "#4575b4", "#74add1", "#abd9e9", "#e0f3f8", "#ffffbf",
"#fee090", "#fdae61", "#f46d43", "#d73027", "#a50026"};
var colors = new List<string>
{
"#313695",
"#4575b4",
"#74add1",
"#abd9e9",
"#e0f3f8",
"#ffffbf",
"#fee090",
"#fdae61",
"#f46d43",
"#d73027",
"#a50026"
};
visualMap.inRange.Clear();
foreach (var str in colors)
{
@@ -80,11 +92,27 @@ namespace XCharts
#endif
protected override void UpdateTooltip()
{
var dataIndex = GetDataIndex();
if (dataIndex < 0) return;
var content = TooltipHelper.GetFormatterContent(tooltip, dataIndex, this);
TooltipHelper.SetContentAndPosition(tooltip, content, chartRect);
tooltip.SetActive(true);
for (int i = 0; i < m_XAxes.Count; i++)
{
UpdateAxisTooltipLabel(i, m_XAxes[i]);
}
for (int i = 0; i < m_YAxes.Count; i++)
{
UpdateAxisTooltipLabel(i, m_YAxes[i]);
}
}
private int GetDataIndex()
{
var xData = tooltip.runtimeXValues[0];
var yData = tooltip.runtimeYValues[0];
if (IsCategory() && (xData < 0 || yData < 0)) return;
sb.Length = 0;
if (IsCategory() && (xData < 0 || yData < 0)) return -1;
for (int i = 0; i < m_Series.Count; i++)
{
var serie = m_Series.GetSerie(i);
@@ -96,30 +124,11 @@ namespace XCharts
{
if (IsCategory())
{
string key = serie.name;
var serieData = serie.data[(int)xData * yCount + (int)yData];
var value = serieData.data[2];
var color = visualMap.enable ? visualMap.GetColor(value) :
m_Theme.GetColor(serie.index);
sb.Append("\n")
.Append(key).Append(!string.IsNullOrEmpty(key) ? "\n" : "")
.Append("<color=#").Append(ChartCached.ColorToStr(color)).Append(">● </color>")
.Append(xAxis.data[(int)xData]).Append(": ")
.Append(ChartCached.FloatToStr(value, string.Empty));
return (int) xData * yCount + (int) yData;
}
}
}
TooltipHelper.SetContentAndPosition(tooltip, sb.ToString().Trim(), chartRect);
tooltip.SetActive(true);
for (int i = 0; i < m_XAxes.Count; i++)
{
UpdateAxisTooltipLabel(i, m_XAxes[i]);
}
for (int i = 0; i < m_YAxes.Count; i++)
{
UpdateAxisTooltipLabel(i, m_YAxes[i]);
}
return -1;
}
}
}
}

View File

@@ -18,12 +18,18 @@ namespace XCharts
public static string CheckChart(BaseGraph chart)
{
if (chart is BaseChart) return CheckChart((BaseChart)chart);
else return string.Empty;
if (chart == null)
return string.Empty;
if (chart is BaseChart)
return CheckChart((BaseChart)chart);
else
return string.Empty;
}
public static string CheckChart(BaseChart chart)
{
if (chart == null)
return string.Empty;
var sb = ChartHelper.sb;
sb.Length = 0;
CheckName(chart, sb);
@@ -39,10 +45,10 @@ namespace XCharts
private static void CheckName(BaseChart chart, StringBuilder sb)
{
if (string.IsNullOrEmpty(chart.chartName)) return;
var list = XChartsMgr.Instance.GetCharts(chart.chartName);
if (list.Count > 1)
if (XChartsMgr.Instance.IsRepeatChartName(chart))
{
sb.AppendFormat("warning:chart name is repeated: {0}\n", chart.chartName);
var info = XChartsMgr.Instance.GetRepeatChartNameInfo(chart, chart.chartName);
sb.AppendFormat("warning:chart name is repeated: {0}\n{1}", chart.chartName, info);
}
}

View File

@@ -248,6 +248,8 @@ namespace XCharts
{
if (total != 0)
content = content.Replace(old, ChartCached.FloatToStr(value / total * 100, numericFormatter));
else
content = content.Replace(old, ChartCached.FloatToStr(0, numericFormatter));
}
else
{

View File

@@ -642,13 +642,13 @@ namespace XCharts
int start = 0, end = 0;
if (dataZoom.runtimeInvert)
{
end = Mathf.CeilToInt(data.Count * dataZoom.end / 100);
end = Mathf.RoundToInt(data.Count * dataZoom.end / 100);
start = end - range;
if (start < 0) start = 0;
}
else
{
start = Mathf.FloorToInt(data.Count * dataZoom.start / 100);
start = Mathf.RoundToInt(data.Count * dataZoom.start / 100);
end = start + range;
if (end > data.Count) end = data.Count;
}
@@ -666,6 +666,8 @@ namespace XCharts
if (dataZoom.minShowNum > data.Count) range = data.Count;
else range = dataZoom.minShowNum;
}
if (range > data.Count - start)
start = data.Count - range;
serie.m_FilterData = data.GetRange(start, range);
}
else

View File

@@ -33,7 +33,7 @@ namespace XCharts
if (!string.IsNullOrEmpty(serieData.name))
sb.Append(serieData.name).Append(": ");
sb.AppendFormat("({0},{1})", ChartCached.FloatToStr(xValue, numericFormatter),
ChartCached.FloatToStr(yValue, numericFormatter));
ChartCached.FloatToStr(yValue, numericFormatter));
if (i != dataIndexList.Count - 1)
{
sb.Append("\n");
@@ -41,7 +41,6 @@ namespace XCharts
}
}
private static void InitPieTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
ChartTheme theme)
{
@@ -72,7 +71,7 @@ namespace XCharts
if (!string.IsNullOrEmpty(serieData.name))
{
sb.Append("<color=#").Append(theme.GetColorStr(index)).Append(">● </color>")
.Append(serieData.name).Append(": ").Append(ChartCached.FloatToStr(value, numericFormatter));
.Append(serieData.name).Append(": ").Append(ChartCached.FloatToStr(value, numericFormatter));
}
else
{
@@ -196,7 +195,7 @@ namespace XCharts
double xValue, yValue;
serie.GetXYData(index, dataZoom, out xValue, out yValue);
var isIngore = serie.IsIgnorePoint(index);
if(isIngore) return;
if (isIngore) return;
var serieData = serie.GetSerieData(index, dataZoom);
var numericFormatter = GetItemNumericFormatter(tooltip, serie, serieData);
if (isCartesian)
@@ -234,6 +233,35 @@ namespace XCharts
}
}
private static void InitHeatmapTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
CoordinateChart chart)
{
if (serie.type != SerieType.Heatmap) return;
var xData = tooltip.runtimeXValues[0];
var yData = tooltip.runtimeYValues[0];
if (chart.IsCategory() && (xData < 0 || yData < 0)) return;
sb.Length = 0;
var xAxis = chart.GetXAxis(serie.xAxisIndex);
var yAxis = chart.GetYAxis(serie.yAxisIndex);
var xCount = xAxis.data.Count;
var yCount = yAxis.data.Count;
var visualMap = chart.visualMap;
if (chart.IsCategory())
{
string key = serie.name;
var serieData = serie.data[(int) xData * yCount + (int) yData];
var numericFormatter = GetItemNumericFormatter(tooltip, serie, serieData);
var value = serieData.data[2];
var color = visualMap.enable ? visualMap.GetColor(value) :
chart.theme.GetColor(serie.index);
sb.Append("\n")
.Append(key).Append(!string.IsNullOrEmpty(key) ? "\n" : "")
.Append("<color=#").Append(ChartCached.ColorToStr(color)).Append(">● </color>")
.Append(xAxis.data[(int) xData]).Append(": ")
.Append(ChartCached.FloatToStr(value, numericFormatter));
}
}
private static void InitDefaultContent(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
BaseChart chart, DataZoom dataZoom = null, bool isCartesian = false,
Radar radar = null)
@@ -259,6 +287,7 @@ namespace XCharts
InitRingTooltip(ref sb, tooltip, serie, index, chart.theme);
break;
case SerieType.Heatmap:
InitHeatmapTooltip(ref sb, tooltip, serie, index, chart as CoordinateChart);
break;
case SerieType.Gauge:
InitGaugeTooltip(ref sb, tooltip, serie, index, chart.theme);
@@ -335,8 +364,8 @@ namespace XCharts
{
string content = itemFormatter;
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, chart, null);
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar
|| serie.type == SerieType.Ring ? dataIndex : serie.index;
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar ||
serie.type == SerieType.Ring ? dataIndex : serie.index;
sb.Append(ChartCached.ColorToDotStr(chart.theme.GetColor(dotColorIndex)));
sb.Append(content);
}
@@ -449,8 +478,8 @@ namespace XCharts
string content = itemFormatter;
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, chart, dataZoom);
if (!first) sb.Append(FormatterHelper.PH_NN);
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar
|| serie.type == SerieType.Ring ? dataIndex : i;
var dotColorIndex = serie.type == SerieType.Pie || serie.type == SerieType.Radar ||
serie.type == SerieType.Ring ? dataIndex : i;
sb.Append(ChartCached.ColorToDotStr(chart.theme.GetColor(dotColorIndex)));
sb.Append(content);
first = false;

View File

@@ -144,7 +144,7 @@ namespace XCharts
public static bool IsNeedGradient(VisualMap visualMap)
{
if (!visualMap.enable || visualMap.inRange.Count <= 0) return false;
if (!visualMap.enable || (visualMap.inRange.Count <= 0 && visualMap.pieces.Count <= 0)) return false;
return true;
}

View File

@@ -74,12 +74,17 @@ namespace XCharts
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieBeforeCallback;
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieAfterCallback;
protected Action<PointerEventData, int, int> m_OnPointerClickPie;
protected Action<int, string, bool> m_OnLegendClick;
protected Action<int, string> m_OnLegendEnter;
protected Action<int, string> m_OnLegendExit;
protected bool m_RefreshLabel = false;
internal bool m_ReinitLabel = false;
internal bool m_ReinitTitle = false;
internal bool m_CheckAnimation = false;
internal bool m_IsPlayingAnimation = false;
internal int m_BasePainterVertCount;
internal int m_TopPainterVertCount;
internal protected List<string> m_LegendRealShowName = new List<string>();
protected List<Painter> m_PainterList = new List<Painter>();
internal Painter m_PainterTop;
@@ -109,6 +114,8 @@ namespace XCharts
m_ComponentHandlers.Add(new VisualMapHandler(this));
m_ComponentHandlers.Add(new DataZoomHandler(this));
foreach (var draw in m_ComponentHandlers) draw.Init();
m_DebugInfo.Init(this);
}
protected override void Awake()
@@ -161,6 +168,7 @@ namespace XCharts
Internal_CheckAnimation();
foreach (var draw in m_DrawSeries) draw.Update();
foreach (var draw in m_ComponentHandlers) draw.Update();
m_DebugInfo.Update();
}
public Painter GetPainter(int index)
@@ -520,12 +528,12 @@ namespace XCharts
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
m_SerieLabelRoot.hideFlags = chartHideFlags;
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
int count = 0;
for (int i = 0; i < m_Series.Count; i++)
{
var serie = m_Series.list[i];
serie.index = i;
SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight);
int count = 0;
for (int j = 0; j < serie.data.Count; j++)
{
var serieData = serie.data[j];
@@ -791,6 +799,12 @@ namespace XCharts
{
}
public override void OnPointerClick(PointerEventData eventData)
{
m_DebugInfo.clickChartCount++;
base.OnPointerClick(eventData);
}
public override void OnPointerDown(PointerEventData eventData)
{
base.OnPointerDown(eventData);
@@ -836,6 +850,8 @@ namespace XCharts
}
OnYMaxValueChanged();
}
if(m_OnLegendClick != null)
m_OnLegendClick(index, legendName, show);
}
protected virtual void OnLegendButtonEnter(int index, string legendName)
@@ -851,6 +867,8 @@ namespace XCharts
RefreshPainter(serie);
}
}
if(m_OnLegendEnter != null)
m_OnLegendEnter(index, legendName);
}
protected virtual void OnLegendButtonExit(int index, string legendName)
@@ -866,6 +884,8 @@ namespace XCharts
RefreshPainter(serie);
}
}
if(m_OnLegendExit != null)
m_OnLegendExit(index, legendName);
}
protected virtual void UpdateTooltip()
@@ -883,6 +903,7 @@ namespace XCharts
{
m_OnCustomDrawBaseCallback(vh);
}
m_BasePainterVertCount = vh.currentVertCount;
}
protected virtual void OnDrawPainterSerie(VertexHelper vh, Painter painter)
@@ -892,6 +913,7 @@ namespace XCharts
var maxSeries = m_Series.Count;
var rate = Mathf.CeilToInt(maxSeries * 1.0f / maxPainter);
m_PainterTop.Refresh();
m_DebugInfo.refreshCount++;
for (int i = painter.index * rate; i < (painter.index + 1) * rate && i < maxSeries; i++)
{
var serie = m_Series.GetSerie(i);
@@ -904,6 +926,7 @@ namespace XCharts
{
m_OnCustomDrawSerieAfterCallback(vh, serie);
}
serie.runtimeVertCount = vh.currentVertCount;
}
m_RefreshLabel = true;
}
@@ -919,6 +942,7 @@ namespace XCharts
m_OnCustomDrawTopCallback(vh);
}
DrawTooltip(vh);
m_TopPainterVertCount = vh.currentVertCount;
}
protected virtual void DrawPainterSerie(VertexHelper vh, Serie serie)

View File

@@ -22,6 +22,7 @@ namespace XCharts
[SerializeField] protected bool m_DebugMode = false;
[SerializeField] protected bool m_EnableTextMeshPro = false;
[SerializeField] protected Background m_Background = Background.defaultBackground;
protected DebugInfo m_DebugInfo = new DebugInfo();
protected Painter m_Painter;
protected int m_SiblingIndex;
@@ -57,7 +58,7 @@ namespace XCharts
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
protected Vector2 graphPivot { get { return m_GraphPivot; } }
public HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
public DebugInfo debug { get { return m_DebugInfo; } }
private ScrollRect m_ScrollRect;
@@ -129,7 +130,7 @@ namespace XCharts
}
}
private void CheckTextMeshPro()
{

View File

@@ -848,7 +848,8 @@ namespace XCharts
private Vector3 GetLabelYPosition(float scaleWid, int i, int yAxisIndex, YAxis yAxis)
{
var grid = GetAxisGridOrDefault(yAxis);
var startX = yAxis.IsLeft() ? grid.runtimeX : grid.runtimeX + grid.runtimeWidth;
var startX = grid.runtimeX + (yAxis.axisLabel.onZero ? m_XAxes[yAxisIndex].runtimeZeroXOffset : 0);
if (yAxis.IsRight()) startX += grid.runtimeWidth;
var posX = 0f;
var inside = yAxis.axisLabel.inside;
if ((inside && yAxis.IsLeft()) || (!inside && yAxis.IsRight()))
@@ -1081,7 +1082,7 @@ namespace XCharts
new Vector2(grid.runtimeX, pY + scaleWidth),
yAxis.splitArea.GetColor(i, m_Theme.axis));
}
if (yAxis.splitLine.show)
if (yAxis.splitLine.show && pY >= grid.runtimeY)
{
if (!xAxis.axisLine.show || !xAxis.axisLine.onZero || zeroPos.y != pY)
{
@@ -1199,7 +1200,7 @@ namespace XCharts
new Vector2(pX + scaleWidth, grid.runtimeY),
xAxis.splitArea.GetColor(i, m_Theme.axis));
}
if (xAxis.splitLine.show)
if (xAxis.splitLine.show && pX >= grid.runtimeX)
{
if (!yAxis.axisLine.show || !yAxis.axisLine.onZero || zeroPos.x != pX)
{
@@ -1696,11 +1697,11 @@ namespace XCharts
}
public void Internal_CheckClipAndDrawZebraLine(VertexHelper vh, Vector3 p1, Vector3 p2, float size, float zebraWidth,
float zebraGap, Color32 color, Color32 toColor, bool clip, Grid grid)
float zebraGap, Color32 color, Color32 toColor, bool clip, Grid grid, float maxDistance)
{
ClampInChart(ref p1);
ClampInChart(ref p2);
UGL.DrawZebraLine(vh, p1, p2, size, zebraWidth, zebraGap, color, toColor);
UGL.DrawZebraLine(vh, p1, p2, size, zebraWidth, zebraGap, color, toColor, maxDistance);
}
protected Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, Grid grid)

View File

@@ -386,14 +386,14 @@ namespace XCharts
plt = (plb + plt) / 2;
prt = (prt + prb) / 2;
Internal_CheckClipAndDrawZebraLine(vh, plt, prt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
barColor, barToColor, serie.clip, grid);
barColor, barToColor, serie.clip, grid, grid.runtimeWidth);
}
else
{
plb = (prb + plb) / 2;
plt = (plt + prt) / 2;
Internal_CheckClipAndDrawZebraLine(vh, plb, plt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
barColor, barToColor, serie.clip, grid);
barColor, barToColor, serie.clip, grid, grid.runtimeHeight);
}
}

View File

@@ -266,6 +266,8 @@ namespace XCharts
var offset = new Vector3(textStyle.offset.x, textStyle.offset.y);
AxisHelper.AdjustCircleLabelPos(txt, pos, radar.runtimeCenterPos, txtHig, offset);
}
if(chart.tooltip.gameObject != null)
chart.tooltip.gameObject.transform.SetSiblingIndex(chart.transform.childCount-1);
chart.RefreshBasePainter();
};
radar.refreshComponent.Invoke();
@@ -312,9 +314,9 @@ namespace XCharts
serieIndex = serieNameCount;
}
else if (!serieNameSet.ContainsKey(dataName))
{
serieNameSet.Add(dataName, serieNameCount);
{
serieNameCount++;
serieNameSet.Add(dataName, serieNameCount);
serieIndex = serieNameCount;
}
else
@@ -482,8 +484,8 @@ namespace XCharts
}
else if (!serieNameSet.ContainsKey(dataName))
{
serieNameSet.Add(dataName, serieNameCount);
serieNameCount++;
serieNameSet.Add(dataName, serieNameCount);
serieIndex = serieNameCount;
}
else

View File

@@ -136,7 +136,6 @@ namespace XCharts
public bool CheckTootipArea(Vector2 local)
{
if (!chart.series.Contains(SerieType.Ring)) return false;
if (!PointerIsInRingSerie(chart.series, local)) return false;
if (m_IsEnterLegendButtom) return false;
bool selected = false;
chart.tooltip.runtimeDataIndex.Clear();

View File

@@ -33,8 +33,8 @@ namespace XCharts
[ExecuteInEditMode]
public class XChartsMgr : MonoBehaviour
{
internal static string _version = "2.6.0";
internal static int _versionDate = 20211230;
internal static string _version = "2.8.2";
internal static int _versionDate = 20220815;
public static string version { get { return _version; } }
public static int versionDate { get { return _versionDate; } }
public static string fullVersion { get { return version + "-" + versionDate; } }
@@ -57,7 +57,9 @@ namespace XCharts
{
var obj = GameObject.Find("_xcharts_");
if (obj == null) obj = new GameObject("_xcharts_");
obj.SetActive(false);
m_XCharts = obj.AddComponent<XChartsMgr>();
obj.SetActive(true);
}
m_XCharts.m_NowVersion = fullVersion;
}
@@ -279,7 +281,7 @@ namespace XCharts
public List<BaseChart> GetCharts(string chartName)
{
if (string.IsNullOrEmpty(chartName)) return null;
return m_ChartList.FindAll(chart => chartName.Equals(chartName));
return m_ChartList.FindAll(chart => chartName.Equals(chart.chartName));
}
public void RemoveChart(string chartName)
@@ -299,6 +301,33 @@ namespace XCharts
return m_ChartList.Contains(chart);
}
public bool IsRepeatChartName(BaseChart chart, string chartName = null)
{
if(chartName == null)
chartName = chart.chartName;
if (string.IsNullOrEmpty(chartName))
return false;
foreach (var temp in m_ChartList)
{
if (temp != chart && chartName.Equals(temp.chartName))
return true;
}
return false;
}
public string GetRepeatChartNameInfo(BaseChart chart, string chartName)
{
if (string.IsNullOrEmpty(chartName))
return string.Empty;
string result = "";
foreach (var temp in m_ChartList)
{
if (temp != chart && chartName.Equals(temp.chartName))
result += ChartHelper.GetFullName(temp.transform) + "\n";
}
return result;
}
public static void RemoveAllChartObject()
{
if (Instance.m_ChartList.Count == 0)
@@ -487,4 +516,4 @@ namespace XCharts
}
#endif
}
}
}

View File

@@ -34,7 +34,7 @@ namespace XUGL
/// <param name="dent">箭头凹度</param>
/// <param name="color">颜色</param>
public static void DrawArrow(VertexHelper vh, Vector3 startPoint, Vector3 arrowPoint, float width,
float height, float offset, float dent, Color32 color)
float height, float offset, float dent, Color32 color)
{
var dir = (arrowPoint - startPoint).normalized;
var sharpPos = arrowPoint + (offset + height / 4) * dir;
@@ -299,9 +299,25 @@ namespace XUGL
/// <param name="color">起始颜色</param>
/// <param name="toColor">结束颜色</param>
public static void DrawZebraLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width,
float zebraWidth, float zebraGap, Color32 color, Color32 toColor)
float zebraWidth, float zebraGap, Color32 color, Color32 toColor, float maxDistance)
{
DrawDotLine(vh, startPoint, endPoint, width, color, toColor, zebraWidth, zebraGap);
var dist = Vector3.Distance(startPoint, endPoint);
if (dist < 0.1f) return;
if (zebraWidth == 0) zebraWidth = 3 * width;
if (zebraGap == 0) zebraGap = 3 * width;
var allSegment = Mathf.CeilToInt(maxDistance / (zebraWidth + zebraGap));
var segment = Mathf.CeilToInt(dist / maxDistance * allSegment);
var dir = (endPoint - startPoint).normalized;
var sp = startPoint;
var np = Vector3.zero;
var isGradient = !color.Equals(toColor);
zebraWidth = (maxDistance - zebraGap * (allSegment - 1)) / allSegment;
for (int i = 1; i <= segment; i++)
{
np = sp + dir * zebraWidth;
DrawLine(vh, sp, np, width, isGradient ? Color32.Lerp(color, toColor, i * 1.0f / allSegment) : color);
sp = np + dir * zebraGap;
}
}
/// <summary>
@@ -419,7 +435,7 @@ namespace XUGL
/// <param name="color">颜色</param>
/// <param name="vertical">是否垂直方向</param>
public static void DrawRectangle(VertexHelper vh, Vector3 p, float xRadius, float yRadius,
Color32 color, bool vertical = true)
Color32 color, bool vertical = true)
{
DrawRectangle(vh, p, xRadius, yRadius, color, color, vertical);
}
@@ -1047,7 +1063,7 @@ namespace XUGL
}
public static void DrawTriangle(VertexHelper vh, Vector3 p1,
Vector3 p2, Vector3 p3, Color32 color, Color32 color2, Color32 color3)
Vector3 p2, Vector3 p3, Color32 color, Color32 color2, Color32 color3)
{
UIVertex v1 = new UIVertex();
v1.position = p1;
@@ -1075,7 +1091,7 @@ namespace XUGL
}
public static void DrawCricle(VertexHelper vh, Vector3 center, float radius, Color32 color,
Color32 toColor, float smoothness = 2f)
Color32 toColor, float smoothness = 2f)
{
DrawSector(vh, center, radius, color, toColor, 0, 360, 0, s_ClearColor32, smoothness);
}
@@ -1122,13 +1138,13 @@ namespace XUGL
}
public static void DrawSector(VertexHelper vh, Vector3 center, float radius, Color32 color,
float startDegree, float toDegree, float smoothness = 2f)
float startDegree, float toDegree, float smoothness = 2f)
{
DrawSector(vh, center, radius, color, color, startDegree, toDegree, 0, s_ClearColor32, smoothness);
}
public static void DrawSector(VertexHelper vh, Vector3 center, float radius, Color32 color, Color32 toColor,
float startDegree, float toDegree, int gradientType = 0, bool isYAxis = false, float smoothness = 2f)
float startDegree, float toDegree, int gradientType = 0, bool isYAxis = false, float smoothness = 2f)
{
DrawSector(vh, center, radius, color, toColor, startDegree, toDegree, 0, s_ClearColor32, 0, smoothness,
gradientType, isYAxis);
@@ -1167,10 +1183,11 @@ namespace XUGL
float smoothness, int gradientType = 0, bool isYAxis = false)
{
if (radius == 0) return;
if (space > 0 && Mathf.Abs(toDegree - startDegree) >= 360) space = 0;
var isCircle = Mathf.Abs(toDegree - startDegree) >= 360;
if (space > 0 && isCircle) space = 0;
radius -= borderWidth;
smoothness = (smoothness < 0 ? 2f : smoothness);
int segments = (int)((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness);
int segments = (int) ((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness);
if (segments < 1) segments = 1;
float startAngle = startDegree * Mathf.Deg2Rad;
float toAngle = toDegree * Mathf.Deg2Rad;
@@ -1207,7 +1224,7 @@ namespace XUGL
if (realToAngle < realStartAngle) realToAngle = realStartAngle;
p2 = UGLHelper.GetPos(center, radius, realStartAngle);
}
if (needBorder)
if (needBorder && !isCircle)
{
borderDiff = borderLineWidth / Mathf.Sin(halfAngle);
realCenter += borderDiff * middleDire;
@@ -1243,9 +1260,9 @@ namespace XUGL
{
p4 = new Vector3(p3.x, realCenter.y);
var dist = p4.x - realCenter.x;
var tcolor = Color32.Lerp(color, toColor, dist >= 0
? dist / radius
: Mathf.Min(radius + dist, radius) / radius);
var tcolor = Color32.Lerp(color, toColor, dist >= 0 ?
dist / radius :
Mathf.Min(radius + dist, radius) / radius);
if (isLeft && (i == segments || i == 0)) tcolor = toColor;
DrawQuadrilateral(vh, lastP4, p2, p3, p4, lastColor, tcolor);
lastP4 = p4;
@@ -1358,11 +1375,12 @@ namespace XUGL
insideRadius += borderWidth;
smoothness = smoothness < 0 ? 2f : smoothness;
Vector3 p1, p2, p3, p4, e1, e2;
var isCircle = Mathf.Abs(toDegree - startDegree) >= 360;
var needBorder = borderWidth != 0;
var needSpace = space != 0;
var diffAngle = Mathf.Abs(toDegree - startDegree) * Mathf.Deg2Rad;
int segments = (int)((2 * Mathf.PI * outsideRadius) * (diffAngle * Mathf.Rad2Deg / 360) / smoothness);
int segments = (int) ((2 * Mathf.PI * outsideRadius) * (diffAngle * Mathf.Rad2Deg / 360) / smoothness);
if (segments < 1) segments = 1;
float startAngle = startDegree * Mathf.Deg2Rad;
float toAngle = toDegree * Mathf.Deg2Rad;
@@ -1425,7 +1443,7 @@ namespace XUGL
p2 = UGLHelper.GetPos(center, outsideRadius, realStartOutAngle, false);
e2 = UGLHelper.GetPos(center, outsideRadius, realToOutAngle, false);
}
if (needBorder)
if (needBorder && !isCircle)
{
var borderDiff = borderWidth / Mathf.Sin(halfAngle);
realCenter += Mathf.Abs(borderDiff) * middleDire;
@@ -1608,7 +1626,7 @@ namespace XUGL
float lineWidth, Color32 lineColor, float smoothness)
{
var dist = Vector3.Distance(sp, ep);
var segment = (int)(dist / (smoothness <= 0 ? 2f : smoothness));
var segment = (int) (dist / (smoothness <= 0 ? 2f : smoothness));
UGLHelper.GetBezierList2(ref s_CurvesPosList, sp, ep, segment, cp1, cp2);
if (s_CurvesPosList.Count > 1)
{
@@ -1632,4 +1650,4 @@ namespace XUGL
}
}
}
}
}

View File

@@ -1,9 +1,9 @@
{
"name": "com.monitor1394.xcharts",
"displayName": "XCharts",
"version": "2.6.0",
"date": "20211230",
"checkdate": "20211230",
"version": "2.8.2",
"date": "20220815",
"checkdate": "20220815",
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
"unity": "2018.3",
"description": "A charting and data visualization library for Unity.",

View File

@@ -1,7 +1,7 @@
{
"version": "2.6.0",
"date": "20211230",
"checkdate": "20211230",
"version": "2.8.2",
"date": "20220815",
"checkdate": "20220815",
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
}

View File

@@ -1,9 +1,9 @@
# Get start with XCharts in 5 minute
[Return homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
## Installing XCharts
@@ -116,9 +116,9 @@ See the complete code in `Examples``Example13_LineSimple.cs`
You can also use the code to control more parameters. There are many more examples under `Examples`. All parameters in [XCharts Configuration](xcharts-configuration-EN.md) or `Inspector` can be controlled by code.
In addition, unless customized, it is recommended to call the interfaces in the [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md), which do some internal correlation processing, such as refreshing the chart, etc. If you call the interface of an internal component, you'll need to handle other issues like refresh yourself.
In addition, unless customized, it is recommended to call the interfaces in the [XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-api-EN.md), which do some internal correlation processing, such as refreshing the chart, etc. If you call the interface of an internal component, you'll need to handle other issues like refresh yourself.
[Return homepage](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/xcharts-configuration-EN.md)
[XCharts Q&A](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-questions-and-answers-EN.md)
[XCharts API](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-api-EN.md)
[XCharts Configuration](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/xcharts-configuration-EN.md)

View File

@@ -1,9 +1,9 @@
# 教程5分钟上手XCharts
# 教程5分钟上手 XCharts 2.0
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md)
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)
## 获取和引入 XCharts
@@ -121,7 +121,7 @@ for (int i = 0; i < 10; i++)
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](XCharts配置项手册.md)里面的所有参数都是可以通过代码控制的。
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XChartsAPI.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
## 使用TextMeshPro
@@ -172,6 +172,6 @@ serieData.itemStyle.color = Color.blue;
```
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md)
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)

View File

@@ -9,15 +9,15 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier: UnityEditor:UnityEditor.PackageManager.UI:PackageManagerProjectSettings
m_EditorClassIdentifier:
m_ScopedRegistriesSettingsExpanded: 1
oneTimeWarningShown: 0
m_Registries:
- m_Id: main
m_Name:
m_Url: https://packages.unity.cn
m_Url: https://packages.unity.com
m_Scopes: []
m_IsDefault: 1
m_UserSelectedRegistryName:

View File

@@ -1,2 +1,2 @@
m_EditorVersion: 2019.4.13f1c1
m_EditorVersionWithRevision: 2019.4.13f1c1 (ddecf0c37a3b)
m_EditorVersion: 2019.4.39f1
m_EditorVersionWithRevision: 2019.4.39f1 (78d14dfa024b)

View File

@@ -12,7 +12,7 @@
<a href="Assets/XCharts/README.md">English Doc</a>
</p>
<p align="center">
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/LICENSE">
<img src="https://img.shields.io/github/license/monitor1394/unity-ugui-XCharts">
</a>
<a href="https://github.com/monitor1394/unity-ugui-XCharts/releases">
@@ -45,11 +45,11 @@
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持折线图、柱状图、饼图、雷达图、散点图、热力图、仪表盘、环形图、极坐标、水位图、K线图等常见图表。
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
[XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md)
[XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
[教程5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程5分钟上手XCharts.md)
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)
[XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XChartsAPI.md)
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)
[XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
[教程5分钟上手 XCharts 2.0](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/教程5分钟上手XCharts.md)
## XCharts 2.0
@@ -182,25 +182,25 @@ XCharts的图表由组件和数据组成。不同的组件和数据可以组合
* 在Editor上快速创建一个图表
1. 在`Hierarchy`试图下右键或菜单栏`GameObject`下拉:`XCharts->LineChart`,即可快速创建一个简单的折线图出来。
2. `Inspector` 视图下可以调整各个组件的参数,`Game` 视图会实时反馈调整的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md)。
2. `Inspector` 视图下可以调整各个组件的参数,`Game` 视图会实时反馈调整的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)。
* 更多的代码动态控制的例子请参考[教程5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程5分钟上手XCharts.md) 。
* 更多的代码动态控制的例子请参考[教程5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/教程5分钟上手XCharts.md) 。
## 文档
* 常见问题看这里☞ [XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
* 接口文档看这里☞ [XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
* 参数配置看这里☞ [XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts配置项手册.md)
* 更新日志看这里☞ [XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
* 新手教程看这里☞ [教程5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/教程5分钟上手XCharts.md)
* 常见问题看这里☞ [XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts问答.md)
* 接口文档看这里☞ [XChartsAPI手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XChartsAPI.md)
* 参数配置看这里☞ [XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/Documentation/XCharts配置项手册.md)
* 更新日志看这里☞ [XCharts更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
* 新手教程看这里☞ [教程5分钟上手XCharts](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Doc/教程5分钟上手XCharts.md)
## 日志
[更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/CHANGELOG.md)
[更新日志](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/CHANGELOG.md)
## Licenses
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/LICENSE.md)
[MIT License](https://github.com/monitor1394/unity-ugui-XCharts/blob/2.0/Assets/XCharts/LICENSE.md)
## 其他