private void ResizeAxisY() { int iCount = __cLayers.Count; if (iCount > 0) { int iAxisYWidth = 0; for (int i = 0; i < iCount; i++) { Layer cLayer = __cLayers[i]; AxisY cAxisY = cLayer.AxisY; if (cAxisY != null) { int iWidthY = cAxisY.AxisRectangle.Width; if (iWidthY > iAxisYWidth) { iAxisYWidth = iWidthY; } } } for (int i = 0; i < iCount; i++) { Layer cLayer = __cLayers[i]; cLayer.ResizeAxisY(iAxisYWidth); } //重新設定 AxisX 的寬度 Rectangle cAxisRect = __cAxisX.AxisRectangle; cAxisRect.Width = __cChartRect.Width - iAxisYWidth; __cAxisX.AxisRectangle = cAxisRect; } }
internal void ResizeAxisY(int width) { if (__cPlots.Count > 0) { AxisY cAxisY = __cPlots[0].AxisY; cAxisY.SetAxisRectangle(__cLayerRect, width); } }
protected static AxisY CreateAxisY(AbstractPaintEngine engine, AxisSetting axisSetting, IPriceScale scale, ChartProperty property, Rectangle axisRectangle) { AxisY cAxisY = new AxisY(axisSetting, scale); cAxisY.AxisRectangle = axisRectangle; cAxisY.FontMetrics = engine.GetFontMetrics("0", property.AxisFont); return(cAxisY); }
internal void CalculatePlot() { int iCount = __cPlots.Count; if (iCount > 0) { AxisY cAxis0 = __cPlots[0].AxisY; for (int i = 0; i < iCount; i++) { if (i == 0 || __cPlots[i].AxisY != cAxis0) { __cPlots[i].CalculatePlot(this.AxisX); } } } }
internal void AddPlot(AbstractPlot plot, AxisY axisY = null) { if (axisY == null) { if (__cPlots.Count == 0 || plot.ChartSetting.Axis.IsCreateInstance) { Rectangle cAxisRect = this.LayerRectangle; cAxisRect.Width = 0; //將寬度設定為0(讓 AxisY 自動計算寬度) plot.CreateAxisY(__cProperty, cAxisRect); } else { plot.AxisY = __cPlots[0].AxisY; } } else { plot.AxisY = axisY; } EChartType cChartType = plot.ChartSetting.ChartType; switch (cChartType) { case EChartType.TextObject: case EChartType.TradeObject: plot.PlotIndex = -1; break; default: plot.PlotIndex = __iMaxPlotCount++; break; } __cPlots.Add(plot); }
/// <summary> /// 繪製 AxisY 座標軸 /// </summary> /// <param name="axis">AxisY 座標軸</param> /// <param name="property">Chart 屬性參數</param> public abstract void DrawAxisY(AxisY axis, ChartProperty property);
/// <summary> /// 繪製 AxisY 軸的數值標籤(價格線或數值線標籤) /// </summary> /// <param name="axis">AxisY 座標軸</param> /// <param name="lineColor">標籤線色彩</param> /// <param name="property">Chart 屬性參數</param> public abstract void DrawAxisValueLabel(AxisY axis, Color lineColor, ChartProperty property);