Пример #1
0
        public void Resize(int nWidth, int nHeight, bool bResetStartPos = false)
        {
            m_rcBounds = new Rectangle(0, 0, nWidth, nHeight);
            int nMargin = 5;
            int nY      = nMargin;
            int nX      = nMargin;

            if (m_frames.Count() == 0)
            {
                return;
            }

            int           nFrameCount       = m_frames.Count();
            int           nFrameHeight      = ((nHeight - nMargin) / nFrameCount) - nMargin;
            int           nTotalFrameHeight = nFrameHeight * nFrameCount;
            double        dfTotalRatio      = 0;
            List <double> rgFrameRatios     = new List <double>();

            foreach (GraphFrame frame in m_frames)
            {
                dfTotalRatio += frame.Configuration.FrameHeight;
            }

            foreach (GraphFrame frame in m_frames)
            {
                rgFrameRatios.Add((double)frame.Configuration.FrameHeight / dfTotalRatio);
            }

            int nWidth1  = nWidth - (nMargin * 2);
            int nHeight1 = 0;

            for (int i = 0; i < m_frames.Count; i++)
            {
                GraphFrame frame = m_frames[i];

                nHeight1 = (int)(nTotalFrameHeight * rgFrameRatios[i]);
                frame.Resize(nX, nY, nWidth1, nHeight1, bResetStartPos);
                nY = frame.Bounds.Bottom + nMargin;
            }
        }
Пример #2
0
        public List <PlotCollectionSet> BuildGraph(Configuration config, List <PlotCollectionSet> rgData, bool bAddToParams = false)
        {
            List <PlotCollectionSet> rgOutputData = new List <PlotCollectionSet>();

            m_config = config.Surface;

            if (m_frames == null)
            {
                m_frames = new SimpleGraphing.GraphFrameCollection();
            }

            if (rgData == null)
            {
                if (m_frames.Count > 0)
                {
                    m_frames.Dispose();
                    m_frames = new GraphFrameCollection();
                }

                return(rgOutputData);
            }

            int nMaxIdx = config.Frames.Max(p => p.DataIndex);

            if (nMaxIdx >= rgData.Count)
            {
                throw new Exception("The plot collection set count is less than the max data index of '" + nMaxIdx.ToString() + "'!");
            }

            if (!m_frames.Compare(config.Frames))
            {
                if (m_frames.Count > 0)
                {
                    m_frames.Dispose();
                    m_frames = new GraphFrameCollection();
                }
            }

            int nFrameIdx   = 0;
            int nFrameCount = m_frames.Count;

            for (int i = 0; i < config.Frames.Count && i < rgData.Count; i++)
            {
                PlotCollectionSet dataOutput = null;

                if (config.Frames[i].Visible)
                {
                    GraphFrame frame = null;

                    if (nFrameIdx >= nFrameCount)
                    {
                        frame = new GraphFrame(m_cache);
                    }
                    else
                    {
                        frame = m_frames[nFrameIdx];
                    }

                    if (frame.Configuration.Visible)
                    {
                        dataOutput = frame.BuildGraph(config.Frames[i], rgData[i], bAddToParams);
                    }

                    if (nFrameIdx >= nFrameCount)
                    {
                        m_frames.Add(frame);
                    }

                    nFrameIdx++;
                }

                rgOutputData.Add(dataOutput);
            }

            return(rgOutputData);
        }