예제 #1
0
        private void UpdateChartSettings()
        {
            chart1.BeginInit();

            comboBoxChartType.Enabled = true;
            comboBoxMarks.Enabled     = true;
            checkBoxCloseOnly.Enabled = true;

            // Load default settings except of the chart's size
            defaultViewStyleStream.Seek(0, SeekOrigin.Begin);
            chart1.Serializer.SerializableContent    = "*.*";
            chart1.Serializer.NonSerializableContent = "*.Size";
            chart1.Serializer.Load(defaultViewStyleStream);

            // Set series chart type
            chart1.Series["Price"].ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), comboBoxChartType.Text, true);

            // Set stock chart attributes
            if (comboBoxChartType.Text == "Stock")
            {
                comboBoxMarks.Enabled     = true;
                checkBoxCloseOnly.Enabled = true;
                chart1.Series["Price"]["OpenCloseStyle"] = comboBoxMarks.Text;
                if (checkBoxCloseOnly.Checked)
                {
                    chart1.Series["Price"]["ShowOpenClose"] = "Close";
                }

                chart1.Series["Price"]["PointWidth"] = "1.0";
            }
            else
            {
                chart1.Series["Price"]["PointWidth"] = "0.8";
                comboBoxMarks.Enabled     = false;
                checkBoxCloseOnly.Enabled = false;
            }

            chart1.Series["Volume"]["PointWidth"] = "0.5";

            chart1.EndInit();
        }
예제 #2
0
파일: AreaChart.cs 프로젝트: deweyvm/prod
        private static Chart createChart()
        {
            var chart = new Chart();
            chart.BeginInit();

            chart.BackColor = SystemColors.Control;
            //chart.BorderlineColor = Color.Black;
            //chart.BorderlineDashStyle = ChartDashStyle.Solid;
            //chart.BorderlineWidth = 1;

            var area = createArea();
            chart.ChartAreas.Add(area);

            chart.Size = new Size(380, 150);

            chart.EndInit();
            return chart;
        }
예제 #3
0
        public static void ParseStreamIntoChart( NetworkStream NetworkStream, Chart NetworkChart, string ActorFilter, string PropertyFilter, string RPCFilter )
        {
            var StartTime = DateTime.UtcNow;

            NetworkChart.BeginInit();

            // Reset existing data.
            foreach( var Series in NetworkChart.Series )
            {
                Series.Points.Clear();
            }
            NetworkChart.ResetAutoValues();
            NetworkChart.Invalidate();

            int FrameCounter = 0;
            foreach( PartialNetworkStream RawFrame in NetworkStream.Frames )
            {
                PartialNetworkStream Frame = RawFrame.Filter(ActorFilter,PropertyFilter,RPCFilter);

                if( Frame.EndTime == Frame.StartTime )
                {
                    throw new InvalidOperationException();
                }
                float OneOverDeltaTime = 1 / (Frame.EndTime - Frame.StartTime);

                NetworkChart.Series["ActorCount"].Points.AddXY( FrameCounter, Frame.ActorCount );
                NetworkChart.Series["ActorCountSec"].Points.AddXY(FrameCounter, Frame.ActorCount * OneOverDeltaTime);
                NetworkChart.Series["PropertyCount"].Points.AddXY( FrameCounter, Frame.PropertyCount );
                NetworkChart.Series["PropertyCountSec"].Points.AddXY( FrameCounter, Frame.PropertyCount * OneOverDeltaTime );
                NetworkChart.Series["PropertySize"].Points.AddXY( FrameCounter, Frame.ReplicatedSizeBits / 8 );
                NetworkChart.Series["PropertySizeSec"].Points.AddXY( FrameCounter, Frame.ReplicatedSizeBits / 8 * OneOverDeltaTime );
                NetworkChart.Series["RPCCount"].Points.AddXY( FrameCounter, Frame.RPCCount );
                NetworkChart.Series["RPCCountSec"].Points.AddXY( FrameCounter, Frame.RPCCount * OneOverDeltaTime );
                NetworkChart.Series["RPCSize"].Points.AddXY( FrameCounter, Frame.RPCSizeBits / 8 );
                NetworkChart.Series["RPCSizeSec"].Points.AddXY( FrameCounter, Frame.RPCSizeBits / 8 * OneOverDeltaTime );
                NetworkChart.Series["SendBunchCount"].Points.AddXY( FrameCounter, Frame.SendBunchCount );
                NetworkChart.Series["SendBunchCountSec"].Points.AddXY( FrameCounter, Frame.SendBunchCount * OneOverDeltaTime );
                NetworkChart.Series["SendBunchSize"].Points.AddXY( FrameCounter, Frame.SendBunchSizeBits / 8 );
                NetworkChart.Series["SendBunchSizeSec"].Points.AddXY( FrameCounter, Frame.SendBunchSizeBits / 8 * OneOverDeltaTime );
                NetworkChart.Series["GameSocketSendSize"].Points.AddXY( FrameCounter, Frame.UnrealSocketSize );
                NetworkChart.Series["GameSocketSendSizeSec"].Points.AddXY( FrameCounter, Frame.UnrealSocketSize * OneOverDeltaTime );
                NetworkChart.Series["GameSocketSendCount"].Points.AddXY( FrameCounter, Frame.UnrealSocketCount );
                NetworkChart.Series["GameSocketSendCountSec"].Points.AddXY( FrameCounter, Frame.UnrealSocketCount * OneOverDeltaTime );
                NetworkChart.Series["MiscSocketSendSize"].Points.AddXY( FrameCounter, Frame.OtherSocketSize );
                NetworkChart.Series["MiscSocketSendSizeSec"].Points.AddXY( FrameCounter, Frame.OtherSocketSize * OneOverDeltaTime );
                NetworkChart.Series["MiscSocketSendCount"].Points.AddXY( FrameCounter, Frame.OtherSocketCount );
                NetworkChart.Series["MiscSocketSendCountSec"].Points.AddXY( FrameCounter, Frame.OtherSocketCount * OneOverDeltaTime );
                int OutgoingBandwidth = Frame.UnrealSocketSize + Frame.OtherSocketSize + NetworkStream.PacketOverhead * (Frame.UnrealSocketCount + Frame.OtherSocketCount);
                NetworkChart.Series["OutgoingBandwidthSize"].Points.AddXY( FrameCounter, OutgoingBandwidth );
                NetworkChart.Series["OutgoingBandwidthSizeSec"].Points.AddXY( FrameCounter, OutgoingBandwidth * OneOverDeltaTime );
                NetworkChart.Series["ActorReplicateTimeInMS"].Points.AddXY(FrameCounter, Frame.ActorReplicateTimeInMS);

                if( Frame.NumEvents > 0 )
                {
                    NetworkChart.Series["Events"].Points.AddXY( FrameCounter, 0 );
                }

                FrameCounter++;
            }

            NetworkChart.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage,"30","GameSocketSendSizeSec","GameSocketSendSizeAvgSec");
            NetworkChart.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage,"30","OutgoingBandwidthSizeSec","OutgoingBandwidthSizeAvgSec");

            NetworkChart.ChartAreas["DefaultChartArea"].RecalculateAxesScale();

            NetworkChart.EndInit();

            Console.WriteLine("Adding data to chart took {0} seconds", (DateTime.UtcNow - StartTime).TotalSeconds);
        }
