diff --git a/Assets/XCharts/CHANGELOG-EN.md b/Assets/XCharts/CHANGELOG-EN.md index 9a9020f0..afd8e400 100644 --- a/Assets/XCharts/CHANGELOG-EN.md +++ b/Assets/XCharts/CHANGELOG-EN.md @@ -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 diff --git a/Assets/XCharts/CHANGELOG.md b/Assets/XCharts/CHANGELOG.md index 05bd67b3..78c44187 100644 --- a/Assets/XCharts/CHANGELOG.md +++ b/Assets/XCharts/CHANGELOG.md @@ -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`上新创建的图表无法正常绘制的问题 diff --git a/Assets/XCharts/Editor/BaseChartEditor.cs b/Assets/XCharts/Editor/BaseChartEditor.cs index 3da65679..3171ca84 100644 --- a/Assets/XCharts/Editor/BaseChartEditor.cs +++ b/Assets/XCharts/Editor/BaseChartEditor.cs @@ -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; @@ -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--; } diff --git a/Assets/XCharts/README.md b/Assets/XCharts/README.md index 3852f57e..c78019f6 100644 --- a/Assets/XCharts/README.md +++ b/Assets/XCharts/README.md @@ -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) diff --git a/Assets/XCharts/Runtime/API/PolarChart_API.cs b/Assets/XCharts/Runtime/API/PolarChart_API.cs index 6f1d045a..c13e2984 100644 --- a/Assets/XCharts/Runtime/API/PolarChart_API.cs +++ b/Assets/XCharts/Runtime/API/PolarChart_API.cs @@ -7,7 +7,7 @@ namespace XCharts { - public partial class PolarChart + public partial class BaseChart { /// /// 极坐标。 diff --git a/Assets/XCharts/Runtime/XChartsMgr.cs b/Assets/XCharts/Runtime/XChartsMgr.cs index 18c0ea77..cf6c8120 100644 --- a/Assets/XCharts/Runtime/XChartsMgr.cs +++ b/Assets/XCharts/Runtime/XChartsMgr.cs @@ -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; @@ -173,7 +173,7 @@ private void CheckVersionWebRequest(UnityWebRequest web) { isNetworkError = false; var cv = JsonUtility.FromJson(web.downloadHandler.text); - m_NewVersion = cv.version + "_" + cv.date; + m_NewVersion = cv.version + "-" + cv.date; newDate = cv.date; newCheckDate = cv.checkdate; desc = cv.desc; diff --git a/Assets/XCharts/package.json b/Assets/XCharts/package.json index 4839ab21..8f7744b3 100644 --- a/Assets/XCharts/package.json +++ b/Assets/XCharts/package.json @@ -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.", diff --git a/Assets/XCharts/version.json b/Assets/XCharts/version.json index 1bbf70b2..a4bb0630 100644 --- a/Assets/XCharts/version.json +++ b/Assets/XCharts/version.json @@ -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" } \ No newline at end of file diff --git a/Doc/screenshot/op_textmeshpro.png b/Doc/screenshot/op_textmeshpro.png new file mode 100644 index 00000000..d0ba7932 Binary files /dev/null and b/Doc/screenshot/op_textmeshpro.png differ diff --git a/Doc/screenshot/op_textmeshpro2.png b/Doc/screenshot/op_textmeshpro2.png new file mode 100644 index 00000000..250c9f02 Binary files /dev/null and b/Doc/screenshot/op_textmeshpro2.png differ diff --git a/Doc/screenshot/op_textmeshpro3.png b/Doc/screenshot/op_textmeshpro3.png new file mode 100644 index 00000000..fa2cae1d Binary files /dev/null and b/Doc/screenshot/op_textmeshpro3.png differ diff --git "a/Doc/\346\225\231\347\250\213\357\274\2325\345\210\206\351\222\237\344\270\212\346\211\213XCharts.md" "b/Doc/\346\225\231\347\250\213\357\274\2325\345\210\206\351\222\237\344\270\212\346\211\213XCharts.md" index 03b1bb12..0012e330 100644 --- "a/Doc/\346\225\231\347\250\213\357\274\2325\345\210\206\351\222\237\344\270\212\346\211\213XCharts.md" +++ "b/Doc/\346\225\231\347\250\213\357\274\2325\345\210\206\351\222\237\344\270\212\346\211\213XCharts.md" @@ -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)