private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            var name = checkedListBox1.Items[e.Index] as string;

            if (e.NewValue == CheckState.Checked)
            {
                GraphControl  graphControl = GraphControl.Create();
                SortAlgorithm sa           = _app.CreateSortAlgorithm(name);
                graphControl.SortAlgorithm     = sa;
                graphControl.VisualizationTick = _visualizationTick;
                _app.AddGraph(graphControl);
                mainFlowLayoutPanel.Controls.Add(graphControl);
            }
            else if (e.NewValue == CheckState.Unchecked)
            {
                var gc = _app.FindGraph(name: name);
                _app.RemoveGraph(gc);
                var zcontrol = gc as ZedGraphControl;
                mainFlowLayoutPanel.Controls.Remove(zcontrol);
            }
            FitGraphs();
        }
Exemplo n.º 2
0
        public static GraphControl Create()
        {
            GraphControl z = new GraphControl()
            {
                Dock = DockStyle.Fill
            };
            var p  = z.GraphPane;
            var po = new GraphPane();
            var c  = po.AddCurve(null, new PointPairList(), Color.Black);

            c.Symbol.Type            = SymbolType.None;
            po.XAxis.Type            = AxisType.Linear;
            po.XAxis.Scale.IsVisible = false;
            po.XAxis.Title.IsVisible = false;
            po.XAxis.Scale.MaxAuto   = false;
            po.XAxis.Scale.Max       = SortingAlgorithm.BigOXMax;
            po.YAxis.Type            = AxisType.Linear;
            po.YAxis.Scale.IsVisible = false;
            po.YAxis.Title.IsVisible = false;
            po.YAxis.Scale.MaxAuto   = false;
            po.YAxis.Scale.Max       = SortingAlgorithm.BigOYMax;
            z.MasterPane.Add(po);

            var cbar = p.AddBar("compare", new PointPairList(), Color.DarkOrange);

            cbar.Bar.Fill.Type        = FillType.Solid;
            cbar.Bar.Border.IsVisible = false;

            var sbar = p.AddBar("swap", new PointPairList(), Color.Red);

            sbar.Bar.Fill.Type        = FillType.Solid;
            sbar.Bar.Border.IsVisible = false;

            var setbar = p.AddBar("working-set", new PointPairList(), Color.Blue);

            setbar.Bar.Fill.Type        = FillType.Solid;
            setbar.Bar.Border.IsVisible = false;

            var bar = p.AddBar("Data", new PointPairList(), Color.LightBlue);

            bar.Bar.Fill.Type        = FillType.Solid;
            bar.Bar.Border.IsVisible = false;

            p.Title.IsVisible       = true;
            p.Legend.IsVisible      = false;
            p.XAxis.Title.IsVisible = false;
            p.XAxis.Type            = AxisType.Linear;
            p.XAxis.Scale.Min       = 0;
            p.XAxis.MinorTic.Size   = 0;
            p.YAxis.Title.IsVisible = false;
            p.YAxis.Type            = AxisType.Linear;
            p.YAxis.Scale.Max       = App.YMax;
            p.BarSettings.Type      = BarType.Overlay;
            z.IsEnableVZoom         = false;
            z.IsEnableZoom          = false;
            z.Dock = DockStyle.None;

            // Layout the GraphPanes using a default Pane Layout
            using (Graphics g = z.CreateGraphics())
            {
                z.MasterPane.SetLayout(g, false, new int[] { 1, 1 }, new float[] { 2f, 1f });
            }

            return(z);
        }