Пример #1
0
        /// <summary>
        /// CSV文字列取得
        /// </summary>
        /// <returns></returns>
        public string ToCsv()
        {
            string ret = string.Empty;

            string[] fields = new string[dataNum];

            fields[0] = string.Format("{0:D}", this.Id);
            fields[1] = string.Format("{0}", this.Name);
            fields[2] = string.Format("{0:F5}", this.YAxisMax);
            fields[3] = string.Format("{0:F5}", this.YAxisMin);
            fields[4] = string.Format("{0}", this.LineColor.Name);
            fields[5] = string.Format("{0:F0}", this.LineWidth);
            fields[6] = string.Format("{0}", this.Visible);

            fields[7]  = string.Format("{0:D}", Axis.Id);
            fields[8]  = string.Format("{0}", Axis.Name);
            fields[9]  = string.Format("{0}", Axis.UnitName);
            fields[10] = string.Format("{0}", Axis.GridLineVisible);
            fields[11] = string.Format("{0:F5}", Axis.GridResolution);
            fields[12] = string.Format("{0}", Axis.AxisColor.Name);
            fields[13] = string.Format("{0:D}", Axis.DispOrder);

            //ret = string.Join(",", fields);
            ret = CsvUtil.Join(fields);

            return(ret);
        }
Пример #2
0
        /// <summary>
        /// CSVからオブジェクト生成
        /// </summary>
        /// <param name="csv"></param>
        /// <returns></returns>
        public static ItemBean CreateFromCsv(string csv)
        {
            ItemBean item = null;
            AxisBean axis = null;

            string[] fields = CsvUtil.Split(csv);

            if (fields.Count() == dataNum)
            {
                item = new ItemBean();
                axis = new AxisBean();

                item.Id        = int.Parse(fields[0]);
                item.Name      = fields[1];
                item.YAxisMax  = double.Parse(fields[2]);
                item.YAxisMin  = double.Parse(fields[3]);
                item.LineColor = ColorUtil.NameToColor(fields[4]);
                item.LineWidth = double.Parse(fields[5]);
                item.Visible   = bool.Parse(fields[6]);

                axis.Id              = int.Parse(fields[7]);
                axis.Name            = fields[8];
                axis.UnitName        = fields[9];
                axis.AxisMax         = item.YAxisMax;
                axis.AxisMin         = item.YAxisMin;
                axis.GridLineVisible = bool.Parse(fields[10]);
                axis.GridResolution  = double.Parse(fields[11]);
                axis.AxisColor       = ColorUtil.NameToColor(fields[12]);
                axis.DispOrder       = int.Parse(fields[13]);

                item.Axis = axis;
            }

            return(item);
        }
Пример #3
0
        /// <summary>
        /// CSVからオブジェクト生成
        /// </summary>
        /// <param name="csv"></param>
        /// <returns></returns>
        public static AxisBean CreateFromCsv(string csv)
        {
            AxisBean ret = null;

            string[] fields = CsvUtil.Split(csv);

            if (fields.Count() == fieldNum)
            {
                ret = new AxisBean();

                ret.Id              = int.Parse(fields[0]);
                ret.Name            = fields[1];
                ret.UnitName        = fields[2];
                ret.AdRangeMax      = double.Parse(fields[3]);
                ret.AdRangeMin      = double.Parse(fields[4]);
                ret.AxisMax         = double.Parse(fields[5]);
                ret.AxisMin         = double.Parse(fields[6]);
                ret.GridLineVisible = bool.Parse(fields[7]);
                ret.GridResolution  = double.Parse(fields[8]);
                ret.AxisColor       = ColorUtil.NameToColor(fields[9]);
                ret.DispOrder       = int.Parse(fields[10]);
                ret.IsY2Axis        = bool.Parse(fields[11]);
            }

            return(ret);
        }
Пример #4
0
        /// <summary>
        /// CSV文字列取得
        /// </summary>
        /// <returns></returns>
        public string ToCsv()
        {
            string ret = string.Empty;

            string[] fields = new string[fieldNum];

            fields[0]  = string.Format("{0:D}", this.Id);
            fields[1]  = string.Format("{0}", this.Name);
            fields[2]  = string.Format("{0}", this.UnitName);
            fields[3]  = string.Format("{0:F5}", this.AdRangeMax);
            fields[4]  = string.Format("{0:F5}", this.AdRangeMin);
            fields[5]  = string.Format("{0:F5}", this.AxisMax);
            fields[6]  = string.Format("{0:F5}", this.AxisMin);
            fields[7]  = string.Format("{0}", this.GridLineVisible);
            fields[8]  = string.Format("{0:F5}", this.GridResolution);
            fields[9]  = string.Format("{0}", this.AxisColor.Name);
            fields[10] = string.Format("{0:D}", this.DispOrder);
            fields[11] = string.Format("{0}", this.IsY2Axis);

            ret = CsvUtil.Join(fields);

            return(ret);
        }