private bool constructAxes() { // Setup Axes defined in XAML if (LineSeries != null && LineSeries.Count() > 0 && OxyPlotViewAxes.Count > 1) { IEnumerator <OxyPlot.Wpf.Axis> it = OxyPlotViewAxes.GetEnumerator(); while (it.MoveNext()) { OxyPlotView.Axes.Add(it.Current); } } // Setup Axes defined in the ViewModel else if (ChartData != null && ChartData.LinesData.Count > 0 && ChartData.AxesConfigurations.Count > 1) { int i = 0; foreach (ChartAxisConf axisConf in ChartData.AxesConfigurations) { OxyPlot.Wpf.Axis _axis = (OxyPlot.Wpf.Axis)Activator.CreateInstance(Type.GetType("OxyPlot.Wpf." + axisConf.AxisTypeName + ",OxyPlot.Wpf")); _axis.SetCurrentValue(OxyPlot.Wpf.Axis.PositionProperty, MultifunctionalChartData.AxesPositions[i]); // Set axis style Style _axis_style = null; switch (MultifunctionalChartData.AxesPositions[i]) { case AxisPosition.Left: _axis.Title = (ChartData.TitleY == null ? "" : ChartData.TitleY); _axis_style = YAxisStyle; break; case AxisPosition.Bottom: _axis.Title = (ChartData.TitleX == null ? "" : ChartData.TitleX); _axis_style = XAxisStyle; break; // implement more cases if required default: DllEntryPoint.LogMessage(Xvue.MSOT.Services.Log.EnumLogType.Info, "Warning", $"{Name}.constructAxes: Axis # {(i + 1)}: Unhandled AxisPosition: {Convert.ToString(MultifunctionalChartData.AxesPositions[i])}"); break; } OxyPlotView.Axes.Add(_axis); // Style DependencyProperty has to be defined always after adding the axis to the view if (_axis_style == null) { _axis_style = TryFindResource("OxyPlotDefaultAxisStyle") as Style; } if (_axis_style != null) { _axis.SetCurrentValue(StyleProperty, _axis_style); } i++; } } return(OxyPlotView.Axes.Count() > 1); }