mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 09:50:15 +00:00
优化border
This commit is contained in:
@@ -228,18 +228,6 @@ namespace XCharts.Runtime
|
||||
get { return m_CornerRadius; }
|
||||
set { if (PropertyUtil.SetClass(ref m_CornerRadius, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 实际边框宽。边框不显示时为0。
|
||||
/// </summary>
|
||||
public float runtimeBorderWidth { get { return NeedShowBorder() ? borderWidth : 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// 是否需要显示边框。
|
||||
/// </summary>
|
||||
public bool NeedShowBorder()
|
||||
{
|
||||
return borderWidth != 0 && !ChartHelper.IsClearColor(borderColor);
|
||||
}
|
||||
|
||||
public Color32 GetColor()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
internal static class ListPool<T>
|
||||
public static class ListPool<T>
|
||||
{
|
||||
private static readonly ObjectPool<List<T>> s_ListPool = new ObjectPool<List<T>>(OnGet, OnClear);
|
||||
static void OnGet(List<T> l)
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace XCharts.Runtime
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, state);
|
||||
var value = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
|
||||
var relativedValue = serieData.GetCurrData(1, dataAddDuration, dataChangeDuration, relativedAxis.inverse, 0, 0, serie.animation.unscaledTime);
|
||||
var borderWidth = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth;
|
||||
var borderWidth = relativedValue == 0 ? 0 : itemStyle.borderWidth;
|
||||
var borderGap = relativedValue == 0 ? 0 : itemStyle.borderGap;
|
||||
var borderGapAndWidth = borderWidth + borderGap;
|
||||
var backgroundColor = itemStyle.backgroundColor;
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace XCharts.Runtime
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||
var value = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
|
||||
var relativedValue = serieData.GetCurrData(1, dataAddDuration, dataChangeDuration, relativedAxis.inverse, 0, 0, serie.animation.unscaledTime);
|
||||
var borderWidth = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth;
|
||||
var borderWidth = relativedValue == 0 ? 0 : itemStyle.borderWidth;
|
||||
|
||||
if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting, interactDuration))
|
||||
{
|
||||
@@ -290,7 +290,7 @@ namespace XCharts.Runtime
|
||||
Vector3 prb, bool isYAxis, GridCoord grid, Color32 areaColor, Color32 areaToColor)
|
||||
{
|
||||
|
||||
var borderWidth = itemStyle.runtimeBorderWidth;
|
||||
var borderWidth = itemStyle.borderWidth;
|
||||
if (isYAxis)
|
||||
{
|
||||
if (serie.clip)
|
||||
|
||||
@@ -126,8 +126,8 @@ namespace XCharts.Runtime
|
||||
var heighest = serieData.GetCurrData(startDataIndex + 3, dataAddDuration, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue, unscaledTime);
|
||||
var isRise = yAxis.inverse ? close<open : close> open;
|
||||
var borderWidth = open == 0 ? 0f :
|
||||
(itemStyle.runtimeBorderWidth == 0 ? theme.serie.candlestickBorderWidth :
|
||||
itemStyle.runtimeBorderWidth);
|
||||
(itemStyle.borderWidth == 0 ? theme.serie.candlestickBorderWidth :
|
||||
itemStyle.borderWidth);
|
||||
if (serieData.IsDataChanged()) dataChanging = true;
|
||||
float pX = grid.context.x + i * categoryWidth;
|
||||
float zeroY = grid.context.y + yAxis.context.offset;
|
||||
|
||||
@@ -125,8 +125,8 @@ namespace XCharts.Runtime
|
||||
var heighest = serieData.GetCurrData(startDataIndex + 3, dataAddDuration, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue, unscaledTime);
|
||||
var isRise = yAxis.inverse ? close<open : close> open;
|
||||
var borderWidth = open == 0 ? 0f :
|
||||
(itemStyle.runtimeBorderWidth == 0 ? theme.serie.candlestickBorderWidth :
|
||||
itemStyle.runtimeBorderWidth);
|
||||
(itemStyle.borderWidth == 0 ? theme.serie.candlestickBorderWidth :
|
||||
itemStyle.borderWidth);
|
||||
if (serieData.IsDataChanged()) dataChanging = true;
|
||||
float pX = grid.context.x + i * categoryWidth;
|
||||
float zeroY = grid.context.y + yAxis.context.offset;
|
||||
|
||||
Reference in New Issue
Block a user