mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 07:50:16 +00:00
增加LineArrow配置带箭头曲线
This commit is contained in:
@@ -81,6 +81,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
DrawLinePoint(vh);
|
||||
DrawLineArrow(vh);
|
||||
if (yCategory) DrawYTooltipIndicator(vh);
|
||||
else DrawXTooltipIndicator(vh);
|
||||
}
|
||||
@@ -92,8 +93,14 @@ namespace XCharts
|
||||
var serie = m_Series.GetSerie(n);
|
||||
if (serie.type != SerieType.Line) continue;
|
||||
if (!serie.show || serie.symbol.type == SerieSymbolType.None) continue;
|
||||
for (int i = 0; i < serie.dataPoints.Count; i++)
|
||||
var count = serie.dataPoints.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (serie.lineArrow.show)
|
||||
{
|
||||
if (serie.lineArrow.position == LineArrow.Position.Start && i == 0) continue;
|
||||
if (serie.lineArrow.position == LineArrow.Position.End && i == count - 1) continue;
|
||||
}
|
||||
Vector3 p = serie.dataPoints[i];
|
||||
bool highlight = (m_Tooltip.show && m_Tooltip.IsSelected(i)) || serie.data[i].highlighted || serie.highlighted;
|
||||
float symbolSize = highlight ? serie.symbol.selectedSize : serie.symbol.size;
|
||||
@@ -104,6 +111,38 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawLineArrow(VertexHelper vh)
|
||||
{
|
||||
for (int n = 0; n < m_Series.Count; n++)
|
||||
{
|
||||
var serie = m_Series.GetSerie(n);
|
||||
if (serie.type != SerieType.Line) continue;
|
||||
if (!serie.show || !serie.lineArrow.show) continue;
|
||||
if (serie.dataPoints.Count < 2) return;
|
||||
Color lineColor = serie.GetLineColor(m_ThemeInfo, n, false);
|
||||
|
||||
switch (serie.lineArrow.position)
|
||||
{
|
||||
case LineArrow.Position.End:
|
||||
var dataPoints = serie.GetUpSmoothList(serie.dataCount - 1);
|
||||
if (dataPoints.Count < 2) dataPoints = serie.dataPoints;
|
||||
var startPos = dataPoints[dataPoints.Count - 2];
|
||||
var arrowPos = dataPoints[dataPoints.Count - 1];
|
||||
ChartHelper.DrawArrow(vh, startPos, arrowPos, serie.lineArrow.width,
|
||||
serie.lineArrow.height, serie.lineArrow.offset, serie.lineArrow.dent, lineColor);
|
||||
break;
|
||||
case LineArrow.Position.Start:
|
||||
dataPoints = serie.GetUpSmoothList(1);
|
||||
if (dataPoints.Count < 2) dataPoints = serie.dataPoints;
|
||||
startPos = dataPoints[1];
|
||||
arrowPos = dataPoints[0];
|
||||
ChartHelper.DrawArrow(vh, startPos, arrowPos, serie.lineArrow.width,
|
||||
serie.lineArrow.height, serie.lineArrow.offset, serie.lineArrow.dent, lineColor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawXLineSerie(VertexHelper vh, int serieIndex, Serie serie, ref List<float> seriesHig)
|
||||
{
|
||||
if (!IsActive(serie.index)) return;
|
||||
|
||||
Reference in New Issue
Block a user