优化Line的默认配置效果

This commit is contained in:
monitor1394
2023-07-31 07:29:53 +08:00
parent ec89828c67
commit 0ffc6d7efe
6 changed files with 19 additions and 4 deletions

View File

@@ -74,6 +74,7 @@ slug: /changelog
日志详情:
* (2023.07.31) 优化`Line`的默认配置效果
* (2023.07.27) 增加`Serie``minRadius`可设置最小半径
* (2023.07.26) 增加`MLValue`多样式数值
* (2023.07.25) 增加`XLog`日志系统

View File

@@ -8,7 +8,6 @@ namespace XCharts.Example
[DisallowMultipleComponent]
public class Example_TestSerie : MonoBehaviour
{
public int maxCache = 100;
BaseChart chart;
int timestamp;
@@ -23,6 +22,14 @@ namespace XCharts.Example
chart.GetSerie(0).radius[1] = Random.Range(50, 80);
chart.SetAllDirty();
}
else if (Input.GetKeyDown(KeyCode.W))
{
chart.GetSerie(0).lineStyle.width = Random.Range(1, 5);
}
else if (Input.GetKeyDown(KeyCode.S))
{
chart.GetSerie(0).symbol.size = Random.Range(1, 10);
}
}
}
}

View File

@@ -31,6 +31,7 @@ namespace XCharts.Runtime
{
var serie = chart.AddSerie<Line>(serieName);
serie.symbol.show = true;
serie.animation.interaction.radius.value = 1.5f;
for (int i = 0; i < 5; i++)
{
chart.AddData(serie.index, UnityEngine.Random.Range(10, 90));

View File

@@ -1044,7 +1044,7 @@ namespace XCharts.Runtime
public override void SetVerticesDirty()
{
base.SetVerticesDirty();
handler.ForceUpdateSerieContext();
interactDirty = true;
}
private bool AnySerieDataVerticesDirty()
@@ -1082,6 +1082,7 @@ namespace XCharts.Runtime
public bool labelDirty { get; set; }
public bool titleDirty { get; set; }
public bool dataDirty { get; set; }
public bool interactDirty { get; set; }
private void SetSerieNameDirty()
{

View File

@@ -132,6 +132,11 @@ namespace XCharts.Runtime
serie.ResetInteract();
serie.ClearVerticesDirty();
}
if (serie.interactDirty)
{
serie.interactDirty = false;
m_ForceUpdateSerieContext = true;
}
UpdateSerieContextInternal();
}

View File

@@ -646,7 +646,7 @@ namespace XCharts.Runtime
if (stateStyle == null)
{
var itemStyle = GetItemStyle(serie, serieData, SerieState.Normal);
border = itemStyle.borderWidth != 0 ? itemStyle.borderWidth : serie.lineStyle.GetWidth(theme.serie.lineWidth);
border = itemStyle.borderWidth != 0 ? itemStyle.borderWidth : serie.lineStyle.GetWidth(theme.serie.lineWidth) * 1.8f;
cornerRadius = itemStyle.cornerRadius;
GetColor(ref borderColor, itemStyle.borderColor, itemStyle.borderColor, 1, theme, -1);
switch (state)
@@ -667,7 +667,7 @@ namespace XCharts.Runtime
else
{
var itemStyle = stateStyle.itemStyle;
border = itemStyle.borderWidth != 0 ? itemStyle.borderWidth : stateStyle.lineStyle.GetWidth(theme.serie.lineWidth);
border = itemStyle.borderWidth != 0 ? itemStyle.borderWidth : stateStyle.lineStyle.GetWidth(theme.serie.lineWidth) * 1.8f;
cornerRadius = itemStyle.cornerRadius;
GetColor(ref borderColor, stateStyle.itemStyle.borderColor, ColorUtil.clearColor32, 1, theme, -1);
}