Comments (9)
I think I can help you. Give me some time, I will come back to you within the next days.
from reportgenerator.
Thanks for your quick and supportive response. 😄
Thanks for the help.
from reportgenerator.
@arpitgold:
I created a plugin for you, that renders the chart.
Please download this project, and place the compiled DLL next to ReportGenerator.exe. Then call ReportGenerator.exe with -reporttypes:HtmlChart.
This will create a single file report that contains the chart (and unfortunately the footer).
In Jenkins you can publish this file as an artifact or with the HTML Publisher Plugin.
Then you could create a simple HTML page, that embeds the charts from all of your projects as iframes.
This is the code of the plugin:
using System;
using System.Collections.Generic;
using System.Linq;
using Palmmedia.ReportGenerator.Parser.Analysis;
using Palmmedia.ReportGenerator.Properties;
using Palmmedia.ReportGenerator.Reporting;
using Palmmedia.ReportGenerator.Reporting.Rendering;
namespace MyCompany.CustomReportTypes
{
/// <summary>
/// Creates HTML with chart component only (no reports for classes are generated).
/// </summary>
[System.ComponentModel.Composition.Export(typeof(IReportBuilder))]
public class HtmlChartReportBuilder : HtmlSummaryReportBuilder
{
/// <summary>
/// Gets the report type.
/// </summary>
/// <value>
/// The report type.
/// </value>
public override string ReportType
{
get { return "HtmlChart"; }
}
/// <summary>
/// Creates the summary report.
/// </summary>
/// <param name="reportRenderer">The report renderer.</param>
/// <param name="summaryResult">The summary result.</param>
public override void CreateSummaryReport(IReportRenderer reportRenderer, SummaryResult summaryResult)
{
if (reportRenderer == null)
{
throw new ArgumentNullException("reportRenderer");
}
if (summaryResult == null)
{
throw new ArgumentNullException("summaryResult");
}
this.TargetDirectory = System.IO.Path.Combine(this.TargetDirectory, "chart");
System.IO.Directory.CreateDirectory(this.TargetDirectory);
reportRenderer.BeginSummaryReport(this.TargetDirectory, ReportResources.Summary);
var historicCoverages = this.GetOverallHistoricCoverages(summaryResult.Assemblies.SelectMany(a => a.Classes));
if (historicCoverages.Any(h => h.CoverageQuota.HasValue || h.BranchCoverageQuota.HasValue))
{
reportRenderer.Chart(historicCoverages);
}
reportRenderer.CustomSummary(summaryResult.Assemblies);
reportRenderer.SaveSummaryReport(this.TargetDirectory);
}
/// <summary>
/// Gets the overall historic coverages from all classes.
/// </summary>
/// <param name="classes">The classes.</param>
/// <returns>
/// The overall historic coverages from all classes.
/// </returns>
private IEnumerable<HistoricCoverage> GetOverallHistoricCoverages(IEnumerable<Class> classes)
{
var historicCoverages = classes
.SelectMany(c => c.HistoricCoverages);
var executionTimes = historicCoverages
.Select(h => h.ExecutionTime)
.Distinct();
var result = new List<HistoricCoverage>();
foreach (var executionTime in executionTimes)
{
var historicCoveragesOfExecutionTime = historicCoverages
.Where(h => h.ExecutionTime.Equals(executionTime))
.ToArray();
result.Add(new HistoricCoverage(executionTime)
{
CoveredLines = historicCoveragesOfExecutionTime.Sum(h => h.CoveredLines),
CoverableLines = historicCoveragesOfExecutionTime.Sum(h => h.CoverableLines),
CoveredBranches = historicCoveragesOfExecutionTime.Sum(h => h.CoveredBranches),
TotalBranches = historicCoveragesOfExecutionTime.Sum(h => h.TotalBranches),
TotalLines = historicCoveragesOfExecutionTime.Sum(h => h.TotalLines)
});
}
return result;
}
}
}
from reportgenerator.
Thanks @danielpalme , 👍
A big thank for your support and fast response.
I will check it and get back to you if I need any further assistance.
from reportgenerator.
Hi @danielpalme,
It works as exactly as I required.
But the issue is I am calling as -reporttypes:Html;XmlSummary;HtmlChart .
Html and HtmlChart both creates index.htm. Html report's "index.htm" file get overriden.
Can we create seperate files for each report?
from reportgenerator.
Easiest solution would be, to save the HtmlChart report to a different directory.
Just add the following lines to the CreateSummaryReport method:
this.TargetDirectory = System.IO.Path.Combine(this.TargetDirectory, "chart");
System.IO.Directory.CreateDirectory(this.TargetDirectory);
from reportgenerator.
Thanks @danielpalme, its works like a charm.
Again thanks for all your support. 👍
from reportgenerator.
I am getting unknown Report Type - I added the dll MyCompany.ReportGeneratorExtensions.dll next to the ReportGenerator.exe - can you help?
from reportgenerator.
Please use latest version 2.3.2. Custom report types are only supported with version >2
from reportgenerator.
Related Issues (20)
- LCov: branch hit count can overflow Int32. HOT 1
- Files with 0% coverage are omitted from the coverage report HOT 8
- Report generator is looking for dotnet even the artifact is Python code HOT 1
- Cobertura report generation emits NaN as complexity for async functions HOT 2
- Visual Studio .coveragexml: ReportGenerator ignores compiler-generated classes HOT 11
- SixLabors.ImageSharp.Drawing has potential vulnerability HOT 6
- Risk Hotspots thresholds - what are the default values - and how change them HOT 1
- Visual Studio Coverage: Support partial line coverage HOT 6
- Cobertura output async "class" merging can create duplicate method entries HOT 10
- 10 days trial HOT 1
- coverlet-coverage give much higher Cyclomatic Complexity score for given Method then Visual Studio 2022 Code Metrics Results HOT 3
- The generated (GeneratedRegex) codes are count as uncovered branches in v5.2.0 HOT 4
- I don't manage to get the final results exposed in Azure DevOps UI HOT 2
- Downloaded file not found at path specified HOT 1
- Cobertura merge information loss HOT 8
- Projects with DebugType "Portable" experience internal server 500 error while reading source files. HOT 6
- Calculate C.R.A.P. Score from Cobertura file? HOT 7
- Looking for documentations on how the extension manages data HOT 1
- Add support for Gitlab (Code Climate) Reports HOT 10
- [Question] Up-to-date overview: How to use ReportGenerator with Azure DevOps? HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reportgenerator.