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(); }