using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; namespace TProduct.PumpGraph.Picture { public partial class LxpSeriesChart { protected Graphics _graphics; public virtual Image CreateImage(int imageWidth, int imageHeight) { return null; } #region 尺寸 protected int _imageWidth; protected int _imageHeight; /// /// 图表 /// protected RectangleF _chartDiagramSize; protected void CalcDiagramSize(int imageWidth, int imageHeight) { this._imageWidth = imageWidth; this._imageHeight = imageHeight; float space_top = 30; float space_bottom = 100; float space_left = 100; float space_right = 30; _chartDiagramSize = new RectangleF(space_left, space_top, _imageWidth - space_left - space_right, _imageHeight - space_top - space_bottom); } #endregion //X轴实际尺寸换算为像素尺寸 protected float MapRealToPictQ(double Q) { double disMaxQ = _coordinateParas.AxisLabelQ[_coordinateParas.AxisLabelQ.Count - 1]; double disMinQ = _coordinateParas.AxisLabelQ[0]; return _chartDiagramSize.X + (float)((Math.Log10(Q) - Math.Log10(disMinQ)) * _chartDiagramSize.Width / (Math.Log10(disMaxQ) - Math.Log10(disMinQ))) ; } //扬程曲线Y坐标实际尺寸换算为像素尺寸 protected float MapRealToPictH(double H) { double disMaxH = _coordinateParas.AxisLabelH[_coordinateParas.AxisLabelH.Count - 1]; double disMinH = _coordinateParas.AxisLabelH[0]; return _chartDiagramSize.Bottom - (float)((Math.Log10(H) - Math.Log10(disMinH)) * _chartDiagramSize.Height / (Math.Log10(disMaxH) - Math.Log10(disMinH))); } protected PointF MapRealePointToPictPoint(Eventech.Model.FeatPoint realPoint) { return new PointF(MapRealToPictQ(realPoint.X), MapRealToPictH(realPoint.Y)); } } }