示例#1
0
        void ShowLabel(LynxTime ltime, TimeDimention ctd)
        {
            string TimeText = ltime.getTopFormatStr(ctd);

            //string ShortStr = LynxTime.getShortExpressStr(ltime);

            if (Marks.ContainsValue(ltime))
            {
                return;
            }
            double lleft = getLynxTimeXValue(ltime);

            if (!Marks.ContainsKey(lleft))
            {
                Marks.Add(lleft, ltime);
                LynxTime  lt = new LynxTime(ltime);
                TextBlock l  = new TextBlock();
                l.FontSize   = 10;
                l.Foreground = new SolidColorBrush(Colors.Blue);

                l.Text = TimeText;
                ToolTipService.SetToolTip(l, ltime.getTimeString());

                Canvas.SetLeft(l, lleft);
                Canvas.SetTop(l, 0);
                l.Tag = ltime;
                canvasTimeLine.Children.Add(l);
                ll.Add(l);
            }
        }
示例#2
0
        public void ShowXUnit()
        {
            Marks.Clear();
            canvasTimeLine.Children.Clear();
            maxDimention     = LynxTime.getMaxCrossUnit(XShowBeginTime, XShowEndTime);
            FirstTopUnitTime = XShowBeginTime.getPastTime(maxDimention);
            LastTopUnitTime  = XShowEndTime.getNextTime(maxDimention);
            TimeUnitNum      = LynxTime.getUnitNum(FirstTopUnitTime, LastTopUnitTime, maxDimention);
            long     stepUnitNum = Convert.ToInt64(Math.Ceiling(TimeUnitNum / (double)SubNum));
            LynxTime pastTime    = FirstTopUnitTime;

            ShowLabel(FirstTopUnitTime, maxDimention);
            for (int i = 1; i < SubNum; i++)
            {
                LynxTime lt = new LynxTime(FirstTopUnitTime);
                lt.AddTimeSpan(stepUnitNum * i, maxDimention);

                ShowLabel(lt, maxDimention);
                LastTopUnitTime = lt;
                double w = getLynxTimeWidth(pastTime, lt);
                if (w > MinSpace)
                {
                    ShowXUnit(pastTime, lt, LynxTime.getLowTimeDim(maxDimention));
                }
                pastTime = lt;
            }
            ShowLabel(LastTopUnitTime, maxDimention);
            //LastTopUnitTime = FirstTopUnitTime + (LastTopUnitTime)XShowEndTime.getNextTime(maxDimention);
            //ShowXUnit(XShowBeginTime, XShowEndTime, canvasTimeLine.Width);
        }
示例#3
0
        int SubNum       = 3; //每次的下一级别分割区域

        public void ShowXUnit(LynxTime bt, LynxTime et, TimeDimention ct)
        {
            //TimeDimention cDimention = LynxTime.getMaxCrossUnit(XShowBeginTime, XShowEndTime);
            //FirstTopUnitTime = XShowBeginTime.getPastTime(cDimention);
            //LastTopUnitTime = XShowEndTime.getNextTime(cDimention);
            long tn = LynxTime.getUnitNum(bt, et, ct);

            if (tn < 2)
            {
                return;
            }
            long     stepUnitNum = Convert.ToInt64(Math.Ceiling(tn / (double)SubNum));
            LynxTime pastTime    = bt;

            //ShowLabel(pastTime, maxDimention);
            for (int i = 1; i < SubNum; i++)
            {
                LynxTime lt = new LynxTime(bt);
                lt.AddTimeSpan(stepUnitNum * i, ct);

                ShowLabel(lt, ct);
                double sw = getLynxTimeWidth(pastTime, lt);
                if (sw > MinSpace)
                {
                    ShowXUnit(pastTime, lt, LynxTime.getLowTimeDim(maxDimention));
                }
                pastTime = lt;
            }
        }
示例#4
0
        public double getLynxTimeWidth(TimeDimention td)//时间差获取间隔对应的宽度
        {
            LynxTime v = LynxTime.getUnitSpan(1, td);

            return(Math.Abs(Convert.ToDouble(v.getDoubleValue()) / (XShowEndTime.getDoubleValue() - XShowBeginTime.getDoubleValue())) * canvasTimeLine.Width);
        }