增加SymbolPlus加号和Minus减号的支持

This commit is contained in:
monitor1394
2023-08-02 07:23:28 +08:00
parent f36ca34055
commit e3e01587ab
8 changed files with 75 additions and 5 deletions

View File

@@ -668,6 +668,7 @@ slug: /api
|SetColor()||public void SetColor(ref bool needInteract, Color32 color)|
|SetColor()||public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)|
|SetPosition()||public void SetPosition(ref bool needInteract, Vector3 pos)|
|SetValue()||public void SetValue(float value)|
|SetValue()||public void SetValue(ref bool needInteract, float value)|
|SetValue()||public void SetValue(ref bool needInteract, float value, bool highlight, float rate = 1.3f)|
|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color)|
@@ -1051,6 +1052,7 @@ the data of serie event.
|DrawSerie()||public virtual void DrawSerie(VertexHelper vh) { }|
|DrawTop()||public virtual void DrawTop(VertexHelper vh) { }|
|DrawUpper()||public virtual void DrawUpper(VertexHelper vh) { }|
|ForceUpdateSerieContext()||public virtual void ForceUpdateSerieContext() { }|
|InitComponent()||public virtual void InitComponent() { }|
|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData) { }|
|OnDrag()||public virtual void OnDrag(PointerEventData eventData) { }|
@@ -1081,6 +1083,7 @@ the data of serie event.
|public method|since|description|
|--|--|--|
|DrawLabelLineSymbol()||public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)|
|ForceUpdateSerieContext()||public override void ForceUpdateSerieContext()|
|GetPointerItemDataDimension()||public override int GetPointerItemDataDimension()|
|GetPointerItemDataIndex()||public override int GetPointerItemDataIndex()|
|GetSerieDataAutoColor()||public virtual Color GetSerieDataAutoColor(SerieData serieData)|
@@ -1297,10 +1300,13 @@ UGUI Graphics Library.
|--|--|--|
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color)<br/>Draw a diamond. 画菱形(钻石形状) |
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)<br/>Draw a diamond. 画菱形(钻石形状) |
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, Color32 color, Color32 toColor)|
|DrawEllipse()||public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)|
|DrawLine()||public static void DrawLine(VertexHelper vh, List&lt;Vector3&gt; points, float width, Color32 color, bool smooth, bool closepath = false)|
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)<br/>Draw a line. 画直线 |
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)<br/>Draw a line. 画直线 |
|DrawMinus()||public static void DrawMinus(VertexHelper vh, Vector3 center, float radius, float tickness, Color32 color)<br/>Draw minus sign. |
|DrawPlus()||public static void DrawPlus(VertexHelper vh, Vector3 center, float radius, float tickness, Color32 color)<br/>Draw plus sign. |
|DrawPolygon()||public static void DrawPolygon(VertexHelper vh, List&lt;Vector3&gt; points, Color32 color)<br/>填充任意多边形(目前只支持凸多边形) |
|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)|
|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)|

View File

@@ -1160,7 +1160,7 @@ The interface for serie data component.
|show|true||Whether the label line is showed.
|lineType|||the type of visual guide line.<br/>`LabelLine.LineType`:<br/>- `BrokenLine`: 折线<br/>- `Curves`: 曲线<br/>- `HorizontalLine`: 水平线<br/>|
|lineColor|Color32(0,0,0,0)||the color of visual guild line.
|lineAngle|0||the angle of visual guild line.
|lineAngle|60||the angle of visual guild line.
|lineWidth|1.0f||the width of visual guild line.
|lineGap|1.0f||the gap of container and guild line.
|lineLength1|25f||The length of the first segment of visual guide line.
@@ -1979,7 +1979,7 @@ the state style of serie.
|field|default|since|comment|
|--|--|--|--|
|show|true||Whether the symbol is showed.
|type|||the type of symbol.<br/>`SymbolType`:<br/>- `None`: 不显示标记。<br/>- `Custom`: 自定义标记。<br/>- `Circle`: 圆形。<br/>- `EmptyCircle`: 空心圆。<br/>- `Rect`: 正方形。可通过设置`itemStyle`的`cornerRadius`变成圆角矩形。<br/>- `EmptyRect`: 空心正方形。<br/>- `Triangle`: 三角形。<br/>- `EmptyTriangle`: 空心三角形。<br/>- `Diamond`: 菱形。<br/>- `EmptyDiamond`: 空心菱形。<br/>- `Arrow`: 箭头。<br/>- `EmptyArrow`: 空心箭头。<br/>|
|type|||the type of symbol.<br/>`SymbolType`:<br/>- `None`: 不显示标记。<br/>- `Custom`: 自定义标记。<br/>- `Circle`: 圆形。<br/>- `EmptyCircle`: 空心圆。<br/>- `Rect`: 正方形。可通过设置`itemStyle`的`cornerRadius`变成圆角矩形。<br/>- `EmptyRect`: 空心正方形。<br/>- `Triangle`: 三角形。<br/>- `EmptyTriangle`: 空心三角形。<br/>- `Diamond`: 菱形。<br/>- `EmptyDiamond`: 空心菱形。<br/>- `Arrow`: 箭头。<br/>- `EmptyArrow`: 空心箭头。<br/>- `Plus`: 加号。<br/>- `Minus`: 减号。<br/>|
|size|0f||the size of symbol.
|gap|0||the gap of symbol and line segment.
|width|0f||图形的宽。

