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