3.0
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 042c85734494346adab5b3233234d261
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0793c29ff7adb422fb93f9f4e29d5a06
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
0
Documentation~/README-EN.md
Normal file
40
Documentation~/SUPPORT.md
Normal file
@@ -0,0 +1,40 @@
|
||||
## 技术支持
|
||||
|
||||
如需技术支持,可订阅VIP服务。扫后面的支付宝二维码后可加VIP群(`867291970`,验证信息请输入支付宝账号)。企业VIP可加官方群私聊群主了解详情。
|
||||
|
||||
## 订阅服务
|
||||
|
||||
| |免费用户|个人`1`年`VIP`|个人`2`年`VIP` | 个人长期`VIP` |
|
||||
| ----- |--|--|--|--|
|
||||
| 订阅费用 | -- | `298`¥ | `498`¥ | `888`¥ |
|
||||
| 席位时长 | -- | `1`个席位<br>`1`年 | `1`个席位<br>`2`年 | `1`个席位<br>`长期` |
|
||||
||
|
||||
| <b>`服务方式:`</b>|
|
||||
| 官方QQ群交流 | √ | √ | √ | √ |
|
||||
| 专属VIP群交流 | | √ | √ | √ |
|
||||
| 即时一对一交流 | | √ | √ | √ |
|
||||
||
|
||||
| <b>`服务内容:`</b>|
|
||||
| 可商用 | √ | √ | √ | √ |
|
||||
| 可二次开发 | √ | √ | √ | √ |
|
||||
| 有问必答 | | √ | √ | √ |
|
||||
| 新手指导 | | √ | √ | √ |
|
||||
| 开发指导 | | √ | √ | √ |
|
||||
| 优化指导 | | √ | √ | √ |
|
||||
| 其他技术支持 | | √ | √ | √ |
|
||||
| 问题及时处理 | | √ | √ | √ |
|
||||
| 需求优先考虑 | | √ | √ | √ |
|
||||
| 可另付费定制 | | √ | √ | √ |
|
||||
| 可另付费加急 | | √ | √ | √ |
|
||||
| 付费模块85折 | | | | √ |
|
||||
|
||||
## 备注说明
|
||||
|
||||
1. __`付费定制`__ 是指用户可根据自己的需求定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
|
||||
2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并指定`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。
|
||||
|
||||
## 捐助支持
|
||||
|
||||
如果这个项目对您有帮助,请右上方点 `Star` 予以支持!也欢迎任何金额的赞助,非常感谢!
|
||||
|
||||

|
||||
231
Documentation~/XCharts教程:5分钟上手教程.md
Normal file
@@ -0,0 +1,231 @@
|
||||
# 教程:5分钟上手 XCharts 3.0
|
||||
|
||||
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
|
||||
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/master/Documentation~/XCharts问答.md)
|
||||
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/master/Documentation~/XChartsAPI.md)
|
||||
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/master/Documentation~/XCharts配置项手册.md)
|
||||
|
||||
## 获取和导入 XCharts
|
||||
|
||||
1. 直接放入XCharts源码到项目
|
||||
|
||||
下载好XCharts源码后,直接将XCharts目录拷贝到Unity项目工程的Assets目录下。
|
||||
|
||||
2. 通过`Assets/Import Package`导入XCharts
|
||||
|
||||
下载好XCharts的.unitypackage文件后,打开Unity,菜单栏 Assets-->Import Package-->选中.unitypackage导入即可开始使用XCharts。
|
||||
|
||||
3. 通过`Package Manager`导入XCharts
|
||||
|
||||
对于Unity 2018.3以上版本,可通过 Package Manager来导入XCharts,打开Package Manager后,通过 `Add package form git URL...`,输入XCharts的github URL: https://github.com/monitor1394/unity-ugui-XCharts.git#master 稍等片刻后即可使用XCharts。
|
||||
|
||||
也可以直接将package加入到`manifest.json`文件:打开`Packages`目录下的`manifest.json`文件,在`dependencies`下加入:
|
||||
|
||||
``` json
|
||||
"com.monitor1394.xcharts": "https://github.com/monitor1394/unity-ugui-XCharts.git#master",
|
||||
```
|
||||
|
||||
如需更新`XCharts`,删除`manifest.json`文件(部分Unity版本可能是packages-lock.json文件)的`lock`下的`com.monitor1394.xcharts`相关内容即会重新下载编译。
|
||||
|
||||
## 添加一个简单图表
|
||||
|
||||
在`Hierarchy`试图下右键或菜单栏`GameObject`下拉:`XCharts->LineChart`:
|
||||
|
||||

|
||||
|
||||
即可快速创建一个简单的折线图出来:
|
||||
|
||||

|
||||
|
||||
## 添加多个Seire
|
||||
|
||||
如何在上图的基础上添加两条折线呢,只需`Add Serie`按钮,选择对应的`Serie`类型即可:
|
||||

|
||||

|
||||
|
||||
## 添加其他组件
|
||||
|
||||
默认图表没有`Legend`,需要`Legend`组件可通过`Add Component`按钮添加:
|
||||

|
||||
|
||||
## 添加Serie组件
|
||||
|
||||
如果需要给折线图区域填充颜色,可单独给`Serie`添加`Component`:
|
||||

|
||||

|
||||
|
||||
## 添加SerieData组件
|
||||
|
||||
如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加`Component`。比如我们给第一个折线图的第二个数据单独显示`Label`:
|
||||

|
||||

|
||||
|
||||
## 更多组件和配置参数
|
||||
|
||||
功能越丰富就越需要更多的组件和参数支持。XCharts有多达几十种的主组件和子组件,每个组件有几个至几十个不等的可配置参数,以支持各种灵活而复杂的功能。
|
||||
|
||||
首次接触XCharts者可在 `Inspector` 视图下可以添加和调整各个组件,`Game` 视图会实时反馈调整的效果,以熟悉各种组件实现的效果。各个组件的详细参数说明可查阅[XCharts配置项手册](XCharts配置项手册.md)。
|
||||
|
||||
## 如何快速调整参数
|
||||
|
||||
`XCharts`是配置参数驱动。想要什么效果,你只需要去调整对应组件下的配置参数就可以,不需要去改`Hierarchy`试图下的节点,因为那些节点是由`XCharts`内部根据配置参数生成的。你改了也会变还原。
|
||||
|
||||
快速定位你想要改的效果对应的组件。这就需要对组件有一定的了解。比如我们想要让X轴的轴线末端显示箭头,如何定位?第一步,X轴定位到`XAxis0`;第二步,轴线定位到`AxisLine`;最后,再去看`AxisLine`组件下有没有这样的参数可以实现这个效果。
|
||||
|
||||
`XCharts`提供从全局`Theme`、系列`Serie`、单个数据项`SerieData`全方位的参数配置。优先级从大到小为:`SerieData`->`Serie`->`Theme`。以`ItemStyle`的颜色例,如果`SerieData`的`ItemStyle`配置有颜色值,则优先用这个颜色值。
|
||||
|
||||
## 用代码添加折线图
|
||||
|
||||
给`gameObject`挂上`LineChart`脚本:
|
||||
|
||||
```C#
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
}
|
||||
```
|
||||
|
||||
调整大小:
|
||||
|
||||
```C#
|
||||
chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTransform,或直接在Inspector上改
|
||||
```
|
||||
|
||||
设置标题:
|
||||
|
||||
```C#
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
title.text = "Simple Line";
|
||||
```
|
||||
|
||||
设置提示框和图例是否显示:
|
||||
|
||||
```C#
|
||||
var tooltip = chart.GetOrAddChartComponent<Tooltip>();
|
||||
tooltip.show = true;
|
||||
|
||||
var legend = chart.GetOrAddChartComponent<Legend>();
|
||||
legend.show = false;
|
||||
```
|
||||
|
||||
设置坐标轴:
|
||||
|
||||
```C#
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
```
|
||||
|
||||
清空默认数据,添加`Line`类型的`Serie`用于接收数据:
|
||||
|
||||
```C#
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>("line");
|
||||
```
|
||||
|
||||
添加10个数据:
|
||||
|
||||
```C#
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
chart.AddData(0, Random.Range(10, 20));
|
||||
}
|
||||
```
|
||||
|
||||
这样一个简单的折线图就出来了:
|
||||

|
||||
|
||||
如果一个Chart里面有多个系列时,则Axis的data只需要加一次,不要多个循环加重复了。记住:Axis的数据个数要和Serie的数据个数一致。
|
||||
|
||||
完整代码请查阅`Examples`:`Example13_LineSimple.cs`
|
||||
|
||||
你还可以用代码控制更多的参数,`Examples`下还有更多的其他例子,凡是`Inspector`上看到的可配置的参数,都可以通过代码来设置。[XCharts配置项手册](XCharts配置项手册.md)里面的所有参数都是可以通过代码控制的。
|
||||
|
||||
另外,除非定制,建议调用[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/master/Documentation~/XChartsAPI.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。
|
||||
|
||||
## 使用TextMeshPro
|
||||
|
||||
XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换。可通过一下两种方式开启和关闭:
|
||||

|
||||

|
||||
开启后需要设置好TextMeshPro要用的全局字体,也可以在主题Theme里单独设置:
|
||||

|
||||
建议在项目初就规划好是否使用TextMeshPro,在有很多图表的情况下再切换,可能导致某些图表无法正常初始化,这时可能需要每个图表单独的使用`Remove All Chart Object`来清理让图表重新初始化。
|
||||
|
||||
## 用代码改图表参数
|
||||
|
||||
`Inspector`上看到的所有参数都可以用代码来修改,关键是要定位好你要改的参数是在组件上、还是serie上、还是在具体的数据项上改。
|
||||
|
||||
### 改主组件上的参数
|
||||
|
||||
需要先获取组件,再修改里面的参数:
|
||||
|
||||
```C#
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
title.text = "Simple LineChart";
|
||||
title.subText = "normal line";
|
||||
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
```
|
||||
|
||||
### 改Serie的参数
|
||||
|
||||
新添加Serie:
|
||||
|
||||
```C#
|
||||
var serie = chart.AddSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
serie.radius[0] = 80;
|
||||
serie.radius[1] = 90;
|
||||
serie.animation.dataChangeEnable = true;
|
||||
serie.roundCap = true;
|
||||
```
|
||||
|
||||
已存在的Serie:
|
||||
|
||||
```C#
|
||||
var serie = chart.GetSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
serie.radius[0] = 80;
|
||||
serie.radius[1] = 90;
|
||||
serie.animation.dataChangeEnable = true;
|
||||
serie.roundCap = true;
|
||||
```
|
||||
|
||||
给Serie添加额外组件:
|
||||
|
||||
```C#
|
||||
serie.AddExtraComponent<AreaStyle>();
|
||||
|
||||
var label = serie1.AddExtraComponent<LabelStyle>();
|
||||
label.offset = new Vector3(0,20,0);
|
||||
```
|
||||
|
||||
### 改数据项SerieData上的参数
|
||||
|
||||
```C#
|
||||
var serieData = chart.AddData(0, 20);
|
||||
//var serieData = serie.GetSerieData(0); //从已有数据中获取
|
||||
serieData.radius = 10;
|
||||
|
||||
var itemStyle = serieData.GetOrAddComponent<ItemStyle>(); //启用SerieData的Component
|
||||
itemStyle.color = Color.blue;
|
||||
|
||||
```
|
||||
|
||||
[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
|
||||
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/master/Documentation~/XCharts问答.md)
|
||||
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/master/Documentation~/XChartsAPI.md)
|
||||
[XCharts配置项手册](https://github.com/monitor1394/unity-ugui-XCharts/master/Documentation~/XCharts配置项手册.md)
|
||||
BIN
Documentation~/res/alipay.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
Documentation~/res/inpsector-desc.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
Documentation~/res/linechart-simple.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
Documentation~/res/linechart.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
Documentation~/res/linechart1.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
Documentation~/res/linechart2.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
Documentation~/res/linechart3.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
Documentation~/res/linechart4.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
Documentation~/res/op_addchart.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
Documentation~/res/op_addcomponent.png
Normal file
|
After Width: | Height: | Size: 148 KiB |
BIN
Documentation~/res/op_addserie.png
Normal file
|
After Width: | Height: | Size: 140 KiB |
BIN
Documentation~/res/op_addseriecomponent.png
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
Documentation~/res/op_addseriedatacomponent.png
Normal file
|
After Width: | Height: | Size: 132 KiB |
BIN
Documentation~/res/op_datamore.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
Documentation~/res/op_textmeshpro.png
Normal file
|
After Width: | Height: | Size: 308 KiB |
BIN
Documentation~/res/op_textmeshpro2.png
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
Documentation~/res/op_textmeshpro3.png
Normal file
|
After Width: | Height: | Size: 256 KiB |
@@ -14,16 +14,17 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.SetSize(580, 300);//代码动态添加图表需要设置尺寸,或直接操作chart.rectTransform
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
}
|
||||
chart.GetChartComponent<Title>().show = true;
|
||||
chart.GetChartComponent<Title>().text = "Line Simple";
|
||||
chart.GetOrAddChartComponent<Title>().show = true;
|
||||
chart.GetOrAddChartComponent<Title>().text = "Line Simple";
|
||||
|
||||
chart.GetChartComponent<Tooltip>().show = true;
|
||||
chart.GetChartComponent<Legend>().show = false;
|
||||
chart.GetOrAddChartComponent<Tooltip>().show = true;
|
||||
chart.GetOrAddChartComponent<Legend>().show = false;
|
||||
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
xAxis.show = true;
|
||||
yAxis.show = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
@@ -35,7 +36,7 @@ namespace XCharts.Example
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>();
|
||||
chart.AddSerie<Line>();
|
||||
for (int i = 0; i < 2000; i++)
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
chart.AddData(0, Random.Range(10, 20));
|
||||
|
||||
67
Examples/Runtime/Example_AddChart.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
//[ExecuteInEditMode]
|
||||
public class Example_AddChart : MonoBehaviour
|
||||
{
|
||||
BaseChart chart;
|
||||
void Awake()
|
||||
{
|
||||
//AddChart();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
AddChart();
|
||||
}
|
||||
}
|
||||
|
||||
void AddChart()
|
||||
{
|
||||
chart = gameObject.GetComponent<BaseChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(1200, 600);
|
||||
}
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
title.text = "Simple LineChart";
|
||||
title.subText = "normal line";
|
||||
|
||||
var tooltip = chart.GetOrAddChartComponent<Tooltip>();
|
||||
tooltip.show = true;
|
||||
|
||||
var legend = chart.GetOrAddChartComponent<Legend>();
|
||||
legend.show = false;
|
||||
|
||||
var xAxis = chart.GetOrAddChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
|
||||
var yAxis = chart.GetOrAddChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>("line");
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
chart.AddData(0, Random.Range(10, 20));
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyComponent()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Examples/Runtime/Example_AddChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e5c24ed461624b8d924dfb1285e0a95
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Examples/Runtime/Example_Component.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
//[ExecuteInEditMode]
|
||||
public class Example_Component : MonoBehaviour
|
||||
{
|
||||
BaseChart chart;
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<BaseChart>();
|
||||
}
|
||||
|
||||
void ModifyComponent()
|
||||
{
|
||||
var title = chart.GetOrAddChartComponent<Title>();
|
||||
title.text = "Simple LineChart";
|
||||
title.subText = "normal line";
|
||||
|
||||
var serie1 = chart.AddSerie<Line>();
|
||||
//var serie2 = chart.GetSerie<Line>();
|
||||
|
||||
serie1.AddExtraComponent<AreaStyle>();
|
||||
var label = serie1.AddExtraComponent<LabelStyle>();
|
||||
label.offset = new Vector3(0, 20, 0);
|
||||
|
||||
var serieData = chart.AddData(0, 20);
|
||||
//var serieData = serie1.GetSerieData(0);
|
||||
serieData.radius = 10;
|
||||
var itemStyle = serieData.GetOrAddComponent<ItemStyle>();
|
||||
itemStyle.color = Color.blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Examples/Runtime/Example_Component.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e9941e7d67e44b18899e6048d4ef25a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -20,20 +20,12 @@ namespace XCharts.Example
|
||||
}
|
||||
}
|
||||
|
||||
float m_LastTime = 0;
|
||||
double m_Value = 0;
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
//AddData();
|
||||
OnTestBtn();
|
||||
}
|
||||
if (Time.time - m_LastTime > 0.1f)
|
||||
{
|
||||
m_LastTime = Time.time;
|
||||
chart.UpdateData(0, 2, m_Value);
|
||||
m_Value += 15;
|
||||
AddData();
|
||||
//OnTestBtn();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
64
README.md
@@ -9,7 +9,7 @@
|
||||
<br>
|
||||
一款基于UGUI的数据可视化图表插件。
|
||||
<br>
|
||||
<a href="Assets/XCharts/README.md">English Doc</a>
|
||||
<a href="Documentation~/README-EN.md">English Doc</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/monitor1394/unity-ugui-XCharts/blob/master/LICENSE">
|
||||
@@ -43,6 +43,64 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等常见图表。
|
||||
一款基于`UGUI`的功能强大、易用、参数可配置的数据可视化图表插件。支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表,以及3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||
|
||||
[WebGL Demo](https://xcharts-team.github.io/demo.github.io/)
|
||||
## 特性
|
||||
|
||||
* 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
||||
* 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
||||
* 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||
* 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
||||
* 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
||||
* 支持环形图、玫瑰图等饼图。
|
||||
* 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
|
||||
* 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
||||
* 支持主题定制、导入和导出,内置两种默认主题。
|
||||
* 支持自定义图表内容绘制,提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
|
||||
* 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
|
||||
* 支持万级大数据绘制。
|
||||
* 支持`TexMeshPro`。
|
||||
|
||||
## XCharts3.0 比 2.0 的改进
|
||||
|
||||
* 更具可读性、可扩展性和可维护性的健壮底层框架。
|
||||
* 更好的性能。
|
||||
* 更小的存储文件。
|
||||
* 更好的交互体验。
|
||||
* 更多的组件支持。
|
||||
* 更合理的组件调整。
|
||||
* 更灵活的组件插拔。
|
||||
* 更方便的二次开发。
|
||||
* 更丰富的Demo示例。
|
||||
|
||||
## XCharts3.0新功能
|
||||
|
||||
* 增加Time时间轴。
|
||||
* 增加SingleAxis单轴。
|
||||
* 增加多种坐标系:Grid、Polar、Radar、SingleAxis。
|
||||
* 增加多种动画方式。
|
||||
* 增加更细致的图表交互。
|
||||
* 增加国际化支持。
|
||||
* 增加Widgets小组件。
|
||||
* 增加更多付费扩展图表的无缝支持。
|
||||
|
||||
## 截图
|
||||
|
||||
## 使用
|
||||
|
||||
[XCharts教程:5分钟上手教程](Documentation~/XCharts教程:5分钟上手教程.md)
|
||||
|
||||
## 日志
|
||||
|
||||
[更新日志](CHANGELOG.md)
|
||||
|
||||
## Licenses
|
||||
|
||||
[MIT License](LICENSE.md)
|
||||
|
||||
## 其他
|
||||
|
||||
邮箱:monitor1394@gmail.com
|
||||
QQ群:XCharts交流群(`202030963`)
|
||||
VIP群:XCharts技术支持VIP群(`867291970`)
|
||||
捐助和技术支持:[☞ 看这里](Documentation~/SUPPORT.md)
|
||||
|
||||
@@ -7,17 +7,15 @@ namespace XCharts.Runtime
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[DisallowMultipleComponent]
|
||||
public partial class BarChart : BaseChart
|
||||
public class BarChart : BaseChart
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<GridCoord>();
|
||||
AddChartComponentWhenNoExist<XAxis>();
|
||||
AddChartComponentWhenNoExist<YAxis>();
|
||||
|
||||
var tooltip = GetChartComponent<Tooltip>();
|
||||
var tooltip = GetOrAddChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.Shadow;
|
||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||
|
||||
@@ -28,6 +26,5 @@ namespace XCharts.Runtime
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,26 +10,22 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class CandlestickChart : BaseChart
|
||||
{
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<GridCoord>();
|
||||
AddChartComponentWhenNoExist<XAxis>();
|
||||
AddChartComponentWhenNoExist<YAxis>();
|
||||
|
||||
var tooltip = GetChartComponent<Tooltip>();
|
||||
var tooltip = GetOrAddChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.Shadow;
|
||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||
|
||||
RemoveData();
|
||||
Candlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
for (int i = 0; i < GetSerie(0).dataCount; i++)
|
||||
var serie = Candlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,8 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class HeatmapChart : BaseChart
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
var tooltip = GetChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.None;
|
||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||
@@ -76,6 +73,5 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,13 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class LineChart : BaseChart
|
||||
{
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<GridCoord>();
|
||||
AddChartComponentWhenNoExist<XAxis>();
|
||||
AddChartComponentWhenNoExist<YAxis>();
|
||||
|
||||
var tooltip = GetChartComponent<Tooltip>();
|
||||
var tooltip = GetOrAddChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.Line;
|
||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||
|
||||
@@ -30,6 +27,5 @@ namespace XCharts.Runtime
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,8 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class ParallelChart : BaseChart
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
RemoveData();
|
||||
AddChartComponent<ParallelCoord>();
|
||||
|
||||
@@ -29,6 +27,5 @@ namespace XCharts.Runtime
|
||||
|
||||
Parallel.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,13 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class PieChart : BaseChart
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
var legend = GetOrAddChartComponent<Legend>();
|
||||
legend.show = true;
|
||||
|
||||
RemoveData();
|
||||
Pie.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,8 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class PolarChart : BaseChart
|
||||
{
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<PolarCoord>();
|
||||
|
||||
var tooltip = GetChartComponent<Tooltip>();
|
||||
@@ -32,6 +29,5 @@ namespace XCharts.Runtime
|
||||
AddData(0, Mathf.Abs(r), i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,20 +9,12 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class RadarChart : BaseChart
|
||||
{
|
||||
protected override void InitComponent()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.InitComponent();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
RemoveData();
|
||||
RemoveChartComponents<RadarCoord>();
|
||||
AddChartComponent<RadarCoord>();
|
||||
Radar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,15 +10,11 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class RingChart : BaseChart
|
||||
{
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
GetChartComponent<Tooltip>().type = Tooltip.Type.Line;
|
||||
RemoveData();
|
||||
Ring.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,27 +9,24 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class ScatterChart : BaseChart
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<GridCoord>();
|
||||
|
||||
|
||||
var tooltip = GetOrAddChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.None;
|
||||
tooltip.trigger = Tooltip.Trigger.Item;
|
||||
|
||||
var xAxis = GetOrAddChartComponent<XAxis>();
|
||||
xAxis.type = Axis.AxisType.Value;
|
||||
xAxis.type = Axis.AxisType.Value;
|
||||
xAxis.boundaryGap = false;
|
||||
|
||||
var yAxis = GetOrAddChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
yAxis.boundaryGap = false;
|
||||
|
||||
RemoveData();
|
||||
Scatter.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,8 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class SimplifiedBarChart : BaseChart
|
||||
{
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<GridCoord>();
|
||||
AddChartComponentWhenNoExist<XAxis>();
|
||||
AddChartComponentWhenNoExist<YAxis>();
|
||||
@@ -30,6 +27,5 @@ namespace XCharts.Runtime
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,8 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class SimplifiedCandlestickChart : BaseChart
|
||||
{
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<GridCoord>();
|
||||
AddChartComponentWhenNoExist<XAxis>();
|
||||
AddChartComponentWhenNoExist<YAxis>();
|
||||
@@ -30,6 +27,5 @@ namespace XCharts.Runtime
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,8 @@ namespace XCharts.Runtime
|
||||
[DisallowMultipleComponent]
|
||||
public class SimplifiedLineChart : BaseChart
|
||||
{
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
base.Reset();
|
||||
AddChartComponentWhenNoExist<GridCoord>();
|
||||
AddChartComponentWhenNoExist<XAxis>();
|
||||
AddChartComponentWhenNoExist<YAxis>();
|
||||
@@ -30,6 +27,5 @@ namespace XCharts.Runtime
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ namespace XCharts.Runtime
|
||||
/// <returns></returns>
|
||||
public bool IsCategory()
|
||||
{
|
||||
return type == AxisType.Category;
|
||||
return m_Type == AxisType.Category;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -498,7 +498,7 @@ namespace XCharts.Runtime
|
||||
/// <returns></returns>
|
||||
public bool IsValue()
|
||||
{
|
||||
return type == AxisType.Value;
|
||||
return m_Type == AxisType.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -507,7 +507,7 @@ namespace XCharts.Runtime
|
||||
/// <returns></returns>
|
||||
public bool IsLog()
|
||||
{
|
||||
return type == AxisType.Log;
|
||||
return m_Type == AxisType.Log;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -515,27 +515,27 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public bool IsTime()
|
||||
{
|
||||
return type == AxisType.Time;
|
||||
return m_Type == AxisType.Time;
|
||||
}
|
||||
|
||||
public bool IsLeft()
|
||||
{
|
||||
return position == AxisPosition.Left;
|
||||
return m_Position == AxisPosition.Left;
|
||||
}
|
||||
|
||||
public bool IsRight()
|
||||
{
|
||||
return position == AxisPosition.Right;
|
||||
return m_Position == AxisPosition.Right;
|
||||
}
|
||||
|
||||
public bool IsTop()
|
||||
{
|
||||
return position == AxisPosition.Top;
|
||||
return m_Position == AxisPosition.Top;
|
||||
}
|
||||
|
||||
public bool IsBottom()
|
||||
{
|
||||
return position == AxisPosition.Bottom;
|
||||
return m_Position == AxisPosition.Bottom;
|
||||
}
|
||||
|
||||
public void SetNeedUpdateFilterData()
|
||||
|
||||
@@ -69,6 +69,8 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public Vector3 chartPosition { get { return m_ChartPosition; } }
|
||||
public Rect chartRect { get { return m_ChartRect; } }
|
||||
public Action onInit { set { m_OnInit = value; } }
|
||||
public Action onUpdate { set { m_OnUpdate = value; } }
|
||||
/// <summary>
|
||||
/// 自定义绘制回调。在绘制Serie前调用。
|
||||
/// </summary>
|
||||
@@ -103,6 +105,19 @@ namespace XCharts.Runtime
|
||||
/// 坐标轴变更数据索引时回调。参数:axis, dataIndex/dataValue
|
||||
/// </summary>
|
||||
public Action<Axis, double> onAxisPointerValueChanged { set { m_OnAxisPointerValueChanged = value; } get { return m_OnAxisPointerValueChanged; } }
|
||||
|
||||
public void Init(bool defaultChart = true)
|
||||
{
|
||||
if (defaultChart)
|
||||
{
|
||||
OnInit();
|
||||
DefaultChart();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnBeforeSerialize();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Redraw chart in next frame.
|
||||
/// 在下一帧刷新图表。
|
||||
@@ -138,6 +153,7 @@ namespace XCharts.Runtime
|
||||
foreach (var component in m_Components)
|
||||
component.ClearData();
|
||||
m_Series.Clear();
|
||||
m_SerieHandlers.Clear();
|
||||
m_CheckAnimation = false;
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
@@ -55,12 +55,16 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!CanAddChartComponent(type))
|
||||
{
|
||||
throw new InvalidOperationException("CanAddChartComponent:" + type.Name);
|
||||
Debug.LogError("XCharts ERROR: CanAddChartComponent:" + type.Name);
|
||||
return null;
|
||||
}
|
||||
CheckAddRequireChartComponent(type);
|
||||
var component = Activator.CreateInstance(type) as MainComponent;
|
||||
if (component == null)
|
||||
throw new InvalidOperationException("CanAddChartComponent:" + type.Name);
|
||||
{
|
||||
Debug.LogError("XCharts ERROR: CanAddChartComponent:" + type.Name);
|
||||
return null;
|
||||
}
|
||||
component.SetDefaultValue();
|
||||
if (component is IUpdateRuntimeData)
|
||||
(component as IUpdateRuntimeData).UpdateRuntimeData(chartX, chartY, chartWidth, chartHeight);
|
||||
|
||||
@@ -79,6 +79,8 @@ namespace XCharts.Runtime
|
||||
protected Vector2 m_ChartSizeDelta;
|
||||
|
||||
protected Rect m_ChartRect = new Rect(0, 0, 0, 0);
|
||||
protected Action m_OnInit;
|
||||
protected Action m_OnUpdate;
|
||||
protected Action<VertexHelper> m_OnDrawBase;
|
||||
protected Action<VertexHelper> m_OnDrawTop;
|
||||
protected Action<VertexHelper, Serie> m_OnDrawSerieBefore;
|
||||
@@ -101,6 +103,10 @@ namespace XCharts.Runtime
|
||||
protected List<MainComponentHandler> m_ComponentHandlers = new List<MainComponentHandler>();
|
||||
protected List<SerieHandler> m_SerieHandlers = new List<SerieHandler>();
|
||||
|
||||
protected virtual void DefaultChart()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void InitComponent()
|
||||
{
|
||||
base.InitComponent();
|
||||
@@ -125,10 +131,8 @@ namespace XCharts.Runtime
|
||||
XChartsMgr.AddChart(this);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
protected void OnInit()
|
||||
{
|
||||
base.Reset();
|
||||
RemoveAllChartComponent();
|
||||
OnBeforeSerialize();
|
||||
AddChartComponentWhenNoExist<Title>();
|
||||
@@ -148,6 +152,16 @@ namespace XCharts.Runtime
|
||||
rectTransform.sizeDelta = new Vector2(580, 300);
|
||||
}
|
||||
ChartHelper.HideAllObject(transform);
|
||||
if (m_OnInit != null)
|
||||
m_OnInit();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
OnInit();
|
||||
DefaultChart();
|
||||
Awake();
|
||||
}
|
||||
#endif
|
||||
@@ -167,6 +181,8 @@ namespace XCharts.Runtime
|
||||
foreach (var handler in m_SerieHandlers) handler.Update();
|
||||
foreach (var handler in m_ComponentHandlers) handler.Update();
|
||||
m_DebugInfo.Update();
|
||||
if (m_OnUpdate != null)
|
||||
m_OnUpdate();
|
||||
}
|
||||
|
||||
public Painter GetPainter(int index)
|
||||
@@ -537,7 +553,7 @@ namespace XCharts.Runtime
|
||||
serie.context.dataPoints.Clear();
|
||||
serie.context.dataIgnores.Clear();
|
||||
serie.animation.context.isAllItemAnimationEnd = true;
|
||||
|
||||
|
||||
if (m_OnDrawSerieBefore != null)
|
||||
{
|
||||
m_OnDrawSerieBefore.Invoke(vh, serie);
|
||||
|
||||
@@ -411,8 +411,8 @@ namespace XCharts.Runtime
|
||||
|
||||
public bool IsDataChanged()
|
||||
{
|
||||
foreach (var b in m_DataUpdateFlag)
|
||||
if (b) return true;
|
||||
for (int i = 0; i < m_DataUpdateFlag.Count; i++)
|
||||
if (m_DataUpdateFlag[i]) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,8 +192,8 @@ namespace XCharts.Runtime
|
||||
m_SerieLabelRoot = ChartHelper.AddObject(s_SerieLabelObjectName, m_SerieRoot.transform,
|
||||
chart.chartMinAnchor, chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||
m_SerieLabelRoot.hideFlags = chart.chartHideFlags;
|
||||
//SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
|
||||
ChartHelper.DestroyAllChildren(m_SerieLabelRoot.transform);
|
||||
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
|
||||
//ChartHelper.DestroyAllChildren(m_SerieLabelRoot.transform);
|
||||
int count = 0;
|
||||
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
for (int j = 0; j < serie.data.Count; j++)
|
||||
|
||||
@@ -294,17 +294,17 @@ namespace XUGL
|
||||
{
|
||||
var dir1 = (cp - lp).normalized;
|
||||
var dir2 = (cp - np).normalized;
|
||||
var dir1v = Vector3.Cross(dir1, Vector3.forward).normalized;
|
||||
var dir2v = Vector3.Cross(dir2, Vector3.back).normalized;
|
||||
var dir1v = Vector3.Cross(dir1, Vector3.forward).normalized * width;
|
||||
var dir2v = Vector3.Cross(dir2, Vector3.back).normalized * width;
|
||||
|
||||
ltp = lp - dir1v * width;
|
||||
lbp = lp + dir1v * width;
|
||||
ltp = lp - dir1v;
|
||||
lbp = lp + dir1v;
|
||||
|
||||
ntp = np - dir2v * width;
|
||||
nbp = np + dir2v * width;
|
||||
ntp = np - dir2v;
|
||||
nbp = np + dir2v;
|
||||
|
||||
clp = cp - dir2v * width;
|
||||
crp = cp + dir2v * width;
|
||||
clp = cp - dir2v;
|
||||
crp = cp + dir2v;
|
||||
|
||||
var ldist = (Vector3.Distance(cp, lp) + 1) * dir1;
|
||||
var rdist = (Vector3.Distance(cp, np) + 1) * dir2;
|
||||
@@ -312,24 +312,24 @@ namespace XUGL
|
||||
bitp = true;
|
||||
if (!UGLHelper.GetIntersection(ltp, ltp + ldist, ntp, ntp + rdist, ref itp))
|
||||
{
|
||||
itp = cp - dir1v * width;
|
||||
clp = cp - dir1v * width;
|
||||
crp = cp - dir2v * width;
|
||||
itp = cp - dir1v;
|
||||
clp = cp - dir1v;
|
||||
crp = cp - dir2v;
|
||||
bitp = false;
|
||||
}
|
||||
bibp = true;
|
||||
if (!UGLHelper.GetIntersection(lbp, lbp + ldist, nbp, nbp + rdist, ref ibp))
|
||||
{
|
||||
ibp = cp + dir1v * width;
|
||||
clp = cp + dir1v * width;
|
||||
crp = cp + dir2v * width;
|
||||
ibp = cp + dir1v;
|
||||
clp = cp + dir1v;
|
||||
crp = cp + dir2v;
|
||||
bibp = false;
|
||||
}
|
||||
if (bitp == false && bibp == false && cp == np)
|
||||
{
|
||||
ltp = cp - dir1v * width;
|
||||
clp = cp + dir1v * width;
|
||||
crp = cp + dir1v * width;
|
||||
ltp = cp - dir1v;
|
||||
clp = cp + dir1v;
|
||||
crp = cp + dir1v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"version": "3.0.0",
|
||||
"date": "20210724",
|
||||
"checkdate": "20210724",
|
||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 177df8f0362c84b878645cc62387edfa
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||