CheckDataCharts.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Web.UI;
  5. //using myChart.WebCharts.Insight;
  6. using SysBaseLibs;
  7. using System.Drawing;
  8. using AjaxControlToolkit;
  9. namespace SysDataLibs.Charts
  10. {
  11. public class CheckDataCharts
  12. {
  13. public static void ShowPicture(string pcType,string pcReportType, Page poPage)
  14. {
  15. pcType = UtilStr.UAndT(pcType);
  16. switch (pcType)
  17. {
  18. case "PIE"://显示饼图
  19. ShowPieChart(poPage,pcReportType );
  20. break;
  21. case "BAR"://显示柱图
  22. ShowBarChart(poPage,pcReportType );
  23. break;
  24. case "LINES": //线性统计图
  25. break;
  26. case "LINE": //显示实时线图
  27. break;
  28. case "0"://测试柱图
  29. ShowPicture0(poPage);
  30. break;
  31. case "1"://测试饼图
  32. ShowPicture1(poPage);
  33. break;
  34. case "2"://测试实时图
  35. ShowPicture2(poPage);
  36. break;
  37. default:
  38. break;
  39. }
  40. }
  41. private static void ShowBarChart(Page poPage,string pcReportType)
  42. {
  43. UserSession _Session = WebLibs.CheckLogin();
  44. //string SearchStr = _Session.GetObj("SearchStr").ToString();
  45. string lcSql = _Session.GetObj("SearchStr").ToString();//" select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
  46. rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
  47. BarChart loBarChart = new BarChart();
  48. loBarChart.SetDataToDataObj(loQuery);
  49. loBarChart.SubTitleVisable = true;
  50. switch (pcReportType)
  51. {
  52. case "MONTHCount":
  53. loBarChart.DrawChart("月统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  54. break;
  55. case "YEARCount":
  56. loBarChart.DrawChart("年统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  57. break;
  58. case "ProduceUnit":
  59. loBarChart.DrawChart("生产单位统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  60. break;
  61. case "SampleName":
  62. loBarChart.DrawChart("检测样品统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  63. break;
  64. case"LittleKindName":
  65. loBarChart.DrawChart("食品小类统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  66. break;
  67. case "CheckProjectTypeID":
  68. loBarChart.DrawChart("检测项目统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  69. break;
  70. case "CheckUnit":
  71. loBarChart.DrawChart("检测单位统计 柱图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  72. break;
  73. //------------------------------合格率---------------------------------
  74. case "MonthHGL":
  75. loBarChart.IsHeGeLv = true ;
  76. loBarChart.DrawChart("月合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
  77. break;
  78. case "YearHGL":
  79. loBarChart.IsHeGeLv = true;
  80. loBarChart.DrawChart("年合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
  81. break;
  82. case "CheckProjectTypeHGL":
  83. loBarChart.IsHeGeLv = true;
  84. loBarChart.DrawChart("检测项目合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
  85. break;
  86. case "ProduceUnitHGL":
  87. loBarChart.IsHeGeLv = true;
  88. loBarChart.DrawChart("生产单位合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
  89. break;
  90. //
  91. case "SampleNameHGL":
  92. loBarChart.IsHeGeLv = true;
  93. loBarChart.DrawChart("检测样品合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
  94. break;
  95. case "CheckUnitHGL":
  96. loBarChart.IsHeGeLv = true;
  97. loBarChart.DrawChart("检测单位合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
  98. break;
  99. case "LittleKindNameHGL":
  100. loBarChart.IsHeGeLv = true;
  101. loBarChart.DrawChart("食品小类合格率统计 柱图", "", new Size(500, 400), poPage.Response.OutputStream);
  102. break;
  103. default :
  104. break;
  105. }
  106. }
  107. private static void ShowPieChart(Page poPage,string pcReportType)
  108. {
  109. UserSession _Session = WebLibs.CheckLogin();
  110. string lcSql = _Session.GetObj("SearchStr").ToString();// " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
  111. rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
  112. PieChart loPieChart = new PieChart();
  113. loPieChart.SetDataToDataObj(loQuery);
  114. loPieChart.SubTitleVisable = true;
  115. switch (pcReportType)
  116. {
  117. case "MONTHCount":
  118. loPieChart.DrawChart("月统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  119. break;
  120. case "YEARCount":
  121. loPieChart.DrawChart("年统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  122. break;
  123. case "ProduceUnit":
  124. loPieChart.DrawChart("生产单位统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  125. break;
  126. case "SampleName":
  127. loPieChart.DrawChart("检测样品统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  128. break;
  129. case "LittleKindName":
  130. loPieChart.DrawChart("食品小类统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  131. break;
  132. //case "GreatKindName":
  133. // loPieChart.DrawChart("食品大类统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  134. // break;
  135. case "CheckProjectTypeID":
  136. loPieChart.DrawChart("检测项目统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  137. break;
  138. case "CheckUnit":
  139. loPieChart.DrawChart("检测单位统计 饼图", "检测数", new Size(500, 400), poPage.Response.OutputStream);
  140. break;
  141. default:
  142. break;
  143. }
  144. }
  145. private static void ShowLineChart(Page poPage)
  146. {
  147. }
  148. private static void ShowPicture0(Page poPage)
  149. {
  150. UserSession _Session = WebLibs.CheckLogin();
  151. string lcSql = " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
  152. rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
  153. BarChart loBarChart = new BarChart();
  154. loBarChart.SetDataToDataObj(loQuery);
  155. loBarChart.SubTitleVisable = true;
  156. loBarChart.DrawChart("yue统计柱图", "副标题", new Size(500, 400), poPage.Response.OutputStream);
  157. }
  158. private static void ShowPicture1(Page poPage)
  159. {
  160. UserSession _Session = WebLibs.CheckLogin();
  161. string lcSql = " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
  162. rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
  163. PieChart loPieChart = new PieChart();
  164. loPieChart.SetDataToDataObj(loQuery);
  165. loPieChart.SubTitleVisable = true;
  166. loPieChart.DrawChart("品种类型统计饼图", "副标题", new Size(500, 400), poPage.Response.OutputStream);
  167. }
  168. private static void ShowPicture2(Page poPage)
  169. {
  170. UserSession _Session = WebLibs.CheckLogin();
  171. string lcSql = " select SampleName,sum( IsSelf) as yes from Checkdata group by SampleName ";
  172. rsQuery loQuery = _Session.DBConn.OpenQuery(lcSql);
  173. LineChart loLineChart = new LineChart();
  174. loLineChart.SetDataToDataObj(loQuery);
  175. loLineChart.SubTitleVisable = true;
  176. loLineChart.DrawChart("食品安全日实时走势图", "副标题", new Size(500, 400), poPage.Response.OutputStream);
  177. }
  178. }
  179. }