예제 #1
0
        /// <summary>
        /// 默认构造函数
        /// </summary>
        public TimePeriodChartControl()
        {
            InitializeComponent();

            Origin = new Point(50, 70);
            this.UserToScreenCoordConverter = new Geo.Coordinates.ScreenCoordConverter(this.pictureBox1.Size);
            UserChartGraphics = new UserChartGraphics(this.UserToScreenCoordConverter);

            this.pictureBox1.MouseWheel += pictureBox1_MouseWheel;
        }
예제 #2
0
        /// <summary>
        /// 绘制内容带
        /// </summary>
        private void DrawBelts()
        {
            int intervalOfSat = 2;

            double epochCountPerPixe = this.EpochCount * 1.0 / CoordWidth;
            double satCountPerPixe   = this.SatCount * 1.0 / CoordHeight;

            int beltHeight        = CoordHeight / SatCount - intervalOfSat;//减一,为留空格好看
            int drawingBeltHeight = Math.Min(beltHeight, 6);
            Pen penL1             = new Pen(Color.Blue, 2);
            Pen penL2             = new Pen(Color.FromArgb(100, 200, 50), 2);

            for (int i = 1; i <= SatCount; i++)
            {
                int        y      = GetYCoord(i - 1); //扣除epoch,从1开始
                List <int> xCoord = new List <int>();
                int        lastX  = 0;                //避免重复加入
                for (int epoch = MinEpoch; epoch < MaxEpoch; epoch++)
                {
                    var row = DataTable.Rows[epoch];

                    if (!row.IsNull(i))
                    {
                        var x = GetXCoord(epoch);

                        if (lastX == x)
                        {
                            continue;
                        }

                        xCoord.Add(x);

                        lastX = x;
                    }
                }
                Pen pen = null;
                if (i % 2 == 0)
                {
                    pen = penL1;
                }
                else
                {
                    pen = penL2;
                }

                UserChartGraphics.DarwBelt(pen, y, xCoord.ToArray(), drawingBeltHeight);
            }
        }
예제 #3
0
        /// <summary>
        /// 绘制Y轴标签
        /// </summary>
        private void DrawYLabels()
        {
            //绘制Y轴标签,纵轴,卫星号
            int minYDiffer = 10;
            int prevYPixe  = -minYDiffer;

            for (int i = 1; i <= SatCount; i++)
            {
                int y = GetYCoord(i - 1);//扣除epoch,从1开始

                int x   = Origin.X / 2;
                var pos = new Point(x, y);;
                if (y - prevYPixe >= minYDiffer)
                {
                    UserChartGraphics.DrawLabel(DataTable.Columns[i].ToString(), pos);

                    prevYPixe = y;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 绘制X轴标签
        /// </summary>
        private void DrawXLables()
        {
            //绘制历元标签
            int prevX      = -50;
            int minXDiffer = 20;

            for (int epcoh = MinEpoch; epcoh < MaxEpoch; epcoh++)
            {
                int y   = Origin.Y / 2;
                int x   = GetXCoord(epcoh);
                var pos = new Point(x, y);
                if ((pos.X - prevX) >= minXDiffer)
                {
                    prevX = pos.X;

                    var xlabel = GetIndexLabelX(epcoh);

                    UserChartGraphics.DrawLabel(xlabel, pos, -90);
                }
            }
        }