Esempio n. 1
0
    protected void graphStatistics_OnRenderGraph(ZedGraph.Web.ZedGraphWeb z, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane)
    {
        GraphPane myPane = masterPane[0];

        myPane.Border.Color          = Color.White;
        myPane.Title.Text            = Lang.Statistics_for_all_members;
        myPane.XAxis.Title.Text      = "";  //Lang.Participants;
        myPane.XAxis.Scale.IsVisible = false;
        myPane.YAxis.Title.Text      = "%"; // Lang.ErrorPercent;

        myPane.YAxis.Scale.Max = 11.0f;
        myPane.YAxis.Scale.Min = -11.0f;

        myPane.Legend.IsVisible          = true;
        myPane.Chart.Fill                = new Fill(Color.White, Color.FromArgb(255, Color.White), 45.0F);
        myPane.YAxis.Scale.MaxGrace      = 0.2;
        myPane.YAxis.MajorGrid.IsVisible = true;
        myPane.YAxis.MinorGrid.IsVisible = true;

        if (String.IsNullOrEmpty(ddStatistics.SelectedValue))
        {
            myPane.Title.Text      = Lang.Statistics_for_all_members_no_results;
            myPane.XAxis.Scale.Max = 1;
            myPane.XAxis.Scale.Min = 0;
            return;
        }

        List <Guid> idList = new List <Guid>();

        try
        {
            Database.Interface.open();
            Database.Account.select_ID(ref idList, Convert.ToInt32(ddStatistics.SelectedValue));

            PointPairList list       = new PointPairList();
            PointPairList local_list = new PointPairList();
            PointPairList eList      = new PointPairList();

            int count = 0;

            foreach (Guid id in idList)
            {
                DataSet dataSet = Database.RingtestReport.select_Error_CalculatedUncertainty_RingtestBoxID_MCAType_ActivityRef_where_AccountID_Year(id, Convert.ToInt32(ddStatistics.SelectedValue));
                if (dataSet.Tables[0].Rows.Count <= 0)
                {
                    continue;
                }

                double count_offset = (double)count;
                for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                {
                    double error       = Convert.ToDouble(dataSet.Tables[0].Rows[i][0]);
                    double uncertainty = Convert.ToDouble(dataSet.Tables[0].Rows[i][1]);
                    string MCAType     = dataSet.Tables[0].Rows[i][3].ToString();
                    if (MCAType.ToLower() != "serie10")
                    {
                        double activity = Convert.ToDouble(dataSet.Tables[0].Rows[i][4]);
                        uncertainty = (uncertainty / activity) * 100.0;
                    }

                    if (id.ToString() == hiddenAccountID.Value)
                    {
                        local_list.Add(count, error);
                    }
                    else
                    {
                        list.Add(count, error);
                    }

                    eList.Add(count_offset, error + uncertainty, error - uncertainty);
                }

                count++;
            }

            if (count < 5)
            {
                myPane.CurveList.Clear();
                Utils.displayStatus(ref labelStatusStatistics, Color.SeaGreen, Lang.Number_of_results_registered_is + " " + count.ToString() + ". " + Lang.Need_5_to_display_data);
            }
            else
            {
                myPane.XAxis.Scale.Max = count;
                myPane.XAxis.Scale.Min = -1;

                LineItem curve = myPane.AddCurve("Andres rapporterte resultater", list, Color.White, SymbolType.Circle);
                curve.Line.IsVisible = false;
                curve.Symbol.Size    = 6;
                curve.Symbol.Fill    = new Fill(Color.DodgerBlue);

                LineItem local_curve = myPane.AddCurve("Egne rapporterte resultater", local_list, Color.White, SymbolType.Circle);
                local_curve.Line.IsVisible = false;
                local_curve.Symbol.Size    = 6;
                local_curve.Symbol.Fill    = new Fill(Color.IndianRed);

                ErrorBarItem errBar = myPane.AddErrorBar("Beregent usikkerhet", eList, Color.Red);
                errBar.Bar.PenWidth = 1;
            }
        }
        catch (Exception ex)
        {
            Utils.displayStatus(ref labelStatusStatistics, Color.Red, ex.Message);
        }
        finally
        {
            Database.Interface.close();
        }

        masterPane.AxisChange(g);
    }
Esempio n. 2
0
 /// <summary>
 /// Copy the properties of this <see cref="ZedGraphWebErrorBarItem"/> to the specified
 /// <see cref="ZedGraph.ErrorBarItem"/> object.
 /// </summary>
 /// <param name="item">The destination <see cref="ZedGraph.ErrorBarItem"/> object</param>
 internal void CopyTo( ErrorBarItem item )
 {
     base.CopyTo( item );
     this.Symbol.CopyTo( item.Bar.Symbol );
     //item.BarBase = this.BarBase;
     item.Bar.PenWidth = this.PenWidth;
 }
