0 Replies - 692 Views - Last Post: 26 March 2019 - 08:29 PM

#1 mhr92   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 22-October 16

Why the chart did not showing?

Posted 26 March 2019 - 08:29 PM

Hello, I create the charts. It should have 2 chart but the only one chart show in the report. The second chart is the copy of the first chart but the first chart did not showing after copying for the second chart. Below is the code for the chart and the screenshot of the chart.

Attached Image




 bw.append("<html><head>");
			  
	    	   bw.append("<title>Automation Summary Report</title>");
	    	   bw.append("<script type=\"text/javascript\" src=\"../lib/js/jquery.min.js\"></script>");
	    	   bw.append("<script type=\"text/javascript\" src=\"../lib/js/jquery.jqplot.min.js\"></script>");
	    	   bw.append("<script type=\"text/javascript\" src=\"../lib/js/plugins/jqplot.barRenderer.js\"></script>");
	    	   bw.append("<script type=\"text/javascript\" src=\"../lib/js/plugins/jqplot.categoryAxisRenderer.js\"></script>");
	    	   bw.append("<script type=\"text/javascript\" src=\"../lib/js/plugins/jqplot.pointLabels.js\"></script>");
	    	   bw.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../lib/js/jquery.jqplot.min.css\" />");
	    	   bw.append("<link href=\"../testng.css\" rel=\"stylesheet\" type=\"text/css\" />");
	    	   bw.append("<link href=\"../my-testng.css\" rel=\"stylesheet\" type=\"text/css\" />");
	    	   
	    	   bw.append("<style type=\"text/css\">");
	    	   bw.append(".log { display: none;} ");
	    	   bw.append(".stack-trace { display: none;}" );
	    	   bw.append("table, tr, td {");
	    	   bw.append("border: 1px solid blue;");
	    	   bw.append("border-collapse: collapse;");
	    	   bw.append("padding: 5px;}");
	    	   bw.append("#progress {");
	    	    
	    	   NumberFormat formatter = new DecimalFormat("#0.00");
	    	   String failPercent = formatter.format((float)failednum/totalTestSuite*100);
	    	   String passPercent =  formatter.format((float)passnum/totalTestSuite*100);
			
	    	   bw.append("width: 50%;");
	    	   bw.append("background-color: #ddd;");
	    	   bw.append("float:left;");
	    	   bw.append("}");
	    	   bw.append("#passBar {");
	    	   bw.append("width: "+passPercent+"%;");
	    	   bw.append("height: 15px;");
	    	   bw.append("background-color: #00FF00;");
	    	   bw.append("}");
	    	   bw.append("#failBar {");
	    	   bw.append("width: "+failPercent+"%;");
	    	   bw.append("height: 15px;");
	    	   bw.append("background-color: #FF0000;");
	    	   bw.append("}");
	    	   bw.append("#skipBar {");
	    	   bw.append("width: "+passPercent+"%;");
	    	   bw.append("height: 15px;");
	    	   bw.append("background-color: #C4C8BC;");
	    	   bw.append("}");
	    	   bw.append("#noRunBar {");
	    	   bw.append("width: 0%;");
	    	   bw.append("height: 15px;");
	    	   bw.append("background-color: #000000;");
	    	   bw.append("}" + "div.mytable {\r\n" + "display: table;\r\n" + "width: 100%;\r\n" + "}\r\n" + "\r\n" + "div.mytable> div {\r\n" + 
	    	    		"display: table-row;\r\n" + "width: 100%;\r\n" + "}\r\n" + "div.mytable > div > div {\r\n" + "display: table-cell;\r\n" + 
	    	    		"width: 20%;\r\n" + "padding:1em;\r\n" + "}");
	    	   bw.append("</style>");
	    	   
	    	   bw.append("<script type=\"text/javascript\" src=\"https://canvasjs.com/assets/script/canvasjs.min.js\"></script>");
	    	   bw.append("<script type=\"text/javascript\">");
	    	   bw.append("$(document).ready(function(){");
	    	   bw.append("     ");
	    	   bw.append("line1 = [5];");//passnum
	    	   bw.append("line2 = [5];");//fail
	    	   bw.append("line3 = [5];");//skip
	    	   bw.append("plot3b = $.jqplot('chart3b', [line1, line2,line3], {");
	    	   bw.append("stackSeries: true,");
	    	   bw.append("legend: {");
	    	   bw.append("show: true,");
	    	   bw.append("location: 'nw'");
	    	   bw.append("},");
	    	   bw.append("title: 'Overall Test Result1',");
	    	   bw.append("seriesColors:['#00FF00', '#FF0000', '#C4C8BC'],");
	    	   bw.append("seriesDefaults: {");
	    	   bw.append("renderer: $.jqplot.BarRenderer,");
	    	   bw.append("rendererOptions: {");
	    	   bw.append("barPadding: 6,");
	    	   bw.append("barMargin: 60,");
	    	   bw.append("barWidth:"+200);
	    	   bw.append("},");
	    	   bw.append("pointLabels: {show: true, formatString: '%s'}");
	    	   bw.append("},");
	    	   bw.append("series: [{");
	    	   bw.append("label: 'PASSED'");
	    	   bw.append("},");
	    	   bw.append("{");
	    	   bw.append("label: 'FAILED'");
	    	   bw.append("},");
	    	   bw.append("{");
	    	   bw.append("label: 'SKIPPED'");
	    	   bw.append("}],");
	    	   bw.append("axes: {");
	    	   bw.append("xaxis: {");
	    	   bw.append("renderer: $.jqplot.CategoryAxisRenderer,");
	    	   bw.append("ticks: ['Test Suite']");
	    	   bw.append("},");
	    	   bw.append("}");
	    	   bw.append("}); ");
	    	   bw.append("});");
	    	   
	    	   // chart3c =========================================================================================================
	    	   bw.append("<script type=\"text/javascript\" src=\"https://canvasjs.com/assets/script/canvasjs.min.js\"></script>");
	    	   bw.append("<script type=\"text/javascript\">");
	    	   bw.append("$(document).ready(function(){");
	    	   bw.append("     ");
	    	   bw.append("line1 = [5];");//passnum
	    	   bw.append("line2 = [5];");//fail
	    	   bw.append("line3 = [5];");//skip
	    	   bw.append("plot3c = $.jqplot('chart3c', [line1, line2,line3], {");
	    	   bw.append("stackSeries: true,");
	    	   bw.append("legend: {");
	    	   bw.append("show: true,");
	    	   bw.append("location: 'nw'");
	    	   bw.append("},");
	    	   bw.append("title: 'Overall Test Result2',");
	    	   bw.append("seriesColors:['#00FF00', '#FF0000', '#C4C8BC'],");
	    	   bw.append("seriesDefaults: {");
	    	   bw.append("renderer: $.jqplot.BarRenderer,");
	    	   bw.append("rendererOptions: {");
	    	   bw.append("barPadding: 6,");
	    	   bw.append("barMargin: 60,");
	    	   bw.append("barWidth:"+200);
	    	   bw.append("},");
	    	   bw.append("pointLabels: {show: true, formatString: '%s'}");
	    	   bw.append("},");
	    	   bw.append("series: [{");
	    	   bw.append("label: 'PASSED'");
	    	   bw.append("},");
	    	   bw.append("{");
	    	   bw.append("label: 'FAILED'");
	    	   bw.append("},");
	    	   bw.append("{");
	    	   bw.append("label: 'SKIPPED'");
	    	   bw.append("}],");
	    	   bw.append("axes: {");
	    	   bw.append("xaxis: {");
	    	   bw.append("renderer: $.jqplot.CategoryAxisRenderer,");
	    	   bw.append("ticks: ['Test Suite']");
	    	   bw.append("},");
	    	   bw.append("}");
	    	   bw.append("}); ");
	    	   bw.append("});");
	    	   
	    	   bw.append("</script>");
	    	   bw.append("</head>");
	    	 
	    	   bw.append("<body bgcolor=\"#EBF5FB\">");
	    	   bw.append("<div><img src=\""+projectLocation+"\\Template\\img\\pactera.png\" width=\"200\" align='right'>");
	    	   bw.append("<center><h1><font style=\"font-family:Arial;\" color=\"#045387\"><b>"
	    	   		+ "&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;"
	    	   		+ "Automation Summary Report</b></font></h1></center></div>");
	    	   bw.append("<br/>");
	    	   
	    	   bw.append("<hr><div class=\"mytable\"><div>");
	    	   bw.append("<div id=\"chart3b\" style=\"height: 300px;\" align='left'></div>");
	    	   bw.append("<div id=\"chart3c\" style=\"height: 300px;\"align='right'></div>");


Is This A Good Question/Topic? 0
  • +

Page 1 of 1