Exemple #1
0
        protected override string DefaultCommand()
        {
            if (Variables == null)
            {
                return("");
            }

            Mtb.Column[] vars = (Mtb.Column[])Variables;
            Mtb.Column[] gps  = null;
            if (GroupingVariables != null)
            {
                gps = (Mtb.Column[])GroupingVariables;
            }

            StringBuilder cmnd = new StringBuilder(); // local macro 內容

            if (gps != null)
            {
                cmnd.AppendFormat("Boxplot ({0})*{1};\r\n",
                                  string.Join(" &\r\n", vars.Select(x => x.SynthesizedName).ToArray()),
                                  gps[0].SynthesizedName);
                if (gps.Length >= 2)
                {
                    cmnd.AppendFormat(" Group {0};\r\n",
                                      string.Join(" &\r\n", gps.Select((x, i) => new { colId = x.SynthesizedName, index = i }).
                                                  Where(x => x.index > 0).Select(x => x.colId).ToArray()));
                }
            }
            else
            {
                cmnd.AppendFormat("Boxplot {0};\r\n",
                                  string.Join(" &\r\n", vars.Select(x => x.SynthesizedName).ToArray()));
            }
            cmnd.Append(GetOptionCommand());

            cmnd.Append(YScale.GetCommand());
            cmnd.Append(XScale.GetCommand());

            cmnd.Append(Mean.GetCommand());
            cmnd.Append(CMean.GetCommand());
            cmnd.Append(RBox.GetCommand());
            cmnd.Append(IQRBox.GetCommand());
            cmnd.Append(Whisker.GetCommand());
            cmnd.Append(Outlier.GetCommand());
            cmnd.Append(Individual.GetCommand());
            cmnd.Append(MeanDatlab.GetCommand());
            cmnd.Append(IndivDatlab.GetCommand());

            cmnd.Append(Panel.GetCommand());

            cmnd.Append(GetAnnotationCommand());
            cmnd.Append(GetRegionCommand());

            return(cmnd.ToString() + ".");
        }
Exemple #2
0
        public override object Clone()
        {
            IQRBox iqrBox = new IQRBox();

            iqrBox.Type       = _type.Clone();
            iqrBox.Color      = _color.Clone();
            iqrBox.EType      = _etype.Clone();
            iqrBox.EColor     = _ecolor.Clone();
            iqrBox.ESize      = _esize.Clone();
            iqrBox.GroupingBy = _groupBy.Clone();
            iqrBox.Visible    = this.Visible;
            return(iqrBox);
        }
Exemple #3
0
        public override void SetDefault()
        {
            Variables         = null;
            GroupingVariables = null;
            Mean = new Mean()
            {
                Visible = false
            };
            CMean = new CMean()
            {
                Visible = false
            };
            IQRBox = new IQRBox()
            {
                Visible = true
            };
            RBox = new RangeBox()
            {
                Visible = false
            };
            Outlier = new Outlier()
            {
                Visible = true
            };
            Individual = new Individual()
            {
                Visible = false
            };
            Whisker = new Whisker()
            {
                Visible = true
            };
            YScale      = new ContScale(ScaleDirection.Y_Axis);
            XScale      = new CateScale(ScaleDirection.X_Axis);
            Panel       = new MPanel();
            MeanDatlab  = new Meanlab();
            IndivDatlab = new Indivlab();
            //MeanDatlab.GetCommand = () =>
            //{
            //    if (!MeanDatlab.Visible) return "";
            //    if (MeanDatlab.DatlabType == Component.Datlab.DisplayType.Column && MeanDatlab.LabelColumn == null) return "# 未指定給 Datlab 欄位\r\n";
            //    StringBuilder cmnd = new StringBuilder();
            //    switch (MeanDatlab.DatlabType)
            //    {
            //        case Component.Datlab.DisplayType.YValue:
            //            cmnd.AppendLine(" Mealab;");
            //            cmnd.AppendLine("  YValue;");
            //            break;
            //        case Component.Datlab.DisplayType.RowNumber:
            //            cmnd.AppendLine(" Mealab;");
            //            cmnd.AppendLine("  Rownum;");
            //            break;
            //        case Component.Datlab.DisplayType.Column:
            //            cmnd.AppendFormat(" Mealab {0};\r\n", MeanDatlab.LabelColumn);
            //            break;
            //    }
            //    if (MeanDatlab.FontColor > 0) cmnd.AppendFormat("  TColor {0};\r\n", MeanDatlab.FontColor);
            //    if (MeanDatlab.FontSize > 0) cmnd.AppendFormat("  PSize {0};\r\n", MeanDatlab.FontSize);
            //    if (MeanDatlab.Bold) cmnd.AppendLine("  Bold;");
            //    if (MeanDatlab.Italic) cmnd.AppendLine("  Italic;");
            //    if (MeanDatlab.Underline) cmnd.AppendLine("  Underline;");
            //    if (MeanDatlab.Angle < MtbTools.MISSINGVALUE) cmnd.AppendFormat("  Angle {0};\r\n", MeanDatlab.Angle);
            //    if (MeanDatlab.Offset != null) cmnd.AppendFormat("  Offset {0};\r\n", string.Join(" &\r\n", MeanDatlab.Offset));
            //    if (MeanDatlab.Placement != null) cmnd.AppendFormat("  Placement {0};\r\n", string.Join(" &\r\n", MeanDatlab.Placement));

            //    foreach (LabelPosition pos in MeanDatlab.PositionList)
            //    {
            //        cmnd.Append(pos.GetCommand());
            //    }
            //    cmnd.Append(Legend.GetCommand());
            //    return cmnd.ToString();
            //};
            GetCommand = DefaultCommand;
        }