View File

@@ -668,6 +668,7 @@ slug: /api
|SetColor()||public void SetColor(ref bool needInteract, Color32 color)|
|SetColor()||public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)|
|SetPosition()||public void SetPosition(ref bool needInteract, Vector3 pos)|
|SetValue()||public void SetValue(float value)|
|SetValue()||public void SetValue(ref bool needInteract, float value)|
|SetValue()||public void SetValue(ref bool needInteract, float value, bool highlight, float rate = 1.3f)|
|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color)|
@@ -1051,6 +1052,7 @@ serie事件的数据。
|DrawSerie()||public virtual void DrawSerie(VertexHelper vh) { }|
|DrawTop()||public virtual void DrawTop(VertexHelper vh) { }|
|DrawUpper()||public virtual void DrawUpper(VertexHelper vh) { }|
|ForceUpdateSerieContext()||public virtual void ForceUpdateSerieContext() { }|
|InitComponent()||public virtual void InitComponent() { }|
|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData) { }|
|OnDrag()||public virtual void OnDrag(PointerEventData eventData) { }|
@@ -1081,6 +1083,7 @@ serie事件的数据。
|public method|since|description|
|--|--|--|
|DrawLabelLineSymbol()||public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)|
|ForceUpdateSerieContext()||public override void ForceUpdateSerieContext()|
|GetPointerItemDataDimension()||public override int GetPointerItemDataDimension()|
|GetPointerItemDataIndex()||public override int GetPointerItemDataIndex()|
|GetSerieDataAutoColor()||public virtual Color GetSerieDataAutoColor(SerieData serieData)|
@@ -1297,10 +1300,13 @@ UGUI 图形库
|--|--|--|
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color)<br/>Draw a diamond. 画菱形(钻石形状) |
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)<br/>Draw a diamond. 画菱形(钻石形状) |
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, Color32 color, Color32 toColor)|
|DrawEllipse()||public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)|
|DrawLine()||public static void DrawLine(VertexHelper vh, List&lt;Vector3&gt; points, float width, Color32 color, bool smooth, bool closepath = false)|
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)<br/>Draw a line. 画直线 |
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)<br/>Draw a line. 画直线 |
|DrawMinus()||public static void DrawMinus(VertexHelper vh, Vector3 center, float radius, float tickness, Color32 color)<br/>绘制减号 |
|DrawPlus()||public static void DrawPlus(VertexHelper vh, Vector3 center, float radius, float tickness, Color32 color)<br/>绘制加号 |
|DrawPolygon()||public static void DrawPolygon(VertexHelper vh, List&lt;Vector3&gt; points, Color32 color)<br/>填充任意多边形(目前只支持凸多边形) |
|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)|
|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)|

View File

@@ -74,6 +74,7 @@ slug: /changelog
日志详情:
* (2023.08.02) 增加`Symbol``Plus`加号和`Minus`减号的支持
* (2023.07.31) 增加`Symbol``EmptyTriangle``EmptyDiamond`的支持,优化`Symbol`表现效果
* (2023.07.31) 优化`Line`的默认配置效果
* (2023.07.27) 增加`Serie``minRadius`可设置最小半径

View File

