Hi,

I have a requirement to display the bar chart to get the data from database 
show the reject summary report. i tried few methods but i am unable to 
display the data with subject are wise number of source systems.

*Requirement :*


Subject Area        reject-count          source system
Party language        4                        CHP
Party language        81                     EC
Party language       2                        SC
Party language      34                       UDFHP



*Output :* please see the image


*Code :*

<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>

<html>
  <head>
    <script type="text/javascript" 
src="https://www.google.com/jsapi";></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawVisualization);
      function drawVisualization() {
       var data = new google.visualization.DataTable();
        data.addColumn('string', 'subjectarea');
data.addColumn('number', 'SourceSystem');
data.addColumn('number', 'Rejected Record Count');
        
<%

String jdbcURL = "jdbc:sqlserver://DBDMDM01:1433;database=chcdm_dev";
Connection conn = null;
Statement stmt = null;
ResultSet rs =null;
String user ="chcdm_dev" ;
String passwd ="XXXXXX!#";


try 
{
  
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
  conn = DriverManager.getConnection(jdbcURL,user,passwd);

  stmt = conn.createStatement();
rs = stmt.executeQuery("select  subjectarea ,sourcesystem, sum(noofrejects) 
Count from chcdm_dev.dbo.MDM_AUDIT_REJECTS_SUMMARY where RejectStage='base' 
group by SourceSystem,subjectarea order by subjectarea");

 
 ArrayList subjectareaList = new ArrayList();
 //ArrayList SourceSystemList = new ArrayList();
 ArrayList valList = new ArrayList();

 while (rs.next())
  {
  subjectareaList.add(rs.getString("subjectarea"));
  SourceSystemList.add(rs.getString("SourceSystem"));
valList.add(rs.getString("Count"));
  }
 
 if (subjectareaList.size()>0){
out.println("data.addRows("+subjectareaList.size()+");");

 for(int i=0;i<subjectareaList.size(); i++)
  {
          out.println("data.setValue("+i+", 0, 
'"+subjectareaList.get(i)+"');");
          out.println("data.setValue("+i+", 1, '"+SourceSystemList.get(i) 
+"');");
  out.println("data.setValue("+i+", 2, '"+valList.get(i) +"');");
 
  }
 }
 
} 
 
catch (Exception e){
e.printStackTrace();
}
%>

var options = {
        
title: 'MDM Base Load Rejects Summary Report',
vAxis: {title: 'Rejects'},
hAxis: {title: 'Base Object Tables'},
seriesType: 'bars',
        //series: {6: {type: 'line'}}
        //is3D: true
      };
var chart = new 
google.visualization.ComboChart(document.getElementById('chart_div'));
chart.draw(data, options);

      };
    </script>
  </head>

  <body>
    <div id='chart_div' style="height: 100%; width: 99%"></div>
  </body>
</html>

could you please some have any information 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/e73fbf9e-970b-410a-ba2a-0c89c9b4e103%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to