调整SeriearcShaped参数重命名为roundCap

This commit is contained in:
monitor1394
2020-03-06 07:09:15 +08:00
parent 7465bb760d
commit 2c6d9dc483
7 changed files with 18 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
# 更新日志 # 更新日志
* (2020.03.05) 调整`Serie``arcShaped`参数重命名为`roundCap`
* (2020.03.05) 增加运行时和非运行时参数变更自动刷新图表 * (2020.03.05) 增加运行时和非运行时参数变更自动刷新图表
* (2020.02.26) 重构`Legend`图例,改变样式,增加自定义图标等设置 * (2020.02.26) 重构`Legend`图例,改变样式,增加自定义图标等设置
* (2020.02.23) 增加`BaseChart.AnimationFadeOut()`渐出动画,重构动画系统 * (2020.02.23) 增加`BaseChart.AnimationFadeOut()`渐出动画,重构动画系统

View File

@@ -38,7 +38,7 @@ namespace XCharts
serie.radius[0] = 80; serie.radius[0] = 80;
serie.splitNumber = 5; serie.splitNumber = 5;
serie.animation.dataChangeEnable = true; serie.animation.dataChangeEnable = true;
serie.arcShaped = true; serie.roundCap = true;
serie.titleStyle.show = true; serie.titleStyle.show = true;
serie.titleStyle.textStyle.offset = new Vector2(0, 20); serie.titleStyle.textStyle.offset = new Vector2(0, 20);

View File

@@ -436,7 +436,7 @@
* `pieSpace`:饼图项间的空隙留白。 * `pieSpace`:饼图项间的空隙留白。
* `pieCenter`:饼图的中心点。 * `pieCenter`:饼图的中心点。
* `pieRadius`:饼图的半径。`radius[0]` 表示内径,`radius[1]` 表示外径。 * `pieRadius`:饼图的半径。`radius[0]` 表示内径,`radius[1]` 表示外径。
* `arcShaped`:启用弧形圆角效果。目前只在仪表盘和圆环饼图中有效 * `roundCap`:启用圆弧效果
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。 * `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。 * `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。 * `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
@@ -529,7 +529,7 @@
* `space`:扇区间隙。 * `space`:扇区间隙。
* `center`中心点坐标。当值为0-1的浮点数时表示百分比。 * `center`中心点坐标。当值为0-1的浮点数时表示百分比。
* `radius`:半径。`radius[0]`为内径,`radius[1]`为外径。当内径大于0时即为圆环图。 * `radius`:半径。`radius[0]`为内径,`radius[1]`为外径。当内径大于0时即为圆环图。
* `arcShaped`:是否启用圆效果。只在圆环图中有效。 * `roundCap`:是否启用圆效果。
* `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。 * `label`:图形上的文本标签 [SerieLabel](#SerieLabel),可用于说明图形的一些数据信息,比如值,名称等。
* `emphasis`:高亮样式 [Emphasis](#Emphasis)。 * `emphasis`:高亮样式 [Emphasis](#Emphasis)。
* `animation`:起始动画 [SerieAnimation](#SerieAnimation)。 * `animation`:起始动画 [SerieAnimation](#SerieAnimation)。
@@ -591,7 +591,7 @@
* `startAngle`仪表盘起始角度。和时钟一样12点钟位置是0度顺时针到360度。 * `startAngle`仪表盘起始角度。和时钟一样12点钟位置是0度顺时针到360度。
* `endAngle`仪表盘结束角度。和时钟一样12点钟位置是0度顺时针到360度。 * `endAngle`仪表盘结束角度。和时钟一样12点钟位置是0度顺时针到360度。
* `splitNumber`:仪表盘刻度分割段数。 * `splitNumber`:仪表盘刻度分割段数。
* `arcShaped`:是否启用圆效果。 * `roundCap`:是否启用圆效果。
* `titleStyle`:仪表盘标题 [TitleStyle](#TitleStyle)。 * `titleStyle`:仪表盘标题 [TitleStyle](#TitleStyle)。
* `gaugeAxis` 仪表盘坐标轴 [GaugeAxis](#GaugeAxis)。 * `gaugeAxis` 仪表盘坐标轴 [GaugeAxis](#GaugeAxis)。
* `gaugePointer`:仪表盘指针 [GaugePointer](#GaugePointer)。 * `gaugePointer`:仪表盘指针 [GaugePointer](#GaugePointer)。

View File

@@ -64,7 +64,7 @@ namespace XCharts
SerializedProperty m_EndAngle = prop.FindPropertyRelative("m_EndAngle"); SerializedProperty m_EndAngle = prop.FindPropertyRelative("m_EndAngle");
SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber"); SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber");
//SerializedProperty m_Clockwise = prop.FindPropertyRelative("m_Clockwise"); //SerializedProperty m_Clockwise = prop.FindPropertyRelative("m_Clockwise");
SerializedProperty m_ArcShaped = prop.FindPropertyRelative("m_ArcShaped"); SerializedProperty m_RoundCap = prop.FindPropertyRelative("m_RoundCap");
SerializedProperty m_GaugeType = prop.FindPropertyRelative("m_GaugeType"); SerializedProperty m_GaugeType = prop.FindPropertyRelative("m_GaugeType");
SerializedProperty m_GaugeAxis = prop.FindPropertyRelative("m_GaugeAxis"); SerializedProperty m_GaugeAxis = prop.FindPropertyRelative("m_GaugeAxis");
SerializedProperty m_GaugePointer = prop.FindPropertyRelative("m_GaugePointer"); SerializedProperty m_GaugePointer = prop.FindPropertyRelative("m_GaugePointer");
@@ -182,7 +182,7 @@ namespace XCharts
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center"); ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Radius, "Radius"); ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Radius, "Radius");
EditorGUI.PropertyField(drawRect, m_ArcShaped); EditorGUI.PropertyField(drawRect, m_RoundCap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_Label); EditorGUI.PropertyField(drawRect, m_Label);
drawRect.y += EditorGUI.GetPropertyHeight(m_Label); drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
@@ -239,7 +239,7 @@ namespace XCharts
{ {
m_SplitNumber.intValue = 36; m_SplitNumber.intValue = 36;
} }
EditorGUI.PropertyField(drawRect, m_ArcShaped); EditorGUI.PropertyField(drawRect, m_RoundCap);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, m_TitleStyle); EditorGUI.PropertyField(drawRect, m_TitleStyle);
drawRect.y += EditorGUI.GetPropertyHeight(m_TitleStyle); drawRect.y += EditorGUI.GetPropertyHeight(m_TitleStyle);

View File

@@ -8,6 +8,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
namespace XCharts namespace XCharts
{ {
@@ -225,7 +226,8 @@ namespace XCharts
[SerializeField] private float m_StartAngle; [SerializeField] private float m_StartAngle;
[SerializeField] private float m_EndAngle; [SerializeField] private float m_EndAngle;
[SerializeField] private bool m_Clockwise; [SerializeField] private bool m_Clockwise;
[SerializeField] private bool m_ArcShaped; [FormerlySerializedAs("m_ArcShaped")]
[SerializeField] private bool m_RoundCap;
[SerializeField] private int m_SplitNumber; [SerializeField] private int m_SplitNumber;
[SerializeField] private GaugeType m_GaugeType = GaugeType.Pointer; [SerializeField] private GaugeType m_GaugeType = GaugeType.Pointer;
[SerializeField] private GaugeAxis m_GaugeAxis = new GaugeAxis(); [SerializeField] private GaugeAxis m_GaugeAxis = new GaugeAxis();
@@ -584,12 +586,12 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_SplitNumber, value > 36 ? 36 : value)) SetVerticesDirty(); } set { if (PropertyUtility.SetStruct(ref m_SplitNumber, value > 36 ? 36 : value)) SetVerticesDirty(); }
} }
/// <summary> /// <summary>
/// 是否开启圆弧形边角 /// 是否开启圆弧效果
/// </summary> /// </summary>
public bool arcShaped public bool roundCap
{ {
get { return m_ArcShaped; } get { return m_RoundCap; }
set { if (PropertyUtility.SetStruct(ref m_ArcShaped, value)) SetVerticesDirty(); } set { if (PropertyUtility.SetStruct(ref m_RoundCap, value)) SetVerticesDirty(); }
} }
/// <summary> /// <summary>
/// 仪表盘轴线。 /// 仪表盘轴线。

View File

@@ -166,14 +166,14 @@ namespace XCharts
var outsideRadius = serie.runtimeInsideRadius + serie.gaugeAxis.axisLine.width; var outsideRadius = serie.runtimeInsideRadius + serie.gaugeAxis.axisLine.width;
ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, serie.runtimeInsideRadius, outsideRadius, ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, serie.runtimeInsideRadius, outsideRadius,
backgroundColor, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, serie.startAngle, serie.endAngle); backgroundColor, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, serie.startAngle, serie.endAngle);
if (serie.arcShaped) if (serie.roundCap)
{ {
DrawArcShape(vh, serie, serie.startAngle, backgroundColor, true); DrawArcShape(vh, serie, serie.startAngle, backgroundColor, true);
DrawArcShape(vh, serie, serie.endAngle, backgroundColor); DrawArcShape(vh, serie, serie.endAngle, backgroundColor);
} }
ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, serie.runtimeInsideRadius, outsideRadius, ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, serie.runtimeInsideRadius, outsideRadius,
color, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, serie.startAngle, currAngle); color, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, serie.startAngle, currAngle);
if (serie.arcShaped && currAngle != serie.startAngle) if (serie.roundCap && currAngle != serie.startAngle)
{ {
DrawArcShape(vh, serie, currAngle, color); DrawArcShape(vh, serie, currAngle, color);
DrawArcShape(vh, serie, serie.startAngle, color, true); DrawArcShape(vh, serie, serie.startAngle, color, true);

View File

@@ -181,7 +181,7 @@ namespace XCharts
private void DrawArcShape(VertexHelper vh, Serie serie, SerieData serieData, Vector3 centerPos, private void DrawArcShape(VertexHelper vh, Serie serie, SerieData serieData, Vector3 centerPos,
Color color, ref float drawStartDegree, ref float drawEndDegree) Color color, ref float drawStartDegree, ref float drawEndDegree)
{ {
if (serie.arcShaped && serieData.runtimePieInsideRadius > 0) if (serie.roundCap && serieData.runtimePieInsideRadius > 0)
{ {
var width = (serieData.runtimePieOutsideRadius - serieData.runtimePieInsideRadius) / 2; var width = (serieData.runtimePieOutsideRadius - serieData.runtimePieInsideRadius) / 2;
var radius = serieData.runtimePieInsideRadius + width; var radius = serieData.runtimePieInsideRadius + width;