mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 03:58:49 +00:00
[feature][legend] add new icon type:candlestick
This commit is contained in:
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2022.08.26) 增加`Legend`新图标类型`Candlestick`
|
||||||
* (2022.08.26) 优化`CandlestickChart`表现,调整相关的`AddData()`接口参数
|
* (2022.08.26) 优化`CandlestickChart`表现,调整相关的`AddData()`接口参数
|
||||||
* (2022.08.26) 增加`Tooltip`的`position`参数支持设置移动平台不同的显示位置
|
* (2022.08.26) 增加`Tooltip`的`position`参数支持设置移动平台不同的显示位置
|
||||||
* (2022.08.26) 删除`Tooltip`的`fixedXEnable`和`fixedYEnable`参数
|
* (2022.08.26) 删除`Tooltip`的`fixedXEnable`和`fixedYEnable`参数
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ namespace XCharts.Runtime
|
|||||||
/// 菱形。
|
/// 菱形。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Diamond,
|
Diamond,
|
||||||
|
/// <summary>
|
||||||
|
/// 烛台(可用于K线图)。
|
||||||
|
/// </summary>
|
||||||
|
Candlestick,
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
|
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
|
||||||
|
|||||||
@@ -196,7 +196,9 @@ namespace XCharts.Runtime
|
|||||||
if (legend.iconType == Legend.Type.Auto)
|
if (legend.iconType == Legend.Type.Auto)
|
||||||
{
|
{
|
||||||
var serie = chart.GetSerie(item.legendName);
|
var serie = chart.GetSerie(item.legendName);
|
||||||
if (serie != null && serie is Line)
|
if (serie != null)
|
||||||
|
{
|
||||||
|
if (serie is Line || serie is SimplifiedLine)
|
||||||
{
|
{
|
||||||
var sp = new Vector3(rect.center.x - rect.width / 2, rect.center.y);
|
var sp = new Vector3(rect.center.x - rect.width / 2, rect.center.y);
|
||||||
var ep = new Vector3(rect.center.x + rect.width / 2, rect.center.y);
|
var ep = new Vector3(rect.center.x + rect.width / 2, rect.center.y);
|
||||||
@@ -223,6 +225,7 @@ namespace XCharts.Runtime
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iconType = Legend.Type.Rect;
|
iconType = Legend.Type.Rect;
|
||||||
@@ -249,6 +252,12 @@ namespace XCharts.Runtime
|
|||||||
case Legend.Type.Triangle:
|
case Legend.Type.Triangle:
|
||||||
UGL.DrawTriangle(vh, rect.center, 1.2f * radius, color);
|
UGL.DrawTriangle(vh, rect.center, 1.2f * radius, color);
|
||||||
break;
|
break;
|
||||||
|
case Legend.Type.Candlestick:
|
||||||
|
UGL.DrawRoundRectangle(vh, rect.center, rect.width / 2, rect.height / 2, color, color,
|
||||||
|
0, null, false, 0.5f);
|
||||||
|
UGL.DrawLine(vh, new Vector3(rect.center.x, rect.center.y - rect.height / 2),
|
||||||
|
new Vector3(rect.center.x, rect.center.y + rect.height / 2), 1, color);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user