private void UpdateSurface(ChartTypeModel chartTypeModel, View chartView) { var surface = (SciChartSurface)chartView.FindViewById(Resource.Id.chart); var xAxis = new NumericAxis(_context); var yAxis = new NumericAxis(_context); var seriesCollection = chartTypeModel.SeriesCollection; using (surface.SuspendUpdates()) { surface.XAxes.Add(xAxis); surface.YAxes.Add(yAxis); surface.RenderableSeries.Add(seriesCollection); } }
/// <summary> /// 更新和新增图表类型 /// </summary> /// <param name="input"></param> /// <returns></returns> public ChartTypeModel InsertOrUpdateChartType(ChartTypeModel input) { if (_ChartTypeCase.GetAll().Any(p => p.Id != input.Id && p.Name == input.Name)) { throw new UserFriendlyException("名为【" + input.Name + "】的对象已存在!"); } var entObj = input.MapTo <ChartType>(); //var entObj= AutoMapper.Mapper.Map<ChartType>(input); var resObj = _ChartTypeCase.InsertOrUpdate(entObj); if (resObj == null) { throw new UserFriendlyException("新增或更新失败!"); } else { return(resObj.MapTo <ChartTypeModel>()); } }