Skip to content

Commit

Permalink
v2.0.0-preview.1
Browse files Browse the repository at this point in the history
  • Loading branch information
monitor1394 committed Jan 19, 2021
1 parent f330d2e commit 0a5d923
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 24 deletions.
1 change: 1 addition & 0 deletions Assets/XCharts/CHANGELOG-EN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# 更新日志

* (2021.01.19) Release `v2.0.0-preview.1` version
* (2021.01.02) Release `v1.6.3` version
* (2020.12.18) fixed an issue where updating data when `Animation` was not enabled caused the chart to keep refreshing
* (2020.12.01) fixed an issue where a newly created chart on `Unity2020` could not be drawn properly
Expand Down
1 change: 1 addition & 0 deletions Assets/XCharts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# 更新日志

* (2021.01.19) 发布`v2.0.0-preview.1`版本
* (2021.01.02) 发布`v1.6.3`版本
* (2020.12.18) 修复`Animation`不启用时更新数据会导致图表一直刷新的问题
* (2020.12.01) 修复`Unity2020`上新创建的图表无法正常绘制的问题
Expand Down
31 changes: 18 additions & 13 deletions Assets/XCharts/Editor/BaseChartEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ namespace XCharts
[CustomEditor(typeof(BaseChart), false)]
public class BaseChartEditor : Editor
{
private const float k_IconWidth = 14;
private const float k_IconGap = 0f;
private const float k_IconXOffset = 10f;
private const float k_IconYOffset = -5f;

protected BaseChart m_Chart;
protected SerializedProperty m_Script;
protected SerializedProperty m_MultiComponentMode;
Expand Down Expand Up @@ -191,32 +196,32 @@ protected void BlockListField(bool all, params SerializedProperty[] props)
prop.arraySize = EditorGUILayout.IntField("Size", prop.arraySize);
for (int i = 0; i < prop.arraySize; i++)
{
SerializedProperty element = prop.GetArrayElementAtIndex(i);
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
EditorGUILayout.Space(-EditorGUIUtility.singleLineHeight - EditorGUIUtility.standardVerticalSpacing);
var currRect = EditorGUILayout.GetControlRect();
var iconWidth = 14;
var iconGap = 0f;
var xDiff = 10f;
var yDiff = 3f;
var rect1 = new Rect(currRect.width + xDiff, currRect.y + yDiff,
iconWidth, EditorGUIUtility.singleLineHeight);

var rect1 = new Rect(currRect.width + k_IconXOffset,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconRemove, ChartEditorHelper.Styles.invisibleButton))
{
if (i < prop.arraySize && i >= 0) prop.DeleteArrayElementAtIndex(i);
}
var rect2 = new Rect(currRect.width + xDiff - iconWidth - iconGap, currRect.y + yDiff,
iconWidth, EditorGUIUtility.singleLineHeight);
var rect2 = new Rect(currRect.width + k_IconXOffset - k_IconWidth - k_IconGap,
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect2, ChartEditorHelper.Styles.iconDown, ChartEditorHelper.Styles.invisibleButton))
{
if (i < prop.arraySize - 1) prop.MoveArrayElement(i, i + 1);
}
var rect3 = new Rect(currRect.width + xDiff - 2 * (iconWidth + iconGap), currRect.y + yDiff,
iconWidth, EditorGUIUtility.singleLineHeight);
var rect3 = new Rect(currRect.width + k_IconXOffset - 2 * (k_IconWidth + k_IconGap),
currRect.y + k_IconYOffset,
k_IconWidth, EditorGUIUtility.singleLineHeight);
if (GUI.Button(rect3, ChartEditorHelper.Styles.iconUp, ChartEditorHelper.Styles.invisibleButton))
{
if (i > 0) prop.MoveArrayElement(i, i - 1);
}
EditorGUILayout.Space(-EditorGUIUtility.singleLineHeight - EditorGUIUtility.standardVerticalSpacing);
EditorGUILayout.PropertyField(element, true);

}
EditorGUI.indentLevel--;
}
Expand Down
5 changes: 5 additions & 0 deletions Assets/XCharts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ The following is the relationship structure of LineChart:

