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

53 lines
1.4 KiB
C#

using System;
using CPF.Drawing;
using CPF.ReoGrid.Drawing;
namespace CPF.ReoGrid.Chart
{
public class BarChart : ColumnChart
{
public BarChart()
{
this.ShowHorizontalGuideLines = false;
this.ShowVerticalGuideLines = true;
}
protected override ColumnChartPlotView CreateColumnChartPlotView()
{
return new BarChartPlotView(this);
}
protected override AxisInfoView CreatePrimaryAxisSerialLabelView(Rect bodyBounds)
{
return new AxisSerialLabelView(this, AxisTypes.Primary, AxisOrientation.Vertical)
{
Bounds = this.GetDefaultVerticalAxisInfoViewBounds(bodyBounds)
};
}
protected override AxisInfoView CreatePrimaryAxisCategoryLabelView(Rect bodyBounds)
{
return new AxisCategoryLabelView(this, AxisTypes.Primary, AxisOrientation.Horizontal)
{
Bounds = this.GetDefaultHorizontalAxisInfoViewBounds(bodyBounds)
};
}
protected override void UpdateAxisLabelViewLayout(Rect plotRect)
{
FloatingObject horizontalAxisInfoView = this.HorizontalAxisInfoView;
float x = this.ClientBounds.X;
float num = plotRect.Y - 5f;
float num2 = 30f;
float num3 = plotRect.Height + 10f;
horizontalAxisInfoView.Bounds = new Rect(ref x, ref num, ref num2, ref num3);
FloatingObject verticalAxisInfoView = this.VerticalAxisInfoView;
x = plotRect.X;
num = plotRect.Bottom + 10f;
num2 = plotRect.Width;
num3 = 10f;
verticalAxisInfoView.Bounds = new Rect(ref x, ref num, ref num2, ref num3);
}
}
}