mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 14:30:10 +00:00
[refactor][optimize] item color
This commit is contained in:
@@ -110,6 +110,14 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据项背景宽度。
|
||||
/// </summary>
|
||||
public float backgroundWidth
|
||||
{
|
||||
get { return m_BackgroundWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 中心区域颜色。
|
||||
/// </summary>
|
||||
public Color32 centerColor
|
||||
@@ -126,14 +134,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_CenterGap, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据项背景宽度。
|
||||
/// </summary>
|
||||
public float backgroundWidth
|
||||
{
|
||||
get { return m_BackgroundWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BackgroundWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 边框的颜色。
|
||||
/// </summary>
|
||||
public Color32 borderColor
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace XCharts.Runtime
|
||||
private ChartLabel m_Label;
|
||||
private List<float> m_FpsList = new List<float>();
|
||||
|
||||
public bool showAllChartObject { get { return m_ShowAllChartObject; } }
|
||||
public bool showAllChartObject { get { return m_ShowAllChartObject; } set { m_ShowAllChartObject = value; } }
|
||||
public bool foldSeries { get { return m_FoldSeries; } set { m_FoldSeries = value; } }
|
||||
public float fps { get; private set; }
|
||||
public float avgFps { get; private set; }
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace XCharts.Runtime
|
||||
|
||||
UpdateRuntimeData(markArea);
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.serieName);
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
var serieColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, false);
|
||||
var areaColor = markArea.itemStyle.GetColor(serieColor);
|
||||
UGL.DrawRectangle(vh, markArea.runtimeRect, areaColor, areaColor);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace XCharts.Runtime
|
||||
var serie = chart.GetSerie(markLine.serieIndex);
|
||||
if (!serie.show || !markLine.show) return;
|
||||
ResetTempMarkLineGroupData(markLine);
|
||||
var serieColor = (Color)chart.theme.GetColor(chart.GetLegendRealShowNameIndex(serie.serieName));
|
||||
var serieColor = (Color) chart.GetItemColor(serie);
|
||||
if (m_TempGroupData.Count > 0)
|
||||
{
|
||||
foreach (var kv in m_TempGroupData)
|
||||
|
||||
@@ -524,5 +524,18 @@ namespace XCharts.Runtime
|
||||
var background = GetChartComponent<Background>();
|
||||
return theme.GetBackgroundColor(background);
|
||||
}
|
||||
|
||||
public Color32 GetItemColor(Serie serie, SerieData serieData, bool highlight = false)
|
||||
{
|
||||
var colorIndex = serieData == null || !serie.useDataNameForColor
|
||||
? GetLegendRealShowNameIndex(serie.legendName)
|
||||
: GetLegendRealShowNameIndex(serieData.legendName);
|
||||
return SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
|
||||
}
|
||||
|
||||
public Color32 GetItemColor(Serie serie, bool highlight = false)
|
||||
{
|
||||
return SerieHelper.GetItemColor(serie, null, m_Theme, serie.context.colorIndex, highlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,6 @@ namespace XCharts.Runtime
|
||||
m_ChartPivot = m_GraphPivot;
|
||||
m_ChartSizeDelta = m_GraphSizeDelta;
|
||||
m_ChartRect = m_GraphRect;
|
||||
|
||||
SetAllComponentDirty();
|
||||
OnCoordinateChanged();
|
||||
RefreshChart();
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
{
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
DrawCandlestickSerie(vh, colorIndex, serie);
|
||||
DrawCandlestickSerie(vh, serie);
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
@@ -31,7 +30,7 @@ namespace XCharts.Runtime
|
||||
|
||||
title = category;
|
||||
|
||||
var color = chart.GetLegendRealShowNameColor(serie.serieName);
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
var newMarker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
var newItemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
var newNumericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -78,7 +77,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCandlestickSerie(VertexHelper vh, int colorIndex, Candlestick serie)
|
||||
private void DrawCandlestickSerie(VertexHelper vh, Candlestick serie)
|
||||
{
|
||||
if (!serie.show) return;
|
||||
if (serie.animation.HasFadeOut()) return;
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
{
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
DrawCandlestickSerie(vh, colorIndex, serie);
|
||||
DrawCandlestickSerie(vh, serie);
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
@@ -31,7 +30,7 @@ namespace XCharts.Runtime
|
||||
|
||||
title = category;
|
||||
|
||||
var color = chart.GetLegendRealShowNameColor(serie.serieName);
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
var newMarker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
var newItemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
var newNumericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -78,7 +77,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCandlestickSerie(VertexHelper vh, int colorIndex, SimplifiedCandlestick serie)
|
||||
private void DrawCandlestickSerie(VertexHelper vh, SimplifiedCandlestick serie)
|
||||
{
|
||||
if (!serie.show) return;
|
||||
if (serie.animation.HasFadeOut()) return;
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
{
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
DrawHeatmapSerie(vh, colorIndex, serie);
|
||||
DrawHeatmapSerie(vh, serie);
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
@@ -120,7 +119,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawHeatmapSerie(VertexHelper vh, int colorIndex, Heatmap serie)
|
||||
private void DrawHeatmapSerie(VertexHelper vh, Heatmap serie)
|
||||
{
|
||||
if (serie.animation.HasFadeOut()) return;
|
||||
XAxis xAxis;
|
||||
|
||||
@@ -19,15 +19,14 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
{
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
DrawParallelSerie(vh, colorIndex, serie);
|
||||
DrawParallelSerie(vh, serie);
|
||||
}
|
||||
|
||||
private void UpdateSerieContext()
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawParallelSerie(VertexHelper vh, int colorIndex, Parallel serie)
|
||||
private void DrawParallelSerie(VertexHelper vh, Parallel serie)
|
||||
{
|
||||
if (!serie.show) return;
|
||||
if (serie.animation.HasFadeOut()) return;
|
||||
@@ -42,7 +41,7 @@ namespace XCharts.Runtime
|
||||
|
||||
var animationIndex = serie.animation.GetCurrIndex();
|
||||
var isHorizonal = parallel.orient == Orient.Horizonal;
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, false);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.context.colorIndex, false);
|
||||
var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
|
||||
|
||||
float currDetailProgress = !isHorizonal
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace XCharts.Runtime
|
||||
if (serieData == null)
|
||||
return;
|
||||
|
||||
var color = chart.theme.GetColor(dataIndex);
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, dataIndex, false);;
|
||||
title = serieData.name;
|
||||
for (int i = 0; i < serieData.data.Count; i++)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ namespace XCharts.Runtime
|
||||
var areaStyle = SerieHelper.GetAreaStyle(serie, serieData);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var isHighlight = serieData.context.highlight;
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.name);
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var areaColor = SerieHelper.GetAreaColor(serie, serieData, chart.theme, colorIndex, isHighlight);
|
||||
var areaToColor = SerieHelper.GetAreaToColor(serie, serieData, chart.theme, colorIndex, isHighlight);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, serieData, chart.theme, colorIndex, isHighlight);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace XCharts.Runtime
|
||||
param.serieData = serieData;
|
||||
param.value = serieData.GetData(0);
|
||||
param.total = serieData.GetData(1);
|
||||
param.color = chart.theme.GetColor(dataIndex);
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, dataIndex, false);
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter); ;
|
||||
@@ -159,8 +159,9 @@ namespace XCharts.Runtime
|
||||
var startDegree = GetStartAngle(serie);
|
||||
var toDegree = GetToAngle(serie, degree);
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, serieData.context.highlight);
|
||||
var itemColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, j, serieData.context.highlight);
|
||||
var itemToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, j, serieData.context.highlight);
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var itemColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, serieData.context.highlight);
|
||||
var itemToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, serieData.context.highlight);
|
||||
var outsideRadius = serie.context.outsideRadius - j * (ringWidth + serie.gap);
|
||||
var insideRadius = outsideRadius - ringWidth;
|
||||
var borderWidth = itemStyle.borderWidth;
|
||||
@@ -171,12 +172,7 @@ namespace XCharts.Runtime
|
||||
serieData.context.toAngle = serie.clockwise ? toDegree : startDegree;
|
||||
serieData.context.insideRadius = insideRadius;
|
||||
serieData.context.outsideRadius = serieData.radius > 0 ? serieData.radius : outsideRadius;
|
||||
if (itemStyle.backgroundColor.a != 0)
|
||||
{
|
||||
UGL.DrawDoughnut(vh, serie.context.center, insideRadius, outsideRadius, itemStyle.backgroundColor,
|
||||
itemStyle.backgroundColor, Color.clear, 0, 360, borderWidth, borderColor, 0,
|
||||
chart.settings.cicleSmoothness, false, serie.clockwise);
|
||||
}
|
||||
DrawBackground(vh, serie, serieData, j, insideRadius, outsideRadius);
|
||||
UGL.DrawDoughnut(vh, serie.context.center, insideRadius, outsideRadius, itemColor, itemToColor,
|
||||
Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness,
|
||||
roundCap, serie.clockwise);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace XCharts.Runtime
|
||||
param.category = category;
|
||||
param.dimension = 1;
|
||||
param.serieData = serieData;
|
||||
param.color = chart.theme.GetColor(serie.index);
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -52,15 +52,13 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
{
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
|
||||
if (serie.IsUseCoord<SingleAxisCoord>())
|
||||
{
|
||||
DrawSingAxisScatterSerie(vh, colorIndex, serie);
|
||||
DrawSingAxisScatterSerie(vh, serie);
|
||||
}
|
||||
else if (serie.IsUseCoord<GridCoord>())
|
||||
{
|
||||
DrawScatterSerie(vh, colorIndex, serie);
|
||||
DrawScatterSerie(vh, serie);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +105,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void DrawScatterSerie(VertexHelper vh, int colorIndex, BaseScatter serie)
|
||||
protected virtual void DrawScatterSerie(VertexHelper vh, BaseScatter serie)
|
||||
{
|
||||
if (serie.animation.HasFadeOut())
|
||||
return;
|
||||
@@ -141,6 +139,7 @@ namespace XCharts.Runtime
|
||||
var interacting = false;
|
||||
var dataList = serie.GetDataList(xDataZoom);
|
||||
var isEffectScatter = serie is EffectScatter;
|
||||
var colorIndex = serie.context.colorIndex;
|
||||
|
||||
serie.containerIndex = m_Grid.index;
|
||||
serie.containterInstanceId = m_Grid.instanceId;
|
||||
@@ -218,7 +217,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void DrawSingAxisScatterSerie(VertexHelper vh, int colorIndex, BaseScatter serie)
|
||||
protected virtual void DrawSingAxisScatterSerie(VertexHelper vh, BaseScatter serie)
|
||||
{
|
||||
if (serie.animation.HasFadeOut())
|
||||
return;
|
||||
@@ -245,6 +244,7 @@ namespace XCharts.Runtime
|
||||
var dataChanging = false;
|
||||
var dataList = serie.GetDataList(xDataZoom);
|
||||
var isEffectScatter = serie is EffectScatter;
|
||||
var colorIndex = serie.context.colorIndex;
|
||||
|
||||
serie.containerIndex = axis.index;
|
||||
serie.containterInstanceId = axis.instanceId;
|
||||
|
||||
@@ -187,7 +187,16 @@ namespace XCharts.Runtime
|
||||
|
||||
private void InitRoot()
|
||||
{
|
||||
if (m_SerieRoot != null) return;
|
||||
if (m_SerieRoot != null)
|
||||
{
|
||||
var rect = ChartHelper.GetOrAddComponent<RectTransform>(m_SerieRoot);
|
||||
rect.localPosition = Vector3.zero;
|
||||
rect.sizeDelta = chart.chartSizeDelta;
|
||||
rect.anchorMin = chart.chartMinAnchor;
|
||||
rect.anchorMax = chart.chartMaxAnchor;
|
||||
rect.pivot = chart.chartPivot;
|
||||
return;
|
||||
}
|
||||
var objName = s_SerieRootObjectName + "_" + serie.index;
|
||||
m_SerieRoot = ChartHelper.AddObject(objName, chart.transform, chart.chartMinAnchor,
|
||||
chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||
@@ -198,8 +207,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void InitSerieLabel()
|
||||
{
|
||||
if (m_SerieRoot == null)
|
||||
InitRoot();
|
||||
InitRoot();
|
||||
m_SerieLabelRoot = ChartHelper.AddObject(s_SerieLabelObjectName, m_SerieRoot.transform,
|
||||
chart.chartMinAnchor, chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||
m_SerieLabelRoot.hideFlags = chart.chartHideFlags;
|
||||
@@ -241,7 +249,8 @@ namespace XCharts.Runtime
|
||||
&& (serieEmphasisLabel == null || !serieEmphasisLabel.show))
|
||||
return false;
|
||||
|
||||
var dataAutoColor = (Color)chart.theme.GetColor(serie.useDataNameForColor ? serieData.index : serie.index);
|
||||
var colorIndex = serie.useDataNameForColor ? serieData.index : serie.index;
|
||||
var dataAutoColor = (Color)SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false);
|
||||
var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index);
|
||||
var label = ChartHelper.AddChartLabel(textName, serieLabelRoot.transform, serieLabel, chart.theme.common,
|
||||
"", dataAutoColor, TextAnchor.MiddleCenter);
|
||||
@@ -270,9 +279,8 @@ namespace XCharts.Runtime
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (m_SerieRoot == null)
|
||||
InitRoot();
|
||||
var dataAutoColor = (Color)chart.theme.GetColor(serie.index);
|
||||
InitRoot();
|
||||
var dataAutoColor = (Color)chart.GetLegendRealShowNameColor(serie.legendName);
|
||||
m_EndLabel = ChartHelper.AddChartLabel(s_SerieEndLabelObjectName, m_SerieRoot.transform, serie.endLabel,
|
||||
chart.theme.common, "", dataAutoColor, TextAnchor.MiddleLeft);
|
||||
m_EndLabel.SetActive(serie.endLabel.show);
|
||||
@@ -281,8 +289,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private void InitSerieTitle()
|
||||
{
|
||||
if (m_SerieRoot == null)
|
||||
InitRoot();
|
||||
InitRoot();
|
||||
var serieTitleRoot = ChartHelper.AddObject(s_SerieTitleObjectName, m_SerieRoot.transform,
|
||||
chart.chartMinAnchor, chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||
serieTitleRoot.hideFlags = chart.chartHideFlags;
|
||||
@@ -295,8 +302,7 @@ namespace XCharts.Runtime
|
||||
var serieData = serie.data[i];
|
||||
var titleStyle = SerieHelper.GetTitleStyle(serie, serieData);
|
||||
if (titleStyle == null) continue;
|
||||
var color = chart.GetLegendRealShowNameColor(serieData.name);
|
||||
|
||||
var color = chart.GetItemColor(serie, serieData);
|
||||
var label = ChartHelper.AddChartLabel("title_" + i, serieTitleRoot.transform, titleStyle, chart.theme.common,
|
||||
serieData.name, color, TextAnchor.MiddleCenter);
|
||||
serieData.titleObject = label;
|
||||
@@ -312,8 +318,6 @@ namespace XCharts.Runtime
|
||||
if (!m_InitedLabel)
|
||||
return;
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
|
||||
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||
|
||||
foreach (var serieData in serie.data)
|
||||
@@ -331,35 +335,13 @@ namespace XCharts.Runtime
|
||||
&& serieData.context.canShowLabel
|
||||
&& !isIgnore)
|
||||
{
|
||||
//var value = serieData.GetData(defaultDimension);
|
||||
var value = serieData.GetCurrData(defaultDimension, dataChangeDuration);
|
||||
var total = serie.GetDataTotal(defaultDimension, serieData);
|
||||
var color = chart.GetItemColor(serie, serieData);
|
||||
var content = string.IsNullOrEmpty(currLabel.formatter)
|
||||
? ChartCached.NumberToStr(value, serieLabel.numericFormatter)
|
||||
: SerieLabelHelper.GetFormatterContent(serie, serieData, value, total,
|
||||
currLabel, chart.theme.GetColor(colorIndex));
|
||||
|
||||
// var isInsidePosition = currLabel.position == LabelStyle.Position.Inside;
|
||||
// //text color
|
||||
// var textColor = chart.theme.common.textColor;
|
||||
// if (!ChartHelper.IsClearColor(currLabel.textStyle.color))
|
||||
// textColor = currLabel.textStyle.color;
|
||||
// else if (isInsidePosition)
|
||||
// textColor = Color.white;
|
||||
// if (currLabel.textStyle.autoColor && serie.useDataNameForColor)
|
||||
// textColor = chart.theme.GetColor(serieData.index);
|
||||
// //text rotate
|
||||
// var rotate = currLabel.textStyle.rotate;
|
||||
// if (currLabel.textStyle.rotate > 0 && isInsidePosition)
|
||||
// {
|
||||
// var currAngle = serieData.context.halfAngle;
|
||||
// if (currAngle > 0)
|
||||
// {
|
||||
// if (currAngle > 180) rotate += 270 - currAngle;
|
||||
// else rotate += -(currAngle - 90);
|
||||
// }
|
||||
// }
|
||||
// SerieLabelHelper.ResetLabel(serieData.labelObject.text, currLabel, chart.theme, textColor, rotate);
|
||||
currLabel, color);
|
||||
serieData.SetLabelActive(!isIgnore);
|
||||
|
||||
serieData.labelObject.SetText(content);
|
||||
@@ -402,7 +384,9 @@ namespace XCharts.Runtime
|
||||
|
||||
public virtual Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)
|
||||
{
|
||||
return serieData.context.position;
|
||||
return ChartHelper.IsZeroVector(serieData.context.labelPosition)
|
||||
? serieData.context.position
|
||||
: serieData.context.labelPosition;
|
||||
}
|
||||
|
||||
public virtual Vector3 GetSerieDataLabelOffset(SerieData serieData, LabelStyle label)
|
||||
@@ -441,7 +425,7 @@ namespace XCharts.Runtime
|
||||
param.serieData = serieData;
|
||||
param.value = serieData.GetData(1);
|
||||
param.total = serie.yTotal;
|
||||
param.color = chart.GetLegendRealShowNameColor(serie.serieName);
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = itemFormatter;
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -472,6 +456,8 @@ namespace XCharts.Runtime
|
||||
if (TooltipHelper.IsIgnoreItemFormatter(itemFormatter))
|
||||
return;
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.name);
|
||||
|
||||
var param = serie.context.param;
|
||||
param.serieName = serie.serieName;
|
||||
param.serieIndex = serie.index;
|
||||
@@ -480,7 +466,7 @@ namespace XCharts.Runtime
|
||||
param.serieData = serieData;
|
||||
param.value = serieData.GetData(param.dimension);
|
||||
param.total = SerieHelper.GetMaxData(serie, dimension);
|
||||
param.color = chart.GetLegendRealShowNameColor(serieData.name);
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false);
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = itemFormatter;
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
|
||||
Reference in New Issue
Block a user