CPF/CPF.ReoGrid/Chart/AreaLineChartPlotView.cs
2024-06-24 10:15:59 +08:00

62 lines
1.9 KiB
C#

using System;
using CPF.Drawing;
using CPF.ReoGrid.Graphics;
using CPF.ReoGrid.Rendering;
namespace CPF.ReoGrid.Chart
{
public class AreaLineChartPlotView : LineChartPlotView
{
public AreaLineChartPlotView(AxisChart chart) : base(chart)
{
}
protected override void OnPaint(RDrawingContext dc)
{
AxisChart axisChart = base.Chart as AxisChart;
bool flag = axisChart == null;
if (!flag)
{
WorksheetChartDataSource dataSource = base.Chart.DataSource;
IGraphics graphics = dc.Graphics;
Rect clientBounds = this.ClientBounds;
for (int i = 0; i < dataSource.SerialCount; i++)
{
IDataSerialStyle dataSerialStyle = axisChart.DataSerialStyles[i];
PathGeometry pathGeometry = new PathGeometry();
pathGeometry.BeginFigure(axisChart.PlotColumnPoints[0], axisChart.ZeroHeight);
float num2;
for (int j = 0; j < dataSource.CategoryCount; j++)
{
PlotPointColumn plotPointColumn = axisChart.PlotDataPoints[i][j];
bool hasValue = plotPointColumn.hasValue;
Point point;
if (hasValue)
{
float[] plotColumnPoints = axisChart.PlotColumnPoints;
int num = j;
num2 = axisChart.ZeroHeight - plotPointColumn.value;
point = new Point(ref plotColumnPoints[num], ref num2);
}
else
{
float[] plotColumnPoints2 = axisChart.PlotColumnPoints;
int num3 = j;
num2 = axisChart.ZeroHeight;
point = new Point(ref plotColumnPoints2[num3], ref num2);
}
pathGeometry.LineTo(point.X, point.Y);
}
float[] plotColumnPoints3 = axisChart.PlotColumnPoints;
int num4 = dataSource.CategoryCount - 1;
num2 = axisChart.ZeroHeight;
Point point2 = new Point(ref plotColumnPoints3[num4], ref num2);
pathGeometry.LineTo(point2.X, point2.Y);
pathGeometry.EndFigure(true);
graphics.FillPath(dataSerialStyle.LineColor, pathGeometry);
}
}
}
}
}