Exemplo n.º 1
0
 public void SetCanvas(int x1, int x2, int y1, int y2)
 {
     this.y1     = y1;
     this.y2     = y2;
     this.x1     = x1 + this.leftPadding;
     this.x2     = x2 - this.rightPadding;
     this.width  = this.x2 - this.x1;
     this.height = this.y2 - this.y1;
     if (this.axis == null)
     {
         this.axis = new AxisRight(this.chart, this, x2, y1, y2);
     }
     else
     {
         this.axis.SetBounds(x2, y1, y2);
     }
 }
Exemplo n.º 2
0
Arquivo: Pad.cs Projeto: heber/FreeOQ
		public void SetCanvas(int x1, int x2, int y1, int y2)
		{
			this.y1 = y1;
			this.y2 = y2;
			this.x1 = x1 + this.leftPadding;
			this.x2 = x2 - this.rightPadding;
			this.width = this.x2 - this.x1;
			this.height = this.y2 - this.y1;
			if (this.axis == null)
				this.axis = new AxisRight(this.chart, this, x2, y1, y2);
			else
				this.axis.SetBounds(x2, y1, y2);
		}
Exemplo n.º 3
0
        public void Paint()
        {
            SolidBrush solidBrush1 = new SolidBrush(this.titleColor);
            SolidBrush solidBrush2 = new SolidBrush(this.labelColor);
            Pen        pen1        = new Pen(this.titleColor);
            Pen        pen2        = new Pen(this.gridColor);
            Pen        pen3        = new Pen(this.minorGridColor);
            Pen        pen4        = new Pen(this.minorTicksColor);
            Pen        pen5        = new Pen(this.majorTicksColor);

            pen2.DashStyle = this.gridDashStyle;
            pen3.DashStyle = this.minorGridDashStyle;
            this.min       = this.pad.MinValue;
            this.max       = this.pad.MaxValue;
            int    num1 = 10;
            int    num2 = 5;
            double num3 = AxisRight.O3Qc3nfpkF(Math.Abs(this.max - this.min) * 0.999999 / (double)num1);
            double num4 = AxisRight.O3Qc3nfpkF(num3 / (double)num2);
            double num5 = Math.Ceiling((this.min - 0.001 * num3) / num3) * num3;
            double num6 = Math.Floor((this.max + 0.001 * num3) / num3) * num3;
            int    num7 = 0;
            int    num8 = 0;

            if (num3 != 0.0)
            {
                num7 = Math.Min(10000, (int)Math.Floor((num6 - num5) / num3 + 0.5) + 1);
            }
            if (num3 != 0.0)
            {
                num8 = Math.Abs((int)Math.Floor(num3 / num4 + 0.5)) - 1;
            }
            int num9 = 0;

            for (int index1 = 0; index1 < num7; ++index1)
            {
                double num10 = num5 + (double)index1 * num3;
                string str   = num10.ToString(this.pad.AxisLabelFormat);
                this.pad.DrawHorizontalGrid(pen2, num10);
                this.pad.DrawHorizontalTick(pen5, this.x - (double)this.majorTicksLength - 1.0, num10, this.majorTicksLength);
                if (this.labelEnabled)
                {
                    SizeF  sizeF = this.pad.Graphics.MeasureString(str, this.labelFont);
                    double num11 = (double)sizeF.Width;
                    int    num12 = this.labelOffset;
                    int    num13 = (int)sizeF.Height;
                    if (this.labelAlignment == EAxisLabelAlignment.Centre)
                    {
                        int num14 = (int)(this.x + 2.0);
                        int num15 = this.pad.ClientY(num10) - num13 / 2;
                        if (index1 == 0 || num9 - (num15 + num13) >= 1)
                        {
                            if ((double)num15 > this.y1 && (double)(num15 + num13) < this.y2)
                            {
                                this.pad.Graphics.DrawString(str, this.labelFont, (Brush)solidBrush2, (float)num14, (float)num15);
                            }
                            num9 = num15;
                        }
                    }
                }
                for (int index2 = 1; index2 <= num8; ++index2)
                {
                    double y = num5 + (double)index1 * num3 + (double)index2 * num4;
                    if (y < this.max)
                    {
                        this.pad.DrawHorizontalTick(pen4, this.x - (double)this.minorTicksLength - 1.0, y, this.minorTicksLength);
                    }
                }
            }
            for (int index = 1; index <= num8; ++index)
            {
                double y = num5 - (double)index * num4;
                if (y > this.min && this.minorTicksEnabled)
                {
                    this.pad.DrawHorizontalTick(pen4, this.x - (double)this.minorTicksLength - 1.0, y, this.minorTicksLength);
                }
            }
            foreach (IChartDrawable chartDrawable in this.pad.Primitives)
            {
                if (chartDrawable is IAxesMarked)
                {
                    IAxesMarked axesMarked = chartDrawable as IAxesMarked;
                    if (axesMarked.IsMarkEnable)
                    {
                        double lastValue = axesMarked.LastValue;
                        if (!double.IsNaN(lastValue))
                        {
                            string str   = lastValue.ToString("D" + axesMarked.LabelDigitsCount);
                            SizeF  sizeF = this.chart.Graphics.MeasureString(str, this.chart.Font);
                            Color  color = Color.FromArgb((int)axesMarked.Color.R ^ 128, (int)axesMarked.Color.G ^ 128, (int)axesMarked.Color.B ^ 128);
                            if (this.UvocmIoHmQ(axesMarked.Color, Color.Black))
                            {
                                color = Color.White;
                            }
                            if (this.UvocmIoHmQ(axesMarked.Color, Color.White))
                            {
                                color = Color.Black;
                            }
                            this.pad.Graphics.FillRectangle((Brush) new SolidBrush(axesMarked.Color), (float)this.X, (float)((double)this.pad.ClientY(axesMarked.LastValue) - (double)sizeF.Height / 2.0 - 2.0), sizeF.Width, sizeF.Height + 2f);
                            this.pad.Graphics.DrawString(str, this.chart.font, (Brush) new SolidBrush(color), (float)this.X + 2f, (float)((double)this.pad.ClientY(axesMarked.LastValue) - (double)sizeF.Height / 2.0 - 1.0));
                        }
                    }
                }
            }
        }