Beispiel #1
0
 /// <summary>
 /// Draw the form on the screen
 /// </summary>
 /// <param name="screen">Instance of IDrawable device</param>
 public virtual void Paint(IDrawer screen)
 {
     // Paint once
     if (!initPaint)
     {
         return;
     }
     screen.FillRectangle(0, titleBarSize, screen.Width, screen.Height - titleBarSize, this.BackgroundColor);
     initPaint = false;
     screen.FillRectangle(0, 0, screen.Width, titleBarSize, FEZ_Components.FEZTouch.Color.Black);
     screen.DrawString(this.Title, 5, 5, FEZ_Components.FEZTouch.Color.White, FEZ_Components.FEZTouch.Color.Black);
 }
Beispiel #2
0
        /// <summary>
        /// Draw the graph on an device
        /// </summary>
        /// <param name="screen">Screen device</param>
        public void Draw(IDrawer screen)
        {

            if (_dataMin == _dataMax)
                _dataMax += 10;

            // Chart area
            screen.FillRectangle(0, 0, screen.Width, screen.Height, FEZ_Components.FEZTouch.Color.Black);
            // Y Axis

            if (_dataMin < 0)
            {
                // X Axis
                screen.DrawLine(0, screen.Height, screen.Width, screen.Height, GHIElectronics.NETMF.FEZ.FEZ_Components.FEZTouch.Color.Black);
            }

            foreach (var key in series.Keys)
            {
                FEZ_Components.FEZTouch.Color color = FEZ_Components.FEZTouch.Color.Green;
                Serie currentSerie = (Serie)series[key];
                int lastX = 0;
                int lastY = 0;

                for (ushort index = 0; index < currentSerie.Count; index++)
                {
                    int x = ComputePositionX(index, screen);
                    int y = ComputePositionY((float)currentSerie[index], screen);

                    // Draw line interval
                    if (index > 0)
                    {
                        lastX = ComputePositionX(index - 1, screen);
                        lastY = ComputePositionY((float)currentSerie[index - 1], screen);
                        screen.DrawLine(lastX, lastY, x, y, color);
                    }
                }
            }
        }