mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 07:20:08 +00:00
修复Legend控制的Serie颜色有时候异常的问题
This commit is contained in:
@@ -26,53 +26,5 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected HashSet<string> m_SerieNameSet = new HashSet<string>();
|
||||
protected Dictionary<int, List<Serie>> m_StackSeries = new Dictionary<int, List<Serie>>();
|
||||
protected List<float> m_SeriesCurrHig = new List<float>();
|
||||
protected override void DrawChart(VertexHelper vh)
|
||||
{
|
||||
base.DrawChart(vh);
|
||||
if (!m_CheckMinMaxValue) return;
|
||||
bool yCategory = m_YAxises[0].IsCategory() || m_YAxises[1].IsCategory();
|
||||
m_Series.GetStackSeries(ref m_StackSeries);
|
||||
int seriesCount = m_StackSeries.Count;
|
||||
int serieNameCount = -1;
|
||||
m_SerieNameSet.Clear();
|
||||
m_BarLastOffset = 0;
|
||||
for (int j = 0; j < seriesCount; j++)
|
||||
{
|
||||
var serieList = m_StackSeries[j];
|
||||
m_SeriesCurrHig.Clear();
|
||||
for (int n = 0; n < serieList.Count; n++)
|
||||
{
|
||||
Serie serie = serieList[n];
|
||||
serie.dataPoints.Clear();
|
||||
if (string.IsNullOrEmpty(serie.name)) serieNameCount++;
|
||||
else if (!m_SerieNameSet.Contains(serie.name))
|
||||
{
|
||||
m_SerieNameSet.Add(serie.name);
|
||||
serieNameCount++;
|
||||
}
|
||||
switch (serie.type)
|
||||
{
|
||||
case SerieType.Line:
|
||||
if (yCategory) DrawYLineSerie(vh, j, serie, ref m_SeriesCurrHig);
|
||||
else DrawXLineSerie(vh, j, serie, ref m_SeriesCurrHig);
|
||||
break;
|
||||
case SerieType.Bar:
|
||||
if (yCategory) DrawYBarSerie(vh, j, serie, serieNameCount, ref m_SeriesCurrHig);
|
||||
else DrawXBarSerie(vh, j, serie, serieNameCount, ref m_SeriesCurrHig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
DrawLabelBackground(vh);
|
||||
DrawLinePoint(vh);
|
||||
DrawLineArrow(vh);
|
||||
if (yCategory) DrawYTooltipIndicator(vh);
|
||||
else DrawXTooltipIndicator(vh);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user