public void RenderLineArea(LineArea area) { int rx = this.currentAreaContainerXPosition + area.getStartIndent(); int ry = this.currentYPosition; int w = area.getContentWidth(); int h = area.GetHeight(); this.currentYPosition -= area.getPlacementOffset(); this.currentXPosition = rx; int bl = this.currentYPosition; foreach (Box b in area.getChildren()) { if (b is InlineArea) { InlineArea ia = (InlineArea)b; this.currentYPosition = ry - ia.getYOffset(); } else { this.currentYPosition = ry - area.getPlacementOffset(); } b.render(this); } this.currentYPosition = ry - h; this.currentXPosition = rx; }
public int AddLeader(BlockArea ba, FontState fontState, float red, float green, float blue, int leaderPattern, int leaderLengthMinimum, int leaderLengthOptimum, int leaderLengthMaximum, int ruleThickness, int ruleStyle, int leaderPatternWidth, int leaderAlignment) { LineArea la = ba.getCurrentLineArea(); if (la == null) { return(-1); } la.changeFont(fontState); la.changeColor(red, green, blue); if (leaderLengthOptimum <= (la.getRemainingWidth())) { la.AddLeader(leaderPattern, leaderLengthMinimum, leaderLengthOptimum, leaderLengthMaximum, ruleStyle, ruleThickness, leaderPatternWidth, leaderAlignment); } else { la = ba.createNextLineArea(); if (la == null) { return(-1); } la.changeFont(fontState); la.changeColor(red, green, blue); if (leaderLengthMinimum <= la.getContentWidth()) { la.AddLeader(leaderPattern, leaderLengthMinimum, leaderLengthOptimum, leaderLengthMaximum, ruleStyle, ruleThickness, leaderPatternWidth, leaderAlignment); } else { FonetDriver.ActiveDriver.FireFonetWarning( "Leader doesn't fit into line, it will be clipped to fit."); la.AddLeader(leaderPattern, la.getRemainingWidth(), leaderLengthOptimum, leaderLengthMaximum, ruleStyle, ruleThickness, leaderPatternWidth, leaderAlignment); } } return(1); }
protected static int addRealText(BlockArea ba, FontState fontState, float red, float green, float blue, WrapOption wrapOption, LinkSet ls, int whiteSpaceCollapse, char[] data, int start, int end, TextState textState, VerticalAlign vAlign) { int ts, te; char[] ca; ts = start; te = end; ca = data; LineArea la = ba.getCurrentLineArea(); if (la == null) { return(start); } la.changeFont(fontState); la.changeColor(red, green, blue); la.changeWrapOption(wrapOption); la.changeWhiteSpaceCollapse(whiteSpaceCollapse); la.changeVerticalAlign(vAlign); ba.setupLinkSet(ls); ts = la.addText(ca, ts, te, ls, textState); while (ts != -1) { la = ba.createNextLineArea(); if (la == null) { return(ts); } la.changeFont(fontState); la.changeColor(red, green, blue); la.changeWrapOption(wrapOption); la.changeWhiteSpaceCollapse(whiteSpaceCollapse); ba.setupLinkSet(ls); ts = la.addText(ca, ts, te, ls, textState); } return(-1); }
public override Status Layout(Area area) { if (this.marker == MarkerBreakAfter) { return(new Status(Status.OK)); } if (this.marker == MarkerStart) { AccessibilityProps mAccProps = propMgr.GetAccessibilityProps(); AuralProps mAurProps = propMgr.GetAuralProps(); BorderAndPadding bap = propMgr.GetBorderAndPadding(); BackgroundProps bProps = propMgr.GetBackgroundProps(); MarginInlineProps mProps = propMgr.GetMarginInlineProps(); RelativePositionProps mRelProps = propMgr.GetRelativePositionProps(); string id = this.properties.GetProperty("id").GetString(); int align = this.properties.GetProperty("text-align").GetEnum(); int valign = this.properties.GetProperty("vertical-align").GetEnum(); int overflow = this.properties.GetProperty("overflow").GetEnum(); this.breakBefore = this.properties.GetProperty("break-before").GetEnum(); this.breakAfter = this.properties.GetProperty("break-after").GetEnum(); this.width = this.properties.GetProperty("width").GetLength().MValue(); this.height = this.properties.GetProperty("height").GetLength().MValue(); this.contwidth = this.properties.GetProperty("content-width").GetLength().MValue(); this.contheight = this.properties.GetProperty("content-height").GetLength().MValue(); this.wauto = this.properties.GetProperty("width").GetLength().IsAuto(); this.hauto = this.properties.GetProperty("height").GetLength().IsAuto(); this.cwauto = this.properties.GetProperty("content-width").GetLength().IsAuto(); this.chauto = this.properties.GetProperty("content-height").GetLength().IsAuto(); this.startIndent = this.properties.GetProperty("start-indent").GetLength().MValue(); this.endIndent = this.properties.GetProperty("end-indent").GetLength().MValue(); this.spaceBefore = this.properties.GetProperty("space-before.optimum").GetLength().MValue(); this.spaceAfter = this.properties.GetProperty("space-after.optimum").GetLength().MValue(); this.scaling = this.properties.GetProperty("scaling").GetEnum(); area.getIDReferences().CreateID(id); if (this.areaCurrent == null) { this.areaCurrent = new ForeignObjectArea(propMgr.GetFontState(area.getFontInfo()), area.getAllocationWidth()); this.areaCurrent.start(); areaCurrent.SetWidth(this.width); areaCurrent.SetHeight(this.height); areaCurrent.SetContentWidth(this.contwidth); areaCurrent.setContentHeight(this.contheight); areaCurrent.setScaling(this.scaling); areaCurrent.setAlign(align); areaCurrent.setVerticalAlign(valign); areaCurrent.setOverflow(overflow); areaCurrent.setSizeAuto(wauto, hauto); areaCurrent.setContentSizeAuto(cwauto, chauto); areaCurrent.setPage(area.getPage()); int numChildren = this.children.Count; if (numChildren > 1) { throw new FonetException("Only one child element is allowed in an instream-foreign-object"); } if (this.children.Count > 0) { FONode fo = (FONode)children[0]; Status status; if ((status = fo.Layout(this.areaCurrent)).isIncomplete()) { return(status); } this.areaCurrent.end(); } } this.marker = 0; if (breakBefore == BreakBefore.PAGE || ((spaceBefore + areaCurrent.getEffectiveHeight()) > area.spaceLeft())) { return(new Status(Status.FORCE_PAGE_BREAK)); } if (breakBefore == BreakBefore.ODD_PAGE) { return(new Status(Status.FORCE_PAGE_BREAK_ODD)); } if (breakBefore == BreakBefore.EVEN_PAGE) { return(new Status(Status.FORCE_PAGE_BREAK_EVEN)); } } if (this.areaCurrent == null) { return(new Status(Status.OK)); } if (area is BlockArea) { BlockArea ba = (BlockArea)area; LineArea la = ba.getCurrentLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } la.addPending(); if (areaCurrent.getEffectiveWidth() > la.getRemainingWidth()) { la = ba.createNextLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } } la.addInlineArea(areaCurrent, GetLinkSet()); } else { area.addChild(areaCurrent); area.increaseHeight(areaCurrent.getEffectiveHeight()); } if (this.isInTableCell) { startIndent += forcedStartOffset; } areaCurrent.setStartIndent(startIndent); areaCurrent.setPage(area.getPage()); if (breakAfter == BreakAfter.PAGE) { this.marker = MarkerBreakAfter; return(new Status(Status.FORCE_PAGE_BREAK)); } if (breakAfter == BreakAfter.ODD_PAGE) { this.marker = MarkerBreakAfter; return(new Status(Status.FORCE_PAGE_BREAK_ODD)); } if (breakAfter == BreakAfter.EVEN_PAGE) { this.marker = MarkerBreakAfter; return(new Status(Status.FORCE_PAGE_BREAK_EVEN)); } areaCurrent = null; return(new Status(Status.OK)); }
public void DrawCurve() { dayCurveGroup.ClearChartObject(); DateTime time = dateEdit1.DateTime.Date; this.dayCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(time), 0); if (selectDev == null) { return; } IList <HHDeviceProperty> listProp = selectDev.DevGroup.AnalogProperties; int colorIndex = -1; DateTime drawTime = DateTime.MinValue; for (int i = 0; i < listProp.Count; i++) { if (listProp[i].Selected == false) { continue; } colorIndex++; HHDeviceProperty devProp = selectDev.GetProperty(listProp[i]); int analogIndex = devProp.Analog.Index; LineArea la = new LineArea(chart, listProp[i].Name, false); la.YAxes.YAxesMin = 0; la.YAxes.YAxesMax = 200; LineCurve lc = new LineCurve(chart, listProp[i].Name, 0); lc.LineColor = colorList[colorIndex % colorList.Length]; la.AddLine(lc); lc.YAxes.Mode = YAxesMode.Manual; lc.YAxes.YAxesMin = devProp.Analog.ADMin; lc.YAxes.YAxesMax = devProp.Analog.ADMax; lc.YAxes.UnitString = listProp[i].Unit; if (devProp.Analog.ADMax < 1) { lc.YAxes.Precision = 2; } else if (devProp.Analog.ADMax < 10) { lc.YAxes.Precision = 1; } List <AnalogRecordGroup> r = DatabaseModule.GetInstance().QueryAnalogHistory(devProp.Analog.Group.Type, analogIndex, time, time.AddDays(1)); r.Sort(); //不考虑回溯 if (r != null && r.Count > 0) { for (int m = 0; m < r.Count; m++) { List <AnalogRecord> records = r[m].Records; for (int j = 0; j < records.Count; j++) { if (drawTime == DateTime.MinValue) { drawTime = records[j].Time; } else if (drawTime > records[j].Time) { drawTime = records[j].Time; } long tm = ChartGraph.DateTime2ChartTime(records[j].Time); lc.AddPoint(new LinePoint(tm, records[j].Value)); } } } dayCurveGroup.AddChartObject(la); } if (drawTime == DateTime.MinValue) { drawTime = time; } this.dayCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(drawTime), 0); chart.Draw(); }
public override Status Layout(Area area) { if (this.marker == MarkerStart) { AccessibilityProps mAccProps = propMgr.GetAccessibilityProps(); AuralProps mAurProps = propMgr.GetAuralProps(); BorderAndPadding bap = propMgr.GetBorderAndPadding(); BackgroundProps bProps = propMgr.GetBackgroundProps(); MarginInlineProps mProps = propMgr.GetMarginInlineProps(); RelativePositionProps mRelProps = propMgr.GetRelativePositionProps(); this.align = this.properties.GetProperty("text-align").GetEnum(); this.startIndent = this.properties.GetProperty("start-indent").GetLength().MValue(); this.endIndent = this.properties.GetProperty("end-indent").GetLength().MValue(); this.spaceBefore = this.properties.GetProperty("space-before.optimum").GetLength().MValue(); this.spaceAfter = this.properties.GetProperty("space-after.optimum").GetLength().MValue(); this.width = this.properties.GetProperty("width").GetLength().MValue(); this.height = this.properties.GetProperty("height").GetLength().MValue(); this.src = this.properties.GetProperty("src").GetString(); this.id = this.properties.GetProperty("id").GetString(); area.getIDReferences().CreateID(id); this.marker = 0; } try { FonetImage img = FonetImageFactory.Make(src); if ((width == 0) || (height == 0)) { double imgWidth = img.Width; double imgHeight = img.Height; if ((width == 0) && (height == 0)) { width = (int)((imgWidth * 1000d)); height = (int)((imgHeight * 1000d)); } else if (height == 0) { height = (int)((imgHeight * ((double)width)) / imgWidth); } else if (width == 0) { width = (int)((imgWidth * ((double)height)) / imgHeight); } } double ratio = (double)width / (double)height; Length maxWidth = this.properties.GetProperty("max-width").GetLength(); Length maxHeight = this.properties.GetProperty("max-height").GetLength(); if (maxWidth != null && width > maxWidth.MValue()) { width = maxWidth.MValue(); height = (int)(((double)width) / ratio); } if (maxHeight != null && height > maxHeight.MValue()) { height = maxHeight.MValue(); width = (int)(ratio * ((double)height)); } int areaWidth = area.getAllocationWidth() - startIndent - endIndent; int pageHeight = area.getPage().getBody().getMaxHeight() - spaceBefore; if (height > pageHeight) { height = pageHeight; width = (int)(ratio * ((double)height)); } if (width > areaWidth) { width = areaWidth; height = (int)(((double)width) / ratio); } if (area.spaceLeft() < (height + spaceBefore)) { return(new Status(Status.AREA_FULL_NONE)); } this.imageArea = new ImageArea(propMgr.GetFontState(area.getFontInfo()), img, area.getAllocationWidth(), width, height, startIndent, endIndent, align); if ((spaceBefore != 0) && (this.marker == 0)) { area.addDisplaySpace(spaceBefore); } if (marker == 0) { area.GetMyRefs().ConfigureID(id, area); } imageArea.start(); imageArea.end(); if (spaceAfter != 0) { area.addDisplaySpace(spaceAfter); } if (breakBefore == BreakBefore.PAGE || ((spaceBefore + imageArea.GetHeight()) > area.spaceLeft())) { return(new Status(Status.FORCE_PAGE_BREAK)); } if (breakBefore == BreakBefore.ODD_PAGE) { return(new Status(Status.FORCE_PAGE_BREAK_ODD)); } if (breakBefore == BreakBefore.EVEN_PAGE) { return(new Status(Status.FORCE_PAGE_BREAK_EVEN)); } if (area is BlockArea) { BlockArea ba = (BlockArea)area; LineArea la = ba.getCurrentLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } la.addPending(); if (imageArea.getContentWidth() > la.getRemainingWidth()) { la = ba.createNextLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } } la.addInlineArea(imageArea, GetLinkSet()); } else { area.addChild(imageArea); area.increaseHeight(imageArea.getContentHeight()); } imageArea.setPage(area.getPage()); if (breakAfter == BreakAfter.PAGE) { this.marker = MarkerBreakAfter; return(new Status(Status.FORCE_PAGE_BREAK)); } if (breakAfter == BreakAfter.ODD_PAGE) { this.marker = MarkerBreakAfter; return(new Status(Status.FORCE_PAGE_BREAK_ODD)); } if (breakAfter == BreakAfter.EVEN_PAGE) { this.marker = MarkerBreakAfter; return(new Status(Status.FORCE_PAGE_BREAK_EVEN)); } } catch (FonetImageException imgex) { FonetDriver.ActiveDriver.FireFonetError("Error while creating area : " + imgex.Message); } return(new Status(Status.OK)); }
public override Status Layout(Area area) { BlockArea blockArea; if (!(area is BlockArea)) { FonetDriver.ActiveDriver.FireFonetWarning( "Currently Character can only be in a BlockArea"); return(new Status(Status.OK)); } blockArea = (BlockArea)area; bool textDecoration; AuralProps mAurProps = propMgr.GetAuralProps(); BorderAndPadding bap = propMgr.GetBorderAndPadding(); BackgroundProps bProps = propMgr.GetBackgroundProps(); HyphenationProps mHyphProps = propMgr.GetHyphenationProps(); MarginInlineProps mProps = propMgr.GetMarginInlineProps(); RelativePositionProps mRelProps = propMgr.GetRelativePositionProps(); ColorType c = properties.GetColorType(); float red = c.Red; float green = c.Green; float blue = c.Blue; int whiteSpaceCollapse = properties.GetWhiteSpaceCollapse(); WrapOption wrapOption = this.parent.properties.GetWrapOption(); TextDecoration tmp = properties.GetTextDecoration(); if (tmp == TextDecoration.UNDERLINE) { textDecoration = true; } else { textDecoration = false; } char characterValue = this.properties.GetChar(); string id = this.properties.GetId(); blockArea.GetMyRefs().InitializeID(id, blockArea); LineArea la = blockArea.getCurrentLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } la.changeFont(propMgr.GetFontState(area.getFontInfo())); la.changeColor(red, green, blue); la.changeWrapOption(wrapOption); la.changeWhiteSpaceCollapse(whiteSpaceCollapse); blockArea.setupLinkSet(this.GetLinkSet()); int result = la.addCharacter(characterValue, this.GetLinkSet(), textDecoration); if (result == Character.DOESNOT_FIT) { la = blockArea.createNextLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } la.changeFont(propMgr.GetFontState(area.getFontInfo())); la.changeColor(red, green, blue); la.changeWrapOption(wrapOption); la.changeWhiteSpaceCollapse(whiteSpaceCollapse); blockArea.setupLinkSet(this.GetLinkSet()); la.addCharacter(characterValue, this.GetLinkSet(), textDecoration); } return(new Status(Status.OK)); }
public override Status Layout(Area area) { if (!(area is BlockArea)) { FonetDriver.ActiveDriver.FireFonetWarning( "Page-number-citation outside block area"); return(new Status(Status.OK)); } IDReferences idReferences = area.getIDReferences(); this.area = area; if (this.marker == MarkerStart) { AccessibilityProps mAccProps = propMgr.GetAccessibilityProps(); AuralProps mAurProps = propMgr.GetAuralProps(); BorderAndPadding bap = propMgr.GetBorderAndPadding(); BackgroundProps bProps = propMgr.GetBackgroundProps(); MarginInlineProps mProps = propMgr.GetMarginInlineProps(); RelativePositionProps mRelProps = propMgr.GetRelativePositionProps(); ColorType c = this.properties.GetProperty("color").GetColorType(); this.red = c.Red; this.green = c.Green; this.blue = c.Blue; this.wrapOption = this.properties.GetProperty("wrap-option").GetEnum(); this.whiteSpaceCollapse = this.properties.GetProperty("white-space-collapse").GetEnum(); this.refId = this.properties.GetProperty("ref-id").GetString(); if (this.refId.Equals("")) { throw new FonetException("page-number-citation must contain \"ref-id\""); } this.id = this.properties.GetProperty("id").GetString(); idReferences.CreateID(id); ts = new TextState(); this.marker = 0; } if (marker == 0) { idReferences.ConfigureID(id, area); } pageNumber = idReferences.getPageNumber(refId); if (pageNumber != null) { this.marker = FOText.addText((BlockArea)area, propMgr.GetFontState(area.getFontInfo()), red, green, blue, wrapOption, null, whiteSpaceCollapse, pageNumber.ToCharArray(), 0, pageNumber.Length, ts, VerticalAlign.BASELINE); } else { BlockArea blockArea = (BlockArea)area; LineArea la = blockArea.getCurrentLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } la.changeFont(propMgr.GetFontState(area.getFontInfo())); la.changeColor(red, green, blue); la.changeWrapOption(wrapOption); la.changeWhiteSpaceCollapse(whiteSpaceCollapse); la.addPageNumberCitation(refId, null); this.marker = -1; } if (this.marker == -1) { return(new Status(Status.OK)); } else { return(new Status(Status.AREA_FULL_NONE)); } }
private void QueryData() { if (selChannel == null) { return; } int selIndex = comboBoxEdit1.SelectedIndex; if (selIndex < 0) { return; } DateTime timeSel = listTimes[selIndex]; timeQuery = timeSel.AddSeconds((timeEdit1.Time - timeEdit1.Time.Date).TotalSeconds); if (timeQuery < selChannel.File.BeginTime) { MessageBox.Show("查询时间小于记录开始时间!", "查询", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (timeQuery > selChannel.File.EndTime) { MessageBox.Show("查询时间大于记录开始时间!", "查询", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int sec = (int)((timeQuery - selChannel.File.BeginTime).TotalSeconds); trackBarControl1.ValueChanged -= new EventHandler(trackBarControl1_ValueChanged); trackBarControl1.Value = sec; trackBarControl1.ValueChanged += new EventHandler(trackBarControl1_ValueChanged); float[] data = selChannel.File.GetData(selChannel.Channel - 1, timeQuery, secNum); rawCurveGroup.ClearChartObject(); freqCurveGroup.ClearChartObject(); this.rawCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeQuery), 0); this.freqCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeQuery), 0); //幅度谱 LineArea laAmpl = new LineArea(chart, "原始波形", false); laAmpl.YAxes.YAxesMin = 0; laAmpl.YAxes.YAxesMax = 200; LineCurve lcAmpl = new LineCurve(chart, "原始波形", 0); lcAmpl.LineColor = Color.Lime; laAmpl.AddLine(lcAmpl); //lc.YAxes.Mode = YAxesMode.Manual; lcAmpl.YAxes.YAxesMin = 0; lcAmpl.YAxes.YAxesMax = 100; if (data != null) { long startTm = ChartGraph.DateTime2ChartTime(timeQuery); for (int j = 0; j < data.Length; j++) { long tm = startTm + j * 1000000L / 8000; // var tm = timeQuery.AddMilliseconds(j / 8.0); lcAmpl.AddPoint(new LinePoint(tm, data[j])); } } //频率谱 LineArea laFreq = new LineArea(chart1, "频率谱", false); laFreq.YAxes.YAxesMin = 0; laFreq.YAxes.YAxesMax = 200; laFreq.XFreqScale = 8000f / (secNum * 1000000); LineCurve lcFreq = new LineCurve(chart1, "频率谱", 0); lcFreq.LineColor = Color.Red; laFreq.AddLine(lcFreq); lcFreq.YAxes.Mode = YAxesMode.Manual; lcFreq.YAxes.YAxesMin = -1; lcFreq.YAxes.YAxesMax = 15; if (data != null) { if (fftPlan.FFTNum != secNum * 8000) { fftPlan.Dispose(); fftPlan = new FFTPlan(secNum * 8000); fftIn = new float[secNum * 16000]; fftOut = new float[secNum * 16000]; } for (int i = 0; i < data.Length; i++) { fftIn[i * 2] = data[i]; fftIn[i * 2 + 1] = 0; } fftPlan.FFTForward(fftIn, fftOut); long startTm = ChartGraph.DateTime2ChartTime(timeQuery); float maxAmpl = 0; for (int j = 0; j < data.Length / 2; j++) { long tm = startTm + j * 1000000L / 8000; // var tm = timeQuery.AddMilliseconds(j / 8.0); float amplVal = 0; if (j > 2) //不显示直流 { amplVal = (float)(Math.Sqrt(fftOut[2 * j] * fftOut[2 * j] + fftOut[2 * j + 1] * fftOut[2 * j + 1]) * 2 / (8000 * secNum)); } if (amplVal > maxAmpl) { maxAmpl = amplVal; } lcFreq.AddPoint(new LinePoint(tm, amplVal)); } lcFreq.YAxes.YAxesMax = maxAmpl * 1.2f; } rawCurveGroup.AddChartObject(laAmpl); freqCurveGroup.AddChartObject(laFreq); chart.Draw(); chart1.Draw(); }
private void ProcADSample(object obj) { int channel = (int)obj; ADBlock block = new ADBlock(8000, 4000); this.device.AddADBlock(channel, block); try { while (true) { short[] adData = block.GetAdData(-1); if (adData == null) { continue; } if (listEnable[channel] == false) { continue; } int adMin = int.MaxValue; int adMax = int.MinValue; for (int i = 0; i < adData.Length; i++) { if (adData[i] > adMax) { adMax = adData[i]; } if (adData[i] < adMin) { adMin = adData[i]; } } float adMaxf = adMax + (adMax - adMin) * 0.2f; float adMinf = adMin - (adMax - adMin) * 0.2f; this.Invoke((EventHandler) delegate { ChartGraph chart = listChart[channel]; UltraChart.CurveGroup grp = chart.GroupList[0]; grp.ClearChartObject(); LineArea area = new LineArea(chart, "AD曲线", true); area.IsShowFoldFlag = false; area.IsFold = false; area.YAxes.Mode = YAxesMode.Manual; area.YAxes.YAxesMin = adMinf; area.YAxes.YAxesMax = adMaxf; area.YAxes.Precision = 3; area.YAxes.UnitString = ""; LineCurve lcAmpl = new LineCurve(chart, "原始波形", 0); lcAmpl.LineColor = Color.Lime; area.AddLine(lcAmpl); DateTime timeNow = DateTime.Now; long startTm = ChartGraph.DateTime2ChartTime(timeNow); for (int j = 0; j < adData.Length; j++) { long tm = startTm + j * 1000000L / 8000; // var tm = timeQuery.AddMilliseconds(j / 8.0); lcAmpl.AddPoint(new LinePoint(tm, adData[j])); } grp.AddChartObject(area); grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeNow), 0); chart.AutoSetXScale(); chart.Draw(); }); } } catch (Exception ex) { } finally { this.device.RemoveADBlock(channel, block); } }
private void DrawCurve() { HHDevice device = comboBoxEdit2.SelectedItem as HHDevice; HHDeviceProperty devProp = comboBoxEdit1.SelectedItem as HHDeviceProperty; DateTime timeSel = DateTime.Now; if (comboBoxEdit3.SelectedIndex >= 0) { timeSel = (DateTime)comboBoxEdit3.SelectedItem; } HHDeviceProperty devBindProp = device.GetProperty(devProp); List <DevCurve> curves = devBindProp.Curves; UltraChart.CurveGroup grp = chart.GroupList[0]; grp.ClearChartObject(); LineArea area = new LineArea(chart, "道岔曲线", true); area.IsShowFoldFlag = false; area.IsFold = false; area.YAxes.Mode = YAxesMode.Manual; area.YAxes.YAxesMin = curves[0].ADMin; area.YAxes.YAxesMax = curves[0].ADMax; area.YAxes.Precision = 3; area.YAxes.UnitString = ""; grp.AddChartObject(area); grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeSel), 0); chart.AutoSetXScale(); List <StationCurve> listCurve = DataStorage.DatabaseModule.GetInstance().QueryCurveHistory(curves[0].Group.Type, curves[0].Index, timeSel); string[][] curveNames = new string[][] { new string[] { "曲线" }, new string[] { "曲线1", "曲线2" }, new string[] { "A相", "B相", "C相" }, }; for (int i = 0; i < curves.Count; i++) { LineCurve line = new LineCurve(chart, curveNames[curves.Count - 1][i], 0); line.LineColor = ColorList[i % ColorList.Length]; area.AddLine(line); if (listCurve != null && listCurve.Count > 0 && listCurve[i] != null) { for (int j = 0; j < listCurve[i].Points.Length; j++) { DateTime time = timeSel.AddMilliseconds(curves[i].TimeInterval * j); //40毫秒 LinePoint point = new LinePoint(); point.Value = listCurve[i].Points[j]; point.Time = ChartGraph.DateTime2ChartTime(time); line.AddPoint(point); } } } chart.AutoSetXScale(); chart.Draw(); }