70 lines
2.0 KiB
C#
70 lines
2.0 KiB
C#
using System;
|
|
using CPF.Drawing;
|
|
using CPF.ReoGrid.Graphics;
|
|
using CPF.ReoGrid.Rendering;
|
|
|
|
namespace CPF.ReoGrid.Chart
|
|
{
|
|
public class LineChartPlotView : ChartPlotView
|
|
{
|
|
public LineChartPlotView(AxisChart chart) : base(chart)
|
|
{
|
|
}
|
|
|
|
protected override void OnPaint(RDrawingContext dc)
|
|
{
|
|
base.OnPaint(dc);
|
|
AxisChart axisChart = base.Chart as AxisChart;
|
|
bool flag = axisChart == null;
|
|
if (!flag)
|
|
{
|
|
AxisDataInfo primaryAxisInfo = axisChart.PrimaryAxisInfo;
|
|
bool flag2 = double.IsNaN((double)primaryAxisInfo.Levels) || primaryAxisInfo.Levels <= 0;
|
|
if (!flag2)
|
|
{
|
|
WorksheetChartDataSource dataSource = base.Chart.DataSource;
|
|
IGraphics graphics = dc.Graphics;
|
|
Rect clientBounds = this.ClientBounds;
|
|
Point[] array = new Point[dataSource.CategoryCount];
|
|
for (int i = 0; i < dataSource.SerialCount; i++)
|
|
{
|
|
IDataSerialStyle dataSerialStyle = axisChart.DataSerialStyles[i];
|
|
int num = 0;
|
|
for (int j = 0; j < dataSource.CategoryCount; j++)
|
|
{
|
|
PlotPointColumn plotPointColumn = axisChart.PlotDataPoints[i][j];
|
|
int num2 = j - num;
|
|
bool hasValue = plotPointColumn.hasValue;
|
|
if (hasValue)
|
|
{
|
|
Point[] array2 = array;
|
|
int num3 = j;
|
|
float[] plotColumnPoints = axisChart.PlotColumnPoints;
|
|
int num4 = j;
|
|
float num5 = axisChart.ZeroHeight - plotPointColumn.value;
|
|
array2[num3] = new Point(ref plotColumnPoints[num4], ref num5);
|
|
}
|
|
bool flag3 = j >= dataSource.CategoryCount - 1;
|
|
bool flag4 = !plotPointColumn.hasValue || (flag3 && num2 > 0);
|
|
if (flag4)
|
|
{
|
|
bool flag5 = num2 > 1 || (flag3 && num2 > 0);
|
|
if (flag5)
|
|
{
|
|
bool flag6 = flag3;
|
|
if (flag6)
|
|
{
|
|
num2++;
|
|
}
|
|
graphics.DrawLines(array, num, num2, dataSerialStyle.LineColor, dataSerialStyle.LineWidth, dataSerialStyle.LineStyle);
|
|
}
|
|
num = j + 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|