public float[] YTicks(float min, float max) { _lastYmin = min; _lastYmax = max; _yTicks = _yTickProvider.generateTicks(min, max); return(_yTicks); }
public float[] ZTicks(float min, float max) { _lastZmin = min; _lastZmax = max; _zTicks = _zTickProvider.generateTicks(min, max); return(_zTicks); }
public float[] XTicks(float min, float max) { _lastXmin = min; _lastXmax = max; _xTicks = _xTickProvider.generateTicks(min, max); return(_xTicks); }
public System.Drawing.Bitmap toImage(int width, int height, int barWidth) { if ((barWidth > width)) { return(null); } // Init image output System.Drawing.Bitmap image = new System.Drawing.Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(image); int txtSize = 12; // Draw background if (_hasBackground) { graphic.FillRectangle(new System.Drawing.SolidBrush(_backgroundColor.toColor()), 0, 0, width, height); } // Draw colorbar centering in half the Legend text height for (int h = txtSize / 2; h <= (height - txtSize / 2); h++) { // Compute value & color float v = _min + (_max - _min) * h / (height - txtSize); // Color c = mapper.getColor(new Coord3d(0,0,v)); Color c = _mapper.Color(v); //To allow the Color to be a variable independent of the coordinates // Draw line graphic.DrawLine(new System.Drawing.Pen(new System.Drawing.SolidBrush(c.toColor())), 0, height - h, barWidth, height - h); } // Contour of bar graphic.FillRectangle(new System.Drawing.SolidBrush(_foregroundColor.toColor()), 0, Convert.ToSingle(txtSize / 2), barWidth, height - txtSize); // Text annotation if (((_provider != null))) { float[] ticks = _provider.generateTicks(_min, _max); float ypos = 0; string txt = null; for (int t = 0; t <= ticks.Length - 1; t++) { // ypos = (int)(height-height*((ticks[t]-min)/(max-min))); ypos = txtSize + (height - txtSize - (height - txtSize) * ((ticks[t] - _min) / (_max - _min))); //Making sure that the first and last tick appear in the colorbar txt = _renderer.Format(ticks[t]); graphic.DrawString(txt, new System.Drawing.Font("Arial", txtSize, System.Drawing.GraphicsUnit.Pixel), new System.Drawing.SolidBrush(_foregroundColor.toColor()), barWidth + 1, ypos); } } return(image); }