Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }