예제 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="webObject"></param>
 /// <param name="g"></param>
 /// <param name="pane"></param>
 void _zedGraphWeb_RenderGraph(
     ZedGraph.Web.ZedGraphWeb webObject,
     System.Drawing.Graphics g,
     ZedGraph.MasterPane pane)
 {
     // TODO:
     //
     //pane[
     this.Draw(pane[0], this.DataSource);
 }
예제 #2
0
    protected void ZedGraphWebPlayerCount_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        double[] maxCountArray     = new double[_infoArray.Length];
        double[] minCountArray     = new double[_infoArray.Length];
        double[] averageCountArray = new double[_infoArray.Length];
        double[] timeArray         = new double[_infoArray.Length];

        for (int i = 0; i < _infoArray.Length; i++)
        {
            LordControl.PlayerCountStatisticInfo info = _infoArray[i];
            maxCountArray[i]     = info.MaxCount;
            minCountArray[i]     = info.MinCount;
            averageCountArray[i] = info.AverageCount;
            timeArray[i]         = new XDate(info.Time);
        }

        GraphPane graphPane = masterPane[0];

        graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);

        graphPane.Legend.Fill.IsVisible          = false;
        graphPane.Legend.Border.IsVisible        = false;
        graphPane.Legend.FontSpec.Fill.IsVisible = false;

        graphPane.XAxis.Title.Text          = StringDef.Time;
        graphPane.XAxis.MajorGrid.Color     = WebConfig.GraphXAxisGridColor;
        graphPane.XAxis.Type                = AxisType.Date;
        graphPane.XAxis.Scale.FontSpec.Size = 11;

        graphPane.YAxis.Title.Text = StringDef.PlayerCount;
        //graphPane.YAxis.MajorGrid.IsVisible = true;
        //graphPane.YAxis.MajorGrid.DashOff = 0;
        //graphPane.YAxis.MajorGrid.Color = Color.Gray;
        //graphPane.YAxis.MinorGrid.IsVisible = true;
        //graphPane.YAxis.MinorGrid.Color = Color.LightGray;
        //graphPane.YAxis.MinorGrid.DashOff = 0;
        graphPane.YAxis.Scale.Min = 0;

        graphPane.Title.Text = string.Format("{0} [ {1}  {2} ]", StringDef.PlayerCount, _startTime, _endTime);

        graphPane.AddCurve(StringDef.Maximum, timeArray, maxCountArray, Color.Red, SymbolType.Triangle);
        graphPane.AddCurve(StringDef.Minimum, timeArray, minCountArray, Color.Green, SymbolType.TriangleDown);
        graphPane.AddCurve(StringDef.Average, timeArray, averageCountArray, Color.Orange, SymbolType.Diamond);

        graphPane.AxisChange();
    }
    protected void ZedGraphWebProfsStat_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        //if (_statInfo != null)
        //{
        //    GraphPane myPane = masterPane[0];

        //    myPane.Fill = new Fill(Color.White, Color.Goldenrod, 45.0f);
        //    myPane.Chart.Fill.Type = FillType.None;

        //    myPane.Legend.Position = LegendPos.Float;
        //    myPane.Legend.Location = new Location(0.95f, 0.15f, CoordType.PaneFraction, AlignH.Right, AlignV.Top);
        //    myPane.Legend.IsHStack = false;

        //    // Add some pie slices
        //    for (int index = 0; index != param.Length; index += 2)
        //    {
        //        double count = Convert.ToDouble(param[index]);
        //        string label = param[index + 1] as string;
        //        PieItem segment = myPane.AddPieSlice((double)count, Color.Navy, Color.White, (float)(count / totalCount), 0, label);
        //    }
        //}
    }
예제 #4
0
        protected void ZedGraphWeb1_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane pane)
        {
            //Color[] colors = new Color[16] {Color.Silver, Color.Yellow, Color.DarkGreen, Color.Red, Color.Gray, Color.Purple, Color.LightYellow, Color.LightGreen, Color.LightGray, Color.LimeGreen, Color.Magenta, Color.Turquoise, Color.Maroon, Color.Linen, Color.MediumBlue, Color.Olive};
            Color[] colors = new Color[22] {
                ColorTranslator.FromHtml("#149406"), ColorTranslator.FromHtml("#ee5624"),
                ColorTranslator.FromHtml("#0600ff"), ColorTranslator.FromHtml("#eff14a"), ColorTranslator.FromHtml("#eeab36"),
                ColorTranslator.FromHtml("#7f6300"), ColorTranslator.FromHtml("#a40070"), ColorTranslator.FromHtml("#4ecb2c"),
                ColorTranslator.FromHtml("#41a8ff"), ColorTranslator.FromHtml("#f975fb"), Color.Black, Color.Gray, Color.BurlyWood,
                Color.Chartreuse, Color.CornflowerBlue, Color.Cyan, Color.DarkSalmon, Color.DimGray, Color.Fuchsia, Color.Khaki,
                Color.Ivory, Color.LawnGreen
            };
            double[]  ranks  = new double[_datesKwByTime.Count];
            GraphPane myPane = pane[0];

            myPane.Border.Color = System.Drawing.Color.White;
            int firstPos = _searchEngine.IndexOf("-");

            myPane.Title.Text       = "Ranks for '" + _keyword + "' keyword - " + _searchEngine.Substring(0, firstPos) + "(" + _searchEngine.Substring(firstPos + 2, _searchEngine.Length - (firstPos + 2)) + ")";
            myPane.XAxis.Title.Text = "Date";
            myPane.YAxis.Title.Text = "Rank";

            //creating dates list
            List <string> dates = new List <string>();
            int           datesCounter;

            for (datesCounter = _datesKwByTime.Count - 1; datesCounter > 0; datesCounter--)
            {
                //checking half a year limitation
                if (_fromDate == 0 || _datesKwByTime[datesCounter] <= _fromDate)
                {
                    _datesKwByTime.Remove(_datesKwByTime[datesCounter]);
                }
            }

            //make the same dates list in dd/mm/yyyy format
            for (int i = _datesKwByTime.Count - 1; i >= 0; i--)
            {
                dates.Add(DayCode.GenerateDateTime(_datesKwByTime[i]).ToString("dd/MM/yyyy"));
            }
            //foreach (int day in _datesKwByTime)
            //{
            //    dates.Add(DayCode.GenerateDateTime(day).ToString("dd/MM/yyyy"));
            //}

            //creating all the curves data
            List <LineItem>      curvesList     = new List <LineItem>();
            List <string>        urlsList       = new List <string>();
            List <PointPairList> curvesListData = new List <PointPairList>();
            PointPairList        pointsList;
            int rowsCounter = _dtRank.Rows.Count - 1;

            datesCounter = _datesKwByTime.Count - 1;
            int daycode  = 0;
            int rank     = 0;
            int prevRank = (int)_dtRank.Rows[rowsCounter]["Rank"] * -1;

            while (rowsCounter >= 0 && _datesKwByTime.Count > 0)
            {
                pointsList = new PointPairList();
                if (rowsCounter <= 0)
                {
                    break;
                }
                while (_dtRank.Rows[rowsCounter]["Url"].ToString().Equals(_dtRank.Rows[rowsCounter - 1]["Url"].ToString()) &&
                       datesCounter >= 0)
                {
                    //multiply by -1 for proper direction of the graph curve
                    daycode = (int)_dtRank.Rows[rowsCounter]["day_code"];
                    rank    = (int)_dtRank.Rows[rowsCounter]["Rank"] * -1;
                    if ((double)daycode == (double)_datesKwByTime[datesCounter])
                    {
                        pointsList.Add((double)daycode, (double)rank);
                        prevRank = rank;
                        rowsCounter--;
                    }
                    //no data on that date so we'll put the previous rank data
                    else
                    {
                        pointsList.Add(Double.Parse(_datesKwByTime[datesCounter].ToString()), (double)prevRank);
                    }
                    //in case we reached the last row from db - we need to fill the same rank data to the rest of dates
                    //if (rowsCounter == 0 && datesCounter > 0)
                    //{
                    //    while (datesCounter > 0)
                    //    {
                    //        pointsList.Add(Double.Parse(_datesKwByTime[datesCounter].ToString()), (double)rank);
                    //        datesCounter--;
                    //    }
                    //    break;
                    //}
                    //else if(rowsCounter == 0 || datesCounter == 0)
                    //{
                    //    break;
                    //}
                    if (rowsCounter == 0)
                    {
                        break;
                    }
                    datesCounter--;
                }
                daycode = (int)_dtRank.Rows[rowsCounter]["day_code"];
                rank    = (int)_dtRank.Rows[rowsCounter]["Rank"] * -1;
                //for first row in db
                for (int i = datesCounter - 1; i >= 0; i--)
                {
                    if ((double)daycode == (double)_datesKwByTime[i])
                    {
                        pointsList.Add((double)daycode, (double)rank);
                        break;
                    }
                    else
                    {
                        pointsList.Add(Double.Parse(_datesKwByTime[i].ToString()), (double)prevRank);
                    }
                }
                //save url pointsList for the legend
                try
                {
                    urlsList.Add(Server.UrlDecode(_dtRank.Rows[rowsCounter + 1]["Url"].ToString()));
                }
                catch
                {
                    urlsList.Add(Server.UrlDecode(_dtRank.Rows[rowsCounter]["Url"].ToString()));
                }
                curvesListData.Add(pointsList);
                LineItem myCurve = null;
                curvesList.Add(myCurve);
                rowsCounter--;
                datesCounter = _datesKwByTime.Count - 1;
            }

            List <double> dataList = new List <double>();
            List <double> z        = new List <double>();

            //for(int i = 0; i < curvesListData[0].Count; i ++)
            //{
            //    dataList.Add(curvesListData[0][i].Y);
            //    z.Add(curvesListData[0][i].X);
            //}
            double[] curveDataArray = new double[dataList.Count];
            //curveDataArray = dataList.ToArray();
            for (int curvesCounter = 0; curvesCounter < curvesList.Count; curvesCounter++)
            {
                dataList.Clear();
                for (int i = 0; i < curvesListData[curvesCounter].Count; i++)
                {
                    dataList.Add(curvesListData[curvesCounter][i].Y);
                }
                curveDataArray                       = dataList.ToArray();
                curvesList[curvesCounter]            = myPane.AddCurve(urlsList[curvesCounter], null, curveDataArray, colors[curvesCounter]);
                curvesList[curvesCounter].Line.Width = 6;

                curvesList[curvesCounter].Line.IsSmooth    = true;
                curvesList[curvesCounter].Line.StepType    = StepType.RearwardStep;
                curvesList[curvesCounter].Line.IsAntiAlias = true;
                curvesList[curvesCounter].Link             = new Link("graph.aspx", "#", "_blank");

                curvesList[curvesCounter].Symbol.Fill = new Fill(colors[curvesCounter]);
                //curvesList[curvesCounter].Symbol.Fill.Type = FillType.GradientByZ;
                //curvesList[curvesCounter].Symbol.Fill.RangeMin = 0;
                //curvesList[curvesCounter].Symbol.Fill.RangeMax = 30;
                curvesList[curvesCounter].Symbol.Type = SymbolType.Circle;
            }

            foreach (CurveItem curve in myPane.CurveList)
            {
                int    i    = _datesKwByTime.Count;
                string name = curve.Label.Text;
                foreach (PointPair pt in curve.Points as PointPairList)
                {
                    //pt.Tag = (pt.Y * -1).ToString() + " (" + DayCode.GenerateDateTime(pt.X).ToString("dd/MM/yyyy") + ")";
                    //pt.Tag = string.Format("{0} ({1:dd/MM/yyyy})", pt.Y * -1, DayCode.GenerateDateTime(pt.Y));
                    i--;
                    pt.Tag = string.Format("{0} ({1:dd/MM/yyyy})", pt.Y * -1, DayCode.GenerateDateTime(_datesKwByTime[i]));
                }
            }
            string[] datesArray = dates.ToArray();
            myPane.Border.IsVisible     = true;
            myPane.Legend.IsVisible     = true;
            myPane.Legend.FontSpec.Size = 8;
            float r = myPane.Legend.Location.TopLeft.X;

            myPane.Legend.Position = LegendPos.BottomFlushLeft;

            myPane.YAxis.IsVisible = true;
            myPane.YAxis.Scale.FontSpec.IsAntiAlias = true;
            myPane.XAxis.IsVisible = true;
            // Set the XAxis labels
            myPane.XAxis.Scale.TextLabels         = datesArray;
            myPane.XAxis.MajorTic.IsBetweenLabels = true;
            // Set the XAxis to Text type
            myPane.XAxis.Type = AxisType.Text;
            myPane.XAxis.Scale.FontSpec.IsAntiAlias = true;
            myPane.XAxis.Scale.FontSpec.Size        = 10;
            myPane.XAxis.Scale.FontSpec.Angle       = 45;
            myPane.X2Axis.IsVisible = false;

            myPane.YAxis.Scale.FontSpec.Size = 10;
            double maxRank = checkMaxRank(ref myPane);

            if (maxRank < -20)
            {
                myPane.YAxis.Scale.Min = maxRank - 10;
            }
            else
            {
                myPane.YAxis.Scale.Min = -20;
            }
            myPane.YAxis.Scale.Max           = 0;
            myPane.YAxis.Scale.MajorStepAuto = true;

            pane.AxisChange(g);
        }
예제 #5
0
        private void OnRenderGraph(ZedGraph.Web.ZedGraphWeb z, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane)
        {
            DataSet   ds     = (DataSet)Cache["CacheProduse"];
            GraphPane myPane = masterPane[0];

            myPane.Title.Text          = "";
            myPane.XAxis.Title.Text    = "Produse"; myPane.YAxis.Title.Text = "Pret";
            myPane.XAxis.Scale.MaxAuto = true;

            Color[] colors =
            {
                Color.Red,    Color.Yellow, Color.Green, Color.Blue,
                Color.Purple, Color.Pink,   Color.Plum,  Color.Silver, Color.Salmon
            };

            if (Request.QueryString["tip"] != null)
            {
                List <string> listaX = new List <string>();
                PointPairList list   = new PointPairList();
                int           i      = 0;
                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    listaX.Add(r[1].ToString());              // Nume Produs
                    list.Add(0, Convert.ToDouble(r[3]), i++); // Pret
                }

                switch (Request.QueryString["tip"])
                {
                case "Bare":
                {
                    BarItem myCurve = myPane.AddBar("Curve 2", list, Color.Blue);

                    myCurve.Bar.Fill              = new Fill(colors);
                    myCurve.Bar.Fill.Type         = FillType.GradientByZ;
                    myCurve.Bar.Fill.RangeMin     = 0;
                    myCurve.Bar.Fill.RangeMax     = list.Count;
                    myPane.XAxis.Type             = AxisType.Text;
                    myPane.XAxis.Scale.TextLabels = listaX.ToArray();


                    break;
                }

                case "Bare3D":
                {
                    BarItem myCurve = myPane.AddBar("Curve 3", list, Color.Blue);
                    myCurve.Bar.Fill              = new Fill(colors);
                    myCurve.Bar.Fill.Type         = FillType.GradientByZ;
                    myCurve.Bar.Fill.RangeMin     = 0;
                    myCurve.Bar.Fill.RangeMax     = list.Count;
                    myPane.XAxis.Type             = AxisType.Text;
                    myPane.XAxis.Scale.TextLabels = listaX.ToArray();

                    break;
                }

                case "Linie":
                {
                    LineItem curve = myPane.AddCurve("Spline", list, Color.Red, SymbolType.Diamond);
                    curve.Line.IsSmooth      = true;
                    curve.Line.SmoothTension = 0.5F;
                    curve.Line.Width         = 2;



                    curve.Symbol.Fill = new Fill(Color.White);
                    curve.Symbol.Size = 10;

                    myPane.XAxis.Scale.TextLabels = listaX.ToArray();
                    myPane.XAxis.Type             = AxisType.Text;
                    break;
                }

                case "Pie":
                {
                    i = 0;
                    foreach (DataRow r in ds.Tables[0].Rows)
                    {
                        PieItem segment1 = myPane.AddPieSlice(Convert.ToDouble(r[2]), colors[(i++) % colors.Length], Color.White, 45f, (i % 2 == 0) ? 0.2 : 0, r[1].ToString());
                    }
                    break;
                }
                }
            }
        }
예제 #6
0
    protected void ZedGraphWebPlayerCountStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        if (!WebUtil.CheckPrivilege(TheAdminServer.GameServerManager.SecurityObject, OpType.READ, Session))
        {
            return;
        }

        GameServer server = ServerDropDownList.SelectedGameServer;

        //不再只对GameServer进行人数的查询,而是对所有的Server进行查询
        if (server == null || server.Type != GameServer.ServerType.gameserver && server.Type != GameServer.ServerType.gamecenter)
        {
            ZedGraphWebPlayerCount.Visible = false;
            return;
        }

        LordControl.PlayerCountStatisticInfo[] infoArray = server.GetPlugInData(CurrentUser.Id, LordControl.PlugInGuid, LordControl.DataKeyPlayerCountStatistic, DateTime.Now.Subtract(new TimeSpan(1 - _dayIndex, 0, 0, 0)), DateTime.Now.Subtract(new TimeSpan(-_dayIndex, 0, 0, 0))) as LordControl.PlayerCountStatisticInfo[];
        if (infoArray == null)
        {
            ZedGraphWebPlayerCount.Visible = false;
            return;
        }

        double[] maxCountArray     = new double[infoArray.Length];
        double[] minCountArray     = new double[infoArray.Length];
        double[] averageCountArray = new double[infoArray.Length];
        double[] timeArray         = new double[infoArray.Length];

        for (int i = 0; i < infoArray.Length; i++)
        {
            LordControl.PlayerCountStatisticInfo info = infoArray[i];
            maxCountArray[i]     = info.MaxCount;
            minCountArray[i]     = info.MinCount;
            averageCountArray[i] = info.AverageCount;
            timeArray[i]         = new XDate(info.Time);
        }

        GraphPane graphPane = masterPane[0];

        graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);

        graphPane.Legend.Fill.IsVisible          = false;
        graphPane.Legend.Border.IsVisible        = false;
        graphPane.Legend.FontSpec.Fill.IsVisible = false;

        graphPane.XAxis.Title.Text          = StringDef.Time;
        graphPane.XAxis.MajorGrid.Color     = WebConfig.GraphXAxisGridColor;
        graphPane.XAxis.Type                = AxisType.Date;
        graphPane.XAxis.Scale.FontSpec.Size = 11;

        graphPane.YAxis.Title.Text = StringDef.PlayerCount;
        //graphPane.YAxis.MajorGrid.IsVisible = true;
        //graphPane.YAxis.MajorGrid.DashOff = 0;
        //graphPane.YAxis.MajorGrid.Color = Color.Gray;
        //graphPane.YAxis.MinorGrid.IsVisible = true;
        //graphPane.YAxis.MinorGrid.Color = Color.LightGray;
        //graphPane.YAxis.MinorGrid.DashOff = 0;
        graphPane.YAxis.Scale.Min = 0;

        graphPane.Title.Text = string.Format("{0} [ {1}  {2} ]", StringDef.PlayerCount, DateTime.Now.Subtract(new TimeSpan(1 - _dayIndex, 0, 0, 0)), DateTime.Now.Subtract(new TimeSpan(-_dayIndex, 0, 0, 0)));

        graphPane.AddCurve(StringDef.Maximum, timeArray, maxCountArray, Color.Red, SymbolType.Triangle);
        graphPane.AddCurve(StringDef.Minimum, timeArray, minCountArray, Color.Green, SymbolType.TriangleDown);
        graphPane.AddCurve(StringDef.Average, timeArray, averageCountArray, Color.Orange, SymbolType.Diamond);
    }
예제 #7
0
    protected void ZedGraphWebPlayerCount_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        if (!WebUtil.CheckPrivilege(TheAdminServer.GameServerManager.SecurityObject, OpType.READ, Session))
        {
            return;
        }

        GameServer server = ServerDropDownList.SelectedGameServer;

        //不再只对GameServer进行人数的查询,而是对所有的Server进行查询
        if (server == null || server.Type != GameServer.ServerType.gameserver && server.Type != GameServer.ServerType.gamecenter)
        {
            ZedGraphWebPlayerCount.Visible = false;
            return;
        }


        Queue <LordControl.PlayerCountInfo> playerCountInfoQueue = server.GetPlugInData(CurrentUser.Id, LordControl.PlugInGuid, LordControl.DataKeyPlayerCountQueue) as Queue <LordControl.PlayerCountInfo>;

        if (playerCountInfoQueue == null)
        {
            ZedGraphWebPlayerCount.Visible = false;
            return;
        }

        LordControl.PlayerCountInfo[] infoArray = playerCountInfoQueue.ToArray();
        double[] countArray = new double[infoArray.Length];
        double[] timeArray  = new double[infoArray.Length];

        for (int i = 0; i < infoArray.Length; i++)
        {
            LordControl.PlayerCountInfo info = infoArray[i];
            countArray[i] = info.Count;
            timeArray[i]  = new XDate(info.Time);
        }

        GraphPane graphPane = masterPane[0];

        graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);

        graphPane.Legend.Fill.IsVisible          = false;
        graphPane.Legend.Border.IsVisible        = false;
        graphPane.Legend.FontSpec.Fill.IsVisible = false;

        graphPane.XAxis.Title.Text          = StringDef.Time;
        graphPane.XAxis.MajorGrid.Color     = WebConfig.GraphXAxisGridColor;
        graphPane.XAxis.Type                = AxisType.Date;
        graphPane.XAxis.Scale.FontSpec.Size = 11;

        graphPane.YAxis.Title.Text = StringDef.PlayerCount;
        //graphPane.YAxis.MajorGrid.IsVisible = true;
        //graphPane.YAxis.MajorGrid.DashOff = 0;
        //graphPane.YAxis.MajorGrid.Color = Color.Gray;
        //graphPane.YAxis.MinorGrid.IsVisible = true;
        //graphPane.YAxis.MinorGrid.Color = Color.LightGray;
        //graphPane.YAxis.MinorGrid.DashOff = 0;
        graphPane.YAxis.Scale.Min = 0;

        graphPane.Title.Text = string.Format("{0} - {1}", StringDef.PlayerCount, StringDef.Last1Hour);

        graphPane.AddCurve(StringDef.PlayerCount, timeArray, countArray, Color.Red, SymbolType.Diamond);
    }
예제 #8
0
    protected void ZedGraphWebStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        if (_server != null)
        {
            GraphPane graphPane = masterPane[0];

            if (_statisticType == 1)
            {
                FS2RoleType[] roleClasses = FS2GameDataManager.RoleClasses;
                SqlCommand[]  cmds        = new SqlCommand[roleClasses.Length];
                SqlResult[]   results     = new SqlResult[roleClasses.Length];
                for (int i = 0; i < roleClasses.Length; i++)
                {
                    cmds[i] = new SqlCommand("SELECT RoleLevel,COUNT(*) FROM rolesfirst WHERE RoleType=? GROUP BY RoleLevel", (int)roleClasses[i]);
                    if (!_server.IsConnected)
                    {
                        //LabelMessage.Visible = true;
                        //LabelMessage.Text = StringDef.NoConnectionAlert;
                        return;
                    }
                    results[i] = WebUtil.QueryGameServerDb(CurrentUser.Id, _server, cmds[i]);
                }

                bool success = true;
                for (int i = 0; i < roleClasses.Length; i++)
                {
                    if (results[i] == null || !results[i].Success)
                    {
                        success = false;
                        break;
                    }
                }

                if (success)
                {
                    //整理数据
                    SqlDataType[] dataTypes = new SqlDataType[] { SqlDataType.Int16, SqlDataType.UInt32 };
                    for (int i = 0; i < roleClasses.Length; i++)
                    {
                        results[i].SetFieldType(dataTypes);
                    }
                    int      minLevel = 1;
                    int      maxLevel = FS2GameDataManager.MaxLevel;
                    object[] record   = null;
                    RoleLevelStatisticInfo[] infos = new RoleLevelStatisticInfo[maxLevel - minLevel + 1];
                    for (int i = minLevel; i <= maxLevel; i++)
                    {
                        RoleLevelStatisticInfo info = new RoleLevelStatisticInfo((short)i);
                        info.Counts         = new UInt32[roleClasses.Length];
                        infos[i - minLevel] = info;
                    }

                    for (int i = 0; i < roleClasses.Length; i++)
                    {
                        while ((record = results[i].ReadRecord()) != null)
                        {
                            Int16  level = (Int16)record[0];
                            UInt32 count = (UInt32)record[1];
                            infos[level - minLevel].Counts[i] = count;
                        }
                    }

                    //绘制图表
                    string[] roleClassNames = new string[] { StringDef.Jiashi, StringDef.Daoshi, StringDef.Yiren };

                    graphPane.Title.Text = StringDef.RoleCountByLevel;
                    graphPane.Fill       = new Fill(WebConfig.GraphPaneBgColor);
                    graphPane.Legend.FontSpec.Fill.IsVisible = false;

                    graphPane.Legend.Fill.IsVisible   = false;
                    graphPane.Legend.Border.IsVisible = false;

                    graphPane.XAxis.Title.Text      = StringDef.Level;
                    graphPane.XAxis.Scale.Max       = maxLevel + 1;
                    graphPane.XAxis.Scale.Min       = minLevel - 1;
                    graphPane.XAxis.Scale.MajorStep = 5;
                    graphPane.XAxis.Scale.MinorStep = 1;

                    graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor;

                    graphPane.YAxis.Title.Text          = StringDef.Count;
                    graphPane.YAxis.Scale.Min           = 0;
                    graphPane.YAxis.MajorGrid.IsVisible = true;
                    graphPane.YAxis.MajorGrid.DashOff   = 0;
                    graphPane.YAxis.MajorGrid.Color     = Color.Gray;
                    graphPane.YAxis.MinorGrid.IsVisible = true;
                    graphPane.YAxis.MinorGrid.Color     = Color.LightGray;
                    graphPane.YAxis.MinorGrid.DashOff   = 0;

                    if (_chartType == ChartType.Bar)
                    {
                        graphPane.BarSettings.Type = BarType.Stack;

                        double[] counts = new double[infos.Length];
                        double[] levels = new double[infos.Length];

                        for (int i = 0; i < roleClasses.Length; i++)
                        {
                            for (int j = 0; j < infos.Length; j++)
                            {
                                RoleLevelStatisticInfo info = infos[j] as RoleLevelStatisticInfo;
                                counts[j] = info.Counts[i];
                                levels[j] = info.Level;
                            }

                            BarItem barItem = graphPane.AddBar(roleClassNames[i], levels, counts, Colors[i]);
                            barItem.Bar.Fill = new Fill(Colors[i]);
                        }
                    }
                    else if (_chartType == ChartType.Line)
                    {
                        double[] counts = new double[infos.Length];
                        double[] levels = new double[infos.Length];

                        for (int i = 0; i < roleClasses.Length; i++)
                        {
                            for (int j = 0; j < infos.Length; j++)
                            {
                                RoleLevelStatisticInfo info = infos[j] as RoleLevelStatisticInfo;
                                counts[j] = info.Counts[i];
                                levels[j] = info.Level;
                            }

                            LineItem lineItem = graphPane.AddCurve(roleClassNames[i], levels, counts, Colors[i], (showSymbol ? WebConfig.GraphSymbols[i] : SymbolType.None));
                            lineItem.Line.Width = 1;
                        }
                    }
                    graphPane.AxisChange(g);
                }
            }
            else if (_statisticType == 2)
            {
                SqlCommand[] cmds    = new SqlCommand[RoleSexCount];
                SqlResult[]  results = new SqlResult[RoleSexCount];
                for (int i = 0; i < RoleSexCount; i++)
                {
                    cmds[i] = new SqlCommand("SELECT RoleLevel,COUNT(*) FROM rolesfirst WHERE RoleSex=? GROUP BY RoleLevel", i);
                    if (!_server.IsConnected)
                    {
                        //LabelMessage.Visible = true;
                        //LabelMessage.Text = StringDef.NoConnectionAlert;
                        return;
                    }
                    results[i] = WebUtil.QueryGameServerDb(CurrentUser.Id, _server, cmds[i]);
                }

                bool success = true;
                for (int i = 0; i < RoleSexCount; i++)
                {
                    if (results[i] == null || !results[i].Success)
                    {
                        success = false;
                        break;
                    }
                }

                if (success)
                {
                    int minLevel = 1;
                    int maxLevel = FS2GameDataManager.MaxLevel;

                    //整理数据
                    SqlDataType[] dataTypes = new SqlDataType[] { SqlDataType.Int16, SqlDataType.UInt32 };
                    for (int i = 0; i < RoleSexCount; i++)
                    {
                        results[i].SetFieldType(dataTypes);
                    }

                    object[] record = null;
                    RoleLevelStatisticInfo[] infos = new RoleLevelStatisticInfo[maxLevel - minLevel + 1];
                    for (int i = minLevel; i <= maxLevel; i++)
                    {
                        RoleLevelStatisticInfo info = new RoleLevelStatisticInfo((short)i);
                        info.Counts         = new UInt32[RoleSexCount];
                        infos[i - minLevel] = info;
                    }

                    for (int i = 0; i < RoleSexCount; i++)
                    {
                        while ((record = results[i].ReadRecord()) != null)
                        {
                            Int16  level = (Int16)record[0];
                            UInt32 count = (UInt32)record[1];
                            infos[level - minLevel].Counts[i] = count;
                        }
                    }

                    //绘制图表
                    string[] roleSexNames = new string[] { StringDef.Male, StringDef.Female };

                    graphPane.Title.Text = StringDef.RoleCountByLevel;
                    graphPane.Fill       = new Fill(WebConfig.GraphPaneBgColor);

                    graphPane.Legend.Fill.IsVisible   = false;
                    graphPane.Legend.Border.IsVisible = false;

                    graphPane.XAxis.Title.Text      = StringDef.Level;
                    graphPane.XAxis.Scale.Max       = maxLevel + 1;
                    graphPane.XAxis.Scale.Min       = minLevel - 1;
                    graphPane.XAxis.Scale.MajorStep = 5;
                    graphPane.XAxis.Scale.MinorStep = 1;
                    graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor;

                    graphPane.YAxis.Title.Text          = StringDef.Count;
                    graphPane.YAxis.MajorGrid.IsVisible = true;
                    graphPane.YAxis.MajorGrid.DashOff   = 0;
                    graphPane.YAxis.MajorGrid.Color     = Color.Gray;
                    graphPane.YAxis.MinorGrid.IsVisible = true;
                    graphPane.YAxis.MinorGrid.Color     = Color.LightGray;
                    graphPane.YAxis.MinorGrid.DashOff   = 0;

                    if (_chartType == ChartType.Bar)
                    {
                        graphPane.BarSettings.Type = BarType.Stack;

                        double[] counts = new double[infos.Length];
                        double[] levels = new double[infos.Length];

                        for (int i = 0; i < RoleSexCount; i++)
                        {
                            for (int j = 0; j < infos.Length; j++)
                            {
                                RoleLevelStatisticInfo info = infos[j] as RoleLevelStatisticInfo;
                                counts[j] = info.Counts[i];
                                levels[j] = info.Level;
                            }

                            BarItem barItem = graphPane.AddBar(roleSexNames[i], levels, counts, Colors[i]);
                            barItem.Bar.Fill = new Fill(Colors[i]);
                        }
                    }
                    else if (_chartType == ChartType.Line)
                    {
                        double[] counts = new double[infos.Length];
                        double[] levels = new double[infos.Length];

                        for (int i = 0; i < RoleSexCount; i++)
                        {
                            for (int j = 0; j < infos.Length; j++)
                            {
                                RoleLevelStatisticInfo info = infos[j] as RoleLevelStatisticInfo;
                                counts[j] = info.Counts[i];
                                levels[j] = info.Level;
                            }

                            LineItem lineItem = graphPane.AddCurve(roleSexNames[i], levels, counts, Colors[i], (showSymbol ? WebConfig.GraphSymbols[i] : SymbolType.None));
                        }
                    }

                    graphPane.AxisChange(g);
                }
            }
        }
    }
예제 #9
0
    //private bool CreateStatisticTable(StatisticInfo[] infos, int statisticTypeIndex, object[] statistic)
    //{
    //    string[] StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map };

    //    TableHeaderRow headerRow = new TableHeaderRow();
    //    TableHeaderCell headerCell = new TableHeaderCell();
    //    headerCell.Text = StatisticTypeNames[statisticTypeIndex];
    //    headerRow.Cells.Add(headerCell);

    //    headerCell = new TableHeaderCell();
    //    headerCell.Text = StringDef.Count;
    //    headerRow.Cells.Add(headerCell);

    //    TableStatistic.Rows.Add(headerRow);

    //    for (int i = 0; i < infos.Length; i++)
    //    {
    //        StatisticInfo info = infos[i];
    //        TableRow row = new TableRow();

    //        TableCell cell = new TableCell();
    //        for (int j = 0; j < statistic.Length; j++)
    //        {
    //            if (statistic[j].Id == info.Type)
    //            {
    //                cell.Text = statistic[j].Name;
    //                row.Cells.Add(cell);
    //                break;
    //            }
    //        }

    //        cell = new TableCell();
    //        cell.Text = info.Count.ToString();
    //        row.Cells.Add(cell);

    //        TableStatistic.Rows.Add(row);
    //    }

    //    return true;
    //}

    protected void ZedGraphWebStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        if (_server != null)
        {
            GraphPane graphPane = masterPane[0];

            string[]   StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map };
            string     staticType         = StatisticTypes[_statisticType];
            string     staticTypeName     = StatisticTypeNames[_statisticType];
            SqlCommand cmd = new SqlCommand("SELECT " + staticType + ",COUNT(*) FROM rolesfirst " + _whereStatement + " GROUP BY " + staticType);
            if (!_server.IsConnected)
            {
                //LabelMessage.Visible = true;
                //LabelMessage.Text = StringDef.NoConnectionAlert;
                return;
            }
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, _server, cmd);

            if (result != null && result.Success)
            {
                //整理数据
                SqlDataType[] dataTypes = new SqlDataType[] { SqlDataType.Int32, SqlDataType.Int32 };
                result.SetFieldType(dataTypes);

                object[] statistic = null;
                switch (_statisticType)
                {
                case 0:
                {
                    statistic = new object[FS2GameDataManager.MaxLevel];
                    for (int level = 1; level <= FS2GameDataManager.MaxLevel; level++)
                    {
                        statistic[level - 1] = level;
                    }
                }
                break;

                case 1:
                {
                    statistic = new object[FS2GameDataManager.RoleClasses.Length];
                    for (int i = 0; i < FS2GameDataManager.RoleClasses.Length; i++)
                    {
                        statistic[i] = FS2GameDataManager.RoleClasses[i];
                    }
                }
                break;

                case 2:
                {
                    statistic = new object[FS2GameDataManager.RoleSexes.Length];
                    for (int i = 0; i < FS2GameDataManager.RoleSexes.Length; i++)
                    {
                        statistic[i] = FS2GameDataManager.RoleSexes[i];
                    }
                }
                break;

                case 3:
                    statistic = new object[] { 0, 1, 2, 3, 4 };
                    break;
                }

                StatisticInfo[] infos = new StatisticInfo[statistic.Length];
                for (int i = 0; i < infos.Length; i++)
                {
                    infos[i] = new StatisticInfo(int.Parse(statistic[i].ToString()), 0);
                }

                object[] record = null;
                while ((record = result.ReadRecord()) != null)
                {
                    int type  = (int)record[0];
                    int count = (int)record[1];

                    for (int i = 0; i < infos.Length; i++)
                    {
                        if (infos[i].Type == type)
                        {
                            infos[i].Count = count;
                        }
                    }
                }

                ////构造数据表格
                //bool success = CreateStatisticTable(infos, _statisticType, statistic);
                //if (success)
                //{
                //    TableStatistic.Visible = true;
                //}

                graphPane.Title.Text = staticTypeName;
                graphPane.Fill       = new Fill(WebConfig.GraphPaneBgColor);

                graphPane.Legend.IsVisible = false;

                string[] textLabels = new string[statistic.Length];
                for (int i = 0; i < statistic.Length; i++)
                {
                    textLabels[i] = statistic[i].ToString();
                }

                graphPane.XAxis.Title.Text      = staticTypeName;
                graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor;

                if (_statisticType > 0)
                {
                    graphPane.XAxis.MajorTic.IsBetweenLabels = true;
                    graphPane.XAxis.Type             = AxisType.Text;
                    graphPane.XAxis.Scale.TextLabels = textLabels;
                }

                graphPane.YAxis.Title.Text          = StringDef.Count;
                graphPane.YAxis.Scale.Min           = 0;
                graphPane.YAxis.MajorGrid.IsVisible = true;
                graphPane.YAxis.MajorGrid.DashOff   = 0;
                graphPane.YAxis.MajorGrid.Color     = Color.Gray;
                graphPane.YAxis.MinorGrid.IsVisible = true;
                graphPane.YAxis.MinorGrid.Color     = Color.LightGray;
                graphPane.YAxis.MinorGrid.DashOff   = 0;

                if (_chartType == ChartType.Bar)
                {
                    graphPane.BarSettings.Type = BarType.Stack;

                    double[] counts = new double[infos.Length];
                    double[] types  = new double[infos.Length];

                    for (int i = 0; i < infos.Length; i++)
                    {
                        StatisticInfo info = infos[i] as StatisticInfo;
                        counts[i] = info.Count;
                        types[i]  = info.Type;

                        //添加数值标签
                        string  lab  = info.Count.ToString();
                        TextObj text = new TextObj(lab, i + 1, (float)(info.Count));;
                        text.Location.CoordinateFrame  = CoordType.AxisXYScale;
                        text.FontSpec.Border.IsVisible = false;
                        text.FontSpec.Fill.IsVisible   = false;
                        if (_statisticType == 0)
                        {
                            text.Location.AlignH = AlignH.Left;
                            text.Location.AlignV = AlignV.Center;
                            text.FontSpec.Angle  = 90f;
                        }
                        else
                        {
                            text.Location.AlignH = AlignH.Center;
                            text.Location.AlignV = AlignV.Bottom;
                        }
                        graphPane.GraphObjList.Add(text);
                    }

                    //绘制柱子
                    BarItem barItem = graphPane.AddBar(StringDef.Count, types, counts, WebConfig.GraphColors[0]);
                    barItem.Bar.Fill = new Fill(WebConfig.GraphColors[0]);
                }
                else if (_chartType == ChartType.Line)
                {
                    double[] counts = new double[infos.Length];
                    double[] types  = new double[infos.Length];

                    for (int i = 0; i < infos.Length; i++)
                    {
                        StatisticInfo info = infos[i] as StatisticInfo;
                        counts[i] = info.Count;
                        types[i]  = info.Type;

                        //添加数值标签
                        string  lab  = info.Count.ToString();
                        TextObj text = new TextObj(lab, i + 1, (float)(info.Count));;
                        text.Location.CoordinateFrame  = CoordType.AxisXYScale;
                        text.FontSpec.Border.IsVisible = false;
                        text.FontSpec.Fill.IsVisible   = false;
                        if (_statisticType == 0)
                        {
                            text.Location.AlignH = AlignH.Left;
                            text.Location.AlignV = AlignV.Center;
                            text.FontSpec.Angle  = 90f;
                        }
                        else
                        {
                            text.Location.AlignH = AlignH.Center;
                            text.Location.AlignV = AlignV.Bottom;
                        }
                        graphPane.GraphObjList.Add(text);
                    }

                    //绘制线条
                    LineItem lineItem = graphPane.AddCurve("xxx", types, counts, WebConfig.GraphColors[1], SymbolType.None);
                }

                graphPane.AxisChange(g);
            }
        }
    }
예제 #10
0
        protected void ZedGraphWeb1_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, System.Drawing.Graphics g, ZedGraph.MasterPane pane)
        {
            String  masina            = (String)Cache["CacheMasini"];
            DataSet dataSetITP        = (DataSet)Cache["CacheITP"];
            DataSet dataSetMasini_ITP = (DataSet)Cache["CacheMasini_ITP"];



            GraphPane myPane = pane[0];

            myPane.Title.Text       = "";
            myPane.XAxis.Title.Text = "Proprietar"; myPane.YAxis.Title.Text = "KM";
            Color[] colors =
            {
                Color.Red,    Color.Yellow, Color.Green, Color.Blue,
                Color.Purple, Color.Pink,   Color.Plum,  Color.Silver, Color.Salmon
            };
            double media;

            if (Request.QueryString["tip"] != null)
            {
                List <string> listaX = new List <string>();
                List <double> listaY = new List <double>();
                PointPairList list   = new PointPairList();
                int           i      = 0;

                List <int> listaITPPentruMasina = new List <int>();
                foreach (DataRow r in dataSetMasini_ITP.Tables[0].Rows)
                {
                    if ((int)r[1] == int.Parse(masina))
                    {
                        listaITPPentruMasina.Add((int)r[2]);
                    }
                }

                foreach (int id in listaITPPentruMasina)
                {
                    foreach (DataRow r in dataSetITP.Tables[0].Rows)
                    {
                        if (id == (int)r[0])
                        {
                            string v = r[3].ToString();

                            string v2 = r[4].ToString();
                            listaX.Add(r[3].ToString());
                            listaY.Add(double.Parse((r[4].ToString())));
                            list.Add(0, double.Parse((r[4].ToString())));
                        }
                    }
                }



                switch (Request.QueryString["tip"])
                {
                case "Bare":
                {
                    BarItem myCurve = myPane.AddBar("Curve 2", list, Color.Blue);
                    myCurve.Bar.Fill                  = new Fill(colors);
                    myCurve.Bar.Fill.Type             = FillType.GradientByZ;
                    myCurve.Bar.Fill.RangeMin         = 0;
                    myCurve.Bar.Fill.RangeMax         = list.Count;
                    myPane.XAxis.Type                 = AxisType.Text;
                    myPane.XAxis.Scale.TextLabels     = listaX.ToArray();
                    myPane.XAxis.Scale.FontSpec.Angle = 90;
                    myPane.XAxis.Scale.FontSpec.Size  = 10;
                    myPane.YAxis.Scale.FontSpec.Size  = 10;
                    //zedGraphControl1.AxisChange();


                    media = (double)listaY.Average();
                    // = media;
                    // myPane.YAxis.MajorGrid.Equals(10);
                    var yScale = myPane.YAxis.Scale;

                    double yMin = yScale.Min;
                    double yMax = yScale.Max;
                    var    line = new LineObj(media, 50000.00, media, 10000.000)
                    {
                        IsClippedToChartRect = true
                    };
                    line.Line.Color = Color.DarkGreen;
                    myPane.GraphObjList.Add(line);
                    break;
                }

                case "Bare3D": break;

                case "Pie3D": break;

                case "Linie":
                {
                    LineItem curve = myPane.AddCurve("Spline", list, Color.Red, SymbolType.Diamond);
                    curve.Line.IsSmooth      = true;
                    curve.Line.SmoothTension = 0.5F;
                    curve.Line.Width         = 2;

                    curve = myPane.AddCurve("Dreapta", list, Color.Blue, SymbolType.Diamond);
                    curve.Line.IsSmooth = false;
                    curve.Line.Width    = 2;
                    curve.Symbol.Size   = 5;

                    curve = myPane.AddCurve("ForwardStep", list, Color.Black, SymbolType.Diamond);
                    curve.Line.StepType = StepType.ForwardStep;
                    curve.Line.Width    = 2;
                    curve.Symbol.Size   = 5;

                    curve.Symbol.Fill = new Fill(Color.White);
                    curve.Symbol.Size = 10;

                    myPane.XAxis.Scale.TextLabels     = listaX.ToArray();
                    myPane.XAxis.Type                 = AxisType.Text;
                    myPane.XAxis.Scale.FontSpec.Size  = 10;
                    myPane.XAxis.Scale.FontSpec.Angle = 90;
                    myPane.YAxis.Scale.FontSpec.Size  = 10;
                    break;
                }

                case "Pie":
                {
                    i = 0;


                    foreach (int id in listaITPPentruMasina)
                    {
                        foreach (DataRow r in dataSetITP.Tables[0].Rows)
                        {
                            if (id == (int)r[0])
                            {
                                PieItem segment1 = myPane.AddPieSlice((double.Parse(r[4].ToString())),
                                                                      colors[(i++) % colors.Length],
                                                                      Color.White, 45f, (i % 2 == 0) ? 0.2 : 0, r[3].ToString());
                            }
                        }
                    }
                    break;
                }
                }
            }
        }
