Beispiel #1
0
        public List <string> GenerateCommandSequence()
        {
            List <string> commands = new List <string>();

            switch (Format)
            {
            case ChartFormat.Svg:
                commands.Add($"set terminal svg enhanced size {Width},{Height} fontscale {FontScale}");
                break;

            case ChartFormat.Png:
                commands.Add($"set terminal png size {Width},{Height}");
                break;
            }


            commands.Add($"set output '{Destination}'");
            if (!string.IsNullOrEmpty(Title))
            {
                commands.Add($"set title '{Title}'");
            }


            // データをあらかじめなぞってみる。
            // ※これを外部から行い、x_axisなどを外部から与えるようにしたい。

            if (XAxis == null || YAxis == null)
            {
                var range = DataSeries.Scan();

                if (XAxis == null)
                {
                    DefineXAxis(range.XRange);
                }
                if (YAxis == null)
                {
                    DefineYAxis(range.YRange);
                }

                if (!string.IsNullOrEmpty(XTitle))
                {
                    XAxis.Title = XTitle;
                }
                if (!string.IsNullOrEmpty(YTitle))
                {
                    YAxis.Title = YTitle;
                }
            }

            XAxis.GetCommands("x").ForEach(c => commands.Add(c));
            YAxis.GetCommands("y").ForEach(c => commands.Add(c));

            commands.Add($"set datafile separator '{DataFileSeparator}'");

            commands.Add($"plot {string.Join(",", DataSeries)}");
            commands.Add("set output");

            return(commands);
        }