public Column(double width, int headerHeight, int bodyHeight, List<Data> datalist, DataModel model) { _model = model; initializeData(width, headerHeight, bodyHeight, datalist); initializeGraphics(); initializeContextMenu(); }
private double _width; // ScrollViewer的宽度 #endregion Fields #region Constructors public TimeBasedDynamicDiagram(double width, DataModel model, String path) { initializeData(width, model, path); initializeGraphics(); initializeHandler(); }
private void initializeData(double width, DataModel model, String path) { // 获取图形显示配置 _configPath = path; XmlDocument doc = new XmlDocument(); doc.Load(_configPath); XmlNode node = doc.SelectSingleNode("Diagram/ColumnBody/CanvasHeight"); _bodyHeight = Int32.Parse(node.InnerText); node = doc.SelectSingleNode("Diagram/ColumnHeader/Height"); _headerHeight = Int32.Parse(node.InnerText); _width = width; _colWidth = adjustColumnWidth(width, model.DataList.Count); _model = model; _columns = new List<Column>(); _headerPanel = new StackPanel(); _headerPanel.Orientation = Orientation.Horizontal; _bodyViewer = new ScrollViewer(); _bodyViewer.Height = Int32.Parse(doc.SelectSingleNode("Diagram/BodyViewer/Height").InnerText); _bodyPanel = new StackPanel(); _bodyPanel.Orientation = Orientation.Horizontal; _bodyViewer.Content = _bodyPanel; List<List<Data>> list = new List<List<Data>>(); for (int i = 0; i < _model.ColumnNumber; ++i) { List<Data> datalist = new List<Data>(); list.Add(datalist); } for (int i = 0; i < _model.DataList.Count; ++i) { Data d = _model.DataList.ElementAt(i); if (d.DefaultColumnPos.Count == 0) continue; for (int j = 0; j < d.DefaultColumnPos.Count; ++j) list.ElementAt(d.DefaultColumnPos.ElementAt(j) - 1).Add(d); } _scale = new ScaleColumn(_colWidth, _headerHeight, _bodyHeight); _headerPanel.Children.Add(_scale.Header); _bodyPanel.Children.Add(_scale.Body); for (int i = 0; i < _model.ColumnNumber; ++i) { Column c = new Column(_colWidth, _headerHeight, _bodyHeight, list.ElementAt(i), _model); _columns.Add(c); _headerPanel.Children.Add(c.Header); _bodyPanel.Children.Add(c.Body); } }
// 动态图标初始化 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; }
private void InitData(DataModel model) { _model = model; tbInterval.Text = (_model.Interval / 1000).ToString(); tbDisplayInterval.Text = _model.DisplayInterval.ToString(); }
public ChangeIntervalWindow(DataModel model) { InitializeComponent(); InitData(model); }