diff --git a/CHANGELOG-EN.md.meta b/CHANGELOG-EN.md.meta deleted file mode 100644 index 23297ecb..00000000 --- a/CHANGELOG-EN.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 042c85734494346adab5b3233234d261 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Documentation.meta b/Documentation.meta deleted file mode 100644 index 2cab140e..00000000 --- a/Documentation.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0793c29ff7adb422fb93f9f4e29d5a06 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/CHANGELOG-EN.md b/Documentation~/CHANGELOG-EN.md similarity index 100% rename from CHANGELOG-EN.md rename to Documentation~/CHANGELOG-EN.md diff --git a/Documentation~/README-EN.md b/Documentation~/README-EN.md new file mode 100644 index 00000000..e69de29b diff --git a/Documentation~/SUPPORT.md b/Documentation~/SUPPORT.md new file mode 100644 index 00000000..bb14bbe0 --- /dev/null +++ b/Documentation~/SUPPORT.md @@ -0,0 +1,40 @@ +## 技术支持 + +如需技术支持,可订阅VIP服务。扫后面的支付宝二维码后可加VIP群(`867291970`,验证信息请输入支付宝账号)。企业VIP可加官方群私聊群主了解详情。 + +## 订阅服务 + +| |免费用户|个人`1`年`VIP`|个人`2`年`VIP` | 个人长期`VIP` | +| ----- |--|--|--|--| +| 订阅费用 | -- | `298`¥ | `498`¥ | `888`¥ | +| 席位时长 | -- | `1`个席位
`1`年 | `1`个席位
`2`年 | `1`个席位
`长期` | +|| +| `服务方式:`| +| 官方QQ群交流 | √ | √ | √ | √ | +| 专属VIP群交流 | | √ | √ | √ | +| 即时一对一交流 | | √ | √ | √ | +|| +| `服务内容:`| +| 可商用 | √ | √ | √ | √ | +| 可二次开发 | √ | √ | √ | √ | +| 有问必答 | | √ | √ | √ | +| 新手指导 | | √ | √ | √ | +| 开发指导 | | √ | √ | √ | +| 优化指导 | | √ | √ | √ | +| 其他技术支持 | | √ | √ | √ | +| 问题及时处理 | | √ | √ | √ | +| 需求优先考虑 | | √ | √ | √ | +| 可另付费定制 | | √ | √ | √ | +| 可另付费加急 | | √ | √ | √ | +| 付费模块85折 | | | | √ | + +## 备注说明 + +1. __`付费定制`__ 是指用户可根据自己的需求定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。 +2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并指定`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。 + +## 捐助支持 + +如果这个项目对您有帮助,请右上方点 `Star` 予以支持!也欢迎任何金额的赞助,非常感谢! + +![alipay-qrcode](res/alipay.png) \ No newline at end of file diff --git a/Documentation/XChartsAPI.md b/Documentation~/XChartsAPI.md similarity index 100% rename from Documentation/XChartsAPI.md rename to Documentation~/XChartsAPI.md diff --git a/Documentation/XChartsAPI.md.meta b/Documentation~/XChartsAPI.md.meta similarity index 100% rename from Documentation/XChartsAPI.md.meta rename to Documentation~/XChartsAPI.md.meta diff --git a/Documentation~/XCharts教程:5分钟上手教程.md b/Documentation~/XCharts教程:5分钟上手教程.md new file mode 100644 index 00000000..4e5d81e1 --- /dev/null +++ b/Documentation~/XCharts教程:5分钟上手教程.md @@ -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`: + +![op_addchart](res/op_addchart.png) + +即可快速创建一个简单的折线图出来: + +![linechart1](res/linechart1.png) + +## 添加多个Seire + +如何在上图的基础上添加两条折线呢,只需`Add Serie`按钮,选择对应的`Serie`类型即可: +![op_addserie](res/op_addserie.png) +![linechart2](res/linechart2.png) + +## 添加其他组件 + +默认图表没有`Legend`,需要`Legend`组件可通过`Add Component`按钮添加: +![op_addcomponent](res/op_addcomponent.png) + +## 添加Serie组件 + +如果需要给折线图区域填充颜色,可单独给`Serie`添加`Component`: +![op_addseriecomponent](res/op_addseriecomponent.png) +![linechart3](res/linechart3.png) + +## 添加SerieData组件 + +如果需要个性化定制每个数据项的配置,可以单独给每个`SerieData`添加`Component`。比如我们给第一个折线图的第二个数据单独显示`Label`: +![op_addseriedatacomponent](res/op_addseriedatacomponent.png) +![linechart4](res/linechart4.png) + +## 更多组件和配置参数 + +功能越丰富就越需要更多的组件和参数支持。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(); +if (chart == null) +{ + chart = gameObject.AddComponent(); + chart.Init(); +} +``` + +调整大小: + +```C# +chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTransform,或直接在Inspector上改 +``` + +设置标题: + +```C# +var title = chart.GetOrAddChartComponent(); +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)); +} +``` + +这样一个简单的折线图就出来了: +![linechart-simple](res/linechart-simple.png) + +如果一个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,但默认是不开启的,需要自己手动切换。可通过一下两种方式开启和关闭: +![textmeshpro1](res/op_textmeshpro.png) +![textmeshpro2](res/op_textmeshpro2.png) +开启后需要设置好TextMeshPro要用的全局字体,也可以在主题Theme里单独设置: +![textmeshpro-font](res/op_textmeshpro3.png) +建议在项目初就规划好是否使用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) diff --git a/Documentation/XCharts配置项手册.md b/Documentation~/XCharts配置项手册.md similarity index 100% rename from Documentation/XCharts配置项手册.md rename to Documentation~/XCharts配置项手册.md diff --git a/Documentation/XCharts配置项手册.md.meta b/Documentation~/XCharts配置项手册.md.meta similarity index 100% rename from Documentation/XCharts配置项手册.md.meta rename to Documentation~/XCharts配置项手册.md.meta diff --git a/Documentation/XCharts问答.md b/Documentation~/XCharts问答.md similarity index 100% rename from Documentation/XCharts问答.md rename to Documentation~/XCharts问答.md diff --git a/Documentation/XCharts问答.md.meta b/Documentation~/XCharts问答.md.meta similarity index 100% rename from Documentation/XCharts问答.md.meta rename to Documentation~/XCharts问答.md.meta diff --git a/Documentation~/res/alipay.png b/Documentation~/res/alipay.png new file mode 100644 index 00000000..4d336102 Binary files /dev/null and b/Documentation~/res/alipay.png differ diff --git a/Documentation~/res/inpsector-desc.png b/Documentation~/res/inpsector-desc.png new file mode 100644 index 00000000..4ca01a6a Binary files /dev/null and b/Documentation~/res/inpsector-desc.png differ diff --git a/Documentation~/res/linechart-simple.png b/Documentation~/res/linechart-simple.png new file mode 100644 index 00000000..524a1a1c Binary files /dev/null and b/Documentation~/res/linechart-simple.png differ diff --git a/Documentation~/res/linechart.png b/Documentation~/res/linechart.png new file mode 100644 index 00000000..7ce3d8da Binary files /dev/null and b/Documentation~/res/linechart.png differ diff --git a/Documentation~/res/linechart1.png b/Documentation~/res/linechart1.png new file mode 100644 index 00000000..c14d0a85 Binary files /dev/null and b/Documentation~/res/linechart1.png differ diff --git a/Documentation~/res/linechart2.png b/Documentation~/res/linechart2.png new file mode 100644 index 00000000..4a028e3d Binary files /dev/null and b/Documentation~/res/linechart2.png differ diff --git a/Documentation~/res/linechart3.png b/Documentation~/res/linechart3.png new file mode 100644 index 00000000..32f8af41 Binary files /dev/null and b/Documentation~/res/linechart3.png differ diff --git a/Documentation~/res/linechart4.png b/Documentation~/res/linechart4.png new file mode 100644 index 00000000..3ac8e0c6 Binary files /dev/null and b/Documentation~/res/linechart4.png differ diff --git a/Documentation~/res/op_addchart.png b/Documentation~/res/op_addchart.png new file mode 100644 index 00000000..86c5fcc9 Binary files /dev/null and b/Documentation~/res/op_addchart.png differ diff --git a/Documentation~/res/op_addcomponent.png b/Documentation~/res/op_addcomponent.png new file mode 100644 index 00000000..c4b510d5 Binary files /dev/null and b/Documentation~/res/op_addcomponent.png differ diff --git a/Documentation~/res/op_addserie.png b/Documentation~/res/op_addserie.png new file mode 100644 index 00000000..eb518d08 Binary files /dev/null and b/Documentation~/res/op_addserie.png differ diff --git a/Documentation~/res/op_addseriecomponent.png b/Documentation~/res/op_addseriecomponent.png new file mode 100644 index 00000000..78197d94 Binary files /dev/null and b/Documentation~/res/op_addseriecomponent.png differ diff --git a/Documentation~/res/op_addseriedatacomponent.png b/Documentation~/res/op_addseriedatacomponent.png new file mode 100644 index 00000000..38c69396 Binary files /dev/null and b/Documentation~/res/op_addseriedatacomponent.png differ diff --git a/Documentation~/res/op_datamore.png b/Documentation~/res/op_datamore.png new file mode 100644 index 00000000..0a3651b4 Binary files /dev/null and b/Documentation~/res/op_datamore.png differ diff --git a/Documentation~/res/op_textmeshpro.png b/Documentation~/res/op_textmeshpro.png new file mode 100644 index 00000000..d0ba7932 Binary files /dev/null and b/Documentation~/res/op_textmeshpro.png differ diff --git a/Documentation~/res/op_textmeshpro2.png b/Documentation~/res/op_textmeshpro2.png new file mode 100644 index 00000000..250c9f02 Binary files /dev/null and b/Documentation~/res/op_textmeshpro2.png differ diff --git a/Documentation~/res/op_textmeshpro3.png b/Documentation~/res/op_textmeshpro3.png new file mode 100644 index 00000000..fa2cae1d Binary files /dev/null and b/Documentation~/res/op_textmeshpro3.png differ diff --git a/Documentation/xcharts-api-EN.md b/Documentation~/xcharts-api-EN.md similarity index 100% rename from Documentation/xcharts-api-EN.md rename to Documentation~/xcharts-api-EN.md diff --git a/Documentation/xcharts-api-EN.md.meta b/Documentation~/xcharts-api-EN.md.meta similarity index 100% rename from Documentation/xcharts-api-EN.md.meta rename to Documentation~/xcharts-api-EN.md.meta diff --git a/Documentation/xcharts-configuration-EN.md b/Documentation~/xcharts-configuration-EN.md similarity index 100% rename from Documentation/xcharts-configuration-EN.md rename to Documentation~/xcharts-configuration-EN.md diff --git a/Documentation/xcharts-configuration-EN.md.meta b/Documentation~/xcharts-configuration-EN.md.meta similarity index 100% rename from Documentation/xcharts-configuration-EN.md.meta rename to Documentation~/xcharts-configuration-EN.md.meta diff --git a/Documentation/xcharts-questions-and-answers-EN.md b/Documentation~/xcharts-questions-and-answers-EN.md similarity index 100% rename from Documentation/xcharts-questions-and-answers-EN.md rename to Documentation~/xcharts-questions-and-answers-EN.md diff --git a/Documentation/xcharts-questions-and-answers-EN.md.meta b/Documentation~/xcharts-questions-and-answers-EN.md.meta similarity index 100% rename from Documentation/xcharts-questions-and-answers-EN.md.meta rename to Documentation~/xcharts-questions-and-answers-EN.md.meta diff --git a/Examples/Runtime/Example13_LineSimple.cs b/Examples/Runtime/Example13_LineSimple.cs index 5cfb9429..ab3c177c 100644 --- a/Examples/Runtime/Example13_LineSimple.cs +++ b/Examples/Runtime/Example13_LineSimple.cs @@ -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)); diff --git a/Examples/Runtime/Example_AddChart.cs b/Examples/Runtime/Example_AddChart.cs new file mode 100644 index 00000000..5d4ff601 --- /dev/null +++ b/Examples/Runtime/Example_AddChart.cs @@ -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() + { + + } + } +} \ No newline at end of file diff --git a/Examples/Runtime/Example_AddChart.cs.meta b/Examples/Runtime/Example_AddChart.cs.meta new file mode 100644 index 00000000..2fdb2eaa --- /dev/null +++ b/Examples/Runtime/Example_AddChart.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8e5c24ed461624b8d924dfb1285e0a95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/Runtime/Example_Component.cs b/Examples/Runtime/Example_Component.cs new file mode 100644 index 00000000..7af0da8a --- /dev/null +++ b/Examples/Runtime/Example_Component.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Examples/Runtime/Example_Component.cs.meta b/Examples/Runtime/Example_Component.cs.meta new file mode 100644 index 00000000..add53bcb --- /dev/null +++ b/Examples/Runtime/Example_Component.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e9941e7d67e44b18899e6048d4ef25a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/Runtime/Example_Test.cs b/Examples/Runtime/Example_Test.cs index 7b853d04..66049cf3 100644 --- a/Examples/Runtime/Example_Test.cs +++ b/Examples/Runtime/Example_Test.cs @@ -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(); } } diff --git a/README.md b/README.md index 5dedc8e2..1d977d80 100644 --- a/README.md +++ b/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/) \ No newline at end of file +## 特性 + +* 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。 +* 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、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) diff --git a/Runtime/Chart/BarChart.cs b/Runtime/Chart/BarChart.cs index 0a1966c2..f01f53ac 100644 --- a/Runtime/Chart/BarChart.cs +++ b/Runtime/Chart/BarChart.cs @@ -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 } } diff --git a/Runtime/Chart/CandlestickChart.cs b/Runtime/Chart/CandlestickChart.cs index 181c24c5..9e6a162f 100644 --- a/Runtime/Chart/CandlestickChart.cs +++ b/Runtime/Chart/CandlestickChart.cs @@ -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 } } diff --git a/Runtime/Chart/HeatmapChart.cs b/Runtime/Chart/HeatmapChart.cs index 7f53c3a7..7e013bfe 100644 --- a/Runtime/Chart/HeatmapChart.cs +++ b/Runtime/Chart/HeatmapChart.cs @@ -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 } } diff --git a/Runtime/Chart/LineChart.cs b/Runtime/Chart/LineChart.cs index efc84335..331d35c6 100644 --- a/Runtime/Chart/LineChart.cs +++ b/Runtime/Chart/LineChart.cs @@ -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 } } diff --git a/Runtime/Chart/ParallelChart.cs b/Runtime/Chart/ParallelChart.cs index ac6deb86..b955dbfa 100644 --- a/Runtime/Chart/ParallelChart.cs +++ b/Runtime/Chart/ParallelChart.cs @@ -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 } } diff --git a/Runtime/Chart/PieChart.cs b/Runtime/Chart/PieChart.cs index 9f17ff0a..41fb5e89 100644 --- a/Runtime/Chart/PieChart.cs +++ b/Runtime/Chart/PieChart.cs @@ -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 } } diff --git a/Runtime/Chart/PolarChart.cs b/Runtime/Chart/PolarChart.cs index 03ae5d52..4c0b5258 100644 --- a/Runtime/Chart/PolarChart.cs +++ b/Runtime/Chart/PolarChart.cs @@ -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 } } diff --git a/Runtime/Chart/RadarChart.cs b/Runtime/Chart/RadarChart.cs index fd5f48bc..01942892 100644 --- a/Runtime/Chart/RadarChart.cs +++ b/Runtime/Chart/RadarChart.cs @@ -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 } } diff --git a/Runtime/Chart/RingChart.cs b/Runtime/Chart/RingChart.cs index 155a15ac..a591f264 100644 --- a/Runtime/Chart/RingChart.cs +++ b/Runtime/Chart/RingChart.cs @@ -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 } } diff --git a/Runtime/Chart/ScatterChart.cs b/Runtime/Chart/ScatterChart.cs index 7e890ced..194b84b7 100644 --- a/Runtime/Chart/ScatterChart.cs +++ b/Runtime/Chart/ScatterChart.cs @@ -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 } } diff --git a/Runtime/Chart/SimplifiedBarChart.cs b/Runtime/Chart/SimplifiedBarChart.cs index ab4f893d..df919e1c 100644 --- a/Runtime/Chart/SimplifiedBarChart.cs +++ b/Runtime/Chart/SimplifiedBarChart.cs @@ -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 } } diff --git a/Runtime/Chart/SimplifiedCandlestickChart.cs b/Runtime/Chart/SimplifiedCandlestickChart.cs index 4bb28c79..5abcb1f6 100644 --- a/Runtime/Chart/SimplifiedCandlestickChart.cs +++ b/Runtime/Chart/SimplifiedCandlestickChart.cs @@ -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 } } diff --git a/Runtime/Chart/SimplifiedLineChart.cs b/Runtime/Chart/SimplifiedLineChart.cs index 96983ce3..5064c3ea 100644 --- a/Runtime/Chart/SimplifiedLineChart.cs +++ b/Runtime/Chart/SimplifiedLineChart.cs @@ -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 } } diff --git a/Runtime/Component/Axis/Axis.cs b/Runtime/Component/Axis/Axis.cs index 5820c95c..2d9e9f3a 100644 --- a/Runtime/Component/Axis/Axis.cs +++ b/Runtime/Component/Axis/Axis.cs @@ -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() diff --git a/Runtime/Internal/BaseChart.API.cs b/Runtime/Internal/BaseChart.API.cs index 1cf78f4e..7075fed0 100644 --- a/Runtime/Internal/BaseChart.API.cs +++ b/Runtime/Internal/BaseChart.API.cs @@ -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(); } diff --git a/Runtime/Internal/BaseChart.Component.cs b/Runtime/Internal/BaseChart.Component.cs index 3d0b76be..06f7c835 100644 --- a/Runtime/Internal/BaseChart.Component.cs +++ b/Runtime/Internal/BaseChart.Component.cs @@ -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); diff --git a/Runtime/Internal/BaseChart.cs b/Runtime/Internal/BaseChart.cs index 75c3056d..4c627558 100644 --- a/Runtime/Internal/BaseChart.cs +++ b/Runtime/Internal/BaseChart.cs @@ -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); diff --git a/Runtime/Serie/SerieData.cs b/Runtime/Serie/SerieData.cs index fa4b3478..639e7503 100644 --- a/Runtime/Serie/SerieData.cs +++ b/Runtime/Serie/SerieData.cs @@ -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; } diff --git a/Runtime/Serie/SerieHandler.cs b/Runtime/Serie/SerieHandler.cs index cdf56dba..38608b2a 100644 --- a/Runtime/Serie/SerieHandler.cs +++ b/Runtime/Serie/SerieHandler.cs @@ -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++) diff --git a/Runtime/XUGL/UGLHelper.cs b/Runtime/XUGL/UGLHelper.cs index f88d8f0e..8c84d110 100644 --- a/Runtime/XUGL/UGLHelper.cs +++ b/Runtime/XUGL/UGLHelper.cs @@ -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; } } } diff --git a/version.json b/version.json deleted file mode 100644 index ab08eb83..00000000 --- a/version.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "3.0.0", - "date": "20210724", - "checkdate": "20210724", - "desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!", - "homepage": "https://github.com/monitor1394/unity-ugui-XCharts" -} \ No newline at end of file diff --git a/version.json.meta b/version.json.meta deleted file mode 100644 index 5308ef09..00000000 --- a/version.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 177df8f0362c84b878645cc62387edfa -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: