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; } }
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); }