Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. }
  4. public chart ChartUser(string UserId)
  5. {
  6. chart c = new chart();
  7. SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=emp;Integrated Security=True");
  8. // SqlDataAdapter da = new SqlDataAdapter("select * from ChartPie where id= UserId + "'", con);
  9. con.Open();
  10. SqlCommand cmd = new SqlCommand("select * from ChartPie where id='" + UserId + "'", con);
  11. SqlDataReader dr = cmd.ExecuteReader();
  12. while (dr.Read())
  13. {
  14. c.UserId = dr["UserId"].ToString();
  15. c.Language = dr["Language"].ToString();
  16. c.percentage = dr["percentage"].ToString();
  17. }
  18.  
  19. return c;
  20. }
  21. public class chart
  22. {
  23. public string UserId { get; set; }
  24. public string Language { get; set; }
  25. public string percentage { get; set; }
  26.  
  27. }
  28. }
  29.  
  30. var chart = AmCharts.makeChart("chartdiv", {
  31. "type": "pie",
  32. "theme": "none",
  33. "legend": {
  34. "markerType": "circle",
  35. "position": "right",
  36. "marginRight": 80,
  37. "autoMargins": false
  38. },
  39. "dataProvider": [{
  40. "Language": "Tamil",
  41. "percentage": 50
  42. }, {
  43. "Language": "English",
  44. "percentage": 40
  45. }, {
  46. "Language": "Hindi",
  47. "percentage": 30
  48. }],
  49. "valueField": "percentage",
  50. "titleField": "Language",
  51. colorField: "color",
  52. "balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
  53. "exportConfig": {
  54. "menuTop": "0px",
  55. "menuItems": [{
  56. "icon": '/lib/3/images/export.png',
  57. "format": 'png'
  58. }]
  59. }
  60. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement