Ejemplo n.º 1
0
    protected void ZedGraphWebExpStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        Color  statColor      = Color.Blue;
        string statTitle      = string.Empty;
        string statXAxisTitle = string.Empty;

        switch (ListBoxViewContent.SelectedValue)
        {
        case "NpcBeKilled":
            statColor      = Color.Orange;
            statTitle      = StringDef.NpcBeKilledStatistic;
            statXAxisTitle = StringDef.NpcBeKilledCount;
            break;

        case "NpcKill":
            statColor      = Color.Red;
            statTitle      = StringDef.NpcKillPlayerStatistic;
            statXAxisTitle = StringDef.NpcKillPlayerCount;
            break;
        }

        GraphPane graphPane = masterPane[0];

        graphPane.Fill                  = new Fill(WebConfig.GraphPaneBgColor);
        graphPane.Title.Text            = statTitle;
        graphPane.Title.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.Title.FontSpec.Size   = 10;
        graphPane.Legend.IsVisible      = false;
        graphPane.BarSettings.Base      = BarBase.Y;

        graphPane.XAxis.Title.Text            = statXAxisTitle;
        graphPane.XAxis.Title.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.XAxis.Title.FontSpec.Size   = 6.2f;
        graphPane.XAxis.MajorGrid.IsVisible   = true;
        graphPane.XAxis.MajorGrid.DashOff     = 0;
        graphPane.XAxis.MajorGrid.Color       = Color.Gray;
        graphPane.XAxis.MinorGrid.IsVisible   = true;
        graphPane.XAxis.MinorGrid.Color       = Color.LightGray;
        graphPane.XAxis.MinorGrid.DashOff     = 0;
        graphPane.XAxis.Scale.FontSpec.Size   = 5.6f;
        graphPane.XAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;

        //graphPane.YAxis.Title.Text = StringDef.NpcTemplate;
        graphPane.YAxis.Title.FontSpec.Family       = StringDef.DefaultFontFamily;
        graphPane.YAxis.MajorTic.IsBetweenLabels    = true;
        graphPane.YAxis.Scale.IsPreventLabelOverlap = false;
        graphPane.YAxis.Scale.AlignH          = AlignH.Center;
        graphPane.YAxis.Scale.FontSpec.Size   = 5.6f;
        graphPane.YAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.YAxis.Scale.IsReverse       = true;
        graphPane.YAxis.Type = AxisType.Text;

        double[] countList    = new double[_recordList.Count];
        string[] templateList = new string[_recordList.Count];
        for (int i = 0; i < _recordList.Count; i++)
        {
            NpcStatisticInfo info = _recordList[i];
            countList[i] = info.Count;
            FS2NpcData npcData = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(info.TemaplteId));
            if (npcData != null)
            {
                templateList[i] = npcData.ToString();
            }
            else
            {
                templateList[i] = info.TemaplteId;
            }
        }
        BarItem barItem = graphPane.AddBar(StringDef.NpcBeKilledCount, countList, null, Color.Blue);

        barItem.Bar.Fill = new Fill(statColor);
        graphPane.YAxis.Scale.TextLabels = templateList;
        masterPane.AxisChange();
        BarItem.CreateBarLabels(graphPane, false, string.Empty, StringDef.DefaultFontFamily, 5.6f, TextObj.Default.FontColor, false, false, false);
    }