Beispiel #1
0
 public GraphSection(string id, int delayInMs, List <Coordinates> coordinatesSet, Axis x, Axis y, string caption, GraphTypeEnum graphType) : base(id, SectionTypeEnum.Graph, delayInMs)
 {
     this.CoordinatesSet = coordinatesSet;
     this.X         = x;
     this.Y         = y;
     this.Caption   = caption;
     this.GraphType = graphType;
 }
        public void Unserialize(GMDataReader reader, bool includeName)
        {
            if (includeName)
            {
                Name = reader.ReadStringPointerObject();
            }
            GraphType = (GraphTypeEnum)reader.ReadUInt32();

            Channels = new GMList <Channel>();
            Channels.Unserialize(reader);
        }
Beispiel #3
0
 public void SetInsideControl(GraphTypeEnum gt)
 {
     graphType = gt;
     if (Globals.G.mainForm.currentControlIndex == GraphTypeEnum.None)
     {
         toolStripButton1.Text = "Maximize Graph";
     }
     else
     {
         toolStripButton1.Text = "Tile All Graphs";
     }
 }
        override protected internal void _Open()
        {
            short  sharing = 0;
            short  maxSubscriberSharing = 0;
            string reportXml            = "";
            string openNodesXml         = "";
            string schemaXml            = "";
            byte   graphType            = 0;
            int    graphOptions         = 0;

            //bool fakeIsSelected=false;

            FI.Common.DataAccess.IOlapReportsDA dacObj = DataAccessFactory.Instance.GetOlapReportsDA();
            dacObj.ReadReport(_owner.ID, this.ID,
                              ref this._parentReportId,
                              ref this._name,
                              ref this._description,
                              ref sharing,
                              ref maxSubscriberSharing,
                              ref this._isSelected,   //ref fakeIsSelected,
                              ref graphType,
                              ref _graphTheme,
                              ref graphOptions,
                              ref _graphWidth,
                              ref _graphHeight,
                              ref _graphNum1,
                              ref Schema.Server,
                              ref Schema.Database,
                              ref Schema.Cube,
                              ref reportXml,
                              ref schemaXml,
                              ref openNodesXml,
                              ref _undoStateCount,
                              ref _redoStateCount);

            this._sharing = (Report.SharingEnum)sharing;
            this._maxSubscriberSharing = (Report.SharingEnum)maxSubscriberSharing;
            this._graphType            = (GraphTypeEnum)graphType;
            this._graphOptions         = (GraphOptionsEnum)graphOptions;

            //dacObj.UpdateReportHeader(_owner.ID , this.ID, this._parentReportId , (byte)this.SharingStatus , this.Name , this.Description , this.IsSelected , 0, "");

            this.Schema.OpenNodesFromXml(openNodesXml);             // before other loads, cause then other loads will fetch members depending on open nodes
            LoadFromXmlSchema(schemaXml);
            LoadFromXml(reportXml);
        }
Beispiel #5
0
        private void SetupGraph(GraphConfiguration configuration)
        {
            this._graphType = configuration.GraphType;

            // set background color for the graph as transparent
            this.chart.BackColor = Color.Transparent;

            this.chart.ChartAreas[0].BorderWidth = configuration.AxisXConfiguration.MajorGrid.Enabled
                                ? configuration.AxisXConfiguration.MajorGrid.LineWidth
                                : 0;

            this.chart.ChartAreas[0].BorderColor = configuration.AxisXConfiguration.MajorGrid.LineColor;

            this.chart.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid;

            switch (configuration.GraphType.Value)
            {
            case GraphTypeEnum.GanttDiagram:
                this.chart.ChartAreas[0].AxisX.Enabled = AxisEnabled.False;
                SetupAxisX(this.chart.ChartAreas[0].AxisY, configuration);
                this.chart.FormatNumber += chart_FormatNumber;
                break;

            default:
                SetupAxisX(this.chart.ChartAreas[0].AxisX, configuration);
                SetupAxisY(configuration.AxisYConfiguration);
                break;
            }

            this.chart.Legends[0].Enabled   = configuration.LegendConfiguration.Enabled;
            this.chart.Legends[0].Docking   = configuration.LegendConfiguration.Docking;
            this.chart.Legends[0].Alignment = configuration.LegendConfiguration.Alignment;

            if (configuration.LegendConfiguration.GraphicOverlap)
            {
                // this.chart.Legends[0].Alignment = StringAlignment.Center;
                // this.chart.Legends[0].Docking = Docking.Top;
                this.chart.Legends[0].DockedToChartArea = this.chart.ChartAreas[0].Name;
            }

            SetupChartMargin(configuration);
        }
