Пример #1
0
        /// <summary>
        /// 复制数据
        /// </summary>
        public XAxisPointData Copy()
        {
            XAxisPointData data = new XAxisPointData();

            data.Text  = m_text;
            data.Value = m_value;
            return(data);
        }
Пример #2
0
        /// <summary>
        /// 单元格双击事件
        /// </summary>
        /// <param name="sender">调用者</param>
        /// <param name="cell">单元格</param>
        /// <param name="mp">坐标</param>
        /// <param name="button">按钮</param>
        /// <param name="clicks">点击次数</param>
        /// <param name="delta">滚轮值</param>
        private void GridCellClick(object sender, GridCell cell, POINT mp, MouseButtonsA button, int clicks, int delta)
        {
            TreeNodeA tn = cell as TreeNodeA;

            if (tn.m_nodes.Count == 0)
            {
                if (tn.Tag == null)
                {
                    try
                    {
                        MacroDataType type = (MacroDataType)Enum.Parse(typeof(MacroDataType), m_cbMacIndustry.Text);
                        DataTable     dt   = MongoRetriver.GetDescendantDataByService(tn.Name, type);
                        foreach (DataRow row in dt.Rows)
                        {
                            if (row[0].ToString().Length > 0 && row[3].ToString().Length > 0)
                            {
                                TreeNodeA node = new TreeNodeA();
                                node.Tag             = "2";
                                node.Style           = new GridCellStyle();
                                node.Style.ForeColor = COLOR.ARGB(255, 255, 80);
                                node.Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                                node.Text            = row["STR_MACRONAME"].ToString();
                                node.Name            = row[0].ToString();
                                tn.AppendNode(node);
                            }
                        }
                        tn.Tag = "1";
                        m_tvMacIndustry.Update();
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else if (tn.Tag.ToString() == "2")
                {
                    m_gridMacIndustry.ClearRows();
                    m_fundCurve.Clear();
                    FundCurveData  data  = new FundCurveData();
                    XAxisPointData xdata = new XAxisPointData();
                    Dictionary <String, YAxisCurveData> yDatas = new Dictionary <String, YAxisCurveData>();
                    YAxisStyle ySyle  = new YAxisStyle();
                    YAxisStyle ySyle1 = new YAxisStyle();
                    YAxisStyle ySyle2 = new YAxisStyle();
                    XAxisStyle xStyle = new XAxisStyle();
                    xStyle.XAxisType     = XAxisType.Date;
                    data.ChartTitle      = "每日进展";
                    xStyle.XAxisTitle    = "时间";
                    data.BackgroundColor = Color.Black;
                    DataTable      dt    = GetMacIndustyData(tn.Name, m_cbMacIndustry.Text);
                    YAxisCurveData yData = new YAxisCurveData();
                    yData.YPointValues = new List <double>();
                    yData.LineWidth    = 3;
                    yData.Text         = xdata.Text;
                    yData.ShowCycle    = true;
                    data.LstYAxisPointDatas.Add(yData);
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr[0].ToString().Length > 0 && dr[1].ToString().Length > 0)
                        {
                            GridRow row = new GridRow();
                            m_gridMacIndustry.AddRow(row);
                            DateTime date = Convert.ToDateTime(dr[0]);
                            row.AddCell("colN1", new GridStringCell(date.ToString("yyyy-MM-dd")));
                            row.AddCell("colN2", new GridStringCell(dr[1].ToString()));
                            row.GetCell("colN1").Style           = new GridCellStyle();
                            row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80);
                            row.GetCell("colN1").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                            row.GetCell("colN2").Style           = new GridCellStyle();
                            row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80);
                            row.GetCell("colN2").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                        }
                    }
                    int rowsSize = dt.Rows.Count;
                    for (int i = rowsSize - 1; i >= 0; i--)
                    {
                        DataRow dr = dt.Rows[i];
                        if (dr[0].ToString().Length > 0 && dr[1].ToString().Length > 0)
                        {
                            GridRow row = new GridRow();
                            m_gridMacIndustry.AddRow(row);
                            DateTime date = Convert.ToDateTime(dr[0]);
                            xdata.Value = date.Year * 10000 + date.Month * 100 + date.Day;
                            xdata.Text  = date.ToString("yyyyMMdd");
                            data.LstXAxisPointDatas.Add(xdata);
                            yData.YPointValues.Add(CStr.ConvertStrToDouble(dr[1].ToString()));
                        }
                    }
                    data.XAxisStyle        = xStyle;
                    ySyle.YAxisTitleAlign  = YAxisTitleAlign.Middle;
                    ySyle1.YAxisTitleAlign = YAxisTitleAlign.Middle;
                    ySyle2.YAxisTitleAlign = YAxisTitleAlign.Middle;
                    xStyle.XAxisTitleAlign = XAxisTitleAlign.Center;
                    data.LstYAxisStyle.Add(ySyle);
                    data.LstYAxisStyle.Add(ySyle1);
                    data.LstYAxisStyle.Add(ySyle2);
                    m_fundCurve.FundCurveData = data;
                    m_gridMacIndustry.Update();
                    m_gridMacIndustry.Invalidate();
                }
            }
        }