Beispiel #1
0
        void LoadData()
        {
            //MessageBox.Show("Event:Load data");
            currentweeknr = Helper.GetWeekNr(monthCalendar1.SelectionStart);
            zg_Graph.MasterPane.PaneList.Clear();

            if (IsCollectionModified() && MessageBox.Show(SynapseForm.GetLabel("messages.savebefore"), SynapseForm.GetLabel("messages.savebeforetitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == System.Windows.Forms.DialogResult.Yes)
            {
                SaveWeek();
            }

            gb_Data.Text = string.Format(SynapseForm.GetLabel("frm_GasEmissions.gbweekformat"), Helper.GetWeekNr(monthCalendar1.SelectionStart), monthCalendar1.SelectionStart.Year);

            int      Year      = monthCalendar1.SelectionStart.Year;
            int      WeekNr    = Helper.GetWeekNr(monthCalendar1.SelectionStart);
            DateTime firstdate = Helper.FirstDateOfWeek(Year, WeekNr);

            WeekEmissions = o_GasEmission.Load("where ChainID=" + cb_Chain.SelectedValue + " AND Date BETWEEN '" + firstdate.ToString("yyyy/MM/dd") + "' AND '" + firstdate.AddDays(6).ToString("yyyy/MM/dd") + "'");
            lastdata      = Helper.GetLastDate((Int64)cb_Chain.SelectedValue);

            for (int shift = 0; shift <= 6; shift++)
            {
                if (WeekEmissions.Where(We => We.Date == firstdate.AddDays(shift)).Count() == 0)
                {
                    WeekEmissions.Add(new o_GasEmission()
                    {
                        Date = firstdate.AddDays(shift), ChainID = (Int64)cb_Chain.SelectedValue
                    });
                }
            }

            SynapseGraph SG = new SynapseGraph();

            SG.AddTace("", (from w in WeekEmissions select new SynapseGraphPoint()
            {
                label = SynapseForm.GetLabel("labels." + w.Date.DayOfWeek.ToString()), y = (float)w.EmissionDecl
            }).ToList(), TraceType.Curve, Color.Blue);
            SG.XAxisType = XAxisType.Labels;
            SG.Title     = gb_Data.Text;

            SG.DrawGraph(ref zg_Graph);
            zg_Graph.MasterPane.PaneList.ForEach(p => p.XAxis.Scale.FontSpec.Size = 20);
            zg_Graph.MasterPane.PaneList.ForEach(p => p.Title.FontSpec.Size       = 20);
            zg_Graph.MasterPane.PaneList.ForEach(p => p.YAxis.Scale.FontSpec.Size = 20);
            zg_Graph.MasterPane.PaneList.ForEach(p => p.YAxis.Title.FontSpec.Size = 20);

            zg_Graph.MasterPane.PaneList.ForEach(p => p.YAxis.Title.Text = "Bq");
            zg_Graph.AxisChange();
            zg_Graph.Refresh();
            olv_Data.SetObjects(WeekEmissions.OrderBy(W => W.Date));
            ComputeSums();
        }
Beispiel #2
0
 public void Clear()
 {
     zedGraph.MasterPane.PaneList.Clear();
     _Graph = new SynapseGraph();
 }