예제 #11
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);
    }
예제 #12
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);
    }
예제 #13
0
    //void CreateTableHead()
    //{
    //    if(TextBoxRoleName.Text!=null&&TextBoxRoleName.Text.Trim().Length!=0)
    //    {
    //        TableRow rowHead = new TableRow();

    //        TableHeaderCell cellHead = new TableHeaderCell();
    //        cellHead.Text = StringDef.RoleName;
    //        rowHead.Cells.Add(cellHead);

    //        cellHead = new TableHeaderCell();
    //        cellHead.Text = StringDef.Date;
    //        rowHead.Cells.Add(cellHead);

    //        cellHead = new TableHeaderCell();
    //        cellHead.Text = StringDef.Count;
    //        rowHead.Cells.Add(cellHead);

    //        cellHead = new TableHeaderCell();
    //        cellHead.Text = StringDef.Percentage;
    //        rowHead.Cells.Add(cellHead);

    //        TableSearchTaiSuiList.Rows.Add(rowHead);
    //    }
    //    else
    //    {
    //        TableRow rowHead = new TableRow();

    //        TableHeaderCell cellHead = new TableHeaderCell();
    //        cellHead.Text = StringDef.Date;
    //        rowHead.Cells.Add(cellHead);

    //        cellHead = new TableHeaderCell();
    //        cellHead.Text = StringDef.Count;
    //        rowHead.Cells.Add(cellHead);

    //        cellHead = new TableHeaderCell();
    //        cellHead.Text = StringDef.Percentage;
    //        rowHead.Cells.Add(cellHead);

    //        TableSearchTaiSuiList.Rows.Add(rowHead);
    //    }
    //}

    //void CreateSearchResultList(TaiSuiUseInfo[] infos, int total)
    //{
    //    if (infos != null)
    //    {
    //        if (TextBoxRoleName.Text != null && TextBoxRoleName.Text.Trim().Length != 0)
    //        {
    //            foreach (TaiSuiUseInfo info in infos)
    //            {
    //                TableRow row = new TableRow();
    //                TableCell cell = new TableCell();
    //                cell.Text = TextBoxRoleName.Text.Trim();
    //                row.Cells.Add(cell);
    //                cell = new TableCell();
    //                cell.Text = info.date.ToShortDateString();
    //                row.Cells.Add(cell);
    //                cell = new TableCell();
    //                cell.Text = info.num.ToString();
    //                row.Cells.Add(cell);
    //                cell = new TableCell();
    //                cell.Text = total == 0 ? "0" : Decimal.Round((decimal)info.num / total, 2) * 100 + "%";
    //                row.Cells.Add(cell);
    //                TableSearchTaiSuiList.Rows.Add(row);
    //            }
    //        }
    //        else
    //        {
    //            foreach (TaiSuiUseInfo info in infos)
    //            {
    //                TableRow row = new TableRow();
    //                TableCell cell = new TableCell();
    //                cell.Text = info.date.ToShortDateString();
    //                row.Cells.Add(cell);
    //                cell = new TableCell();
    //                cell.Text = info.num.ToString();
    //                row.Cells.Add(cell);
    //                cell = new TableCell();
    //                cell.Text = total == 0 ? "0" : Decimal.Round((decimal)info.num / total, 2) * 100 + "%";
    //                row.Cells.Add(cell);
    //                TableSearchTaiSuiList.Rows.Add(row);
    //            }
    //        }
    //        TableRow rowTail = new TableRow();
    //        TableCell cellTail = new TableCell();
    //        cellTail.ColumnSpan = TextBoxRoleName.Text != null && TextBoxRoleName.Text.Trim().Length != 0 ? 4 : 3;
    //        cellTail.Font.Bold = true;
    //        cellTail.Text = StringDef.Total + StringDef.Colon + total;
    //        rowTail.Cells.Add(cellTail);

    //        TableSearchTaiSuiList.Rows.Add(rowTail);
    //    }
    //}

    protected void ZedGraphWebTaiSuiStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        if (_statInfo != null)
        {
            //整理数据
            double[] timeArray = null;
            double[] counts    = null;

            if (RadioButtonListType.SelectedValue.Equals("Day"))
            {
                //按天
                TimeSpan span = _end.Subtract(_start);
                timeArray = new double[span.Days + 1];
                counts    = new double[span.Days + 1];

                for (int index = 0; index != span.Days + 1; ++index)
                {
                    DateTime tempDate = _start.Date.AddDays(index);
                    timeArray[index] = new XDate(tempDate);
                    foreach (TaiSuiUseInfo info in _statInfo)
                    {
                        //如果相等赋num,如果比date的日期小则结束
                        if (tempDate.Date.Equals(info.date))
                        {
                            counts[index] = info.num;
                            break;
                        }
                        else if (tempDate.Date < info.date)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                //按月
                int monthLength = (_end.Year - _start.Year) * 12 + (_end.Month - _start.Month);
                timeArray = new double[monthLength + 1];
                counts    = new double[monthLength + 1];

                for (int index = 0; index != monthLength + 1; ++index)
                {
                    DateTime tempDate = _start.Date.AddMonths(index);
                    timeArray[index] = new XDate(tempDate);
                    foreach (TaiSuiUseInfo info in _statInfo)
                    {
                        //如果相等赋num,如果比date的日期小则结束
                        if (tempDate.ToString("yyyyMM").Equals(info.date.ToString("yyyyMM")))
                        {
                            counts[index] = info.num;
                            break;
                        }
                        else if (tempDate.Date < info.date)
                        {
                            break;
                        }
                    }
                }
            }

            GraphPane graphPane = masterPane[0];

            //绘制图表
            graphPane.Title.Text = string.Format("{0} {1} {2} {3}", _start.ToShortDateString(), StringDef.To, _end.ToShortDateString(),
                                                 StringDef.TaiSui + StringDef.Total + StringDef.Colon + _totalCount.ToString());
            graphPane.Title.IsVisible     = true;
            graphPane.Title.FontSpec.Size = 14;

            graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);
            graphPane.Legend.FontSpec.Fill.IsVisible = false;
            graphPane.Legend.FontSpec.Size           = 10.5f;
            graphPane.Legend.Fill.IsVisible          = false;
            graphPane.Legend.Border.IsVisible        = false;

            graphPane.YAxis.Title.Text            = StringDef.UseCount;
            graphPane.YAxis.Title.FontSpec.IsBold = false;
            graphPane.YAxis.Title.FontSpec.Size   = 10.5f;
            graphPane.YAxis.Scale.FontSpec.Size   = 10.5f;
            graphPane.YAxis.MajorGrid.IsVisible   = true;
            graphPane.YAxis.MajorGrid.DashOff     = 0;
            graphPane.YAxis.MajorGrid.Color       = Color.Gray;
            graphPane.YAxis.MinorGrid.IsVisible   = true;
            graphPane.YAxis.MinorGrid.Color       = Color.LightGray;
            graphPane.YAxis.MinorGrid.DashOff     = 0;

            graphPane.XAxis.Title.Text            = StringDef.Date;
            graphPane.XAxis.Title.FontSpec.IsBold = false;
            graphPane.XAxis.Title.FontSpec.Size   = 10.5f;
            graphPane.XAxis.Scale.MajorUnit       = DateUnit.Day;
            graphPane.XAxis.MinorGrid.IsVisible   = false;
            graphPane.XAxis.Type = AxisType.DateAsOrdinal;
            if (RadioButtonListType.SelectedValue.Equals("Day"))
            {
                graphPane.XAxis.Scale.Format = "MM-dd";
            }
            else
            {
                graphPane.XAxis.Scale.Format = "yyyy-MM";
            }
            graphPane.XAxis.Scale.FontSpec.Size = 10.5f;
            //graphPane.XAxis.Scale.FontSpec.Angle = 45;

            graphPane.BarSettings.Type = BarType.Cluster;

            BarItem barItem = graphPane.AddBar(StringDef.UseCount, timeArray, counts, Color.Blue);
            masterPane.AxisChange(g);
            BarItem.CreateBarLabels(graphPane, false, string.Empty, TextObj.Default.FontFamily, 10.5f,
                                    TextObj.Default.FontColor, false, false, false);
        }
    }
예제 #14
0
    protected void ZedGraphWebLevelSuiStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        if (_infoHashtable != null)
        {
            //整理数据
            int      startLevel = int.Parse(TextBoxStartLevel.Text.Trim());
            int      endLevel   = int.Parse(TextBoxEndLevel.Text.Trim());
            int      groupCount = int.Parse(TextBoxGroup.Text.Trim());
            string[] levels     = new string[(endLevel - startLevel) / groupCount + 1];
            double[] counts;
            Color[]  roleTypeColor = new Color[] {
                Color.Blue,
                Color.Brown,
                Color.DarkGoldenrod,
                Color.Beige,
                Color.Yellow,
                Color.Coral,
                Color.Pink,
                Color.Green,
                Color.Gray
            };

            for (int index = 0; index != levels.Length; ++index)
            {
                levels[index] = string.Concat(startLevel + index * groupCount, '-', startLevel + (index + 1) * groupCount - 1);
            }

            GraphPane graphPane = masterPane[0];

            //绘制图表
            graphPane.Title.Text = string.Format("{0}-{1} {2} {3}", startLevel, endLevel,
                                                 StringDef.Role + StringDef.Total + StringDef.Colon, _total.ToString());
            graphPane.Title.IsVisible     = true;
            graphPane.Title.FontSpec.Size = 14;

            graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);
            graphPane.Legend.FontSpec.Fill.IsVisible = false;
            graphPane.Legend.FontSpec.Size           = 10.5f;
            graphPane.Legend.Fill.IsVisible          = false;
            graphPane.Legend.Border.IsVisible        = false;

            graphPane.YAxis.Title.Text            = StringDef.Count;
            graphPane.YAxis.Title.FontSpec.IsBold = false;
            graphPane.YAxis.Title.FontSpec.Size   = 10.5f;
            graphPane.YAxis.Scale.FontSpec.Size   = 10.5f;
            graphPane.YAxis.MajorGrid.IsVisible   = true;
            graphPane.YAxis.MajorGrid.DashOff     = 0;
            graphPane.YAxis.MajorGrid.Color       = Color.Gray;
            graphPane.YAxis.MinorGrid.IsVisible   = true;
            graphPane.YAxis.MinorGrid.Color       = Color.LightGray;
            graphPane.YAxis.MinorGrid.DashOff     = 0;

            graphPane.XAxis.Title.Text            = StringDef.Level;
            graphPane.XAxis.Title.FontSpec.IsBold = false;
            graphPane.XAxis.Title.FontSpec.Size   = 10.5f;
            graphPane.XAxis.Scale.IsVisible       = true;
            graphPane.XAxis.Type                = AxisType.Text;
            graphPane.XAxis.Scale.TextLabels    = levels;
            graphPane.XAxis.Scale.FontSpec.Size = 10.5f;

            switch (DropDownListBarType.SelectedItem.Text)
            {
            case "Stack":
                graphPane.BarSettings.Type = BarType.Stack;
                break;

            case "PercentStack":
                graphPane.BarSettings.Type = BarType.PercentStack;
                break;

            case "Cluster":
                graphPane.BarSettings.Type = BarType.Cluster;
                break;

            case "ClusterHiLow":
                graphPane.BarSettings.Type = BarType.ClusterHiLow;
                break;

            case "Overlay":
                graphPane.BarSettings.Type = BarType.Overlay;
                break;

            case "SortedOverlay":
                graphPane.BarSettings.Type = BarType.SortedOverlay;
                break;
            }

            for (int roleType = 0; roleType != 10; ++roleType)
            {
                ArrayList infoList = _infoHashtable[(FS2RoleType)roleType] as ArrayList;
                if (infoList != null)
                {
                    counts = new double[(endLevel - startLevel) / groupCount + 1];
                    for (int index = 0; index != levels.Length; ++index)
                    {
                        foreach (LevelInfo info in (LevelInfo[])infoList.ToArray(typeof(LevelInfo)))
                        {
                            if (info.Level >= startLevel + index * groupCount && info.Level < startLevel + (index + 1) * groupCount)
                            {
                                counts[index] += info.Num;
                            }
                            else if (info.Level >= startLevel + (index + 1) * groupCount)
                            {
                                break;
                            }
                        }
                    }
                    string classDescription = string.Empty;
                    switch ((FS2RoleType)roleType)
                    {
                    case FS2RoleType.Jiashi:
                        classDescription = StringDef.Jiashi;
                        break;

                    case FS2RoleType.Xuanfeng:
                        classDescription = StringDef.XuanFeng;
                        break;

                    case FS2RoleType.Xingtian:
                        classDescription = StringDef.XingTian;
                        break;

                    case FS2RoleType.Daoshi:
                        classDescription = StringDef.Daoshi;
                        break;

                    case FS2RoleType.Zhenren:
                        classDescription = StringDef.ZhenRen;
                        break;

                    case FS2RoleType.Tianshi:
                        classDescription = StringDef.TianShi;
                        break;

                    case FS2RoleType.Yiren:
                        classDescription = StringDef.Yiren;
                        break;

                    case FS2RoleType.Shoushi:
                        classDescription = StringDef.ShouShi;
                        break;

                    case FS2RoleType.Yishi:
                        classDescription = StringDef.YiShi;
                        break;
                    }
                    BarItem bar = graphPane.AddBar(classDescription, null, counts, roleTypeColor[(int)roleType]);
                    bar.Bar.Fill = new Fill(roleTypeColor[(int)roleType]);
                }
            }

            masterPane.AxisChange(g);
            BarItem.CreateBarLabels(graphPane, true, string.Empty, TextObj.Default.FontFamily, 10.5f,
                                    TextObj.Default.FontColor, false, false, false);
        }
    }