예제 #4
0
		public static void ParseStreamIntoChart( MainWindow InMainWindow, NetworkStream NetworkStream, Chart NetworkChart, FilterValues InFilterValues )
		{
			var StartTime = DateTime.UtcNow;

			InMainWindow.ShowProgress( true );

			// Save old scroll position
			double OldPosition = NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.Position;

			NetworkChart.BeginInit();

			// Reset existing data.
			for ( int i = 0; i < NetworkChart.Series.Count; i++ )
			{
				float Percent = ( float )i / ( float )NetworkChart.Series.Count;
				InMainWindow.UpdateProgress( ( int )( Percent * 100 ) );

				NetworkChart.Series[i].Points.Clear();
			}

			InMainWindow.ShowProgress( true );

			NetworkChart.ResetAutoValues();
			NetworkChart.Invalidate();

			NetworkChart.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = false;
			NetworkChart.ChartAreas[0].AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.All;
			NetworkChart.ChartAreas[0].AxisX.ScrollBar.Size = 15;
			NetworkChart.ChartAreas[0].AxisX.ScrollBar.ButtonColor = Color.LightGray;

			NetworkChart.ChartAreas[0].AxisY.ScrollBar.IsPositionedInside = false;
			NetworkChart.ChartAreas[0].AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.All;
			NetworkChart.ChartAreas[0].AxisY.ScrollBar.Size = 15;
			NetworkChart.ChartAreas[0].AxisY.ScrollBar.ButtonColor = Color.LightGray;

			int FrameCounter = 0;

			foreach( PartialNetworkStream RawFrame in NetworkStream.Frames )
			{
				if ( FrameCounter % 1000 == 0 )
				{
					float Percent = ( float )FrameCounter / ( float )NetworkStream.Frames.Count;
					InMainWindow.UpdateProgress( ( int )( Percent * 100 ) );
				}

				PartialNetworkStream Frame = RawFrame.Filter( InFilterValues );

				if( Frame.EndTime == Frame.StartTime )
				{
					throw new InvalidOperationException();
				}

				float OneOverDeltaTime = 1 / (Frame.EndTime - Frame.StartTime);

				int OutgoingBandwidth = Frame.UnrealSocketSize + Frame.OtherSocketSize + NetworkStream.PacketOverhead * ( Frame.UnrealSocketCount + Frame.OtherSocketCount );

				InMainWindow.AddChartPoint( SeriesType.OutgoingBandwidthSize,		FrameCounter, OutgoingBandwidth );
				InMainWindow.AddChartPoint( SeriesType.OutgoingBandwidthSizeSec,	FrameCounter, OutgoingBandwidth * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.ActorCount,					FrameCounter, Frame.ActorCount );
				InMainWindow.AddChartPoint( SeriesType.PropertySize,				FrameCounter, Frame.ReplicatedSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.PropertySizeSec,				FrameCounter, Frame.ReplicatedSizeBits / 8 * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.RPCSize,						FrameCounter, Frame.RPCSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.RPCSizeSec,					FrameCounter, Frame.RPCSizeBits / 8 * OneOverDeltaTime );

#if true
				InMainWindow.AddChartPoint( SeriesType.ActorCountSec,				FrameCounter, Frame.ActorCount * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.PropertyCount,				FrameCounter, Frame.PropertyCount );
				InMainWindow.AddChartPoint( SeriesType.PropertyCountSec,			FrameCounter, Frame.PropertyCount * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.RPCCount,					FrameCounter, Frame.RPCCount );
				InMainWindow.AddChartPoint( SeriesType.RPCCountSec,					FrameCounter, Frame.RPCCount * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.ExportBunchCount,			FrameCounter, Frame.ExportBunchCount );
				InMainWindow.AddChartPoint( SeriesType.ExportBunchSize,				FrameCounter, Frame.ExportBunchSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.MustBeMappedGuidsCount,		FrameCounter, Frame.MustBeMappedGuidCount / 8 );
				InMainWindow.AddChartPoint( SeriesType.MustBeMappedGuidsSize,		FrameCounter, Frame.MustBeMappedGuidSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.SendAckCount,				FrameCounter, Frame.SendAckCount );
				InMainWindow.AddChartPoint( SeriesType.SendAckCountSec,				FrameCounter, Frame.SendAckCount * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.SendAckSize,					FrameCounter, Frame.SendAckSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.SendAckSizeSec,				FrameCounter, Frame.SendAckSizeBits / 8 * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.ContentBlockHeaderSize,		FrameCounter, Frame.ContentBlockHeaderSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.ContentBlockFooterSize,		FrameCounter, Frame.ContentBlockFooterSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.PropertyHandleSize,			FrameCounter, Frame.PropertyHandleSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.SendBunchCount,				FrameCounter, Frame.SendBunchCount );
				InMainWindow.AddChartPoint( SeriesType.SendBunchCountSec,			FrameCounter, Frame.SendBunchCount * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.SendBunchSize,				FrameCounter, Frame.SendBunchSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.SendBunchSizeSec,			FrameCounter, Frame.SendBunchSizeBits / 8 * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.SendBunchHeaderSize,			FrameCounter, Frame.SendBunchHeaderSizeBits / 8 );
				InMainWindow.AddChartPoint( SeriesType.GameSocketSendSize,			FrameCounter, Frame.UnrealSocketSize );
				InMainWindow.AddChartPoint( SeriesType.GameSocketSendSizeSec,		FrameCounter, Frame.UnrealSocketSize * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.GameSocketSendCount,			FrameCounter, Frame.UnrealSocketCount );
				InMainWindow.AddChartPoint( SeriesType.GameSocketSendCountSec,		FrameCounter, Frame.UnrealSocketCount * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.ActorReplicateTimeInMS,		FrameCounter, Frame.ActorReplicateTimeInMS);
#endif

#if false
				InMainWindow.AddChartPoint( SeriesType.MiscSocketSendSize,			FrameCounter, Frame.OtherSocketSize );
				InMainWindow.AddChartPoint( SeriesType.MiscSocketSendSizeSec,		FrameCounter, Frame.OtherSocketSize * OneOverDeltaTime );
				InMainWindow.AddChartPoint( SeriesType.MiscSocketSendCount,			FrameCounter, Frame.OtherSocketCount );
				InMainWindow.AddChartPoint( SeriesType.MiscSocketSendCountSec,		FrameCounter, Frame.OtherSocketCount * OneOverDeltaTime );								
#endif

				if ( Frame.NumEvents > 0 )
				{
					InMainWindow.AddChartPoint( SeriesType.Events, FrameCounter, 0 );
				}

				FrameCounter++;
			}

			//NetworkChart.DataManipulator.FinancialFormula( FinancialFormula.MovingAverage, "30", SeriesType.GameSocketSendSizeSec, SeriesType.GameSocketSendSizeAvgSec );
			NetworkChart.DataManipulator.FinancialFormula( FinancialFormula.MovingAverage, "30", SeriesType.OutgoingBandwidthSizeSec.ToString(), SeriesType.OutgoingBandwidthSizeAvgSec.ToString() );

			NetworkChart.ChartAreas["DefaultChartArea"].RecalculateAxesScale();

			NetworkChart.ChartAreas["DefaultChartArea"].AxisX.ScaleView.Position = OldPosition;

			NetworkChart.EndInit();

			InMainWindow.ShowProgress( false );

            Console.WriteLine("Adding data to chart took {0} seconds", (DateTime.UtcNow - StartTime).TotalSeconds);
		}