Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tbl"></param>
        /// <param name="cfg"></param>
        /// <returns></returns>
        public LineBase CreateLine(DataTable tbl, LineDataConfig cfg, string xAxisFieldName)
        {
            LineBase line1 = CreateLine();

            line1.Colour = cfg.Color;

            // line name and font size
            //
            line1.Set_Key(cfg.Name, cfg.FontSize);

            //line1.Tooltip = "my tip #val#";
            //line1.Tooltip = "x_label #value#";
            foreach (DataRow row in tbl.Rows)
            {
                double value       = 0;
                object valueObject = row[cfg.DataFieldName];
                if (valueObject != DBNull.Value)
                {
                    value = Convert.ToDouble(valueObject);
                }

                DateTime dt = Convert.ToDateTime(row[xAxisFieldName]);

                string       tip     = string.Format("{0}\n{1}\n{2}\n", cfg.Name, dt, value);
                LineDotValue ldValue = new LineDotValue(value, tip, cfg.Color);
                line1.Add(ldValue);
            }
            return(line1);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        internal OpenFlashChart.ChartBase CreateElement()
        {
            LineBase line1 = CreateLine();

            _linebase = line1;
            // color
            //

            // line name and font size
            //
            line1.Set_Key(this.Key, this.KeyFontSize);

            //line1.Tooltip = "my tip #val#";
            //line1.Tooltip = "x_label #value#";
            DataTable tbl = this.DataSource as DataTable;

            foreach (DataRow row in tbl.Rows)
            {
                double       value   = Convert.ToDouble(row[this.DataFieldName]);
                DateTime     dt      = Convert.ToDateTime(row[this.DTFieldName]);
                string       tip     = string.Format("{0}\n{1}", value, dt);
                LineDotValue ldValue = new LineDotValue(value, tip, "#0000ff");
                line1.Add(ldValue);
            }
            return(line1);
        }