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` 予以支持!也欢迎任何金额的赞助,非常感谢!
+
+
\ 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`:
+
+
+
+即可快速创建一个简单的折线图出来:
+
+
+
+## 添加多个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();
+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.show = true;
+
+var legend = chart.GetOrAddChartComponent
@@ -43,6 +43,64 @@
-一款基于`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();
AddChartComponentWhenNoExist();
AddChartComponentWhenNoExist();
- var tooltip = GetChartComponent();
+ var tooltip = GetOrAddChartComponent();
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();
AddChartComponentWhenNoExist();
AddChartComponentWhenNoExist();
- var tooltip = GetChartComponent();
+ var tooltip = GetOrAddChartComponent();
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.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();
AddChartComponentWhenNoExist();
AddChartComponentWhenNoExist();
- var tooltip = GetChartComponent();
+ var tooltip = GetOrAddChartComponent();
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();
@@ -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.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();
var tooltip = GetChartComponent();
@@ -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();
AddChartComponent();
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().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();
-
+
var tooltip = GetOrAddChartComponent();
tooltip.type = Tooltip.Type.None;
tooltip.trigger = Tooltip.Trigger.Item;
var xAxis = GetOrAddChartComponent();
- xAxis.type = Axis.AxisType.Value;
+ xAxis.type = Axis.AxisType.Value;
xAxis.boundaryGap = false;
var yAxis = GetOrAddChartComponent();
- 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();
AddChartComponentWhenNoExist();
AddChartComponentWhenNoExist();
@@ -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();
AddChartComponentWhenNoExist();
AddChartComponentWhenNoExist();
@@ -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();
AddChartComponentWhenNoExist();
AddChartComponentWhenNoExist();
@@ -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
///
public bool IsCategory()
{
- return type == AxisType.Category;
+ return m_Type == AxisType.Category;
}
///
@@ -498,7 +498,7 @@ namespace XCharts.Runtime
///
public bool IsValue()
{
- return type == AxisType.Value;
+ return m_Type == AxisType.Value;
}
///
@@ -507,7 +507,7 @@ namespace XCharts.Runtime
///
public bool IsLog()
{
- return type == AxisType.Log;
+ return m_Type == AxisType.Log;
}
///
@@ -515,27 +515,27 @@ namespace XCharts.Runtime
///
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
///
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; } }
///
/// 自定义绘制回调。在绘制Serie前调用。
///
@@ -103,6 +105,19 @@ namespace XCharts.Runtime
/// 坐标轴变更数据索引时回调。参数:axis, dataIndex/dataValue
///
public Action onAxisPointerValueChanged { set { m_OnAxisPointerValueChanged = value; } get { return m_OnAxisPointerValueChanged; } }
+
+ public void Init(bool defaultChart = true)
+ {
+ if (defaultChart)
+ {
+ OnInit();
+ DefaultChart();
+ }
+ else
+ {
+ OnBeforeSerialize();
+ }
+ }
///
/// 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 m_OnDrawBase;
protected Action m_OnDrawTop;
protected Action m_OnDrawSerieBefore;
@@ -101,6 +103,10 @@ namespace XCharts.Runtime
protected List m_ComponentHandlers = new List();
protected List m_SerieHandlers = new List();
+ 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();
@@ -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: