public CurveChartTemplate TemplateFrom(CurveChart chart, bool validateTemplate = true)
        {
            var template = _chartTemplateMapper.MapFrom(chart);

            if (!template.Curves.Any() && validateTemplate)
            {
                throw new OSPSuiteException(Error.TemplateShouldContainAtLeastOneCurve);
            }

            return(template);
        }
Example #2
0
        private void initializeFromTemplate(CurveChart originalChart, CurveChart clonedChart, IndividualSimulation simulation)
        {
            var allAvailableColumns = new List <DataColumn>();

            addSimulationResults(simulation, allAvailableColumns);
            addObservedDataColumns(simulation, allAvailableColumns);
            Func <DataColumn, string> curveNameDefinition = c => _quantityDisplayPathMapper.DisplayPathAsStringFor(simulation, c);

            _chartFromTemplateService.InitializeChartFromTemplate(clonedChart, allAvailableColumns, _chartTemplateMapper.MapFrom(originalChart), curveNameDefinition);
        }
 public XElement SerializeBasedOn(CurveChart chart)
 {
     return(Serialize(_curveChartTemplateMapper.MapFrom(chart)));
 }