Beispiel #1
0
            private void view_OnHide(object sender, EventArgs e)
            {
                LinkLabel      label = (LinkLabel)((MenuItem)sender).Parent.Tag;
                DataSeriesView view  = (DataSeriesView)label.Tag;

                view.Hidden = !((MenuItem)sender).Checked;
            }
Beispiel #2
0
 private void RaiseOnRemoveView(DataSeriesView view)
 {
     if (OnRemoveView != null)
     {
         OnRemoveView(this, view);
     }
 }
Beispiel #3
0
            private void view_OnRemove(object sender, EventArgs e)
            {
                LinkLabel      label = (LinkLabel)((MenuItem)sender).Parent.Tag;
                DataSeriesView view  = (DataSeriesView)label.Tag;

                _graph.RemoveView(view.Series);
            }
Beispiel #4
0
 private void RaiseOnViewChange(DataSeriesView view)
 {
     if (OnViewChanged != null)
     {
         OnViewChanged(this, view);
     }
 }
Beispiel #5
0
        public void Attach(DataSeriesView view)
        {
            _views.Add(view);

            view.Series.OnMinChanged += new DataSeries.MinMaxChangedDelegate(series_OnMinChanged);
            view.Series.OnMaxChanged += new DataSeries.MinMaxChangedDelegate(series_OnMaxChanged);

            UpdateGlobalMin();
            UpdateGlobalMax();
        }
Beispiel #6
0
 public void RemoveViewLabel(DataSeriesView view)
 {
     foreach (Control c in _graphControlsPanel.Controls)
     {
         if (c.Tag == view)
         {
             c.Click -= viewLabel_Click;
             _graphControlsPanel.Controls.Remove(c);
         }
     }
 }
Beispiel #7
0
            public LinkLabel AddViewLabel(DataSeriesView view)
            {
                LinkLabel label = CreateLinkLabel("\u2588\u2588 " + view.Series.Name, view.LineColor);

                label.Tag    = view;
                label.Click += new EventHandler(viewLabel_Click);

                _graphControlsPanel.Controls.Add(label);

                return(label);
            }
Beispiel #8
0
            private void series_OnCreateGroup(object sender, EventArgs e)
            {
                LinkLabel      label = (LinkLabel)((MenuItem)((MenuItem)sender).Parent).Parent.Tag;
                DataSeriesView view  = (DataSeriesView)label.Tag;

                CreateSeriesGroupForm dlg = new CreateSeriesGroupForm();

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    view.Container.CreateNewGroup(dlg.GroupName, view);
                }
            }
Beispiel #9
0
        private void AddViewHelper(DataSeriesView view)
        {
            view.OnViewChanged += new DataSeriesView.ViewChangeDelegate(view_OnViewChanged);

            view.Series.OnAddPoint        += new DataSeries.AddDataPointDelegate(series_OnAddPoint);
            view.Series.OnNameChanged     += new DataSeries.NameChangedDelegate(series_OnChange);
            view.Series.OnUnitNameChanged += new DataSeries.UnitNameChangedDelegate(series_OnChange);
            view.Series.OnGroupChanged    += new DataSeries.GroupChangedDelegate(series_OnChange);

            _views.AddLast(view);
            RaiseOnAddView(view);
        }
Beispiel #10
0
            private void view_OnChangeColor(object sender, EventArgs e)
            {
                LinkLabel      label = (LinkLabel)((MenuItem)sender).Parent.Tag;
                DataSeriesView view  = (DataSeriesView)label.Tag;

                ColorDialog dlg = new ColorDialog();

                dlg.Color = view.LineColor;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    view.LineColor = dlg.Color;
                    SetLinkLabelColor(label, dlg.Color);
                }
            }
Beispiel #11
0
        public ViewGroup CreateNewGroup(string name, DataSeriesView initialView)
        {
            ViewGroup group = new ViewGroup(name);

            if (initialView != null)
            {
                initialView.Group = group;
            }

            group.OnEmptyGroup += new ViewGroup.EmptyGroupDelegate(group_OnEmptyGroup);
            _groups.Add(group);

            return(group);
        }
Beispiel #12
0
        public void Detach(DataSeriesView view)
        {
            _views.Remove(view);

            view.Series.OnMinChanged -= series_OnMinChanged;
            view.Series.OnMaxChanged -= series_OnMaxChanged;

            UpdateGlobalMin();
            UpdateGlobalMax();

            if (_views.Count == 0)
            {
                RaiseOnEmptyGroup();
            }
        }
Beispiel #13
0
            void viewLabel_Click(object sender, EventArgs e)
            {
                Control        c = (Control)sender;
                DataSeriesView v = (DataSeriesView)c.Tag;

                ContextMenu menu = new ContextMenu();

                menu.Tag = c;

                MenuItem[] groups = new MenuItem[v.Container.Groups.Count + 2];
                string     verb   = v.Group == null ? "Add" : "Move";

                int index = 0;

                foreach (ViewGroup g in v.Container.Groups)
                {
                    if (g != v.Group)
                    {
                        MenuItem item = new MenuItem(verb + " To " + g.Name, new EventHandler(series_OnAddToGroup));
                        item.Tag = g;

                        groups[index++] = item;
                    }
                }

                groups[index++] = new MenuItem("-");
                groups[index++] = new MenuItem(verb + " To New Group...", new EventHandler(series_OnCreateGroup));

                if (v.Group != null)
                {
                    groups[index++] = new MenuItem("Remove From " + v.Group.Name, new EventHandler(series_OnRemoveFromGroup));
                }

                menu.MenuItems.Add(new MenuItem("Grouping", groups));
                menu.MenuItems.Add(new MenuItem("Change Color...", new EventHandler(view_OnChangeColor)));

                MenuItem hidden = new MenuItem("Hidden", new EventHandler(view_OnHide));

                hidden.Checked = v.Hidden;
                menu.MenuItems.Add(hidden);

                menu.MenuItems.Add(new MenuItem("Remove", new EventHandler(view_OnRemove)));

                menu.Show(c, new Point(0, c.Size.Height));
            }
Beispiel #14
0
 void graph_OnViewChanged(Graph graph, DataSeriesView view)
 {
     _graphPanel.Invalidate();
 }
Beispiel #15
0
 void graph_OnRemoveView(Graph graph, DataSeriesView view)
 {
     _graphControls[graph].RemoveViewLabel(view);
     _graphPanel.Invalidate();
 }
Beispiel #16
0
 private void view_OnViewChanged(DataSeriesView view)
 {
     RaiseOnViewChange(view);
 }