Beispiel #6
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Graph" /> class.
        /// </summary>
        /// <param name="graphTypeEnum">The graph type enum.</param>
        /// <param name="numberOfNodes">The number of nodes.</param>
        public Graph(GraphTypeEnum graphTypeEnum, int numberOfNodes)
        {
            NumberOfNodes = numberOfNodes;
            Random random = new Random();
            int    count  = 0;

            for (int i = 0; i < numberOfNodes; i++)
            {
                Nodes.Add(new Node(i));
            }


            switch (graphTypeEnum)
            {
            case GraphTypeEnum.Empty:
                AdjacencyLists = Enumerable.Range(0, NumberOfNodes).Select(l => new List <Node>()).ToList();
                break;

            case GraphTypeEnum.Complete:
                AdjacencyLists = Enumerable.Range(0, NumberOfNodes).Select(l => new List <Node>()).ToList();

                foreach (List <Node> adjacencyList in AdjacencyLists)
                {
                    for (int i = 0; i < NumberOfNodes; i++)
                    {
                        adjacencyList.Add(Nodes.GetNodeByValue(i));
                    }

                    adjacencyList.RemoveAll(n => n.Value == count);
                    count++;
                }

                break;

            case GraphTypeEnum.Random:
                AdjacencyLists = Enumerable.Range(0, NumberOfNodes).Select(l => new List <Node>()).ToList();
                List <List <Node> > auxiliarAdjacencyLists = new List <List <Node> >();
                foreach (List <Node> adjacencyList in AdjacencyLists)
                {
                    int length = random.Next(NumberOfNodes);
                    for (int i = 0; i < length; i++)
                    {
                        adjacencyList.Add(Nodes.GetNodeByValue(random.Next(NumberOfNodes)));
                    }

                    adjacencyList.RemoveAll(n => n.Value == count);

                    auxiliarAdjacencyLists.Add(adjacencyList.GroupBy(node => node.Value)
                                               .Select(group => group.First())
                                               .ToList());                  //Distinct().ToList());

                    count++;
                }

                AdjacencyLists = auxiliarAdjacencyLists;

                count = 0;
                foreach (List <Node> adjacencyList in AdjacencyLists)
                {
                    foreach (Node node in adjacencyList)
                    {
                        if (!AdjacencyLists[node.Value].Contains(Nodes.GetNodeByValue(count)))
                        {
                            AdjacencyLists[node.Value].Add(Nodes.GetNodeByValue(count));
                        }
                    }

                    count++;
                }

                List <List <Node> > finalLists = new List <List <Node> >();
                foreach (List <Node> adjacencyList in AdjacencyLists)
                {
                    finalLists.Add(adjacencyList.OrderBy(node => node.Value).ToList());
                }

                AdjacencyLists = finalLists;

                break;

            default:
                AdjacencyLists = Enumerable.Range(0, NumberOfNodes).Select(l => new List <Node>()).ToList();
                break;
            }

            GetEdges();
        }
		private void SetupGraph(GraphConfiguration configuration)
		{
			this._graphType = configuration.GraphType;

			// set background color for the graph as transparent
			this.chart.BackColor = Color.Transparent;

			this.chart.ChartAreas[0].BorderWidth = configuration.AxisXConfiguration.MajorGrid.Enabled
				? configuration.AxisXConfiguration.MajorGrid.LineWidth
				: 0;

			this.chart.ChartAreas[0].BorderColor = configuration.AxisXConfiguration.MajorGrid.LineColor;

			this.chart.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid;

			switch (configuration.GraphType.Value)
			{
				case GraphTypeEnum.GanttDiagram:
					this.chart.ChartAreas[0].AxisX.Enabled = AxisEnabled.False;
					SetupAxisX(this.chart.ChartAreas[0].AxisY, configuration);
					this.chart.FormatNumber += chart_FormatNumber;
					break;

				default:
					SetupAxisX(this.chart.ChartAreas[0].AxisX, configuration);
					SetupAxisY(configuration.AxisYConfiguration);
					break;
			}

			this.chart.Legends[0].Enabled   = configuration.LegendConfiguration.Enabled;
			this.chart.Legends[0].Docking   = configuration.LegendConfiguration.Docking;
			this.chart.Legends[0].Alignment = configuration.LegendConfiguration.Alignment;

			if (configuration.LegendConfiguration.GraphicOverlap)
			{
				// this.chart.Legends[0].Alignment = StringAlignment.Center;
				// this.chart.Legends[0].Docking = Docking.Top;
				this.chart.Legends[0].DockedToChartArea = this.chart.ChartAreas[0].Name;
			}

			SetupChartMargin(configuration);
		}