EChart_ParticlesComposition.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. using DevExpress.Utils;
  2. using DevExpress.XtraCharts;
  3. using NPOI.Util;
  4. using OTSIncAReportApp.OTSRstMgrFunction;
  5. using OTSIncAReportApp.OTSSampleReportInfo;
  6. using OTSIncAReportApp.SysMgrTools;
  7. using OTSIncAReportGrids;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.Data;
  12. using System.Linq;
  13. using System.Windows.Forms;
  14. namespace OTSIncAReportApp.Control_ECharts
  15. {
  16. /// <summary>
  17. /// 各图char相关模块
  18. /// </summary>
  19. public partial class EChart_ParticlesComposition : UserControl
  20. {
  21. Hashtable table;
  22. #region 图表相关变量
  23. //y轴名称
  24. public string m_str_AxisY { get; set; }
  25. //数据图类型:常用夹杂物分类CommonlyUsedClassify ,颗粒成分PComponent,元素成分EComponent,颗粒尺寸分布PSize
  26. string ComSel { get; set; }
  27. public bool Report { get; set; }
  28. frmReportApp m_ReportApp;
  29. private frmReportConditionChoose m_conditionChoose;
  30. private ResultDataMgr m_DataMgr;
  31. private List<DataTable> prListData = new List<DataTable>();
  32. private List<string> prListString = new List<string>();
  33. #endregion
  34. #region 窗体加载及构造函数
  35. public EChart_ParticlesComposition(frmReportApp ReportApp, string comsel)
  36. {
  37. ComSel = comsel;
  38. m_ReportApp = ReportApp;
  39. m_conditionChoose = ReportApp.m_conditionChoose;
  40. m_DataMgr = ReportApp.m_rstDataMgr;
  41. InitializeComponent();
  42. //国际化
  43. Language lan = new Language();
  44. table = lan.GetNameTable("CompositionDistributionGrid");
  45. }
  46. private void EChart_ParticlesComposition_Load(object sender, EventArgs e)
  47. {
  48. string sou = "";
  49. int sel = 0;//选择颗粒范围(0为全部颗粒1为选择颗粒)
  50. if (Report)
  51. {
  52. sou = m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResultId()].anotherFileName.ToString();
  53. sel = 0;
  54. }
  55. else
  56. {
  57. sou = m_conditionChoose.m_conditionData.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE).ToString();
  58. sel = m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
  59. }
  60. Report = false;
  61. if (m_ReportApp.more)
  62. {
  63. m_ReportApp.trans = false;
  64. }
  65. else
  66. {
  67. m_ReportApp.trans = true;
  68. }
  69. m_ReportApp.more = true;
  70. List<DataTable> list_dt = GetListJsonStr();
  71. bool bl = false;
  72. for (int i=0;i< list_dt.Count;i++)
  73. {
  74. if (list_dt[i].Rows.Count>0)
  75. {
  76. bl = true;
  77. }
  78. }
  79. if(!bl)
  80. {
  81. checkButton1.Visible = false;
  82. checkButton2.Visible = false;
  83. checkButton3.Visible = false;
  84. return;
  85. }
  86. List<DataTable> listDt = new List<DataTable>();
  87. for (int i=0;i< list_dt.Count;i++)
  88. {
  89. DataTable dt = list_dt[i].Clone();
  90. for (int a=0;a< list_dt[i].Rows.Count;a++)
  91. {
  92. if (list_dt[i].Rows[a]["name"].ToString() != "")
  93. {
  94. dt.Rows.Add(list_dt[i].Rows[a].ItemArray);
  95. }
  96. }
  97. listDt.Add(dt);
  98. }
  99. prListData = listDt.Copy();
  100. prListString.Clear();
  101. for (int i = 0; i < list_dt.Count; i++)
  102. {
  103. ResultFile resultFile = m_DataMgr.ResultFilesList.Find(s => s.anotherFileName == sou.Split('+')[i]);
  104. string str = resultFile.anotherFileName;
  105. prListString.Add(str);
  106. // 假设你已经有一个 ChartControl 实例,并且已经添加了一个饼图 Series
  107. //string str = prListString[i];
  108. Series series = new Series(str, ViewType.Pie);
  109. for (int a = 0; a < prListData[i].Rows.Count; a++)
  110. {
  111. string name = prListData[i].Rows[a]["name"].ToString();
  112. double Cunt = Convert.ToDouble(prListData[i].Rows[a]["Cunt"]);
  113. series.Points.Add(new SeriesPoint(name, Cunt));
  114. }
  115. series.LabelsVisibility = DefaultBoolean.True;
  116. series.Label.TextPattern = "{A}";
  117. chartControl1.Series.Add(series);
  118. }
  119. chartControl1.Legend.Visibility = DefaultBoolean.False;
  120. chartControl1.Refresh();
  121. panel1.Dock = DockStyle.Fill;
  122. chartControl1.Dock = DockStyle.Fill;
  123. checkButton1.Checked = false;
  124. checkButton2.Checked = false;
  125. checkButton3.Checked = true;
  126. }
  127. #endregion
  128. #region 获取单数据源
  129. private DataTable ClassificationIntegration(string path, int sel)
  130. {
  131. //------------------加载模块,获取数据-------------------------------------------------
  132. ResultGrid ls_resultgrid = new ResultGrid(m_ReportApp);
  133. Dictionary<string, string> keyValues_ResultGrid = ls_resultgrid.GetData_ResultGrid_Report();
  134. //------------------加载模块,获取数据结束----------------------------------------------
  135. Dictionary<string, string>.Enumerator en = keyValues_ResultGrid.GetEnumerator();
  136. string str_SCZS = "";
  137. keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col5"].ToString(), out str_SCZS);//视场总数
  138. DataOperation.DataAccess.ParticleData particledata = new DataOperation.DataAccess.ParticleData(path);
  139. DataTable data = new DataTable();
  140. data = particledata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
  141. if (data.Rows.Count == 0)
  142. {
  143. return data;
  144. }
  145. DataTable AreaInformationOfAllElements = ConSolidateInvalid(data);
  146. DataTable AllAnalysisDetails = new DataTable();
  147. AllAnalysisDetails.Columns.Add("Name");
  148. AllAnalysisDetails.Columns.Add("TypeId");
  149. AllAnalysisDetails.Columns.Add("Area", typeof(double));
  150. AllAnalysisDetails.Columns.Add("Class");
  151. AllAnalysisDetails.Columns.Add("Cunt", typeof(double));
  152. for (int i = 0; i < AreaInformationOfAllElements.Rows.Count; i++)
  153. {
  154. DataRow dr2 = AllAnalysisDetails.NewRow();
  155. dr2["Name"] = AreaInformationOfAllElements.Rows[i]["TypeName"].ToString();
  156. dr2["Area"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["ar"]);
  157. dr2["TypeId"] = AreaInformationOfAllElements.Rows[i]["TypeId"].ToString();
  158. dr2["Cunt"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["con"]);
  159. dr2["Class"] = AreaInformationOfAllElements.Rows[i]["GroupName"].ToString();
  160. AllAnalysisDetails.Rows.Add(dr2);
  161. }
  162. //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
  163. List<string> ClassName = new List<string>();
  164. DataTable getClass_dt = particledata.GetAllClass();
  165. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  166. {
  167. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  168. }
  169. DataTable AreaRatio = new DataTable();
  170. AreaRatio.TableName = "InclusionAreaRatio";
  171. AreaRatio.Columns.Add("e1");
  172. AreaRatio.Columns.Add("e2");
  173. AreaRatio.Columns.Add("e3", typeof(double));
  174. AreaRatio.Columns.Add("e4");
  175. AreaRatio.Columns.Add("e5");
  176. AreaRatio.Columns.Add("Cunt", typeof(int));
  177. //获取夹杂物的总面积用于计算夹杂物类别的占比(gridview最后一个固定是未识别颗粒,要排除未识别颗粒所以for循环至grid view长度减一)
  178. double totalInclusionArea = 0;
  179. totalInclusionArea = Convert.ToDouble(decimal.Parse(AllAnalysisDetails.Compute("sum(Area)", "").ToString()));
  180. for (int i = 0; i < AllAnalysisDetails.Rows.Count; i++)
  181. {
  182. DataRow dr2 = AreaRatio.NewRow();
  183. dr2["e1"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
  184. dr2["e2"] = AllAnalysisDetails.Rows[i]["Name"].ToString();
  185. dr2["e3"] = Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]);
  186. dr2["e4"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / totalInclusionArea) * 100, 2);
  187. dr2["e5"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / Convert.ToDouble(str_SCZS)) * 100, 4);
  188. dr2["Cunt"] = AllAnalysisDetails.Rows[i]["Cunt"].ToString();
  189. AreaRatio.Rows.Add(dr2);
  190. }
  191. DataTable AreaRatio_dt = AreaRatio.Copy();
  192. AreaRatio_dt.Clear();
  193. for (int i = 0; i < ClassName.Count(); i++)
  194. {
  195. DataTable dt = AreaRatio.Copy();
  196. dt.Clear();
  197. for (int a = 0; a < AreaRatio.Rows.Count; a++)
  198. {
  199. if (AreaRatio.Rows[a]["e1"].ToString() == ClassName[i].ToString())
  200. {
  201. dt.Rows.Add(AreaRatio.Rows[a].ItemArray);
  202. }
  203. }
  204. DataView dv = dt.DefaultView;
  205. dv.Sort = "e3 DESC";
  206. DataTable dt_Element = dv.ToTable();
  207. for (int a = 0; a < dt_Element.Rows.Count; a++)
  208. {
  209. AreaRatio_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
  210. }
  211. }
  212. DataTable AllAnalysisDetails1 = AreaRatio_dt.Copy();
  213. AllAnalysisDetails1.Clear();
  214. for (int i = 0; i < ClassName.Count; i++)
  215. {
  216. DataTable dt = AreaRatio_dt.Copy();
  217. dt.Clear();
  218. for (int a = 0; a < AreaRatio_dt.Rows.Count; a++)
  219. {
  220. if (AreaRatio_dt.Rows[a]["e1"].ToString() == ClassName[i].ToString())
  221. {
  222. dt.Rows.Add(AreaRatio_dt.Rows[a].ItemArray);
  223. }
  224. }
  225. if (dt.Rows.Count > 0)
  226. {
  227. double totalInclusionArea2 = Convert.ToDouble(decimal.Parse(AreaRatio_dt.Compute("sum(e3)", "").ToString()));
  228. double Area = Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
  229. int cunt = Convert.ToInt32(decimal.Parse(dt.Compute("sum(Cunt)", "").ToString()));
  230. DataRow dr3 = AllAnalysisDetails1.NewRow();
  231. dr3["e1"] = ClassName[i].ToString();
  232. dr3["e3"] = Math.Round(Area, 2);
  233. dr3["e4"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / totalInclusionArea2) * 100, 2);
  234. dr3["e5"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / Convert.ToDouble(str_SCZS)) * 100, 4);
  235. dr3["Cunt"] = cunt;
  236. AllAnalysisDetails1.Rows.Add(dr3);
  237. }
  238. }
  239. return AllAnalysisDetails1;
  240. }
  241. private DataTable ConSolidateInvalid(DataTable dt)
  242. {
  243. DataTable dt_invalid = dt.Clone();
  244. DataTable dt_no_invalid = dt.Clone();
  245. for (int i = 0; i < dt.Rows.Count; i++)
  246. {
  247. if (dt.Rows[i]["TypeName"].ToString() == "Invalid")
  248. {
  249. dt_invalid.Rows.Add(dt.Rows[i].ItemArray);
  250. }
  251. else
  252. {
  253. dt_no_invalid.Rows.Add(dt.Rows[i].ItemArray);
  254. }
  255. }
  256. return dt_no_invalid;
  257. }
  258. private string getWhere(string max, string min, string col)
  259. {
  260. return col + ">=" + min + " and " + col + "<" + max;
  261. }
  262. #endregion
  263. #region echarts
  264. /// <summary>
  265. /// 通过m_list_chartstruct,组合json数据格式
  266. /// </summary>
  267. /// <returns></returns>
  268. private List<DataTable> GetListJsonStr()
  269. {
  270. int sel = m_conditionChoose.m_conditionData.ProItemProIndex();
  271. string filedAndParticl = "";
  272. DataOperation.DataAccess.ParticleData particledata = null;
  273. DataTable dt = new DataTable();
  274. List<DataTable> ListData = new List<DataTable>();
  275. string sou = m_conditionChoose.m_conditionData.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE).ToString();
  276. for (int i = 0; i < sou.Split('+').Length; i++)
  277. {
  278. ResultFile resultFile = m_DataMgr.ResultFilesList.Find(s => s.anotherFileName == sou.Split('+')[i]);
  279. if (resultFile == null)
  280. {
  281. continue;
  282. }
  283. particledata = new DataOperation.DataAccess.ParticleData(resultFile.FilePath);
  284. switch (ComSel)
  285. {
  286. case "InclusionareaRatio":
  287. dt = particledata.GetAreaByAllIncA("");
  288. DataTable dtInclusionareaRatio = new DataTable();
  289. dtInclusionareaRatio.Columns.Add("name");
  290. dtInclusionareaRatio.Columns.Add("Cunt");
  291. for (int k = 0; k < dt.Rows.Count; k++)
  292. {
  293. string str = dt.Rows[k]["ar"].ToString();
  294. string name = dt.Rows[k]["TypeName"].ToString();
  295. if (Convert.ToInt32(dt.Rows[k]["TypeId"]) < 100)
  296. {
  297. continue;
  298. }
  299. DataRow dr = dtInclusionareaRatio.NewRow();
  300. dr["name"] = name;
  301. dr["Cunt"] = decimal.Round(decimal.Parse(dt.Rows[k]["ar"].ToString()), 2).ToString();
  302. dtInclusionareaRatio.Rows.Add(dr);
  303. }
  304. ListData.Add(dtInclusionareaRatio);
  305. break;
  306. case "CommonlyUsedClassify":
  307. //计算分类整个表的数据
  308. dt = ClassificationIntegration(resultFile.FilePath, sel);
  309. DataTable data = new DataTable();
  310. data.Columns.Add("name");
  311. data.Columns.Add("Cunt");
  312. for (int a = 0; a < dt.Rows.Count; a++)
  313. {
  314. DataRow dr = data.NewRow();
  315. dr["name"] = dt.Rows[a]["e1"].ToString();
  316. dr["Cunt"] = dt.Rows[a]["Cunt"].ToString();
  317. data.Rows.Add(dr);
  318. }
  319. ListData.Add(data);
  320. break;
  321. case "PComponent":
  322. //创建新的图形数据源
  323. dt = particledata.GetParticleListByIncA("area");
  324. DataTable dtPComponent = new DataTable();
  325. dtPComponent.Columns.Add("name");
  326. dtPComponent.Columns.Add("Cunt");
  327. for (int a = 0; a < dt.Rows.Count; a++)
  328. {
  329. if (Convert.ToInt32(dt.Rows[a]["TypeId"]) < 100)
  330. {
  331. continue;
  332. }
  333. DataRow dr = dtPComponent.NewRow();
  334. dr["name"] = dt.Rows[a]["TypeName"].ToString();
  335. dr["Cunt"] = dt.Rows[a]["con"].ToString();
  336. dtPComponent.Rows.Add(dr);
  337. }
  338. ListData.Add(dtPComponent);
  339. break;
  340. case "EComponent":
  341. //创建新的图形数据源
  342. dt = particledata.GetElementForArea(filedAndParticl);
  343. DataTable dtEComponent = new DataTable();
  344. dtEComponent.Columns.Add("name");
  345. dtEComponent.Columns.Add("Cunt");
  346. for (int k = 0; k < dt.Rows.Count; k++)
  347. {
  348. string str = dt.Rows[k]["earea"].ToString();
  349. try
  350. {
  351. DataRow dr = dtEComponent.NewRow();
  352. dr["name"] = dt.Rows[k]["name"].ToString();
  353. dr["Cunt"] = decimal.Round(decimal.Parse(str), 2).ToString();
  354. dtEComponent.Rows.Add(dr);
  355. }
  356. catch
  357. {
  358. DataRow dr = dtEComponent.NewRow();
  359. dr["name"] = dt.Rows[k]["name"].ToString();
  360. dr["Cunt"] = str;
  361. dtEComponent.Rows.Add(dr);
  362. }
  363. }
  364. ListData.Add(dtEComponent);
  365. break;
  366. case "PSize":
  367. //获取粒级表
  368. string pathe = m_DataMgr.m_RptConfigFile.PartSizeFileFolder + m_DataMgr.m_RptConfigFile.PartSizeFile;
  369. DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(pathe);
  370. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  371. List<string> temp = new List<string>();
  372. for (int j = 0; j < sizestr.Split(',').Length - 1; j++)
  373. {
  374. if (sizestr.Split(',')[j].Length > 0)
  375. {
  376. double d1 = Convert.ToDouble(sizestr.Split(',')[j]);
  377. double d2 = Convert.ToDouble(sizestr.Split(',')[j + 1]);
  378. string name = d1.ToString() + "~" + d2.ToString();
  379. temp.Add(name);
  380. }
  381. }
  382. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  383. string name1 = d.ToString() + "~MAX";
  384. temp.Add(name1);
  385. string con = m_conditionChoose.m_conditionData.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE).ToString();
  386. string po = "";
  387. switch (con)
  388. {
  389. case "DMAX":
  390. po = "DMAX";
  391. break;
  392. case "DMIN":
  393. po = "DMIN";
  394. break;
  395. case "ECD":
  396. po = "Area";
  397. break;
  398. case "FERET":
  399. po = "DFERET";
  400. break;
  401. }
  402. DataTable dtp = particledata.GetParticleAll(filedAndParticl);
  403. DataTable dtPSize = new DataTable();
  404. dtPSize.Columns.Add("name");
  405. dtPSize.Columns.Add("Cunt");
  406. for (int k = 0; k < temp.Count; k++)
  407. {
  408. string str = temp[k];
  409. string d1 = str.Split('~')[0];
  410. string d2 = str.Split('~')[1];
  411. if (d2 == "MAX")
  412. {
  413. d2 = "999";
  414. }
  415. DataRow[] datas = dtp.Select(getWhere(d2, d1, po));
  416. DataRow dr = dtPSize.NewRow();
  417. dr["name"] = str;
  418. dr["Cunt"] = datas.Count().ToString();
  419. dtPSize.Rows.Add(dr);
  420. }
  421. ListData.Add(dtPSize);
  422. break;
  423. }
  424. }
  425. return ListData;
  426. }
  427. #endregion
  428. /// <summary>
  429. /// 折线图
  430. /// </summary>
  431. /// <param name="sender"></param>
  432. /// <param name="e"></param>
  433. private void checkButton2_CheckedChanged(object sender, EventArgs e)
  434. {
  435. if(checkButton2.Checked)
  436. {
  437. checkButton1.Checked = false;
  438. checkButton3.Checked = false;
  439. chartControl1.Series.Clear();
  440. for (int i=0;i< prListData.Count;i++)
  441. {
  442. string str = prListString[i];
  443. // 假设你已经有一个 ChartControl 实例,并且已经添加了一个饼图 Series
  444. Series series = new Series(str, ViewType.Line);
  445. for (int a = 0; a < prListData[i].Rows.Count; a++)
  446. {
  447. string name = prListData[i].Rows[a]["name"].ToString();
  448. double Cunt = Convert.ToDouble(prListData[i].Rows[a]["Cunt"]);
  449. series.Points.Add(new SeriesPoint(name, Cunt));
  450. }
  451. series.LabelsVisibility = DefaultBoolean.True;
  452. series.Label.TextPattern = "{V}";
  453. chartControl1.Series.Add(series);
  454. }
  455. chartControl1.Legend.Visibility = DefaultBoolean.False;
  456. chartControl1.Refresh();
  457. }
  458. else
  459. {
  460. if (!checkButton1.Checked && !checkButton3.Checked)
  461. {
  462. checkButton2.Checked = false;
  463. }
  464. }
  465. }
  466. /// <summary>
  467. /// 柱状图
  468. /// </summary>
  469. /// <param name="sender"></param>
  470. /// <param name="e"></param>
  471. private void checkButton1_CheckedChanged(object sender, EventArgs e)
  472. {
  473. if (checkButton1.Checked)
  474. {
  475. checkButton2.Checked = false;
  476. checkButton3.Checked = false;
  477. chartControl1.Series.Clear();
  478. for (int i = 0; i < prListData.Count; i++)
  479. {
  480. string str = prListString[i];
  481. // 假设你已经有一个 ChartControl 实例,并且已经添加了一个饼图 Series
  482. Series series = new Series(str, ViewType.Bar);
  483. for (int a = 0; a < prListData[i].Rows.Count; a++)
  484. {
  485. string name = prListData[i].Rows[a]["name"].ToString();
  486. double Cunt = Convert.ToDouble(prListData[i].Rows[a]["Cunt"]);
  487. series.Points.Add(new SeriesPoint(name, Cunt));
  488. }
  489. series.LabelsVisibility = DefaultBoolean.True;
  490. series.Label.TextPattern = "{V}";
  491. chartControl1.Series.Add(series);
  492. }
  493. chartControl1.Legend.Visibility = DefaultBoolean.False;
  494. chartControl1.Refresh();
  495. }
  496. else
  497. {
  498. if (!checkButton2.Checked && !checkButton3.Checked)
  499. {
  500. checkButton1.Checked = true;
  501. }
  502. }
  503. }
  504. private void checkButton3_CheckedChanged(object sender, EventArgs e)
  505. {
  506. if (checkButton3.Checked)
  507. {
  508. checkButton1.Checked = false;
  509. checkButton2.Checked = false;
  510. chartControl1.Series.Clear();
  511. for (int i = 0; i < prListData.Count; i++)
  512. {
  513. string str = prListString[i];
  514. Series series = new Series(str, ViewType.Pie);
  515. for (int a = 0; a < prListData[i].Rows.Count; a++)
  516. {
  517. string name = prListData[i].Rows[a]["name"].ToString();
  518. double Cunt = Convert.ToDouble(prListData[i].Rows[a]["Cunt"]);
  519. series.Points.Add(new SeriesPoint(name, Cunt));
  520. }
  521. series.LabelsVisibility = DefaultBoolean.True;
  522. series.Label.TextPattern = "{A}";
  523. chartControl1.Series.Add(series);
  524. }
  525. chartControl1.Legend.Visibility = DefaultBoolean.False;
  526. chartControl1.Refresh();
  527. }
  528. else
  529. {
  530. if (!checkButton1.Checked && !checkButton2.Checked)
  531. {
  532. checkButton3.Checked = true;
  533. }
  534. }
  535. }
  536. }
  537. }