コード例 #1
0
        /* G R A P H E R */

        /*----------------------------------------------------------------------------
        *       %%Function: Grapher
        *       %%Qualified: bg.Grapher.Grapher
        *       %%Contact: rlittle
        *
        *  ----------------------------------------------------------------------------*/
        public Grapher(RectangleF rcf, Graphics gr) // int nWidth, int nHeight
        {
            m_rcfDrawing     = rcf;
            m_cgp.dBgLow     = 30.0;
            m_cgp.dBgHigh    = 220.0;
            m_cgp.nHalfDays  = 14;
            m_cgp.nIntervals = 19;
            m_cgp.fShowMeals = false;

            m_sbge    = new SBGE(m_cgp, gr, false);
            m_sbgeAvg = new SBGE(m_cgp, gr, true);
        }
コード例 #2
0
        public void Calc()
        {
            RectangleF rcf = new RectangleF(m_rcf.Left + 180.0f, m_rcf.Top + 25.0f, m_rcf.Width - 150.0f, 100.0f);

            // we are going to have a number of graphs on the page;
            // calc them all.

            // let's assume we're only graphing one for now
            m_plmpg = new ArrayList();

            foreach (MP mp in m_plmp)
            {
                // graph the meals

                MPG mpg = new MPG(mp);
                mpg.Plsbge = new ArrayList();

                int i = 0, iMac = mp.NGetSampleSize();

                for (i = 0; i < iMac; i++)
                {
                    SBGE sbge = new SBGE(m_gp, m_dxOffsetForSbge, m_dyOffsetForSbge + 15.0f, false);

                    sbge.Tag = mp;
                    sbge.SetDataSet(mp.SlbgeForSample(i), null);
                    sbge.SetMealLegend(mp.DttmMealForSample(i));
                    sbge.SetLineWidth(0.2f);
                    sbge.CalcGraph(rcf);
                    mpg.Plsbge.Add(sbge);
                }
                m_plmpg.Add(mpg);
                rcf.Y += 140.0f;


//			rcf = new RectangleF(m_rcf.Left + 120.0f, m_rcf.Top + 110.0f, m_rcf.Width - 150.0f, 100.0f);

//			i = 0;
//			iMac = mp.NGetSampleSize();

//			for (i = 0; i < iMac; i++)
//				{
//				SBGE sbge = new SBGE(m_gp, m_dxOffsetForSbge, m_dyOffsetForSbge, false);
//
//				sbge.SetDataSet(mp.SlbgeForSample(i), null);
//				sbge.SetMealLegend(mp.DttmMealForSample(i));
//				sbge.SetLineWidth(0.2f);
//				sbge.CalcGraph(rcf);
//				mpg.Plsbge.Add(sbge);
//				}
//			m_plmpg.Add(mpg);
            }
        }
コード例 #3
0
        public void Paint(Graphics gr)
        {
//		int yTopBase = (int)sbge.RectF.Top + 17;

            foreach (MPG mpg in m_plmpg)
            {
                Font       font      = new Font("Tahoma", 10);
                SolidBrush brushBlue = new SolidBrush(Color.Blue);
                Pen        pen       = new Pen(brushBlue, 1);

                SBGE sbge = (SBGE)mpg.Plsbge[0];

                const int dxSep  = 30;
                const int dxLeft = 20;

                int xLeft = (int)m_rcf.Left + dxLeft;
                int yTop  = (int)sbge.RectF.Top;

                MP mp = mpg.Mp;
                gr.DrawString(mp.SGetDescription(), font, brushBlue, sbge.RectF.Left - 150, yTop - 15);


                gr.DrawRectangle(pen, xLeft - 4, yTop, dxSep * 4 + 4, 43);
                gr.DrawLine(pen, xLeft + dxSep - 1, yTop, xLeft + dxSep - 1, yTop + 43);
                gr.DrawLine(pen, xLeft + dxSep * 2 - 1, yTop, xLeft + dxSep * 2 - 1, yTop + 43);
                gr.DrawLine(pen, xLeft + dxSep * 3 - 1, yTop, xLeft + dxSep * 3 - 1, yTop + 43);

                gr.DrawLine(pen, xLeft - 4, yTop + 20, xLeft + dxSep * 4, yTop + 20);
                gr.DrawString("M+0", font, brushBlue, xLeft, yTop + 3);
                gr.DrawString("M+1", font, brushBlue, xLeft + dxSep * 1, yTop + 3);
                gr.DrawString("M+2", font, brushBlue, xLeft + dxSep * 2, yTop + 3);
                gr.DrawString("M+4", font, brushBlue, xLeft + dxSep * 3, yTop + 3);

                for (int i = 0; i < 4; i++)
                {
                    gr.DrawString(mp.NGetAvgForMpt((MP.MPT)i).ToString(), font, brushBlue, xLeft + i * dxSep, yTop + 23);
                }

                yTop += 50;
                xLeft = (int)m_rcf.Left + dxLeft + 30;

                gr.DrawRectangle(pen, xLeft - 4, yTop, dxSep * 2 + 4, 43);
                gr.DrawLine(pen, xLeft + dxSep - 1, yTop, xLeft + dxSep - 1, yTop + 43);

                gr.DrawLine(pen, xLeft - 4, yTop + 20, xLeft + dxSep * 2, yTop + 20);
                gr.DrawString("Post", font, brushBlue, xLeft, yTop + 3);
                gr.DrawString("Morn", font, brushBlue, xLeft + dxSep * 1, yTop + 3);

                for (int i = 0; i < 2; i++)
                {
                    gr.DrawString(mp.NGetAvgForMpt((MP.MPT)i + 4).ToString(), font, brushBlue, xLeft + i * dxSep, yTop + 23);
                }

                sbge.SetNoCurves();
                sbge.PaintGraphGridlines(gr);
                foreach (SBGE sbgeT in mpg.Plsbge)
                {
                    sbgeT.PaintGraph(gr);
                }
            }
        }
コード例 #4
0
ファイル: bggrapher.cs プロジェクト: rlittletht/bg.incomplete
	/* G R A P H E R */
	/*----------------------------------------------------------------------------
		%%Function: Grapher
		%%Qualified: bg.Grapher.Grapher
		%%Contact: rlittle

	----------------------------------------------------------------------------*/
	public Grapher(RectangleF rcf, Graphics gr) // int nWidth, int nHeight
	{
		m_rcfDrawing = rcf;
		m_cgp.dBgLow = 30.0;
		m_cgp.dBgHigh = 220.0;
		m_cgp.nHalfDays = 14;
		m_cgp.nIntervals = 19;
		m_cgp.fShowMeals = false;

		m_sbge = new SBGE(m_cgp, gr, false);
		m_sbgeAvg = new SBGE(m_cgp, gr, true);
	}