Exemple #1
0
 public void drawHeatmapImage(Dhr_HeatmapComponent Owner, Graphics graphics, RectangleF imgBounds)
 {
     SizeF pixelSize = new SizeF(imgBounds.Width / 365.0f, imgBounds.Height / 24.0f);
     int i = 0;
     for (int d = 0; d < 365; d++) for (int h = 0; h < 24; h++)
         {
             Color c = Color.Transparent;
             if (Owner.plotvals.ContainsKey(i))
             {
                 double t = Owner.plotdomain.NormalizedParameterAt(Owner.plotvals[i]);
                 if (t < 0) c = Color.Blue;
                 else if (t > 1) c = Color.Red;
                 // else c = Color.FromArgb(255, (int)(255 * (1 - t)), (int)(255 * (1 - t)), (int)(255 * (1 - t))); // what? is black high or low?
                 else c = Color.FromArgb(255, (int)(255 * (t)), (int)(255 * (t)), (int)(255 * (t)));
             }
             SolidBrush brush = new SolidBrush(c);
             System.Drawing.PointF pt = new System.Drawing.PointF(imgBounds.Location.X + pixelSize.Width * d, imgBounds.Location.Y + pixelSize.Height * h);
             graphics.FillRectangle(brush, new RectangleF(pt, pixelSize));
             i++;
         }
 }
Exemple #2
0
        private Bitmap makeHeatmapImage_SUPERSEDED(Dhr_HeatmapComponent Owner)
        {
            int pixelWidth = 3;
            int pixelHeight = 10;
            Bitmap bmp = new Bitmap(365 * pixelWidth, 24 * pixelHeight);
            using (Graphics gfx = Graphics.FromImage(bmp))
            {
                int i = 0;
                for (int d = 0; d < 365; d++) for (int h = 0; h < 24; h++)
                    {
                        Color c = Color.Transparent;
                        if (Owner.plotvals.ContainsKey(i))
                        {
                            double t = Owner.plotdomain.NormalizedParameterAt(Owner.plotvals[i]);
                            if (t < 0) c = Color.Blue;
                            else if (t > 1) c = Color.Red;
                            else c = Color.FromArgb(255, (int)(255 * (1 - t)), (int)(255 * (1 - t)), (int)(255 * (1 - t)));
                        }
                        SolidBrush brush = new SolidBrush(c);
                        gfx.FillRectangle(brush, pixelWidth * d, pixelHeight * h, pixelWidth, pixelHeight);
                        i++;
                    }

            }
            return bmp;
        }
Exemple #3
0
 public Dhr_HeatmapComponent_Attributes(Dhr_HeatmapComponent owner)
     : base(owner)
 {
 }