private string DrawCommitsPerDayPerAuthorChart(RevisionControlHistoryData history)
        {
            FluentChart chart = FluentChart.Create("Commits History", null, "commits per day")
                                .SetBarSettings(BarType.Stack, 0)
                                .UseDateAsAxisY(history.MinTime.Date, history.MaxTime.Date);

            string[] colors = { "blue", "red", "green", "yellow", "orange", "brown" };

            IDictionary <string, SortedList <DateTime, double> > commitsPerAuthorPerDay
                = RevisionControlHistoryDataMiner.FetchCommitsPerAuthorPerDay(history);

            int i = 0;

            foreach (string author in commitsPerAuthorPerDay.Keys)
            {
                chart
                .AddBarSeries(author, colors[i++])
                .AddDataByDate(commitsPerAuthorPerDay[author], history.MinTime.Date, history.MaxTime.Date);
            }

            string chartImageFileName = fileManager.GetProjectFullFileName(
                projectId,
                ModuleId,
                "CommitsPerDayPerAuthorChart.png",
                true);

            chart
            .ExportToBitmap(chartImageFileName, ImageFormat.Png, 2000, 800);

            return(chartImageFileName);
        }
Exemplo n.º 2
0
        private string DrawChart(ProjectStatsGraph graph, ProjectStatsGraphData graphData, IList <string> xLabels)
        {
            // Draw chart
            using (FluentChart chart = FluentChart.Create(graph.GraphName, graph.XAxisTitle, graph.YAxisTitle))
            {
                chart.SetLabelsToXAxis(xLabels);

                int xScaleMaxValue = 1;

                foreach (ProjectStatsGraphParameter parameter in graph.GraphParameters)
                {
                    SortedList <int, double> values = graphData.GetValuesForParameter(parameter.ParameterName);
                    xScaleMaxValue = values.Count;
                    chart
                    .AddLineSeries(parameter.ParameterName, parameter.SeriesColor)
                    .AddData(values)
                    .SetSymbol(SymbolType.Circle, parameter.SeriesColor, 4, true);
                }

                string chartImageFileName = fileManager.GetProjectFullFileName(
                    projectId,
                    ModuleId,
                    string.Format(CultureInfo.InvariantCulture, "CCNet{0}Chart.png", graph.GraphName.Replace(" ", string.Empty)),
                    true);

                chart
                .SetXAxis(1, xScaleMaxValue)
                .ExportToBitmap(chartImageFileName, ImageFormat.Png, 2000, 800);

                return(chartImageFileName);
            }
        }
Exemplo n.º 3
0
        public void DrawCommittedFilesPerDayPerActionChart()
        {
            RevisionControlHistoryData data = LoadHistoryFromFile();

            FluentChart chart = FluentChart.Create("Committed Files History", null, "commited files per day")
                                .SetBarSettings(BarType.Stack, 0)
                                .UseDateAsAxisY(data.MinTime.Date, data.MaxTime.Date);

            string[] colors = { "blue", "red", "green", "yellow", "orange", "brown" };

            IDictionary <RevisionControlHistoryEntryAction, SortedList <DateTime, double> > reportData
                = RevisionControlHistoryDataMiner.FetchCommittedFilesPerActionTypePerDay(data);

            int i = 0;

            foreach (RevisionControlHistoryEntryAction action in reportData.Keys)
            {
                chart
                .AddBarSeries(action.ToString(), colors[i++])
                .AddDataByDate(reportData[action], data.MinTime.Date, data.MaxTime.Date);
            }

            chart
            .ExportToBitmap("test.png", ImageFormat.Png, 2000, 800);
        }
Exemplo n.º 4
0
        public void DrawCommitsPerDayPerAuthorChart()
        {
            RevisionControlHistoryData data = LoadHistoryFromFile();

            FluentChart chart = FluentChart.Create("Commits History", null, "commits per day")
                                .SetBarSettings(BarType.Stack, 0)
                                .UseDateAsAxisY(data.MinTime.Date, data.MaxTime.Date);

            string[] colors = { "blue", "red", "green", "yellow", "orange", "brown" };

            IDictionary <string, SortedList <DateTime, double> > commitsPerAuthorPerDay
                = RevisionControlHistoryDataMiner.FetchCommitsPerAuthorPerDay(data);

            int i = 0;

            foreach (string author in commitsPerAuthorPerDay.Keys)
            {
                chart
                .AddBarSeries(author, colors[i++])
                .AddDataByDate(commitsPerAuthorPerDay[author], data.MinTime.Date, data.MaxTime.Date);
            }

            chart
            .ExportToBitmap("test.png", ImageFormat.Png, 2000, 800);
        }
