protected void ZedGraphWebExpStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane) { switch (ListBoxViewContent.SelectedIndex) { case 0: ExpByPlayTime(g, masterPane); break; case 1: ExpByDate(g, masterPane); break; } }
private void OnRenderUserChart(ZedGraph.Web.ZedGraphWeb z, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane) { GraphPane graphPane = masterPane[0]; graphPane.Title.Text = Resource.MemberGraphTitle; graphPane.XAxis.Title.Text = Resource.MemberGraphXAxisLabel; graphPane.YAxis.Title.Text = Resource.MemberGraphYAxisLabel; PointPairList pointList = new PointPairList(); using (IDataReader reader = SiteUser.GetUserCountByYearMonth(siteSettings.SiteId)) { while (reader.Read()) { double x = new XDate(Convert.ToInt32(reader["Y"]), Convert.ToInt32(reader["M"]), 1); double y = Convert.ToDouble(reader["Users"]); pointList.Add(x, y); } } LineItem myCurve2 = graphPane.AddCurve(Resource.MemberGraphYAxisLabel, pointList, Color.Blue, SymbolType.Circle); // Fill the area under the curve with a white-red gradient at 45 degrees myCurve2.Line.Fill = new Fill(Color.White, Color.Green, 45F); // Make the symbols opaque by filling them with white myCurve2.Symbol.Fill = new Fill(Color.White); // Set the XAxis to date type graphPane.XAxis.Type = AxisType.Date; graphPane.XAxis.CrossAuto = true; // Fill the axis background with a color gradient graphPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F); masterPane.AxisChange(g); }
protected void ZedGraphWebExpStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane) { try { switch (_viewContent) { case ViewContent.Exp: ExpStatistic(g, masterPane); break; case ViewContent.Money: MoneyStatistic(g, masterPane); break; case ViewContent.Item: ItemStatistic(g, masterPane); break; case ViewContent.PlayerDeath: PlayerDeathStatistic(g, masterPane); break; case ViewContent.Quest: QuestStatistic(g, masterPane); break; case ViewContent.UseSkill: UseSkillStatistic(g, masterPane); break; } } catch (Exception e) { LabelOpMsg.Text = e.Message; LabelOpMsg.Visible = true; } }
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); }
protected void PopulateSPAGauge(ZedGraph.Web.ZedGraphWeb z, Graphics g, ZedGraph.MasterPane masterPane) { GraphPane myPane = masterPane[0]; // Get territory report details with user's full name String qry = "SELECT TeamName FROM db_ccateams WHERE TeamID=@team_id"; DataTable dt = SQL.SelectDataTable(qry, "@team_id", (String)ViewState["team_id"]); // Define the title if (dt.Rows.Count > 0 && dt.Rows[0]["TeamName"] != DBNull.Value) { myPane.Title.Text = dt.Rows[0]["TeamName"].ToString(); } if ((String)ViewState["timeScheme"] == "latest") { teamNameLabel.Text = "Team '" + Server.HtmlEncode(dt.Rows[0]["TeamName"].ToString()) + "' : " + (int)ViewState["timeScale"] + " Weeks"; if ((int)ViewState["timeScale"] == 1) { teamNameLabel.Text = "Team '" + Server.HtmlEncode(dt.Rows[0]["TeamName"].ToString()) + "' : " + "Latest Week"; } } else { teamNameLabel.Text = "Team '" + Server.HtmlEncode(dt.Rows[0]["TeamName"].ToString()) + "' : Between Selected"; } myPane.Title.FontSpec.Size = 34; myPane.Title.FontSpec.IsAntiAlias = false; myPane.Title.FontSpec.IsBold = false; myPane.Title.FontSpec.FontColor = Util.ColourTryParse("#989898"); // Fill the pane and chart myPane.Fill = new Fill(Util.ColourTryParse("#ff191919"), Util.ColourTryParse("#ff191919"), 45.0f); myPane.Chart.Fill = new Fill(Util.ColourTryParse("#333333"), Util.ColourTryParse("#333333"), 45.0f); //Color.LightGray, Color.Black, myPane.Chart.Fill.RangeMax = 16; myPane.Chart.Fill.RangeMin = 0; // Don't show any axes for the gas gauge myPane.XAxis.IsVisible = false; myPane.Y2Axis.IsVisible = false; myPane.YAxis.IsVisible = false; // Define needles // Plot average RAG value by converting to percentage of 18 max then reverse value as chart plots backwards. float plotVal = 100 - (((float)ViewState["avgRAG"] / (float)16) * 100); GasGaugeNeedle gg1 = new GasGaugeNeedle("Suspects", plotVal, Color.DimGray); gg1.NeedleWidth = 100; myPane.CurveList.Add(gg1); //Define all regions GasGaugeRegion ggr1 = new GasGaugeRegion("Green", 0.0f, 7.0f, Color.Green); GasGaugeRegion ggr2 = new GasGaugeRegion("Yellow", 7.0f, 63.0f, Color.Gold); GasGaugeRegion ggr3 = new GasGaugeRegion("Red", 63.0f, 100.0f, Color.Red); // Add the regions myPane.CurveList.Add(ggr1); myPane.CurveList.Add(ggr2); myPane.CurveList.Add(ggr3); myPane.Legend.IsVisible = false; myPane.Chart.Border.Color = Color.DimGray; myPane.Margin.Left = 34; myPane.Margin.Right = 34; myPane.Margin.Bottom = 30; myPane.Margin.Top = 4; myPane.AxisChange(); ViewState["myPane"] = myPane; }
private void OnRenderGraph(ZedGraph.Web.ZedGraphWeb z, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane) { DataSet ds = (DataSet)Cache["BnkCache"]; GraphPane myPane = masterPane[0]; myPane.Title.Text = ""; myPane.XAxis.Title.Text = "Clienti"; myPane.YAxis.Title.Text = "Solduri"; 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 list.Add(0, (double)r[2], i++); // solduri } 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": 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; break; } case "Pie": { i = 0; foreach (DataRow r in ds.Tables[0].Rows) { PieItem segment1 = myPane.AddPieSlice((double)r[2], colors[(i++) % colors.Length], Color.White, 45f, (i % 2 == 0) ? 0.2 : 0, r[1].ToString()); } break; } } } }