73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Drawing;
|
|||
|
|
namespace TChart.ImageChart
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ͼ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <remarks>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>: Kingthy
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>: 2007-09-11
|
|||
|
|
/// MSN: Kingthy@gmail.com
|
|||
|
|
/// ת<><D7AA><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD>ܷ<EFBFBD>һ<EFBFBD>ݸ<EFBFBD><DDB8><EFBFBD>.лл
|
|||
|
|
/// </remarks>
|
|||
|
|
public class RectanglePainter : MovementPainterBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="image"></param>
|
|||
|
|
public RectanglePainter(MovementImage image)
|
|||
|
|
: base(image)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region ʵ<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ֵ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="graphics"><3E><><EFBFBD><EFBFBD></param>
|
|||
|
|
/// <param name="xAxes">X<><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|||
|
|
public override void DrawValue(System.Drawing.Graphics graphics, XAxisItemList xAxes)
|
|||
|
|
{
|
|||
|
|
int tmpXSpaceWidth;
|
|||
|
|
//tmpXSpaceWidth = Image.XSpaceWidth;
|
|||
|
|
tmpXSpaceWidth = Image.Xspace;
|
|||
|
|
//<2F><>һ<EFBFBD><D2BB>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
|
Point p1 = new Point(tmpXSpaceWidth, Image.Height - Image.YSpaceWidth);
|
|||
|
|
Point p2 = new Point(0, 0);
|
|||
|
|
|
|||
|
|
StringFormat format = new StringFormat
|
|||
|
|
{
|
|||
|
|
Alignment = StringAlignment.Center,
|
|||
|
|
LineAlignment = StringAlignment.Center
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
int xSpaceOffset = Image.XSpaceWidth / 4;
|
|||
|
|
|
|||
|
|
for (int i = 0; i< xAxes.Count; i++)
|
|||
|
|
{
|
|||
|
|
XAxisItem item = xAxes[i];
|
|||
|
|
p1.X += Image.XSpaceWidth;
|
|||
|
|
|
|||
|
|
//ȡ<>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ݵĽ<DDB5><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
p2.X = p1.X;
|
|||
|
|
p2.Y = this.GetYPosition(item.Value);
|
|||
|
|
if (p2.Y < 0) p2.Y = 0;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
graphics.FillRectangle(new SolidBrush(item.DrawColor), new Rectangle(p2.X - xSpaceOffset, p2.Y, xSpaceOffset * 2, p1.Y - p2.Y));
|
|||
|
|
|
|||
|
|
//<2F><>ֵ
|
|||
|
|
if (item.ValueVisible)
|
|||
|
|
{
|
|||
|
|
//λ<><CEBB><EFBFBD><EFBFBD> <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD>
|
|||
|
|
graphics.DrawString(item.Value.ToString(), item.ValueFont, new SolidBrush(item.ValueColor), p2.X, p2.Y - this.Image.YSpaceWidth / 4, format);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|