private DataTable dataTableFor(ICurveChart chart, ICurve curve) { var xName = chart.Axes[AxisTypes.X].Caption; var yName = chart.Axes[AxisTypes.Y].Caption; var xUnit = chart.Axes[AxisTypes.X].UnitName; var yUnit = chart.Axes[AxisTypes.Y].UnitName; var dt = new DataTable(curve.Name); dt.Columns.Add(xName, typeof(float)); dt.Columns.Add(yName, typeof(float)); dt.BeginLoadData(); for (var i = 0; i < curve.xData.Values.Count; i++) { var newRow = dt.NewRow(); newRow[xName] = TEXHelper.ValueInDisplayUnit(curve.XDimension, curve.XDimension.Unit(xUnit), curve.xData.Values[i]); newRow[yName] = TEXHelper.ValueInDisplayUnit(curve.YDimension, curve.YDimension.Unit(yUnit), curve.yData.Values[i]); dt.Rows.Add(newRow); } dt.EndLoadData(); return(dt); }
private IEnumerable <object> pkAnalysisFor(Simulation simulation, ICurveChart chart, OSPSuiteTracker buildTracker) { var report = new List <object>(); var globalPKAnalysis = _globalPKAnalysisTask.CalculateGlobalPKAnalysisFor(new[] { simulation }); updateDisplayUnits(globalPKAnalysis, PresentationSettingsFor(chart, PresenterConstants.PresenterKeys.GlobalPKAnalysisPresenter)); var globalPKAnalysisTable = _globalPKAnalysisToDataTableMapper.MapFrom(globalPKAnalysis); if (globalPKAnalysisTable.Rows.Count > 0) { report.Add(buildTracker.GetStructureElementRelativeToLast(PKSimConstants.UI.GlobalPKAnalyses, 1)); report.Add(globalPKAnalysisTable); } var curvesToDisplay = chart.Curves.ForPKAnalysis(); var pkAnalyses = _pkAnalysisTask.CalculateFor(new[] { simulation }, curvesToDisplay.Select(c => c.yData)).ToList(); updateDisplayUnits(pkAnalyses, PresentationSettingsFor(chart, PresenterConstants.PresenterKeys.IndividualPKParametersPresenter)); var pkAnalysesTable = _pkAnalysisToDataTableMapper.MapFrom(pkAnalyses, curvesToDisplay); var pkAnalysesForReport = new PKAnalysesTable(pkAnalysesTable); report.Add(buildTracker.GetStructureElementRelativeToLast(PKSimConstants.UI.PKAnalyses, 1)); report.Add(pkAnalysesForReport); return(report); }
private void initializeFromTemplate(ICurveChart originalChart, ICurveChart clonedChart, IndividualSimulation simulation) { var allAvailableColumns = new List <DataColumn>(); addSimulationResults(simulation, allAvailableColumns); addObservedDataColumns(simulation, allAvailableColumns); _chartFromTemplateService.CurveNameDefinition = c => _quantityDisplayPathMapper.DisplayPathAsStringFor(simulation, c); _chartFromTemplateService.InitializeChartFromTemplate(clonedChart, allAvailableColumns, _chartTemplateMapper.MapFrom(originalChart)); }
public void InitFromTemplate(ICurveChart chart, IChartEditorAndDisplayPresenter chartEditorPresenter, IReadOnlyCollection <DataColumn> allAvailableColumns, IReadOnlyCollection <IndividualSimulation> simulations, Func <DataColumn, string> nameForColumns, CurveChartTemplate defaultChartTemplate = null) { if (defaultChartTemplate == null) { UpdateDefaultSettings(chartEditorPresenter.EditorPresenter, allAvailableColumns, simulations); return; } _chartFromTemplateService.CurveNameDefinition = nameForColumns; _chartFromTemplateService.InitializeChartFromTemplate(chart, allAvailableColumns, defaultChartTemplate); //this can happen if template does not have any matching curve if (!chart.Curves.Any()) { UpdateDefaultSettings(chartEditorPresenter.EditorPresenter, allAvailableColumns, simulations); } }
public void ExportToPDF(ICurveChart chart) { _exportChartToPDFCommand.Subject = chart; _exportChartToPDFCommand.Execute(); }
protected override void Context() { base.Context(); _chart = A.Fake <ICurveChart>(); }
public void LoadCurves(ICurveChart chart, IndividualSimulation simulation) { initializeFromTemplate(chart, chart, simulation); }