protractor-html-reporter-extended
Version:
Generates HTML report with pie charts based on a xml file
42 lines (40 loc) • 1.25 kB
JavaScript
// eslint-disable-next-line no-unused-vars
function drawChart(chartData) {
// eslint-disable-next-line no-undef
const data = google.visualization.arrayToDataTable([
['Status', 'Results'],
['Passed', chartData.passed],
['Failed', chartData.failed]
]);
const options = {
width: '100%',
height: 250,
pieHole: 0.3,
title: `${chartData.title.toUpperCase()} - SUMMARY`,
pieSliceText: 'percentage',
sliceVisibilityThreshold: .0001,
pieResidueSliceColor: 'red',
colors: ['forestgreen', 'red'],
pieSliceTextStyle: {
color: 'black',
},
legend: 'label',
legend: {
position: 'bottom',
textStyle: {
color: '#5e5e5e',
fontSize: 9
}
},
pieStartAngle: 100,
backgroundColor: 'whitesmoke',
titleTextStyle: {
fontSize: '13',
color: '#5e5e5e',
fontName: "Source Sans Pro",
}
};
// eslint-disable-next-line no-undef
const chart = new google.visualization.PieChart(document.getElementById('piechart_' + chartData.title.toLowerCase()));
chart.draw(data, options);
}