/* S E T G R A P H B O U N D S */ /*---------------------------------------------------------------------------- %%Function: SetGraphBounds %%Qualified: bg._bg.SetGraphBounds %%Contact: rlittle ----------------------------------------------------------------------------*/ void SetGraphBounds(BgGraph bgg) { int nDays = 7; if (m_ebDays.Text.Length > 0) nDays = Int32.Parse(m_ebDays.Text); int nIntervals = 19; if (m_ebIntervals.Text.Length > 0) nIntervals = Int32.Parse(m_ebIntervals.Text); int nLow = 30; if (m_ebLow.Text.Length > 0) nLow = Int32.Parse(m_ebLow.Text); int nHigh = 30; if (m_ebHigh.Text.Length > 0) nHigh = Int32.Parse(m_ebHigh.Text); bool fLandscape = true; if (m_cbxOrient.Text == "Portrait") fLandscape = false; bgg.SetBounds(nLow, nHigh, nDays, nIntervals, m_cbShowMeals.Checked, fLandscape); }
private void GenerateMealChart(object sender, System.EventArgs e) { ArrayList plmp = new ArrayList(); // let's walk through the list of meals and build an array of // meal profiles for each group MP mp = new MP(); int nGroup = -1; foreach (ListViewItem lvi in m_lvMeals.Items) { if (nGroup != -1 && nGroup != Int16.Parse(lvi.SubItems[0].Text)) { // starting a new MP; mp.NormalizeMeals(); plmp.Add(mp); mp = new MP(); } nGroup = Int16.Parse(lvi.SubItems[0].Text); // build a subset of sorted entries for this meal, starting with // the first reading entry before (or at) the meal, and ending // with the entry immediately previous to the next meal. BGE bge = (BGE)lvi.Tag; SortedList slbge = SlbgeGetMealSubset(bge); mp.AddMeal(slbge, m_slbge, bge); } if (mp.NGetSampleSize() > 0) { mp.NormalizeMeals(); plmp.Add(mp); } // at this point, plmp is our collection of meals...chart'em BgGraph bgg = new BgGraph(); bgg.SetGraphicViews(BgGraph.BoxView.Meal, BgGraph.BoxView.None); bool fLandscape = true; if (m_cbxOrient.Text == "Portrait") fLandscape = false; bgg.SetBounds(60, 220, 1, 8, false, fLandscape); bgg.SetDataPoints(plmp); bgg.CalcGraph(); bgg.ShowDialog(); }
/* D O G R A P H */ /*---------------------------------------------------------------------------- %%Function: DoGraph %%Qualified: bg._bg.DoGraph %%Contact: rlittle ----------------------------------------------------------------------------*/ private void DoGraph(object sender, System.EventArgs e) { SortedList slbge; if (m_cbxFilterType.Text == "Fasting") slbge = SlbgeCalcFasting(m_cbShowInterp.Checked ? m_slbgeStats : m_slbge); else slbge = SlbgeCalcCustom(m_cbShowInterp.Checked ? m_slbgeStats : m_slbge); BgGraph bgg = new BgGraph(); BgGraph.BoxView bvUpper, bvLower; bvUpper = BgGraph.BvFromString(m_cbxUpper.Text); bvLower = BgGraph.BvFromString(m_cbxLower.Text); bgg.SetGraphicViews(bvUpper, bvLower); SetGraphBounds(bgg); bgg.SetDataPoints(slbge); bgg.CalcGraph(); bgg.ShowDialog(); }