* See more examples of code dynamic control: [Tutorial - Get start with XCharts in 5 minute](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md).

* Enable TextMeshPro:
1. `XCharts -> TextMeshPro Enable` or `Project Setting -> XCharts -> Enable TextMeshPro`
2. `Project Setting -> XCharts -> Settings -> TMP Font` set the TextMeshPro font.
3. If the chart does not initialize properly, you can use the `Remove All Chart Object` button to clean up the chart and reinitialize it.

## Documents

* [XCharts Homepage](https://github.com/monitor1394/unity-ugui-XCharts)
Expand Down
2 changes: 1 addition & 1 deletion Assets/XCharts/Runtime/API/PolarChart_API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace XCharts
{
public partial class PolarChart
public partial class BaseChart
{
/// <summary>
/// 极坐标。
Expand Down
8 changes: 4 additions & 4 deletions Assets/XCharts/Runtime/XChartsMgr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class XChartsVersion
[ExecuteInEditMode]
public class XChartsMgr : MonoBehaviour
{
internal static string _version = "2.0.0";
internal static int _versionDate = 20210117;
internal static string _version = "2.0.0-preview.1";
internal static int _versionDate = 20210119;
public static string version { get { return _version; } }
public static int versionDate { get { return _versionDate; } }
public static string fullVersion { get { return version + "_" + versionDate; } }
public static string fullVersion { get { return version + "-" + versionDate; } }

[SerializeField] private string m_NowVersion;
[SerializeField] private string m_NewVersion;
Expand Down Expand Up @@ -173,7 +173,7 @@ private void CheckVersionWebRequest(UnityWebRequest web)
{
isNetworkError = false;
var cv = JsonUtility.FromJson<XChartsVersion>(web.downloadHandler.text);
m_NewVersion = cv.version + "_" + cv.date;
m_NewVersion = cv.version + "-" + cv.date;
newDate = cv.date;
newCheckDate = cv.checkdate;
desc = cv.desc;
Expand Down
6 changes: 3 additions & 3 deletions Assets/XCharts/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "com.monitor1394.xcharts",
"displayName": "XCharts",
"version": "2.0.0",
"date": "20210117",
"checkdate": "20210117",
"version": "2.0.0-preview.1",
"date": "20210119",
"checkdate": "20210119",
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
"unity": "2018.3",
"description": "A charting and data visualization library for Unity.",
Expand Down
6 changes: 3 additions & 3 deletions Assets/XCharts/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "2.0.0",
"date": "20210117",
"checkdate": "20210117",
"version": "2.0.0-preview.1",
"date": "20210119",
"checkdate": "20210119",
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
}
Binary file added Doc/screenshot/op_textmeshpro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Doc/screenshot/op_textmeshpro2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Doc/screenshot/op_textmeshpro3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions Doc/教程:5分钟上手XCharts.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ for (int i = 0; i < 10; i++)

另外,除非定制,建议调用[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md) 里面的接口,这些接口内部会做一些关联处理,比如刷新图表等。如果自己调用了内部组件的接口,需要自己处理刷新等其他问题。

## 使用TextMeshPro

XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换。可通过一下两种方式开启和关闭:
![textmeshpro1](screenshot/op_textmeshpro.png)
![textmeshpro2](screenshot/op_textmeshpro2.png)
开启后需要设置好TextMeshPro要用的全局字体,也可以在主题Theme里单独设置:
![textmeshpro-font](screenshot/op_textmeshpro3.png)
建议在项目初就规划好是否使用TextMeshPro,在有很多图表的情况下再切换,可能导致某些图表无法正常初始化,这时可能需要每个图表单独的使用`Remove All Chart Object`来清理让图表重新初始化。

[返回首页](https://github.com/monitor1394/unity-ugui-XCharts)
[XCharts问答](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XCharts问答.md)
[XChartsAPI接口](https://github.com/monitor1394/unity-ugui-XCharts/blob/master/Assets/XCharts/Documentation/XChartsAPI.md)
Expand Down

0 comments on commit 0a5d923

Please sign in to comment.