Beispiel #1
0
    /// <summary>
    /// 更新图表方法
    /// </summary>
    public async Task Update(ChartAction action)
    {
        if (OnInitAsync != null)
        {
            var ds = await OnInitAsync();

            await Interop.InvokeVoidAsync(this, ChartElement, "bb_chart", nameof(Completed), ds, action.ToDescriptionString(), ChartType.ToDescriptionString(), Angle);

            if (OnAfterUpdateAsync != null)
            {
                await OnAfterUpdateAsync(action);
            }
        }
    }
Beispiel #2
0
        /// <summary>
        /// 设置属性
        /// </summary>
        protected override void SetAttributes()
        {
            ChartAction control = this.ControlHost.Content as ChartAction;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/Charting/Action");
            if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name))
            {
                this.HtmlWriter.AddAttribute("id", this.ControlHost.Name);
            }
            this.HtmlWriter.AddAttribute("class", "action");
            if (control.ActionType != EChartActionType.None)
            {
                this.HtmlWriter.AddAttribute("type", control.ActionType.ToString());
            }
            if (control.ActionAxis == EChartAxis.xAxis)
            {
                this.HtmlWriter.AddAttribute("axis", "x");
            }
            else if (control.ActionAxis == EChartAxis.yAxis)
            {
                this.HtmlWriter.AddAttribute("axis", "y");
            }
            if (control.MaxScale != null)
            {
                this.HtmlWriter.AddAttribute("maxScale", control.MaxScale.ToString());
            }
            if (control.ScaleFactor != null)
            {
                this.HtmlWriter.AddAttribute("scaleFactor", control.ScaleFactor.ToString());
            }
            if (control.Shift != null)
            {
                this.HtmlWriter.AddAttribute("shift", control.Shift.ToString());
            }

            base.SetAttributes();
        }
Beispiel #3
0
 private Task OnAfterUpdate(ChartAction action)
 {
     Logger.Log($"Pie 图更新数据操作完毕 -- {action}");
     return(Task.CompletedTask);
 }
Beispiel #4
0
 public int DoGUI(ChartType type, int selectedFrame, ChartData cdata, ProfilerArea area, bool active, GUIContent icon, out ChartAction action)
 {
     action = ChartAction.None;
     if (cdata != null)
     {
         int numberOfFrames = cdata.NumberOfFrames;
         if (ms_Styles == null)
         {
             ms_Styles = new Styles();
         }
         int controlID             = GUIUtility.GetControlID(s_ChartHash, FocusType.Keyboard);
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(120f) };
         Rect rect       = GUILayoutUtility.GetRect(GUIContent.none, ms_Styles.background, options);
         Rect chartFrame = rect;
         chartFrame.x     += 170f;
         chartFrame.width -= 170f;
         Event current = Event.current;
         if ((current.GetTypeForControl(controlID) == EventType.MouseDown) && rect.Contains(current.mousePosition))
         {
             action = ChartAction.Activated;
         }
         if (this.m_DragItemIndex == -1)
         {
             selectedFrame = this.HandleFrameSelectionEvents(selectedFrame, controlID, chartFrame, cdata, numberOfFrames);
         }
         Rect position = chartFrame;
         position.x    -= 170f;
         position.width = 170f;
         GUI.Label(new Rect(position.x, position.y, position.width, 20f), GUIContent.Temp(string.Empty, icon.tooltip));
         if (current.type == EventType.Repaint)
         {
             ms_Styles.rightPane.Draw(chartFrame, false, false, active, false);
             ms_Styles.leftPane.Draw(position, EditorGUIUtility.TempContent(icon.text), false, false, active, false);
             if (this.m_NotSupportedWarning == null)
             {
                 chartFrame.height--;
                 if (type == ChartType.StackedFill)
                 {
                     this.DrawChartStacked(selectedFrame, cdata, chartFrame);
                 }
                 else
                 {
                     this.DrawChartLine(selectedFrame, cdata, chartFrame);
                 }
             }
             else
             {
                 Rect rect4 = chartFrame;
                 rect4.x += 56.1f;
                 rect4.y += 43f;
                 GUI.Label(rect4, this.m_NotSupportedWarning, EditorStyles.boldLabel);
             }
             position.x += 10f;
             position.y += 10f;
             GUIStyle.none.Draw(position, EditorGUIUtility.TempContent(icon.image), false, false, false, false);
             position.x += 40f;
             this.DrawLabelDragger(type, position, cdata);
         }
         else
         {
             position.y += 10f;
             this.LabelDraggerDrag(controlID, type, cdata, position, active);
         }
         if (area == ProfilerArea.GPU)
         {
             GUI.Label(new Rect((rect.x + 170f) - ms_Styles.performanceWarning.image.width, (rect.yMax - ms_Styles.performanceWarning.image.height) - 2f, (float)ms_Styles.performanceWarning.image.width, (float)ms_Styles.performanceWarning.image.height), ms_Styles.performanceWarning);
         }
         if (GUI.Button(new Rect(((rect.x + 170f) - 13f) - 2f, rect.y + 2f, 13f, 13f), GUIContent.none, ms_Styles.closeButton))
         {
             action = ChartAction.Closed;
         }
     }
     return(selectedFrame);
 }
 private Task OnAfterUpdate(ChartAction action) => InvokeAsync(() => Logger.Log($"Bar 图更新数据操作完毕 -- {action}"));
