Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
foreach (DataRow row in dt.Rows)
        {
            lstData.Add(new Tablelist() { FileName=csv,  process = row["process"] + "", Event = row["Event"] + "", status = row["status"] + "" });
 
        }
    }
        DataTable dtoutput = new DataTable();
       var columnNames =  lstData.Select(k => k.FileName).Distinct();
       foreach (string columnName in columnNames)       
           dtoutput.Columns.Add(columnName, typeof(string));
       DataRow newrowPassCount = dtoutput.NewRow();
         foreach (string columnName in columnNames) {
            int count = lstData.Where(k=> k.FileName == columnName).Count(k => k.status == "Pass");
            newrowPassCount[columnName] = count; 
        }
         dtoutput.Rows.Add(newrowPassCount);
 
         DataRow newrowFailCount = dtoutput.NewRow();
         foreach (string columnName in columnNames)
         {
             int count = lstData.Where(k => k.FileName == columnName).Count(k => k.status == "Fail");
             newrowFailCount[columnName] = count;
         }
         dtoutput.Rows.Add(newrowFailCount);
 
         gridview.datasource = dtoutput;
         gridview.databind();


i got this code here, instead of using gridview to display, can i display it in chart..i have been trying putting value in x and y..but i just cant get..what should i put for x and y value??
Posted
Updated 2-Jan-14 22:02pm
v2

HI,

Pls specify which chart you want to use? like google chart,Chart in excel file etc.

If you want to use google chart, you have to call Ajax call.

Pls refer this link for more help : https://code.google.com/p/googlechartsharp/

Hope it will work.
 
Share this answer
 
Comments
acing wei 3-Jan-14 4:26am    
column chart...I'm using csv with ,my code above
// Set chart data source
chart1.DataSource = dtoutput;

// Set series members names for the X and Y values
chart1.Series["Series 1"].XValueMember = "";
chart1.Series["Series 1"].YValueMembers = "";

// Data bind to the selected data source
chart1.DataBind();
I'm using something like this but can't work..
HI...

Pls refer this link

http://www.rgraph.net/docs/csv-file-reader.html[^]

Use this code :

 row = getRow(index[, start])
This function fetchs a row of data from the CSV and returns it (as an array). You can optionally give the column index to start at (the column numbering starts from 0). eg row = csv.getRow(3, 1);

col = getCol(index[, start])
This function fetchs a column of data from the CSV and returns it (as an array). You can optionally give the row index to start at (the row numbering starts from 0). eg col = csv.getCol(3, 1); 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900