Esempio n. 1
0
 public PnFBSView(Pad pad, BarSeries series, double boxSize, int reversalAmount) : base(pad)
 {
     this.upColor       = Color.OrangeRed;
     this.downColor     = Color.LawnGreen;
     this.gKtJiYQi50    = Color.FromArgb(0, (int)byte.MaxValue, 0);
     this.barSeries     = series;
     this.pad           = pad;
     this.ToolTipFormat = "";
     this.pGlJXklPGE    = new PointAndFigure(series, boxSize, reversalAmount);
     this.pGlJXklPGE.Calculate();
 }
Esempio n. 2
0
        internal override void Paint(object drawingContext)
        {
            //if (_painted) return;

            Style ps = null;

            if (_priceStyleType != _chartPanel._chartX._priceStyle || _seriesTypeType != _seriesType)
            {
                if (_chartPanel._chartX._priceStyle != PriceStyleEnum.psStandard)
                {
                    switch (_chartPanel._chartX._priceStyle)
                    {
                    case PriceStyleEnum.psKagi:
                        ps = new Kagi(this);
                        break;

                    case PriceStyleEnum.psCandleVolume:
                    case PriceStyleEnum.psEquiVolume:
                    case PriceStyleEnum.psEquiVolumeShadow:
                        ps = new EquiVolume(this);
                        break;

                    case PriceStyleEnum.psPointAndFigure:
                        ps = new PointAndFigure(this);
                        break;

                    case PriceStyleEnum.psRenko:
                        ps = new Renko(this);
                        break;

                    case PriceStyleEnum.psThreeLineBreak:
                        ps = new ThreeLineBreak(this);
                        break;

                    case PriceStyleEnum.psHeikinAshi:
                        ps = new HeikinAshi(this);
                        break;
                    }
                }
                else
                {
                    switch (_seriesType)
                    {
                    case SeriesTypeEnum.stCandleChart:
                        ps = new Candles(this);
                        break;

                    case SeriesTypeEnum.stStockBarChartHLC:
                    case SeriesTypeEnum.stStockBarChart:
                        ps = new PriceStyles.Stock(this);
                        break;

                    case SeriesTypeEnum.stLineChart:
                        ps = new Linear(this);
                        break;
                    }
                }
                if (_priceStyle != null)
                {
                    _priceStyle.RemovePaint();
                }
            }

            if (_darvasBoxes != null)
            {
                _darvasBoxes.RemovePaint();
            }

            if (_chartPanel._chartX._priceStyle == PriceStyleEnum.psStandard || _chartPanel._chartX._priceStyle == PriceStyleEnum.psHeikinAshi)
            {
                if (_darvasBoxes == null)
                {
                    _darvasBoxes = new DarvasBoxes(this);
                }

                _darvasBoxes.SetSeriesStock(this);
                if (_chartPanel._chartX._darwasBoxes)
                {
                    _darvasBoxes.Paint();
                }
            }

            if (_priceStyle != null || ps != null)
            {
                (ps ?? _priceStyle).SetStockSeries(this);
                Style psToPaint = ps ?? _priceStyle;
                bool  res;
                if (psToPaint is Candles && drawingContext != null)
                {
                    res = psToPaint.Paint(drawingContext);
                }
                else
                {
                    res = psToPaint.Paint();
                }
                //if (!(ps ?? _priceStyle).Paint()) return;
                if (!res)
                {
                    return;
                }
            }

            if (Selected)
            {
                ShowSelection();
            }

            if (ps == null)
            {
                return;
            }

            _priceStyle     = ps;
            _priceStyleType = _chartPanel._chartX._priceStyle;
            _seriesTypeType = _seriesType;
        }