private static IEnumerable<AxisDataBindingObject> CalculateBindingObjects(FlightAnalysisViewModel viewModel, IEnumerable<string> parameterIds) { if (parameterIds != null) { //var result1 = from one in parameterIds // where one.IsChecked // select one; //KG(开关量)分一组 //T6L、T6R分一组 //NHL、NHR分一组 List<AxisDataBindingObject> objs = new List<AxisDataBindingObject>(); Dictionary<string, AxisDataBindingObject> objMap = new Dictionary<string, AxisDataBindingObject>(); int item = 0; foreach (var res in parameterIds) { string key = res; if (res.StartsWith("KG")) { key = "KG"; } else if (res.StartsWith("T6")) { key = "T6"; } else if (res.StartsWith("NH")) { key = "NH"; } if (objMap.ContainsKey(key)) { objMap[key].AddRelatedParameterID(res); continue; } else { AxisDataBindingObject obj = new AxisDataBindingObject(viewModel); if (key == "KG") { obj = new KGAxisDataBindingObject(viewModel); } else if (key == "T6") { obj = new T6AxisDataBindingObject(viewModel); } else if (key == "NH") { obj = new NHAxisDataBindingObject(viewModel); } obj.ParameterID = key; obj.Order = item; item++; obj.AddRelatedParameterID(res); objMap.Add(key, obj); objs.Add(obj); } } var result2 = from ob in objs orderby ob.Order ascending select ob; return result2; } return new AxisDataBindingObject[] { }; }
public static XamDataChart CreateOneChart( AxisDataBindingObject bindingObj, ref FAChartModel faChartModel) { FAChartSubModel model = bindingObj.ToFAChartSubModel(); if (faChartModel.SubModels.ContainsKey(bindingObj.ParameterID)) { faChartModel.SubModels[bindingObj.ParameterID] = model; } else { faChartModel.SubModels.Add(bindingObj.ParameterID, model); } Infragistics.Controls.Charts.Legend legend = new Legend() { Margin = new Windows.UI.Xaml.Thickness(10), Opacity = 1, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right }; Infragistics.Controls.XamDock.SetEdge(legend, Infragistics.Controls.DockEdge.InsideRight); XamDataChart chart = new XamDataChart() { Margin = new Windows.UI.Xaml.Thickness(0, 25, 0, 25) }; chart.Legend = legend; chart.DataContext = model; return bindingObj.AssignSimpleLineChart(model, chart); }
private IEnumerable<AxisDataBindingObject> CalculateBindingObjects() { if (this.m_subViewModel != null) { List<string> resultString1 = new List<string>(); resultString1.Add(this.m_subViewModel.HostParameterID); if (m_subViewModel.RelatedParameterIDs != null && m_subViewModel.RelatedParameterIDs.Count > 0) resultString1.AddRange(m_subViewModel.RelatedParameterIDs); //var result1 = from one in this.m_viewModel.RelatedParameterCollection // //where one.IsChecked // select one; //KG(开关量)分一组 //T6L、T6R分一组 //NHL、NHR分一组 List<AxisDataBindingObject> objs = new List<AxisDataBindingObject>(); Dictionary<string, AxisDataBindingObject> objMap = new Dictionary<string, AxisDataBindingObject>(); int item = 0; foreach (var res in resultString1) { string key = res; if (res.StartsWith("KG")) { key = "KG"; } else if (res.StartsWith("T6")) { key = "T6"; } else if (res.StartsWith("NH")) { key = "NH"; } if (objMap.ContainsKey(key)) { objMap[key].AddRelatedParameterID(res); //objMap[key].Add(res); continue; } else { AxisDataBindingObject obj = new AxisDataBindingObject(this.m_subViewModel.ViewModel); if (key == "KG") { obj = new KGAxisDataBindingObject(this.m_subViewModel.ViewModel); } else if (key == "T6") { obj = new T6AxisDataBindingObject(this.m_subViewModel.ViewModel); } else if (key == "NH") { obj = new NHAxisDataBindingObject(this.m_subViewModel.ViewModel); } obj.ParameterID = key; obj.Order = item; item++; //obj.Add(res); obj.AddRelatedParameterID(res); objMap.Add(key, obj); objs.Add(obj); } } var result2 = from ob in objs orderby ob.Order ascending select ob; return result2; } return new AxisDataBindingObject[] { }; }
private NumericYAxis[] CreateYAxis(AxisDataBindingObject axisDataBindingObject) { NumericYAxis xmYAxis = new NumericYAxis() { LabelSettings = new AxisLabelSettings(), FontSize = 18, Foreground = new SolidColorBrush(Windows.UI.Colors.Black), }; xmYAxis.LabelSettings.Extent = 55; xmYAxis.LabelSettings.Location = AxisLabelsLocation.OutsideLeft; return new NumericYAxis[] { xmYAxis }; }
private CategoryXAxis CreateXAxis(AxisDataBindingObject axisDataBindingObject) { CategoryXAxis xaxis = new CategoryXAxis() { Label = "{Second}", Foreground = new SolidColorBrush(Windows.UI.Colors.Black), FontSize = 18, LabelSettings = new AxisLabelSettings(), ItemsSource = TestModelDataSource.Instance//m_viewModel.RawDatas, }; xaxis.LabelSettings.Extent = 35; xaxis.LabelSettings.Location = AxisLabelsLocation.OutsideBottom; return xaxis; }
private XamDataChart BindObject(AxisDataBindingObject axisDataBindingObject) { if (axisDataBindingObject != null) { XamDataChart chart = new XamDataChart(); CategoryXAxis xAxis = this.CreateXAxis(axisDataBindingObject); NumericYAxis[] yAxis = this.CreateYAxis(axisDataBindingObject); int counter = 0; foreach (var vm in axisDataBindingObject.RelatedParameterIDs)//.ViewModels) { LineSeries serie = new LineSeries() { ItemsSource = TestModelDataSource.Instance, // vm.ViewModel.RawDatas, XAxis = xAxis, MarkerType = Infragistics.Controls.Charts.MarkerType.None, Thickness = 2, YAxis = this.FindYAxis(yAxis, counter), ValueMemberPath = "Hp"//vm.Parameter.ParameterID, }; chart.Series.Add(serie); counter++; } return chart; } return null; }