Exemplo n.º 1
0
        /// <summary>
        ///   繪製 Layer 圖層
        /// </summary>
        /// <param name="layer">Layer 圖層</param>
        /// <param name="property">Chart 屬性參數</param>
        /// <param name="onlyUpdateLastBar">是否僅更新最後一根Bar(Plot可以使用此旗標來判斷是否只繪製最後一根Bar, 也可以忽略此旗標全部的Bar都更新)</param>
        /// <returns>返回值:true=繪製 Layer 完成, false=繪製 Layer 未完成</returns>
        public override bool DrawLayer(Layer layer, ChartProperty property, bool onlyUpdateLastBar)
        {
            List <AbstractPlot> cPlots = layer.Plots;
            int iCount = cPlots.Count;

            if (iCount > 0)
            {
                AxisY cAxisY   = layer.AxisY;
                bool  bRefresh = cAxisY.Refresh;
                if (onlyUpdateLastBar || bRefresh)
                {
                    for (int i = 0; i < iCount; i++)
                    {
                        AbstractPlot cPlot = cPlots[i];
                        if (cPlot.IsSubChart)
                        {
                            if (!cPlot.DrawPlot(layer, property, onlyUpdateLastBar))
                            {
                                return(false);
                            }
                        }
                    }

                    if (bRefresh)
                    {
                        //繪製 Layer 邊框
                        Rectangle cRect   = layer.LayerRectangleWithoutAxisY;
                        IntPtr    cOldPen = __cGDI.SelectPen(new PowerLanguage.PenStyle(property.ForeColor, 1));
                        __cGDI.DrawRectangle(0, cRect.Y, cRect.Width, cRect.Height);
                        __cGDI.RemoveObject(__cGDI.SelectPen(cOldPen));
                    }
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        internal static AbstractPlot Create(GdiEngine engine, ZChart chart, object source, ChartSetting chartSetting)
        {
            AbstractPlot cPlot      = null;
            EChartType   cChartType = chartSetting.ChartType;

            switch (cChartType)
            {
            case EChartType.Candlestick:
                cPlot = new PlotCandlestick(engine, source, chartSetting);
                break;

            case EChartType.HLC:
                cPlot = new PlotHlc(engine, source, chartSetting);
                break;

            case EChartType.OHLC:
                cPlot = new PlotOhlc(engine, source, chartSetting);
                break;

            case EChartType.ClosingLine:
                cPlot = new PlotClosingLine(engine, source, chartSetting);
                break;

            case EChartType.TextObject:
                cPlot = new PlotTextObject(engine, chart, source, chartSetting);
                break;

            case EChartType.TradeObject:
                cPlot = new PlotTradeObject(engine, source, chartSetting);
                break;
            }
            return(cPlot);
        }
Exemplo n.º 3
0
        protected override void CreateAxisY(ChartProperty property, Rectangle axisRectangle)
        {
            InstrumentSettings cSettings = __cBars.Info as InstrumentSettings;

            this.AxisY = AbstractPlot.CreateAxisY(this.Painter, this.ChartSetting.Axis, cSettings.Property.PriceScaleRule as IPriceScale, property, axisRectangle);
        }