123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using Sunny.UI;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Windows.Forms;
- namespace WWPipeLine.MapBasic.Results
- {
- public class RWWithChartPie : RWWithChart
- {
- protected override void AddOptionSeries(DataTable dt)
- {
- foreach (DataRow dr in dt.Rows)
- {
- var series = new UIPieSeries
- {
- Name = dr[0].ToString()
- };
- for (int i = 1; i < dr.ItemArray.Length; i++)
- {
- double.TryParse(dr[i].ToString(), out double val);
- series.AddData(dt.Columns[i].Caption, val);
- }
- ((UIPieOption)m_UIOption).AddSeries(series);
- }
- }
- protected override void SetLegendItem(DataTable dt)
- {
- foreach (DataColumn dc in dt.Columns)
- {
- if (dt.Columns.IndexOf(dc) == 0) continue;
- ((UIPieOption)m_UIOption).Legend.AddData(dc.Caption);
- }
- }
- protected override void CreateChart()
- {
- this.m_UIChart = new UIPieChart();
- this.m_UIOption = new UIPieOption();
- }
- }
- }
|