Esempio n. 3
0
    protected void graphResults_OnRenderGraph(ZedGraph.Web.ZedGraphWeb z, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane)
    {
        if (hiddenAccountID.Value == null || hiddenAccountID.Value == Guid.Empty.ToString())
        {
            return;
        }

        DataSet   dataSet = null;
        GraphPane myPane  = masterPane[0];

        myPane.Border.Color     = Color.White;
        myPane.Title.Text       = Lang.OurRingtestResults;;
        myPane.XAxis.Title.Text = Lang.Years;
        myPane.YAxis.Title.Text = "%"; // Lang.ErrorPercent;

        Database.RingtestBox box = new Database.RingtestBox();

        try
        {
            Database.Interface.open();
            dataSet = Database.RingtestReport.select_Year_Error_CalculatedUncertainty_RingtestBoxID_MCAType_ActivityRef_where_AccountID(new Guid(hiddenAccountID.Value));

            PointPairList list  = new PointPairList();
            PointPairList eList = new PointPairList();
            PointPairList bList = new PointPairList();

            double maxYear = DateTime.Now.Year;
            for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
            {
                Guid boxID = (Guid)dataSet.Tables[0].Rows[i][3];
                box.select_all_where_ID(boxID);

                double year        = Convert.ToDouble(dataSet.Tables[0].Rows[i][0]);
                double error       = Convert.ToDouble(dataSet.Tables[0].Rows[i][1]);
                double uncertainty = Convert.ToDouble(dataSet.Tables[0].Rows[i][2]);
                string MCAType     = dataSet.Tables[0].Rows[i][4].ToString();
                if (MCAType.ToLower() != "serie10")
                {
                    double activity = Convert.ToDouble(dataSet.Tables[0].Rows[i][5]);
                    uncertainty = (uncertainty / activity) * 100.0;
                }

                if (year > maxYear)
                {
                    maxYear = year;
                }

                list.Add(year, error);
                eList.Add(year, error + uncertainty, error - uncertainty);
                bList.Add(year, box.Uncertainty, -box.Uncertainty);
            }

            myPane.YAxis.Scale.Max           = 11.0f;
            myPane.YAxis.Scale.Min           = -11.0f;
            myPane.XAxis.Scale.Max           = maxYear + 1;
            myPane.XAxis.Scale.Min           = maxYear - 10;
            myPane.XAxis.Scale.MinorStep     = 1.0;
            myPane.XAxis.Scale.MajorStep     = 1.0;
            myPane.YAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MinorGrid.IsVisible = true;
            myPane.Legend.IsVisible          = true;

            LineItem curve = myPane.AddCurve(Lang.Reported_result, list, Color.White, SymbolType.Circle);
            curve.Line.IsVisible = false;
            curve.Symbol.Fill    = new Fill(Color.IndianRed);
            curve.Symbol.Size    = 6;

            ErrorBarItem errBar = myPane.AddErrorBar(Lang.CalculatedUncertainty, eList, Color.Red);
            errBar.Bar.PenWidth = 1;

            ErrorBarItem boxBar = myPane.AddErrorBar(Lang.RingtestBoxUncertainty, bList, Color.LightGray);
            boxBar.Bar.PenWidth         = 12;
            boxBar.Bar.Symbol.IsVisible = false;

            myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, Color.White), 45.0F);

            const double offset = 0.1;

            for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
            {
                PointPair pt = curve.Points[i];

                if (pt.Y >= myPane.YAxis.Scale.Min && pt.Y <= myPane.YAxis.Scale.Max)
                {
                    TextObj text = new TextObj(pt.Y.ToString("f2"), pt.X + offset, pt.Y, CoordType.AxisXYScale, AlignH.Left, AlignV.Center);
                    text.FontSpec.Size             = 6;
                    text.ZOrder                    = ZOrder.A_InFront;
                    text.FontSpec.Border.IsVisible = false;
                    text.FontSpec.Fill.IsVisible   = false;
                    //text.FontSpec.Angle = 90;
                    myPane.GraphObjList.Add(text);

                    //g.DrawLine(pen, new Point((int)(pt.X + 10), (int)pt.Y), new Point((int)(pt.X - 10), (int)pt.Y));
                }
            }

            myPane.YAxis.Scale.MaxGrace = 0.2;
        }
        catch (Exception ex)
        {
            Utils.reportStatus(ref labelStatus, Color.Red, "Ringtest.graphResults_OnRenderGraph: " + ex.Message);
            return;
        }
        finally
        {
            Database.Interface.close();
        }

        masterPane.AxisChange(g);
    }