mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 00:11:37 +00:00
修复Legend控制的Serie颜色有时候异常的问题
This commit is contained in:
@@ -27,66 +27,5 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void DrawChart(VertexHelper vh)
|
||||
{
|
||||
base.DrawChart(vh);
|
||||
if (!m_CheckMinMaxValue) return;
|
||||
if (m_YAxises[0].type == Axis.AxisType.Category
|
||||
|| m_YAxises[1].type == Axis.AxisType.Category)
|
||||
{
|
||||
DrawLineChart(vh, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawLineChart(vh, false);
|
||||
}
|
||||
DrawLabelBackground(vh);
|
||||
}
|
||||
|
||||
private Dictionary<int, List<Serie>> m_StackSeries = new Dictionary<int, List<Serie>>();
|
||||
private List<float> m_SeriesCurrHig = new List<float>();
|
||||
private void DrawLineChart(VertexHelper vh, bool yCategory)
|
||||
{
|
||||
m_BarLastOffset = 0;
|
||||
m_Series.GetStackSeries(ref m_StackSeries);
|
||||
int seriesCount = m_StackSeries.Count;
|
||||
int serieCount = 0;
|
||||
for (int j = 0; j < seriesCount; j++)
|
||||
{
|
||||
var serieList = m_StackSeries[j];
|
||||
if (serieList.Count <= 0) continue;
|
||||
m_SeriesCurrHig.Clear();
|
||||
if (m_SeriesCurrHig.Capacity != serieList[0].dataCount)
|
||||
{
|
||||
m_SeriesCurrHig.Capacity = serieList[0].dataCount;
|
||||
}
|
||||
for (int n = 0; n < serieList.Count; n++)
|
||||
{
|
||||
Serie serie = serieList[n];
|
||||
serie.dataPoints.Clear();
|
||||
switch (serie.type)
|
||||
{
|
||||
case SerieType.Line:
|
||||
if (yCategory) DrawYLineSerie(vh, serieCount, serie, ref m_SeriesCurrHig);
|
||||
else DrawXLineSerie(vh, serieCount, serie, ref m_SeriesCurrHig);
|
||||
break;
|
||||
case SerieType.Bar:
|
||||
if (yCategory) DrawYBarSerie(vh, serieCount, serie, serieCount, ref m_SeriesCurrHig);
|
||||
else DrawXBarSerie(vh, serieCount, serie, serieCount, ref m_SeriesCurrHig);
|
||||
break;
|
||||
}
|
||||
|
||||
if (serie.show)
|
||||
{
|
||||
serieCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
DrawLinePoint(vh);
|
||||
DrawLineArrow(vh);
|
||||
if (yCategory) DrawYTooltipIndicator(vh);
|
||||
else DrawXTooltipIndicator(vh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user