public void repaintScale(ScaleData data) { if (_body.Children.Count > 4) { _body.Children.RemoveRange(0, _body.Children.Count); } drawBorder(); double scale = _canvasHeight * 1.0 / 3; for (int i = 1; i < 3; ++i) { TextBlock block = new TextBlock(); block.Text = data.Datetime[i - 1].ToDateString() + "\n" + data.Datetime[i-1].ToTimeString() + "\n" +Math.Round(Convert.ToDouble(data.Depth[i - 1].ToString()),2)+"(m)"; block.Foreground = Brushes.Red; Canvas.SetLeft(block, 10); Canvas.SetTop(block, i * scale - 30); _body.Children.Add(block); } //initializeContextMenu(); }
public void startDynamicDrawing(SqlDataAccess conn, String TableName, String WellID, String WellBoreID, ScaleData data) { this.conn = conn; this.TableName = TableName; this.WellID = WellID; this.WellBoreID = WellBoreID; this.data = data; _timer = new System.Windows.Forms.Timer(); _timer.Enabled = true; _timer.Interval = _model.Interval; _timer.Tick += new EventHandler(getData); }
public void repaint(ScaleData data) { _body.repaint(); drawGraphics(data); }
// 动态图标初始化 private void initializeGraphics() { Dmodel = new DynamicDiagram.DataModel("..//..//DynamicDiagram//TimeBasedDataConfig.xml", ReceiveDs); Ddiagram = new DynamicDiagram.TimeBasedDynamicDiagram(900, Dmodel, "..//..//Dynamicdiagram//DiagramConfig.xml"); data = new DynamicDiagram.ScaleData(); Ddiagram.startDynamicDrawing(DRconn, "WS_Drilling_Depth_Based", "龙109井", "主井眼", data); //Ddiagram.getData(DRconn, "WS_Drilling_Depth_Based", "龙109井", "主井眼", data); _Ditem.Content = Ddiagram; }
public void drawGraphics(ScaleData sData) { // 获取本列中的所有数据 List<ColumnHeaderData> list = _header.Data; for (int ii = 0; ii < list.Count; ++ii) { // 获取单项数据 ColumnHeaderData c = list.ElementAt(ii); List<double> data = c.Data.DData; double min = c.Data.Min; double max = c.Data.Max; if(max==min) { max = max + 1; } double span = max - min; double scale = _body.Height * 1.0 / 3.0; //Time ROOT = new Time(_model.TDATE._StringData.ElementAt(sData.pos[0]).ToString(), // _model.TTIME._StringData.ElementAt(sData.pos[0]).ToString()); Time ROOT = sData.FirstTime; int rowInterval = sData.Datetime[0].Getdiff(sData.Datetime[2]) / 3; for (int i = 0; i < 3; ++ i) { for (int j = i==0 ? 0 : sData.Pos[i-1]; j < sData.Pos[i]; ++j) { Time first = new Time(_model.TDATE.StringData.ElementAt(j).ToString(), _model.TTIME.StringData.ElementAt(j).ToString()); Time second = new Time(_model.TDATE.StringData.ElementAt(j + 1).ToString(), _model.TTIME.StringData.ElementAt(j + 1).ToString()); int interval = first.Getdiff(second); Line line = new Line() { X1 = (data.ElementAt(j) - min) * this._body.Width / span, Y1 = (ROOT.Getdiff(first)) * 1.0 / rowInterval * scale, X2 = (data.ElementAt(j+1) - min) * this._body.Width / span, Y2 = (ROOT.Getdiff(second)) * 1.0 / rowInterval * scale, Stroke = colors[ii], StrokeThickness = 0.8 }; _body.Children.Add(line); } } } }