private void AddGridPolar(Graphics g, Grid gd, RAxis ra) { Pen aPen = new Pen(gd.GridColor, gd.GridThickness); aPen.DashStyle = gd.GridPattern; float xc = polarArea.X + polarArea.Width / 2; float yc = polarArea.Y + polarArea.Height / 2; int tickCount = Convert.ToInt32(Math.Ceiling((ra.RMax - ra.RMin) / ra.RTick)); float dr = polarArea.Width / 2.0f / tickCount; // Draw circles: for (int i = 0; i < tickCount; i++) { RectangleF rect1 = new RectangleF(xc - (i + 1) * dr, yc - (i + 1) * dr, 2 * (i + 1) * dr, 2 * (i + 1) * dr); g.DrawEllipse(aPen, rect1); } // Draw radii: for (int i = 0; i < (int)360 / ra.AngleStep; i++) { PointF edgePt = Point2DR(new PointF(ra.StartAngle + i * ra.AngleStep, ra.RMax), ra); g.DrawLine(aPen, xc, yc, edgePt.X, edgePt.Y); } }
/// <summary> /// 绘制极坐标图时的半径转换 /// </summary> /// <param name="r"></param> /// <param name="ra"></param> /// <returns></returns> internal float RNorm(float r, RAxis ra) { float rNorm = new float(); if (r < ra.RMin || r > ra.RMax) { r = Single.NaN; } rNorm = (r - ra.RMin) * polarArea.Width / 2 / (ra.RMax - ra.RMin); return(rNorm); }
/// <summary> /// 绘制过程中极坐标的坐标转换 /// </summary> /// <param name="pt">x为角度,y为对应值的PointF</param> /// <param name="cs"></param> /// <param name="ra"></param> /// <returns></returns> internal PointF Point2DR(PointF pt, RAxis ra) { PointF aPoint = new PointF(); float xc = polarArea.X + polarArea.Width / 2; float yc = polarArea.Y + polarArea.Height / 2; if (ra.AngleDirection == PolarCharts.AngleDirectionEnum.ClockWise) { aPoint.X = RNorm(pt.Y, ra) * (float)Math.Cos((pt.X + ra.StartAngle) * Math.PI / 180) + xc; aPoint.Y = RNorm(pt.Y, ra) * (float)Math.Sin((pt.X + ra.StartAngle) * Math.PI / 180) + yc; } else if (ra.AngleDirection == PolarCharts.AngleDirectionEnum.CounterClockWise) { aPoint.X = RNorm(pt.Y, ra) * (float)Math.Cos((-pt.X - ra.StartAngle) * Math.PI / 180) + xc; aPoint.Y = RNorm(pt.Y, ra) * (float)Math.Sin((-pt.X - ra.StartAngle) * Math.PI / 180) + yc; } return(aPoint); }
/// <summary> /// 极坐标下的样式布局 /// </summary> /// <param name="g"></param> /// <param name="xa"></param> /// <param name="ya"></param> /// <param name="y2a"></param> /// <param name="gd"></param> /// <param name="lb"></param> /// <param name="tl"></param> /// <param name="lg"></param> /// <param name="dcs"></param> internal void AddChartStylePolar(Graphics g, Title tl, Grid gd, RAxis ra, Legend lg, List <DataCollection> dcs) { //图例外置 lg.IsInside = false; SetPolarArea(g, tl, lg, dcs); //整体填色(通用) FillColorInChartAreas(g); //绘制标题(通用) AddTitle(g, tl); if (dcs[0].ChartType == Chart2DTypeEnum.PolorChart) { AddGridPolar(g, gd, ra); if (((DataCollectionPolar)dcs[0]).PolarChartType != PolarCharts.PolarChartTypeEnum.Rose) { AddTicksPolar(g, ra); } } }
private void AddTicksPolar(Graphics g, RAxis ra) { SolidBrush aBrush = new SolidBrush(ra.RTickStyle.TextColor); StringFormat sFormat = new StringFormat(); float xc = polarArea.X + polarArea.Width / 2; float yc = polarArea.Y + polarArea.Height / 2; int tickCount = Convert.ToInt32(Math.Ceiling((ra.RMax - ra.RMin) / ra.RTick)); float dr = polarArea.Width / 2 / tickCount; // Draw the radius labels:值标记 sFormat.Alignment = StringAlignment.Near; for (int i = 0; i <= tickCount; i++) { float fY = ra.RMin + i * ra.RTick; fY = DataDeal.FloatAccur(fY); g.DrawString(fY.ToString(), ra.RTickStyle.TextFont, aBrush, new PointF(xc, yc - i * dr - 0.2f * dr), sFormat); } // Draw the angle labels:方向标记 sFormat.Alignment = StringAlignment.Center; SizeF tickFontSize = g.MeasureString("A", ra.RTickStyle.TextFont); float angleLabel = 0; int angledir = 1; for (int i = 0; i < (int)360 / ra.AngleStep; i++) { if (ra.AngleDirection == PolarCharts.AngleDirectionEnum.ClockWise) { angledir = 1; } else if (ra.AngleDirection == PolarCharts.AngleDirectionEnum.CounterClockWise) { angledir = -1; } float x = (RNorm(ra.RMax, ra) + polarArea.Width / 10f * 2 / 3) * (float)Math.Cos((ra.StartAngle + i * ra.AngleStep) * angledir * Math.PI / 180) + xc; float y = (RNorm(ra.RMax, ra) + polarArea.Width / 10f * 2 / 3) * (float)Math.Sin((ra.StartAngle + i * ra.AngleStep) * angledir * Math.PI / 180) + yc; g.DrawString(ra.RMarkFull[i].ToString(), ra.RTickStyle.TextFont, aBrush, new PointF(x, y - tickFontSize.Height / 2), sFormat); } }
internal static void AddPolar(DataCollectionPolar dc, Graphics g, ChartStyle cs, RAxis ra) { if (!dc.CheckNegative()) { return; } float xc = cs.polarArea.X + cs.polarArea.Width / 2; float yc = cs.polarArea.Y + cs.polarArea.Height / 2; Pen aPen = null; SolidBrush aBrush = null; // Plot lines: //雷达图 if (dc.PolarChartType == PolarChartTypeEnum.Radar || dc.PolarChartType == PolarChartTypeEnum.RadarPolygon) { foreach (DataSeries ds in dc.DataSeriesList) { aBrush = new SolidBrush(ds.FillColor); aPen = new Pen(ds.LineStyle.LineColor, ds.LineStyle.LineThickness); aPen.DashStyle = ds.LineStyle.LinePattern; PointF[] pts = new PointF[ds.PointList.Count]; for (int i = 0; i < ds.PointList.Count; i++) { pts[i] = cs.Point2DR((PointF)ds.PointList[i], ra); } if (ds.LineStyle.IsVisible == true) { g.DrawPolygon(aPen, pts); } if (dc.PolarChartType == PolarChartTypeEnum.RadarPolygon) { g.FillPolygon(aBrush, pts); } } } //玫瑰图 else if (dc.PolarChartType == PolarChartTypeEnum.Rose) { Dictionary <float, float> rSum = new Dictionary <float, float>(); for (int a = 0; a < 360 / ra.AngleStep; a++) { rSum.Add(a * ra.AngleStep, 0); } foreach (DataSeries ds in dc.DataSeriesList) { foreach (PointF p in ds.PointList) { if (p.Y < 0) { return; } if (rSum.ContainsKey(p.X)) { rSum[p.X] += p.Y; } else { return; } } } for (int i = dc.DataSeriesList.Count - 1; i >= 0; i--) { DataSeries ds = (DataSeries)dc.DataSeriesList[i]; aBrush = new SolidBrush(ds.FillColor); aPen = new Pen(ds.LineStyle.LineColor, ds.LineStyle.LineThickness); aPen.DashStyle = ds.LineStyle.LinePattern; //ds.LineStyle.IsVisible = false; float sweepAngle = ra.AngleStep * dc.RoseBarWidth; float pStartAngle = 0; int pBarLeng = 0; foreach (PointF p in ds.PointList) { pStartAngle = p.X + ra.StartAngle - sweepAngle / 2; pBarLeng = (int)Math.Ceiling(cs.RNorm(rSum[p.X], ra)); Rectangle rect1 = new Rectangle((int)xc - pBarLeng, (int)yc - pBarLeng, pBarLeng * 2, pBarLeng * 2); g.FillPie(aBrush, rect1, pStartAngle, sweepAngle); if (ds.LineStyle.IsVisible) { g.DrawPie(aPen, rect1, pStartAngle, sweepAngle); } rSum[p.X] -= p.Y; } } } //曲线图 else if (dc.PolarChartType == PolarChartTypeEnum.Spline) { foreach (DataSeries ds in dc.DataSeriesList) { aPen = new Pen(ds.LineStyle.LineColor, ds.LineStyle.LineThickness); aPen.DashStyle = ds.LineStyle.LinePattern; PointF[] pts = new PointF[ds.PointList.Count]; if (ds.LineStyle.IsVisible == true) { for (int i = 0; i < ds.PointList.Count; i++) { pts[i] = cs.Point2DR((PointF)ds.PointList[i], ra); } g.DrawClosedCurve(aPen, pts); } } } // Plot Symbols: if (dc.PolarChartType == PolarChartTypeEnum.Radar || dc.PolarChartType == PolarChartTypeEnum.Spline) { foreach (DataSeries ds in dc.DataSeriesList) { for (int i = 0; i < ds.PointList.Count; i++) { PointF pt = cs.Point2DR((PointF)ds.PointList[i], ra); if (!pt.IsEmpty) { ds.SymbolStyle.DrawSymbol(g, pt); } } } } if (aPen != null) { aPen.Dispose(); } if (aBrush != null) { aBrush.Dispose(); } }
//只用于柱形玫瑰图 internal void AddRosebarTick(Graphics g, RAxis ra) { AddTicksPolar(g, ra); }
/// <summary> /// 坐标轴检查,便于手动设定limit后不强制开启自适应 /// </summary> /// <param name="dclist"></param> /// <param name="xa"></param> /// <param name="ya"></param> /// <param name="y2a"></param> /// <returns></returns> internal static bool AxesFitCheck(List <DataCollection> dclist, XAxis xa, YAxis ya, Y2Axis y2a, RAxis ra) { bool openFit, xopenfit, yopenfit, y2openfit, ropenfit; openFit = xopenfit = yopenfit = y2openfit = ropenfit = false; float xmax, xmin, ymax, ymin, y2max, y2min, rmin, rmax; xmax = xmin = ymax = ymin = y2max = y2min = rmin = rmax = -99; //含柱状图时,底轴两侧预留一个tick float barmin, barmax; barmin = barmax = -99; bool havebar = false; bool baraxisX = true; try { foreach (DataCollection dc in dclist) { #region AreaChart if (dc.ChartType == Chart2DTypeEnum.AreaChart) { int nPoints = 0; bool isConsistant = true; bool isY2 = false; foreach (DataSeries ds in dc.DataSeriesList) { if (nPoints == 0) { nPoints = ds.PointList.Count; } else if (nPoints != ds.PointList.Count) { isConsistant = false; return(openFit); } if (ds.IsY2Data) { isY2 = true; } } try { DataSeries ds1 = (DataSeries)dc.DataSeriesList[0]; if (xmax == -99 && xmin == -99) { xmax = xmin = ((PointF)ds1.PointList[0]).X; } if (!isY2 && ymax == -99 && ymin == -99) { ymax = ymin = ((PointF)ds1.PointList[0]).Y; } else if (isY2 && y2max == -99 && y2min == -99) { y2max = y2min = ((PointF)ds1.PointList[0]).Y; } } catch { if (xmax == -99 && xmin == -99) { xmax = xmin = 0; } if (ymax == ymin && ymax == -99) { ymax = ymin = 0; } if (y2max == y2min && y2max == -99) { y2max = y2min = 0; } } if (((DataCollectionArea)dc).AreaChartType == AreaCharts.AreaChartTypeEnum.Area) { float[] ySum = new float[nPoints]; foreach (DataSeries ds in dc.DataSeriesList) { for (int i = 0; i < nPoints; i++) { PointF p = (PointF)ds.PointList[i]; xmax = (p.X > xmax) ? p.X : xmax; xmin = (p.X < xmin) ? p.X : xmin; if (!ds.IsY2Data) { ymax = (p.Y > ymax) ? p.Y : ymax; ymin = (p.Y < ymin) ? p.Y : ymin; } else { y2max = (p.Y > y2max) ? p.Y : y2max; y2min = (p.Y < y2min) ? p.Y : y2min; } ySum[i] += p.Y; } } if (!isY2) { foreach (float y in ySum) { ymax = (y > ymax) ? y : ymax; ymin = (y < ymin) ? y : ymin; } } else { foreach (float y in ySum) { y2max = (y > y2max) ? y : y2max; y2min = (y < y2min) ? y : y2min; } } } else if (((DataCollectionArea)dc).AreaChartType == AreaCharts.AreaChartTypeEnum.PercentArea) { //纵轴表示百分比 float ytick = 0.2f; if (!isY2) { ya.YLimMax = ymax = 1; ya.YLimMin = ymin = 0; ya.YTick = ytick; } else { y2a.Y2LimMax = ymax = 1; y2a.Y2LimMin = ymin = 0; y2a.Y2Tick = ytick; } } } #endregion #region BarChart else if (dc.ChartType == Chart2DTypeEnum.BarChart) { havebar = true; int nPoints = 0; bool isY2 = false; foreach (DataSeries ds in dc.DataSeriesList) { if (nPoints < ds.PointList.Count) { nPoints = ds.PointList.Count; } if (ds.IsY2Data) { isY2 = true; } } try { DataSeries ds1 = (DataSeries)dc.DataSeriesList[0]; if (xmax == -99 && xmin == -99) { xmax = xmin = ((PointF)ds1.PointList[0]).X; } if (!isY2 && ymax == -99 && ymin == -99) { ymax = ymin = ((PointF)ds1.PointList[0]).Y; } else if (isY2 && y2max == -99 && y2min == -99) { y2max = y2min = ((PointF)ds1.PointList[0]).Y; } if (((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.Vertical || ((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.VerticalOverlay || ((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.VerticalStack) { barmax = barmin = ((PointF)ds1.PointList[0]).X; } else { barmax = barmin = ((PointF)ds1.PointList[0]).Y; baraxisX = false; } } catch { if (xmax == -99 && xmin == -99) { xmax = xmin = 0; } if (ymax == ymin && ymax == -99) { ymax = ymin = 0; } if (y2max == y2min && y2max == -99) { y2max = y2min = 0; } barmax = barmin = 0; } //不同方向Bar影响不同轴的自适应情况 if (((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.Vertical || ((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.VerticalOverlay) { foreach (DataSeries ds in dc.DataSeriesList) { foreach (PointF p in ds.PointList) { xmax = (p.X > xmax) ? p.X : xmax; xmin = (p.X < xmin) ? p.X : xmin; barmax = (p.X > barmax) ? p.X : barmax; barmin = (p.X < barmin) ? p.X : barmin; if (!ds.IsY2Data) { ymax = (p.Y > ymax) ? p.Y : ymax; ymin = (p.Y < ymin) ? p.Y : ymin; } else { y2max = (p.Y > y2max) ? p.Y : y2max; y2min = (p.Y < y2min) ? p.Y : y2min; } } } } else if (((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.VerticalStack) { float[] ySum = new float[nPoints]; foreach (DataSeries ds in dc.DataSeriesList) { for (int i = 0; i < nPoints; i++) { PointF p = (PointF)ds.PointList[i]; xmax = (p.X > xmax) ? p.X : xmax; xmin = (p.X < xmin) ? p.X : xmin; barmax = (p.X > barmax) ? p.X : barmax; barmin = (p.X < barmin) ? p.X : barmin; if (!ds.IsY2Data) { ymax = (p.Y > ymax) ? p.Y : ymax; ymin = (p.Y < ymin) ? p.Y : ymin; } else { y2max = (p.Y > y2max) ? p.Y : y2max; y2min = (p.Y < y2min) ? p.Y : y2min; } ySum[i] += p.Y; } } if (!isY2) { foreach (float y in ySum) { ymax = (y > ymax) ? y : ymax; ymin = (y < ymin) ? y : ymin; } } else { foreach (float y in ySum) { y2max = (y > y2max) ? y : y2max; y2min = (y < y2min) ? y : y2min; } } } else if (((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.Horizontal || ((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.HorizontalOverlay) { foreach (DataSeries ds in dc.DataSeriesList) { foreach (PointF p in ds.PointList) { xmax = (p.Y > xmax) ? p.Y : xmax; xmin = (p.Y < xmin) ? p.Y : xmin; ymax = (p.X > ymax) ? p.X : ymax; ymin = (p.X < ymin) ? p.X : ymin; barmax = (p.Y > barmax) ? p.Y : barmax; barmin = (p.Y < barmin) ? p.Y : barmin; } } } else if (((DataCollectionBar)dc).BarChartType == BarCharts.BarChartTypeEnum.HorizontalStack) { float[] xSum = new float[nPoints]; foreach (DataSeries ds in dc.DataSeriesList) { for (int i = 0; i < nPoints; i++) { PointF p = (PointF)ds.PointList[i]; xmax = (p.Y > xmax) ? p.Y : xmax; xmin = (p.Y < xmin) ? p.Y : xmin; xSum[i] += p.Y; ymax = (p.X > ymax) ? p.X : ymax; ymin = (p.X < ymin) ? p.X : ymin; barmax = (p.Y > barmax) ? p.Y : barmax; barmin = (p.Y < barmin) ? p.Y : barmin; } } foreach (float x in xSum) { xmax = (x > xmax) ? x : xmax; xmin = (x < xmin) ? x : xmin; } } } #endregion #region LineChart else if (dc.ChartType == Chart2DTypeEnum.LineChart) { try { DataSeries ds1 = (DataSeries)dc.DataSeriesList[0]; if (xmax == -99 && xmin == -99) { xmax = xmin = ((PointF)ds1.PointList[0]).X; } foreach (DataSeries ds in dc.DataSeriesList) { if (ds.LineChartType == LineCharts.LineChartTypeEnum.Candle || ds.LineChartType == LineCharts.LineChartTypeEnum.HiLoOpenClose || ds.LineChartType == LineCharts.LineChartTypeEnum.HiLo) { if (!ds.IsY2Data && ymax == ymin && ymax == -99) { ymax = ymin = Convert.ToSingle(ds.DataString[2, 0]); } else if (ds.IsY2Data && y2max == y2min && y2max == -99) { y2max = y2min = Convert.ToSingle(ds.DataString[2, 0]); } } else { if (!ds.IsY2Data && ymax == ymin && ymax == -99) { ymax = ymin = ((PointF)ds.PointList[0]).Y; } else if (ds.IsY2Data && y2max == y2min && y2max == -99) { y2max = y2min = ((PointF)ds.PointList[0]).Y; } } } } catch { if (xmax == -99 && xmin == -99) { xmax = xmin = 0; } if (ymax == ymin && ymax == -99) { ymax = ymin = 0; } if (y2max == y2min && y2max == -99) { y2max = y2min = 0; } } foreach (DataSeries ds in dc.DataSeriesList) { #region 附加型 if (ds.ErrorList.Count != 0 && ds.LineChartType == LineCharts.LineChartTypeEnum.ErrorBar) { for (int i = 0; i < ds.ErrorList.Count; i++) { PointF p = (PointF)ds.PointList[i]; PointF errp = (PointF)ds.ErrorList[i]; xmax = (p.X > xmax) ? p.X : xmax; xmin = (p.X < xmin) ? p.X : xmin; if (!ds.IsY2Data) { ymax = (p.Y + errp.Y > ymax) ? p.Y + errp.Y : ymax; ymin = (p.Y - errp.Y < ymin) ? p.Y - errp.Y : ymin; } else { y2max = (p.Y + errp.Y > y2max) ? p.Y + errp.Y : y2max; y2min = (p.Y - errp.Y < y2min) ? p.Y - errp.Y : y2min; } } } else if (ds.DataString != null && (ds.LineChartType == LineCharts.LineChartTypeEnum.Candle || ds.LineChartType == LineCharts.LineChartTypeEnum.HiLoOpenClose || ds.LineChartType == LineCharts.LineChartTypeEnum.HiLo)) { xmax = (ds.DataString.GetLength(1) > xmax) ? ds.DataString.GetLength(1) : xmax; xmin = (0 < xmin) ? 0 : xmin; for (int i = 0; i < ds.DataString.GetLength(1); i++) { float ptHigh = Convert.ToSingle(ds.DataString[2, i]); float ptLow = Convert.ToSingle(ds.DataString[3, i]); if (!ds.IsY2Data) { ymax = (ptHigh > ymax) ? ptHigh : ymax; ymin = (ptLow < ymin) ? ptLow : ymin; } else { y2max = (ptHigh > y2max) ? ptHigh : y2max; y2min = (ptLow < y2min) ? ptLow : y2min; } } } #endregion else { foreach (PointF p in ds.PointList) { xmax = (p.X > xmax) ? p.X : xmax; xmin = (p.X < xmin) ? p.X : xmin; if (!ds.IsY2Data) { ymax = (p.Y > ymax) ? p.Y : ymax; ymin = (p.Y < ymin) ? p.Y : ymin; } else { y2max = (p.Y > y2max) ? p.Y : y2max; y2min = (p.Y < y2min) ? p.Y : y2min; } } } } } #endregion #region PolarChart else if (dc.ChartType == Chart2DTypeEnum.PolorChart) { try { DataSeries ds1 = (DataSeries)dc.DataSeriesList[0]; if (rmin == -99 && rmin == -99) { rmax = rmin = ((PointF)ds1.PointList[0]).Y; } } catch { if (rmax == -99 && rmin == -99) { rmax = rmin = 0; } } if (((DataCollectionPolar)dc).PolarChartType == PolarCharts.PolarChartTypeEnum.Rose) { rmin = 0; Dictionary <float, float> rSum = new Dictionary <float, float>(); foreach (DataSeries ds in dc.DataSeriesList) { foreach (PointF p in ds.PointList) { if (rSum.ContainsKey(p.X)) { rSum[p.X] += p.Y; } else { rSum.Add(p.X, p.Y); } } } foreach (float r in rSum.Values) { rmax = (r > rmax) ? r : rmax; rmin = (r < rmin) ? r : rmin; } } else { foreach (DataSeries ds in dc.DataSeriesList) { foreach (PointF p in ds.PointList) { rmax = (p.Y > rmax) ? p.Y : rmax; rmin = (p.Y < rmin) ? p.Y : rmin; } } } } #endregion } //自适应触发条件:极值不满足或范围过大 if (xa.XLimMax < xmax || xa.XLimMin > xmin || (xa.XLimMax - xa.XLimMin) / 2 > (xmax - xmin) || xa.XTick > (xa.XLimMax - xa.XLimMin)) { xopenfit = true; float xtick = 0; FitModify(ref xmax, ref xmin, out xtick); xa.XLimMax = xmax; xa.XLimMin = xmin; xa.XTick = xtick; } if (ya.YLimMax < ymax || ya.YLimMin > ymin || (ya.YLimMax - ya.YLimMin) / 2 > (ymax - ymin) || ya.YTick > (ya.YLimMax - ya.YLimMin)) { yopenfit = true; float ytick = 0; FitModify(ref ymax, ref ymin, out ytick); ya.YLimMax = ymax; ya.YLimMin = ymin; ya.YTick = ytick; } if (y2a.Y2LimMax < y2max || y2a.Y2LimMin > y2min || (y2a.Y2LimMax - y2a.Y2LimMin) / 2 > (y2max - y2min) || y2a.Y2Tick > (y2a.Y2LimMax - y2a.Y2LimMin)) { y2openfit = true; float y2tick = 0; FitModify(ref y2max, ref y2min, out y2tick); y2a.Y2LimMax = y2max; y2a.Y2LimMin = y2min; y2a.Y2Tick = y2tick; } if (ra.RMax < rmax || ra.RMin > rmin || (ra.RMax - ra.RMin) / 2 > (rmax - rmin) || ra.RTick > (ra.RMax - ra.RMin)) { ropenfit = true; float rtick = 0; FitModify(ref rmax, ref rmin, out rtick); ra.RMax = rmax; ra.RMin = rmin; ra.RTick = rtick; } //Bar的一侧宽度问题,预留一个tick if (havebar) { if (baraxisX) { if (xa.XLimMin <= barmin && xa.XLimMin + xa.XTick > barmin) { xopenfit = true; xa.XLimMin -= xa.XTick; if (xa.XMarkStartindex == 0) { xa.XTickMarkFull[0] = string.Empty; } } if (xmin <= barmin && xmin + xa.XTick > barmin) { xa.XTickMarkFull[0] = string.Empty; } if (xa.XLimMax >= barmax && xa.XLimMax - xa.XTick < barmax) { xopenfit = true; xa.XLimMax += xa.XTick; } } else { if (ya.YLimMin <= barmin && ya.YLimMin + ya.YTick > barmin) { yopenfit = true; ya.YLimMin -= ya.YTick; } if (ya.YLimMax >= barmax && ya.YLimMax - ya.YTick < barmax) { yopenfit = true; ya.YLimMax += ya.YTick; } } } } catch { } if (xopenfit || yopenfit || y2openfit || ropenfit) { openFit = true; } return(openFit); }