mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
增加Bar可添加TitleStyle组件支持
This commit is contained in:
@@ -80,6 +80,7 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
* (2025.03.18) 增加`Bar`可添加`TitleStyle`组件支持
|
||||
* (2025.03.18) 增加`LabelStyle`的`fixedX`和`fixedY`可固定label的坐标
|
||||
* (2025.03.17) 增加`ItemStyle`的`backgroundGap`可设置数据项背景间隙
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@ namespace XCharts.Runtime
|
||||
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
||||
[DefaultAnimation(AnimationType.BottomToTop)]
|
||||
[DefaultTooltip(Tooltip.Type.Shadow, Tooltip.Trigger.Axis)]
|
||||
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieComponent(typeof(TitleStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataComponent(typeof(ItemStyle), typeof(TitleStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField("m_Ignore")]
|
||||
public class Bar : Serie, INeedSerieContainer
|
||||
{
|
||||
public override bool useSortData { get { return realtimeSort; } }
|
||||
|
||||
|
||||
public int containerIndex { get; internal set; }
|
||||
public int containterInstanceId { get; internal set; }
|
||||
|
||||
|
||||
@@ -47,12 +47,14 @@ namespace XCharts.Runtime
|
||||
{
|
||||
switch (label.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
case LabelStyle.Position.Bottom:
|
||||
var center = serieData.context.areaCenter;
|
||||
var angle = serieData.context.halfAngle;
|
||||
var radius = serieData.context.insideRadius;
|
||||
return ChartHelper.GetPosition(center, angle, radius);
|
||||
case LabelStyle.Position.Top:
|
||||
case LabelStyle.Position.End:
|
||||
center = serieData.context.areaCenter;
|
||||
angle = serieData.context.halfAngle;
|
||||
radius = serieData.context.outsideRadius;
|
||||
@@ -65,6 +67,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
switch (label.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
case LabelStyle.Position.Bottom:
|
||||
var center = serieData.context.rect.center;
|
||||
if (serie.context.isHorizontal)
|
||||
@@ -73,6 +76,7 @@ namespace XCharts.Runtime
|
||||
return new Vector3(center.x, center.y - serieData.context.rect.height / 2);
|
||||
case LabelStyle.Position.Center:
|
||||
case LabelStyle.Position.Inside:
|
||||
case LabelStyle.Position.Middle:
|
||||
return serieData.context.rect.center;
|
||||
default:
|
||||
return serieData.context.position;
|
||||
@@ -80,6 +84,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public override Vector3 GetSerieDataTitlePosition(SerieData serieData, TitleStyle titleStyle)
|
||||
{
|
||||
return GetSerieDataLabelPosition(serieData, titleStyle);
|
||||
}
|
||||
|
||||
private void UpdateSerieGridContext()
|
||||
{
|
||||
if (m_SerieGrid == null)
|
||||
|
||||
Reference in New Issue
Block a user