Beispiel #6
0
 public int DoGUI(ChartType type, int selectedFrame, ChartData cdata, ProfilerArea area, bool active, GUIContent icon, out ChartAction action)
 {
     action = ChartAction.None;
     if (cdata != null)
     {
         int numberOfFrames = cdata.NumberOfFrames;
         if (ms_Styles == null)
         {
             ms_Styles = new Styles();
         }
         int controlID = GUIUtility.GetControlID(s_ChartHash, FocusType.Keyboard);
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(120f) };
         Rect rect = GUILayoutUtility.GetRect(GUIContent.none, ms_Styles.background, options);
         Rect chartFrame = rect;
         chartFrame.x += 170f;
         chartFrame.width -= 170f;
         Event current = Event.current;
         if ((current.GetTypeForControl(controlID) == EventType.MouseDown) && rect.Contains(current.mousePosition))
         {
             action = ChartAction.Activated;
         }
         if (this.m_DragItemIndex == -1)
         {
             selectedFrame = this.HandleFrameSelectionEvents(selectedFrame, controlID, chartFrame, cdata, numberOfFrames);
         }
         Rect position = chartFrame;
         position.x -= 170f;
         position.width = 170f;
         GUI.Label(new Rect(position.x, position.y, position.width, 20f), GUIContent.Temp(string.Empty, icon.tooltip));
         if (current.type == EventType.Repaint)
         {
             ms_Styles.rightPane.Draw(chartFrame, false, false, active, false);
             ms_Styles.leftPane.Draw(position, EditorGUIUtility.TempContent(icon.text), false, false, active, false);
             if (this.m_NotSupportedWarning == null)
             {
                 chartFrame.height--;
                 if (type == ChartType.StackedFill)
                 {
                     this.DrawChartStacked(selectedFrame, cdata, chartFrame);
                 }
                 else
                 {
                     this.DrawChartLine(selectedFrame, cdata, chartFrame);
                 }
             }
             else
             {
                 Rect rect4 = chartFrame;
                 rect4.x += 56.1f;
                 rect4.y += 43f;
                 GUI.Label(rect4, this.m_NotSupportedWarning, EditorStyles.boldLabel);
             }
             position.x += 10f;
             position.y += 10f;
             GUIStyle.none.Draw(position, EditorGUIUtility.TempContent(icon.image), false, false, false, false);
             position.x += 40f;
             this.DrawLabelDragger(type, position, cdata);
         }
         else
         {
             position.y += 10f;
             this.LabelDraggerDrag(controlID, type, cdata, position, active);
         }
         if (area == ProfilerArea.GPU)
         {
             GUI.Label(new Rect((rect.x + 170f) - ms_Styles.performanceWarning.image.width, (rect.yMax - ms_Styles.performanceWarning.image.height) - 2f, (float) ms_Styles.performanceWarning.image.width, (float) ms_Styles.performanceWarning.image.height), ms_Styles.performanceWarning);
         }
         if (GUI.Button(new Rect(((rect.x + 170f) - 13f) - 2f, rect.y + 2f, 13f, 13f), GUIContent.none, ms_Styles.closeButton))
         {
             action = ChartAction.Closed;
         }
     }
     return selectedFrame;
 }