Esempio n. 1
0
        /// <summary>
        /// 图例
        /// </summary>
        public void DrawLegendColorBar()
        {
            if (TableValue == null)
            {
                return;
            }
            int cellWidth  = 12;
            int cellHeight = 1;

            LineCoordConverter pixeToInputValConverter = new LineCoordConverter(SizeOfLegendColorBar.Height, this.TableValue.ValueSpan.Span);

            for (int i = 0; i < SizeOfLegendColorBar.Height; i++)
            {
                var val   = pixeToInputValConverter.GetNew(i) + this.TableValue.ValueSpan.Start; //像素,转换到原始数据,以获取颜色
                var color = ColorBuilder.Build(val);
                //转回平面坐标
                var pt    = OriginOfLengendColorBar + new Size(0, i);
                var scrPt = UserToScreenCoordConverter.GetScreenCoord(pt);

                ChartGraphics.DrawColorPoint(scrPt, cellWidth, cellHeight, color);
            }
            //绘制文字
            ChartGraphics.DrawLabel(Geo.Utils.StringUtil.FillSpaceLeft(this.TableValue.ValueSpan.Start.ToString("0.00"), 6), OriginOfLengendColorBar - new Size(30, 20), 0);
            ChartGraphics.DrawLabel(Geo.Utils.StringUtil.FillSpaceLeft(this.TableValue.ValueSpan.End.ToString("0.00"), 6),
                                    OriginOfLengendColorBar + new Size(-30, SizeOfLegendColorBar.Height + 20), 0);
        }
Esempio n. 2
0
        /// <summary>
        /// 绘制二维颜色图
        /// </summary>
        /// <param name="table"></param>
        public void DrawColorTable(TwoNumeralKeyAndValueDictionary table)
        {
            int cellWidth  = ToInt(InputToContentCoordConverter.XConverter.Factor * table.IntervalA);
            int cellHeight = ToInt(InputToContentCoordConverter.YConverter.Factor * table.IntervalB);

            table.ForEach(new Action <double, double, double>(delegate(double x, double y, double val)
            {
                var xy    = new XY(x, y);
                var scrPt = InputToScreenPt(xy);

                var color = ColorBuilder.Build(val);
                ChartGraphics.DrawColorPoint(scrPt, cellWidth, cellHeight, color, ContentBoxInScreenCoord);
            }));
        }