Beispiel #1
0
		/// <summary>
		/// Creates a plotter graph component. The default has 4 channels with 2 enabled
		/// and 2 disabled. The default ranges and channel names are also provided for
		/// all the 4 channels
		/// </summary>
		public Plotter()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
			channelCollection = new ChannelCollection();
			Channels.Add(new Channel(0, 100, "Voltage", true, Color.Blue));
			Channels.Add(new Channel(0, 5, "Current", true, Color.Red));
			Channels.Add(new Channel(0, 100, "2", false, Color.Green));
			Channels.Add(new Channel(0, 100, "3", false, Color.Purple));

			gridline = new Gridline(this);
			axisLineXandY = new AxisLine(this);

			SetStyle(
					ControlStyles.DoubleBuffer | ControlStyles.UserPaint |
					ControlStyles.AllPaintingInWmPaint,
					true);
			UpdateStyles();

			PlotRate = 300;
			initialPlotRate = PlotRate;

			GraphArea = new Rectangle(ClientRectangle.Left + graphMarginLeft,
									  ClientRectangle.Top + graphMarginTop,
									  ClientRectangle.Width - graphMarginRight - graphMarginLeft,
									  ClientRectangle.Height - graphMarginBottom - graphMarginTop);

			Debug.Assert(GraphArea.Height == (GraphArea.Bottom - GraphArea.Top), "Problem Ctor");

			int xRangeInMs = (int) (xRange.Duration().Ticks / TimeSpan.TicksPerMillisecond);
			plotterHScrollBar.Maximum = xRangeInMs / PlotRate;
			plotterHScrollBar.Value = xRangeInMs / PlotRate;
			plotterHScrollBar.Visible = false;

			rightDisplayLimit = xRangeInMs - leftDisplayLimit;
			savedXRange = xRange;

			ValueFormat = "{0:F}";

			buttonWidth = buttonPrevChannel.Width;
			buttonHeight = buttonPrevChannel.Height;
		}
Beispiel #2
0
		/// <summary>
		/// Creates a stacked bar graph user control with default properties
		/// </summary>
		public StackedBarGraph()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
			basicBar = new BasicBar();
			basicBar.ShowRangeLines = false;
			basicBar.ShowRangeValues = false;
			basicBar.BarGraduation = Graduation.None;

			gridline = new Gridline(this);
			axisLineXandY = new AxisLine(this);

			barCollection = new BarCollection();

			for (int i = 0;i < BarCount;i ++)
			{
				Bars.Add(new Bar(i.ToString(CultureInfo.CurrentUICulture), 50));
			}

			SetStyle(
					ControlStyles.DoubleBuffer | ControlStyles.UserPaint |
					ControlStyles.AllPaintingInWmPaint,
					true);
			UpdateStyles();

			GraphArea = new Rectangle(ClientRectangle.Left + graphMarginLeft,
									  ClientRectangle.Top + graphMarginTop,
									  ClientRectangle.Width - graphMarginRight - graphMarginLeft,
									  ClientRectangle.Height - graphMarginBottom - graphMarginTop);

			Debug.Assert(GraphArea.Height == (GraphArea.Bottom - GraphArea.Top), "Problem Ctor");
		}