Exemplo n.º 5
0
        public void GenerateGraph(TestReportGraphData graphData, HtmlTestReportGeneratorSettings settings)
        {
            const int GraphWidth  = 1000;
            const int GraphHeight = 500;

            using (FluentChart chart = FluentChart.Create(string.Empty, string.Empty, graphData.GraphName))
            {
                chart
                .SetGraphSize(GraphWidth, GraphHeight)
                .SetFont("Palatino Linotype", 11, true)
                .SetXAxis(0, graphData.ValuesCount - 1);

                foreach (string seriesName in graphData.ListSeriesInOrder())
                {
                    chart
                    .AddLineSeries(seriesName, graphData.SeriesColors[seriesName])
                    .SetFilling(graphData.SeriesColors[seriesName])
                    .AddStackedData(graphData.GraphValues[seriesName]);
                }

                chart
                .ExportToBitmap(
                    Path.GetFullPath(Path.Combine(settings.OutputDirectory, graphData.GraphFileName)),
                    ImageFormat.Png,
                    GraphWidth,
                    GraphHeight);
            }
        }
Exemplo n.º 6
0
        public void Test()
        {
            FluentChart chart = FluentChart
                                .Create("Test chart", "xaxis", "yaxis")
                                .SetXAxis(0, 100)
                                .SetYAxis(45, 65)
                                .AddBarSeries("Test bar", "red");

            Random rnd = new Random();

            for (int i = 0; i < 100; i++)
            {
                chart
                .AddDataPair(i, rnd.Next(10) + 50);
            }

            chart
            .AddLineSeries("Test bar 2", "blue")
            .SetLineWidth(2)
            .SetSymbol(SymbolType.Circle, "green", 5, false);

            for (int i = 0; i < 100; i++)
            {
                chart
                .AddDataPair(i, rnd.Next(10) + 50);
            }

            chart
            .ExportToBitmap("test.png", ImageFormat.Png, 1000, 800);
        }
Exemplo n.º 7
0
        public void DrawChartTest()
        {
            ProjectStatsGraph graph = new ProjectStatsGraph();

            graph.GraphName  = "Build duration";
            graph.YAxisTitle = "Seconds";
            graph.AddParameter <TimeSpan>("Duration", "Green");

            ProjectStatsData data = GetStatisticDataFromFile();

            //Labels on X-Axis
            List <string> xLabels = new List <string> {
                "Test0_1233345667", "Test1_1233345667", "Test2_1233345667", "Test3_1233345667", "Test4_1233345667", "Test5_1233345667"
            };

            ProjectStatsGraphData graphData = new ProjectStatsGraphData(data);

            graphData.SetValue(0, "Duration", 12);
            graphData.SetValue(1, "Duration", 52);
            graphData.SetValue(2, "Duration", 2);
            graphData.SetValue(3, "Duration", 60);
            graphData.SetValue(4, "Duration", 10);
            graphData.SetValue(5, "Duration", 61);

            using (FluentChart chart = FluentChart.Create(graph.GraphName, graph.XAxisTitle, graph.YAxisTitle))
            {
                foreach (ProjectStatsGraphParameter parameter in graph.GraphParameters)
                {
                    chart
                    .AddLineSeries(parameter.ParameterName, parameter.SeriesColor)
                    .AddData(graphData.GetValuesForParameter(parameter.ParameterName))
                    .SetSymbol(SymbolType.Circle, parameter.SeriesColor, 4, true);
                }

                chart.SetXAxis(1, 6);
                chart.SetLabelsToXAxis(xLabels);

                chart
                .ExportToBitmap("test.png", ImageFormat.Png, 2000, 800);
            }
        }