@@ -1160,7 +1160,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|show|true||是否显示视觉引导线。
|lineType|||视觉引导线类型。<br/>`LabelLine.LineType`:<br/>- `BrokenLine`: 折线<br/>- `Curves`: 曲线<br/>- `HorizontalLine`: 水平线<br/>|
|lineColor|Color32(0,0,0,0)||视觉引导线颜色。默认和serie一致取自调色板。
|lineAngle|0||视觉引导线的固定角度。对折线和曲线有效。
|lineAngle|60||视觉引导线的固定角度。对折线和曲线有效。
|lineWidth|1.0f||视觉引导线的宽度。
|lineGap|1.0f||视觉引导线和容器的间距。
|lineLength1|25f||视觉引导线第一段的长度。
@@ -1979,7 +1979,7 @@ Serie的状态样式。Serie的状态有正常高亮淡出选中四种
|field|default|since|comment|
|--|--|--|--|
|show|true||是否显示标记。
|type|||标记类型。<br/>`SymbolType`:<br/>- `None`: 不显示标记。<br/>- `Custom`: 自定义标记。<br/>- `Circle`: 圆形。<br/>- `EmptyCircle`: 空心圆。<br/>- `Rect`: 正方形。可通过设置`itemStyle`的`cornerRadius`变成圆角矩形。<br/>- `EmptyRect`: 空心正方形。<br/>- `Triangle`: 三角形。<br/>- `EmptyTriangle`: 空心三角形。<br/>- `Diamond`: 菱形。<br/>- `EmptyDiamond`: 空心菱形。<br/>- `Arrow`: 箭头。<br/>- `EmptyArrow`: 空心箭头。<br/>|
|type|||标记类型。<br/>`SymbolType`:<br/>- `None`: 不显示标记。<br/>- `Custom`: 自定义标记。<br/>- `Circle`: 圆形。<br/>- `EmptyCircle`: 空心圆。<br/>- `Rect`: 正方形。可通过设置`itemStyle`的`cornerRadius`变成圆角矩形。<br/>- `EmptyRect`: 空心正方形。<br/>- `Triangle`: 三角形。<br/>- `EmptyTriangle`: 空心三角形。<br/>- `Diamond`: 菱形。<br/>- `EmptyDiamond`: 空心菱形。<br/>- `Arrow`: 箭头。<br/>- `EmptyArrow`: 空心箭头。<br/>- `Plus`: 加号。<br/>- `Minus`: 减号。<br/>|
|size|0f||标记的大小。
|gap|0||图形标记和线条的间隙距离。
|width|0f||图形的宽。

View File

@@ -57,7 +57,15 @@ namespace XCharts.Runtime
/// <summary>
/// 空心箭头。
/// </summary>
EmptyArrow
EmptyArrow,
/// <summary>
/// 加号。
/// </summary>
Plus,
/// <summary>
/// 减号。
/// </summary>
Minus,
}
/// <summary>

View File

@@ -136,6 +136,20 @@ namespace XCharts.Runtime
arrowOffset, arrowDent, backgroundColor);
}
break;
case SymbolType.Plus:
if (gap > 0)
{
UGL.DrawPlus(vh, pos, symbolSize + gap, tickness + gap, backgroundColor);
}
UGL.DrawPlus(vh, pos, symbolSize, tickness, color);
break;
case SymbolType.Minus:
if (gap > 0)
{
UGL.DrawMinus(vh, pos, symbolSize + gap, tickness + gap, backgroundColor);
}
UGL.DrawMinus(vh, pos, symbolSize, tickness, color);
break;
}
}

View File

@@ -1971,5 +1971,40 @@ namespace XUGL
vh.AddTriangle(cv, cv + i - 1, cv + i);
}
}
/// <summary>
/// Draw plus sign.
/// |绘制加号
/// </summary>
/// <param name="vh"></param>
/// <param name="center"></param>
/// <param name="radius"></param>
/// <param name="tickness"></param>
/// <param name="color"></param>
public static void DrawPlus(VertexHelper vh, Vector3 center, float radius, float tickness, Color32 color)
{
var xPos1 = new Vector3(center.x - radius, center.y);
var xPos2 = new Vector3(center.x + radius, center.y);
var yPos1 = new Vector3(center.x, center.y - radius);
var yPos2 = new Vector3(center.x, center.y + radius);
UGL.DrawLine(vh, xPos1, xPos2, tickness, color);
UGL.DrawLine(vh, yPos1, yPos2, tickness, color);
}
/// <summary>
/// Draw minus sign.
/// |绘制减号
/// </summary>
/// <param name="vh"></param>
/// <param name="center"></param>
/// <param name="radius"></param>
/// <param name="tickness"></param>
/// <param name="color"></param>
public static void DrawMinus(VertexHelper vh, Vector3 center, float radius, float tickness, Color32 color)
{
var xPos1 = new Vector3(center.x - radius, center.y);
var xPos2 = new Vector3(center.x + radius, center.y);
UGL.DrawLine(vh, xPos1, xPos2, tickness, color);
}
}
}