Пример #1
0
        private void ApplyChartMergeOperators( IAnalysisResult result, Report report )
        {
            var mergedSections = ChartMergeOperators
                .Select( op => op.Merge( result ) )
                .Where( section => section != null )
                .ToList();

            report.Sections.AddRange( mergedSections );
        }
Пример #2
0
        public Report Generate( IAnalysisResult result )
        {
            var report = new Report( "CombinedCharts", "Combined charts: " + result.Stock.Name );

            ApplyChartMergeOperators( result, report );
            AddStandaloneCharts( result, report );

            return report;
        }
Пример #3
0
        public void Visit( Report report )
        {
            if ( CheckAlreadyVisited( report ) ) return;

            myVisitor.Visit( report );

            foreach ( var section in report.Sections )
            {
                Visit( section );
            }
        }
Пример #4
0
        private void AddStandaloneCharts( IAnalysisResult result, Report report )
        {
            var visitor = new ChartSectionVisitor();
            var walker = new ReportWalker( visitor );
            walker.Visit( result.Report );

            var standaloneCharts = visitor.Sections
                .Where( section => !HandledByChartMergeOperators( section ) )
                .ToList();

            report.Sections.AddRange( standaloneCharts );
        }
Пример #5
0
        public Report Generate( IAnalysisResult result )
        {
            var stock = result.Stock;
            var report = new Report( "ClosedPricesChart", "Closed price chart: " + stock.Name );

            var chart = new StockPriceChart( stock, Prices.ForStock( stock ) );
            var chartSection = new GenericChartSection( "Closed prices", chart );

            report.Sections.Add( chartSection );

            return report;
        }
Пример #6
0
        private void AddIndicators( StockPriceChart chart, Report report )
        {
            var visitor = new ChartSectionVisitor();
            var walker = new ReportWalker( visitor );
            walker.Visit( report );

            foreach ( var section in visitor.Sections.OfType<GenericChartSection>() )
            {
                foreach ( var entry in section.Chart.IndicatorPoints )
                {
                    // could be that the chart is already added
                    // sample: indicator 1 = SMA.200, indicator 2 = SMA.10xSMA.200 (double cross over). then SMA.200 would be added two times
                    if ( !chart.IndicatorPoints.ContainsKey( entry.Key ) )
                    {
                        chart.IndicatorPoints.Add( entry.Key, entry.Value );
                    }
                }
            }
        }
Пример #7
0
        private void RenderReport( Report report )
        {
            if ( !Directory.Exists( ReportOutputDirectory ) )
            {
                Directory.CreateDirectory( ReportOutputDirectory );
            }

            using ( PerfMon.Profile( "Rendering report" ) )
            {
                var renderer = new HtmlRenderer();
                renderer.Render( report, ReportOutputDirectory );
            }

            Console.WriteLine( "Report written to: {0}", ReportOutputDirectory );
        }
 public void Visit( Report report )
 {
     // nothing to do
 }
Пример #9
0
 public DetailedReportAdapter( string reference, Report report )
     : base(reference, report.Name, report.Title)
 {
     myReport = report;
 }