private void DrawMarkerLabels(ChartViewData cdata, Rect r, EventMarker[] markers, string[] markerNames) { Color cc = GUI.contentColor; int length = cdata.GetDataDomainLength(); float frameWidth = r.width / length; const int labelPositions = 12; int maxCount = (int)(r.height / labelPositions); if (maxCount != 0) { Dictionary <int, int> markerLastFrame = new Dictionary <int, int>(); for (int s = 0; s < markers.Length; ++s) { int lframe; int frame = markers[s].frame; if (!markerLastFrame.TryGetValue(markers[s].nameOffset, out lframe) || lframe != frame - 1 || lframe < cdata.chartDomainOffset) { frame -= cdata.chartDomainOffset; if (frame >= 0) { float xpos = r.x + frameWidth * frame; // color the label slightly (half way between line color and white) Color color = ProfilerColors.chartAreaColors[(uint)m_Series.Length % ProfilerColors.chartAreaColors.Length]; GUI.contentColor = (color + Color.white) * 0.5f; const float offset = -1; Chart.DoLabel(xpos + offset, r.y + r.height - (s % maxCount + 1) * labelPositions, markerNames[s], 0); } } markerLastFrame[markers[s].nameOffset] = markers[s].frame; } } GUI.contentColor = cc; }
private void DrawMarkerLabels(ChartViewData cdata, Rect r, EventMarker[] markers, string[] markerNames) { Color contentColor = GUI.contentColor; Vector2 dataDomain = cdata.GetDataDomain(); int num = (int)(dataDomain.y - dataDomain.x); float num2 = r.width / (float)num; int num3 = (int)(r.height / 12f); if (num3 != 0) { Dictionary <int, int> dictionary = new Dictionary <int, int>(); for (int i = 0; i < markers.Length; i++) { int num4 = markers[i].frame; int num5; if (!dictionary.TryGetValue(markers[i].nameOffset, out num5) || num5 != num4 - 1 || num5 < cdata.chartDomainOffset) { num4 -= cdata.chartDomainOffset; if (num4 >= 0) { float num6 = r.x + num2 * (float)num4; Color a = ProfilerColors.chartAreaColors[(int)(checked ((IntPtr)(unchecked ((ulong)this.m_Series.Length % (ulong)((long)ProfilerColors.chartAreaColors.Length)))))]; GUI.contentColor = (a + Color.white) * 0.5f; Chart.DoLabel(num6 + -1f, r.y + r.height - (float)((i % num3 + 1) * 12), markerNames[i], 0f); } } dictionary[markers[i].nameOffset] = markers[i].frame; } } GUI.contentColor = contentColor; }
private static void UpdateChartGrid(float timeMax, ChartViewData data) { if (timeMax < 1500) { data.SetGrid(new float[] { 1000, 250, 100 }, new[] { "1ms (1000FPS)", "0.25ms (4000FPS)", "0.1ms (10000FPS)" }); } else if (timeMax < 10000) { data.SetGrid(new float[] { 8333, 4000, 1000 }, new[] { "8ms (120FPS)", "4ms (250FPS)", "1ms (1000FPS)" }); } else if (timeMax < 30000) { data.SetGrid(new float[] { 16667, 10000, 5000 }, new[] { "16ms (60FPS)", "10ms (100FPS)", "5ms (200FPS)" }); } else if (timeMax < 100000) { data.SetGrid(new float[] { 66667, 33333, 16667 }, new[] { "66ms (15FPS)", "33ms (30FPS)", "16ms (60FPS)" }); } else { data.SetGrid(new float[] { 500000, 200000, 66667 }, new[] { "500ms (2FPS)", "200ms (5FPS)", "66ms (15FPS)" }); } }
protected override Rect DoSeriesList(Rect position, int chartControlID, ChartType chartType, ChartViewData cdata) { Rect elementPosition = base.DoSeriesList(position, chartControlID, chartType, cdata); GUIContent label = EditorGUIUtility.TempContent("Markers"); Color color = ProfilerColors.chartAreaColors[cdata.numSeries % ProfilerColors.chartAreaColors.Length]; DoSeriesToggle(elementPosition, label, ref showMarkers, color, cdata); elementPosition.y += elementPosition.height; return(elementPosition); }
public void UpdateData(ChartViewData data) { //if (args.ItemIndex != _loadIndex) //{ // root.Header = data.title; // return; //} BaseChartView chartView = null; BaseChartView zoomedChartView = null; switch (data.graphType) { case 1: chartView = new DoubleLinearChartView(); //zoomedChartView = new DoubleLinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 2: chartView = new StackBarChartView(); //zoomedChartView = new StackBarChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 3: chartView = new BarChartView(); //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 4: chartView = new StackLinearChartView(); chartView.legendSignatureView.showPercentage = true; //zoomedChartView = new PieChartView(); break; case 5: chartView = new StepChartView(); chartView.legendSignatureView.isTopHourChart = true; //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 6: chartView = new DoubleStepChartView(); //zoomedChartView = new DoubleLinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; default: chartView = new LinearChartView(); //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; } LayoutRoot.Children.Clear(); LayoutRoot.Children.Add(chartView); this.data = data; this.chartView = chartView; this.zoomedChartView = zoomedChartView; if (zoomedChartView != null) { chartView.Tapped += (s, args) => { OnZoomed(); }; chartHeaderView.Click += (s, args) => { ZoomOut(true); }; LayoutRoot.Children.Add(zoomedChartView); zoomedChartView.Visibility = Visibility.Collapsed; } CheckPanel.Children.Clear(); chartView.SetHeader(chartView.legendSignatureView.isTopHourChart ? null : chartHeaderView); chartView.Loaded += (s, args) => { chartView.SetDataPublic(data.chartData); var lines = chartView.GetLines(); if (lines.Count > 1) { foreach (var line in lines) { var check = new FauxCheckBox(); check.Style = BootStrapper.Current.Resources["LineCheckBoxStyle"] as Style; check.Content = line.line.name; check.IsChecked = line.enabled; check.Background = new SolidColorBrush(line.lineColor); check.Margin = new Thickness(12, 0, 0, 12); check.DataContext = line; check.Click += CheckBox_Checked; CheckPanel.Children.Add(check); } CheckPanel.Visibility = Visibility.Visible; } else { CheckPanel.Visibility = Visibility.Collapsed; } if (zoomedChartView == null) { return; } if (data.activeZoom > 0) { chartView.SelectDate(data.activeZoom); ZoomChart(true); } else { ZoomOut(false); //chartView.invalidate(); } }; }