Exemple #1
0
        public void PreRender(Graphics g, PlotCollectionSet dataset, int nLookahead)
        {
            PlotCollection rgData = dataset[m_config.DataIndexOnRender];
            List <Tuple <float, float, int> > rgTopRanges;

            m_rgHistogram = GraphDataZones.LoadData(rgData, out rgTopRanges, out m_dfMin, out m_dfMax, out m_fTop, out m_fBottom);

            // Draw the background zones
            for (int i = 0; i < rgTopRanges.Count && i < m_nMaxPeakCount; i++)
            {
                float fBtm1 = rgTopRanges[i].Item1;
                float fTop1 = rgTopRanges[i].Item2;
                int   nIdx  = rgTopRanges[i].Item3;

                RectangleF rc  = new RectangleF(2.0f, m_fBottom - fTop1, m_gx.TickPositions.Last(), fTop1 - fBtm1);
                Color      clr = Color.FromArgb(m_nPeakRenderAlpha, m_clrMap.GetColor(m_rgHistogram[nIdx].NormalizedCount));
                Brush      br  = new SolidBrush(clr);
                g.FillRectangle(br, rc);
                br.Dispose();
            }
        }
Exemple #2
0
        private GraphPlotStyle createStyle(ConfigurationPlot c)
        {
            if (m_style != null && m_config != null && m_config.Compare(c))
            {
                return(m_style);
            }

            if (m_style != null)
            {
                m_style.Dispose();
            }

            m_config = c;

            GraphPlotStyle style = new SimpleGraphing.GraphPlotStyle(c);

            m_idata   = null;
            m_irender = new GraphRenderLine(m_config, m_gx, m_gy, style);

            switch (c.PlotType)
            {
            case ConfigurationPlot.PLOTTYPE.SMA:
                m_idata = new GraphDataSMA(m_config);
                break;

            case ConfigurationPlot.PLOTTYPE.EMA:
                m_idata = new GraphDataEMA(m_config);
                break;

            case ConfigurationPlot.PLOTTYPE.CANDLE:
                m_irender = new GraphRenderCandle(m_config, m_gx, m_gy, style);
                break;

            case ConfigurationPlot.PLOTTYPE.VOLUME:
                m_irender = new GraphRenderVolume(m_config, m_gx, m_gy, style);
                break;

            case ConfigurationPlot.PLOTTYPE.LINE_FILL:
                m_irender = new GraphRenderLineFill(m_config, m_gx, m_gy, style);
                break;

            case ConfigurationPlot.PLOTTYPE.RSI:
                m_idata   = new GraphDataRSI(m_config);
                m_irender = new GraphRenderRSI(m_config, m_gx, m_gy, style);
                break;

            case ConfigurationPlot.PLOTTYPE.HIGHLOW:
                m_idata   = new GraphDataHighLow(m_config);
                m_irender = new GraphRenderHighLow(m_config, m_gx, m_gy, style);
                break;

            case ConfigurationPlot.PLOTTYPE.ZONE:
                GraphDataZones gdz = new GraphDataZones(m_config);
                gdz.OnScale += Gdz_OnScale;
                m_idata      = gdz;
                m_irender    = new GraphRenderZones(m_config, m_gx, m_gy, style);
                break;

            case ConfigurationPlot.PLOTTYPE.BOLLINGERBANDS:
                m_idata   = new GraphDataBB(m_config);
                m_irender = new GraphRenderBB(m_config, m_gx, m_gy, style);
                break;

            case ConfigurationPlot.PLOTTYPE.CUSTOM:
                IGraphPlotDataEx idata = m_cache.Find(m_config.CustomName, true);
                idata.Initialize(m_config);
                m_irender = idata.CreateRender(m_config, m_gx, m_gy, style);
                m_idata   = idata;
                break;
            }

            return(style);
        }