Ejemplo n.º 1
0
        /// <summary>
        /// 绑定图形
        /// </summary>
        private void BindChart()
        {
            m_chartLevels.Clear();
            CTable           dataSource = m_chartLevels.DataSource;
            List <LevelInfo> levels     = DataCenter.LevelService.m_levels;
            int levelsSize = levels.Count;

            for (int i = 0; i < levelsSize; i++)
            {
                if (levels[i].m_date.Length == 8)
                {
                    int      year  = CStr.ConvertStrToInt(levels[i].m_date.Substring(0, 4));
                    int      month = CStr.ConvertStrToInt(levels[i].m_date.Substring(4, 2));
                    int      day   = CStr.ConvertStrToInt(levels[i].m_date.Substring(6, 2));
                    DateTime dt    = new DateTime(year, month, day);
                    double   pk    = CStr.ConvertDateToNum(dt);
                    dataSource.Set(pk, 0, CStr.ConvertStrToDouble(levels[i].m_level));
                    dataSource.Set2(i, 1, 10);
                    dataSource.Set2(i, 2, 0);
                    dataSource.Set2(i, 3, CStr.ConvertStrToDouble(levels[i].m_level2));
                    dataSource.Set2(i, 4, CStr.ConvertStrToDouble(levels[i].m_level3));
                }
            }
            m_chartLevels.Update();
            m_chartLevels.Invalidate();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 绑定图形
        /// </summary>
        private void BindChart()
        {
            m_chartLevels.Clear();
            CTable                   dataSource = m_chartLevels.DataSource;
            List <DialogInfo>        dialogs    = DataCenter.DialogService.m_dialogs;
            Dictionary <String, int> dialogsMap = new Dictionary <String, int>();
            int dialogsSize = dialogs.Count;

            for (int i = 0; i < dialogsSize; i++)
            {
                if (dialogs[i].m_date.Length == 8)
                {
                    if (dialogsMap.ContainsKey(dialogs[i].m_date))
                    {
                        dialogsMap[dialogs[i].m_date] = dialogsMap[dialogs[i].m_date] + 1;
                    }
                    else
                    {
                        dialogsMap[dialogs[i].m_date] = 1;
                    }
                }
            }
            List <DialogData> datas = new List <DialogData>();

            foreach (String key in dialogsMap.Keys)
            {
                DialogData data = new DialogData();
                data.m_name  = key;
                data.m_times = dialogsMap[key];
                datas.Add(data);
            }
            datas.Sort(new DialogDataCompare2());
            int datasSize = datas.Count;

            for (int i = 0; i < datasSize; i++)
            {
                DialogData data  = datas[i];
                int        year  = CStr.ConvertStrToInt(data.m_name.Substring(0, 4));
                int        month = CStr.ConvertStrToInt(data.m_name.Substring(4, 2));
                int        day   = CStr.ConvertStrToInt(data.m_name.Substring(6, 2));
                DateTime   dt    = new DateTime(year, month, day);
                double     pk    = CStr.ConvertDateToNum(dt);
                dataSource.Set(pk, 0, data.m_times);
                dataSource.Set2(i, 1, 0);
            }
            m_chartLevels.Update();
            m_chartLevels.Invalidate();
        }