protected void Page_Load(object sender, EventArgs e) { WorkareaGraphBase graph; string tmp = Request.QueryString["type"]; if (tmp == "pie") { graph = new CircleGraph(); } else if (tmp == "time") { graph = new TimeGraph(); } else { graph = new BarGraph(); } graph.Init(this); }
public BarLegend(Rect rect, BarGraph graph) { this.rect = rect; this.graph = graph; legendScrollRect = new Rect (rect.width * 0.05f, 40, rect.width * 0.9f, rect.height * 0.75f); markerTex = Functions.CreateTexture2D (new Color (0.85f, 0.85f, 0.85f)); markerHoverTex = Functions.CreateTexture2D (Color.white); }
private void GenerateBarGraph() { if (barGraph == null) { barGraph = gameObject.AddComponent<BarGraph> ().GetComponent<BarGraph> (); //first object must be target, then default barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_target_string, manager); barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_default_string, manager); //followed by all of the player's prior attempts for (int i = 0; i < attemptCount; i++) { barGraph.InputToCSVObject (attemptList [i].csv_string, manager); } } barGraph.SetActive (true); }
public BeatmapDetails() { Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = 0.5f, }, new FillFlowContainer <MetadataSegment>() { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, LayoutDuration = 200, LayoutEasing = EasingTypes.OutQuint, Children = new[] { description = new MetadataSegment("Description"), source = new MetadataSegment("Source"), tags = new MetadataSegment("Tags") }, }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Width = 0.6f, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 15), Padding = new MarginPadding(10) { Top = 0 }, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = 0.5f, }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), Padding = new MarginPadding(10), Children = new[] { circleSize = new DifficultyRow("Circle Size", 7), drainRate = new DifficultyRow("HP Drain"), overallDifficulty = new DifficultyRow("Accuracy"), approachRate = new DifficultyRow("Approach Rate"), stars = new DifficultyRow("Star Difficulty"), }, }, }, }, ratingsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Alpha = 0, AlwaysPresent = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = 0.5f, }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = 25, Left = 15, Right = 15, }, Children = new Drawable[] { new OsuSpriteText { Text = "User Rating", Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, ratingsBar = new Bar { RelativeSizeAxes = Axes.X, Height = 5, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new[] { negativeRatings = new OsuSpriteText { Font = @"Exo2.0-Regular", Text = "0", }, positiveRatings = new OsuSpriteText { Font = @"Exo2.0-Regular", Text = "0", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, }, }, new OsuSpriteText { Text = "Rating Spread", TextSize = 14, Font = @"Exo2.0-Regular", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, ratingsGraph = new BarGraph { RelativeSizeAxes = Axes.X, Height = 50, }, }, }, }, }, retryFailContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Alpha = 0, Children = new Drawable[] { new OsuSpriteText { Text = "Points of Failure", Font = @"Exo2.0-Regular", }, new Container <BarGraph> { RelativeSizeAxes = Axes.X, Size = new Vector2(1 / 0.6f, 50), Children = new[] { retryGraph = new BarGraph { RelativeSizeAxes = Axes.Both, }, failGraph = new BarGraph { RelativeSizeAxes = Axes.Both, }, }, }, } }, }, } }; }
IEnumerator RunPollCountdown() { ContentManager content = ContentManager.Instance; CenterScreen centerScreen = CenterScreen.Instance; SideMenu sideMenu = SideMenu.Instance; CenterMenu centerMenu = CenterMenu.Instance; RightMenu rightMenu = RightMenu.Instance; LeftMenu leftMenu = LeftMenu.Instance; BarGraph barGraph = BarGraph.Instance; PlayerManager playerManager = PlayerManager.Instance; float pollCountdown = StartupSettings.Instance.PollCountdown; GraphAnswerInfo answerInfo = null; var poll = content.PollBList[m_pollQuestionCounter]; var activePlayers = playerManager.ActivePlayers; yield return(new WaitForSeconds(m_beforeCountdownTime)); Player.CheckRange = true; //Wait for show icon above to go away... yield return(new WaitForSeconds(1f)); Player.ShowMoveCubeText = false; Player.CountdownValue = (int)pollCountdown; Player.ShowCountdownValue = true; StartCoroutine(Player.RunCountdown(null)); yield return(new WaitForSeconds(pollCountdown + 1f)); Player.ShowCountdownValue = false; Player.CheckRange = false; yield return(new WaitForSeconds(1f)); centerScreen.MoveUpHeader(true); centerScreen.HideRangeBar(true); centerScreen.ShowBarGraph(true); //Wait some time before showing bar graph... yield return(new WaitForSeconds(1f)); //Bar graph stuff... { content.OpenConnection(); answerInfo = (GraphAnswerInfo)content.GetPollAnswersB(poll.Question_Id); content.CloseConnection(); //Setting data and showing bar graph... int highestNum = 0; foreach (int num in answerInfo.numbers) { if (num > highestNum) { highestNum = num; } } float multipler = highestNum > 0f ? 10f / highestNum : 0f; int numVotesPerCube = (int)Mathf.Ceil(highestNum / 10f); for (int i = 0, count = answerInfo.numbers.Count; i < count; ++i) { int num = highestNum > 10 ? (int)Mathf.Ceil(answerInfo.numbers[i] / ((float)(numVotesPerCube))) : (int)Mathf.Round(answerInfo.numbers[i] * multipler); barGraph.SetNumberRows(i, num); } barGraph.ShowTable(true); //Adding player cubes to bar graph... yield return(new WaitForSeconds(3f)); foreach (Player player in activePlayers) { float range = 0f; if (centerScreen.InRangeOfRangeBar( player.transform.position, ref range)) { int index = (int)(answerInfo.numbers.Count * range); GameObject cube = barGraph.AddCubeToRow(index); barGraph.ShowCube(cube, player.ActiveColor); ++answerInfo.numbers[index]; Player.ShowColor = false; } } } //Wait some time before cleaning up bar graph... yield return(new WaitForSeconds( StartupSettings.Instance.AfterPollBTimeout)); barGraph.HideTable(); //Wait some time for animation above to take effect... yield return(new WaitForSeconds(2f)); content.OpenConnection(); content.PutPollAnswers(answerInfo); PollManager.Instance.StartTakeaway(poll.Question_Id); content.CloseConnection(); yield return(new WaitForSeconds(1f)); //Cleanup... Player.ShowColor = false; Player.ShowInactiveColor = true; Player.ShowCountdownValue = false; Player.ShowMoveIcon = true; StartCoroutine(Player.ShowHashtagOverTime(m_hashtagShowTime)); sideMenu.ShowBackground(false); rightMenu.ShowBackground(false); centerMenu.ShowBackground(false); leftMenu.ShowBackground(false); centerScreen.ShowHeader(false); centerScreen.ShowPollB(false); //Wait some time for animations above to take effect... yield return(new WaitForSeconds(2f)); centerScreen.ResetHeader(); centerScreen.HideRangeBar(false); centerScreen.ShowBarGraph(false); //Puts app back in ambient mode... AppManager.State = AppManager.AppState.ATTRACT_CUBES; PanelManager.Instance.ClearAllPanels(); }
void setSelected(BarGraph bar, bool selected) { bar.gameObject.GetComponent <MeshRenderer>().sharedMaterial = selected ? outlineMaterial : defaultMaterial; bar.recolor(); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Transform objectHit = hit.transform; if (objectHit.GetComponent <BarGraph>() == null) { return; } if (selected != null) { BarGraph selectedBarGraph = selected.GetComponentInChildren <BarGraph>(); if (selectedBarGraph != null) { setSelected(selectedBarGraph, false); } } selected = objectHit.GetComponentInParent <RegionController>(); if (!WindowManager.isOpen("RegionWidget")) { WindowManager.openWindowFromChildPrototype("RegionWidget"); } WindowManager.activate("RegionWidget"); WindowManager.get("RegionWidget").GetComponentInChildren <RegionWidget>().regionController = selected; BarGraph barGraph = objectHit.GetComponent <BarGraph>(); if (barGraph != null) { //Debug.Log(objectHit.gameObject.name); setSelected(barGraph, true); } // Do something with the object that was hit by the raycast. } } // Handle spped if (Input.GetButtonDown("Pause")) { speed = 0; } else if (Input.GetButtonDown("Speed1")) { speed = 1; } else if (Input.GetButtonDown("Speed2")) { speed = 2; } else if (Input.GetButtonDown("Speed3")) { speed = 3; } else if (Input.GetButtonDown("Speed")) { float axisSpeed = Input.GetAxis("Speed"); if (axisSpeed > 0) { speed++; } else if (axisSpeed < 0) { speed--; } } if (speed > 0) { elapsed += speedArray[speed - 1]; if (elapsed > maxElapsed) { elapsed = 0; time += 1; world.tic(); if (onTic != null) { onTic(); } // MAIN LOOP } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { // This is a quick check for referrer server name against host server // For best security practice in a deployed application, an authenticating mechanism should be in placed. // Image should only be rendered for authenticated users only. // set return type to png image format Response.ContentType = "image/png"; string xValues, yValues, chartType, print; bool boolPrint; // Get input parameters from query string chartType = Request.QueryString["chartType"]; xValues = Request.QueryString["xValues"]; yValues = Request.QueryString["yValues"]; print = Request.QueryString["Print"]; if (chartType == null) { chartType = string.Empty; } // check for printing option if (print == null) { boolPrint = false; } else { try { boolPrint = Convert.ToBoolean(print); } catch { boolPrint = false; } } if (xValues != null && yValues != null) { Color bgColor; if (boolPrint) { bgColor = Color.White; } else { bgColor = Color.White; } Bitmap StockBitMap; MemoryStream memStream = new MemoryStream(); switch (chartType) { case "bar": BarGraph bar = new BarGraph(bgColor); bar.VerticalLabel = string.Empty; bar.VerticalTickCount = 5; bar.ShowLegend = false; bar.ShowData = false; bar.Height = 400; bar.Width = 700; bar.CollectDataPoints(xValues.Split("|".ToCharArray()), yValues.Split("|".ToCharArray())); StockBitMap = bar.Draw(); break; default: PieChart pc = new PieChart(bgColor); pc.CollectDataPoints(xValues.Split("|".ToCharArray()), yValues.Split("|".ToCharArray())); StockBitMap = pc.Draw(); break; } // Render BitMap Stream Back To Client StockBitMap.Save(memStream, ImageFormat.Png); memStream.WriteTo(Response.OutputStream); } }
//------------------------------------------------------------------------- private void InitialiseForms() { _barGraph = new BarGraph(_infoCollection); }
public UserRatings() { Children = new Drawable[] { header = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "User Rating", TextSize = 13, }, ratingsBar = new Bar { RelativeSizeAxes = Axes.X, Height = 5, Margin = new MarginPadding { Top = 5 }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new[] { negativeRatings = new OsuSpriteText { Text = "0", TextSize = 13, }, positiveRatings = new OsuSpriteText { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Text = @"0", TextSize = 13, }, }, }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "Rating Spread", TextSize = 13, Margin = new MarginPadding { Top = 10, Bottom = 5 }, }, }, }, graphContainer = new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, Child = graph = new BarGraph { RelativeSizeAxes = Axes.Both, }, }, }; }
public Mainclass GetPerformancReport(string batch, long type) { DataTable dt = new DataTable(); dt = ToDataTable(_context.Sp_GetPerformancePWithParamRepots(batch, type).ToList()); List <BarGraph> ss = new List <BarGraph>(); Mainclass mn = new Mainclass(); if (dt.Rows.Count != 0) { DataView view = new DataView(dt); string[] sss; DataTable distinctValues = view.ToTable(true, "ParameterName"); sss = new string[distinctValues.Rows.Count]; for (int q = 0; q < distinctValues.Rows.Count; q++) { sss[q] = (distinctValues.Rows[q]["ParameterName"]).ToString(); mn.labels = sss; } Array.Sort(mn.labels, StringComparer.InvariantCulture); } for (int i = 0; i < dt.Rows.Count; i++) { BarGraph bar = new BarGraph(); if (mn.datasets == null) { bar.label = (dt.Rows[i]["BatchName"]).ToString(); bar.backgroundColor = "#FF6000"; var strExpr = "Id =" + Convert.ToInt32(dt.Rows[i]["Id"]); dt.DefaultView.RowFilter = strExpr; decimal[] sss; DataTable dts = (dt.DefaultView).ToTable(); sss = new decimal[dts.Rows.Count]; foreach (var p in mn.labels) { for (int q = 0; q < dts.Rows.Count; q++) { if (Convert.ToString(dts.Rows[q]["ParameterName"]) == p) { sss[q] = Convert.ToDecimal(dts.Rows[q]["Result"]); bar.data = sss; } } } ss.Add(bar); mn.datasets = ss; } else { string djfkjd = (dt.Rows[i]["BatchName"]).ToString(); List <BarGraph> ssss = (from s in mn.datasets where s.label == (dt.Rows[i]["BatchName"]).ToString() select s).ToList(); if (ssss.Count == 0) { bar.label = (dt.Rows[i]["BatchName"]).ToString(); if (ssss.Count == 2) { bar.backgroundColor = "#00ffad"; } else if (ssss.Count == 3) { bar.backgroundColor = "#00BDC9"; } var strExpr = "Id =" + Convert.ToInt32(dt.Rows[i]["Id"]); dt.DefaultView.RowFilter = strExpr; decimal[] sss; DataTable dts = (dt.DefaultView).ToTable(); sss = new decimal[dts.Rows.Count]; foreach (var p in mn.labels) { for (int q = 0; q < dts.Rows.Count; q++) { if (Convert.ToString(dts.Rows[q]["ParameterName"]) == p) { sss[q] = Convert.ToDecimal(dts.Rows[q]["Result"]); bar.data = sss; } } } ss.Add(bar); mn.datasets = ss; } } } if (mn.datasets != null) { if (mn.datasets.Count == 3) { mn.datasets[2].backgroundColor = "#a1db32"; } } return(mn); }
/// <summary> /// Load a game map for this view /// </summary> /// <param name="newMap">Map object</param> public void loadMap(KTYD.Model.Map newMap) { gameMap = newMap; //Load barGraphs for (int i = 1; i < gameMap.PlayerEntities.Count() + 1; i++) { BarGraph b1; if (i >= 3) { b1 = new BarGraph(new Vector2(100 * i - 50, 60), 200, 2); } else { b1 = new BarGraph(new Vector2(100 * i - 50, 10), 200, 2); } healthBars.Add(b1); } }
// Use this for initialization void Start() { bg_parent = transform.parent.GetComponent <BarGraph>(); transform.localScale = new Vector3(bg_parent.Settings.BarWidth, 0, bg_parent.Settings.BarDepth); }
private void GenerateGraphs(bool newEcosystem) { string title = ( referenceAttemptIdx == Constants.ID_NOT_SET ? "Initial config" : String.Format ("Attempt #{0}", referenceAttemptIdx + 1) ); //hide 0 start from user CSVObject graph1CSV = (referenceAttemptIdx == Constants.ID_NOT_SET) ? ecosystemList [ecosystem_idx].csv_default_object : attemptList [referenceAttemptIdx].csv_object; if (newEcosystem) { //destroy prior bargraph if it exists //Note: barGraph is regenerated when requested if (barGraph != null) { Destroy (barGraph); barGraph = null; } GenerateFoodWeb (); graphs = new GraphsCompare ( graph1CSV, ecosystemList [ecosystem_idx].csv_target_object, leftGraph, topGraph, widthGraph, heightGraph, title, "Target Graph", ecosystemList [ecosystem_idx].timesteps, foodWeb, manager ); } else { graphs.UpdateGraph1Data (graph1CSV, title); } }
// Use this for initialization void Start() { bg_parent = transform.parent.GetComponent<BarGraph>(); transform.localScale = new Vector3(bg_parent.Settings.BarWidth, 0, bg_parent.Settings.BarDepth); }
private Image GetBarGraph() { RandomUtil ru = new RandomUtil(); BarGraph bg = new BarGraph(this.Size); bg.Color = Color.White; bg.ColorGradient = Color.Orange; Legend legend = new Legend(this.Width, 70); legend.Text = String.Empty; bg.Text = _displayString + " Total: " + _totalComponents.ToString(); ICollection keys = _componentInfoTable.Keys; IEnumerator ie = keys.GetEnumerator(); while (ie.MoveNext()) { Type key = (Type)ie.Current; ComponentInfo ci = (ComponentInfo)_componentInfoTable[key]; BarSlice bs = new BarSlice(ci.Count, ci.Color); bg.BarSliceCollection.Add(bs); LegendEntry le = new LegendEntry(ci.Color, ci.Type.Name.ToString().Trim()); legend.LegendEntryCollection.Add(le); } return GraphRenderer.DrawGraphAndLegend(bg, legend, this.Size); }
private void renderGraph() { var geometry = hgd.Geometry; title.text = hgd.Title; xAxis.text = hgd.Aesthetics["x"]; yAxis.text = hgd.Aesthetics["y"]; zAxis.text = hgd.Aesthetics["z"]; this.SetMsgText("Rendering...", true, statusObj); // initialize plot if (geometry == "point") { var colorIsCategorical = hgd.Mappings.ContainsKey(hgd.Aesthetics["color"]); legendText.text = ScatterPlot.Render(gameObject, hgd.GetData("x"), hgd.GetData("y"), hgd.GetData("z"), hgd.GetData("color"), hgd.Aesthetics["color"], colorIsCategorical ? hgd.Mappings[hgd.Aesthetics["color"]] : null); } if (geometry == "bar") { //int m = 50; //int n = 50; //var x = new float[n * m]; //var y = new float[n * m]; //var z = new float[n * m]; //for (int i = 0; i < n; i++) //{ // for (int j = 0; j < m; j++) // { // x[i + n * j] = i; // y[i + n * j] = j; // var X = 7f * (float)((2.0 * i - n) / n); // var Y = 7f * (float)((2.0 * j - m) / m); // z[i + n * j] = 0.5f * (float)(Math.Sin(X + Y) + Math.Sin(X - Y)); // } //} BarGraph.Render(gameObject, hgd.GetData("x"), hgd.GetData("y"), hgd.GetData("z")); } if (geometry == "surface") { //title.text = "Surface Chart"; //int m = 50; //int n = 50; //var x = new float[n * m]; //var y = new float[n * m]; //var z = new float[n * m]; //for (int i = 0; i < n; i++) //{ // for (int j = 0; j < m; j++) // { // x[i + n * j] = i; // y[i + n * j] = j; // var X = 7f * (float)((2.0 * i - n) / n); // var Y = 7f * (float)((2.0 * j - m) / m); // z[i + n * j] = 0.5f * (float)(Math.Sin(X + Y) + Math.Sin(X - Y)); // } //} SurfaceChart.Render(gameObject, hgd.GetData("x"), hgd.GetData("y"), hgd.GetData("z")); } if (geometry == "radartube") { title.text = "Radar Tube"; // From Kaggle bikeshare competition. // Schema is: "year + month","temp","humidity","windspeed","casual","registered" // For each year/month (from Jan 2011 - Dec 2012) gives median value for each other variable. data = new float[, ] { { 0f, 0.183673469387755f, 0.51f, 0.228047490302104f, 2f, 43f }, { 1f, 0.224489795918367f, 0.495f, 0.263195015869284f, 4f, 52.5f }, { 2f, 0.326530612244898f, 0.565f, 0.263195015869284f, 9f, 56f }, { 3f, 0.408163265306122f, 0.67f, 0.263195015869284f, 12f, 65f }, { 4f, 0.510204081632653f, 0.77f, 0.228047490302104f, 27f, 120f }, { 5f, 0.673469387755102f, 0.58f, 0.193017514987657f, 32f, 134.5f }, { 6f, 0.714285714285714f, 0.61f, 0.193017514987657f, 39f, 123.5f }, { 7f, 0.714285714285714f, 0.62f, 0.228047490302104f, 32f, 115.5f }, { 8f, 0.612244897959184f, 0.73f, 0.193017514987657f, 23f, 115f }, { 9f, 0.510204081632653f, 0.76f, 0.157869989420477f, 20f, 115f }, { 10f, 0.36734693877551f, 0.63f, 0.193017514987657f, 12f, 114.5f }, { 11f, 0.285714285714286f, 0.625f, 0.193017514987657f, 7f, 101f }, { 12f, 0.244897959183673f, 0.51f, 0.263195015869284f, 6f, 88f }, { 13f, 0.285714285714286f, 0.56f, 0.193017514987657f, 6f, 107f }, { 14f, 0.428571428571429f, 0.55f, 0.228047490302104f, 16f, 144f }, { 15f, 0.469387755102041f, 0.43f, 0.263195015869284f, 34f, 165f }, { 16f, 0.571428571428572f, 0.675f, 0.193017514987657f, 37f, 181.5f }, { 17f, 0.612244897959184f, 0.585f, 0.228047490302104f, 45f, 193f }, { 18f, 0.755102040816326f, 0.555f, 0.157869989420477f, 49f, 182f }, { 19f, 0.714285714285714f, 0.66f, 0.193017514987657f, 53f, 183.5f }, { 20f, 0.653061224489796f, 0.7f, 0.193017514987657f, 34f, 190f }, { 21f, 0.510204081632653f, 0.69f, 0.193017514987657f, 27f, 197f }, { 22f, 0.326530612244898f, 0.56f, 0.228047490302104f, 17f, 174f }, { 23f, 0.346938775510204f, 0.75f, 0.157869989420477f, 13f, 169f } }; var t = new float[data.GetLength(0)]; var R = new float[data.GetLength(0), data.GetLength(1) - 1]; for (int i = 0; i < data.GetLength(0); i++) { t[i] = data[i, 0]; for (int j = 1; j < data.GetLength(1); j++) { R[i, j - 1] = data[i, j]; } } RadarTube.Render(gameObject, t, R); } this.ClearMsgText(statusObj); }