Ejemplo n.º 1
0
    private void SendMode()
    {
        // TestUIManagerにModeの状態を送る

        mTestUIManager.SetEditMode(mEditMode.ToString());
        mTestUIManager.SetAxisMode(mAxisMode.ToString());
    }
Ejemplo n.º 2
0
        public override string ToString()
        {
            var          optionsString       = new StringBuilder();
            const string FORMAT_STRING       = "{0}={1}\n";
            const string FORMAT_STRING_LABEL = "{0}={{{1}}}\n";

            if (IsEmptyGroupPlot)
            {
                return("group/empty plot");
            }

            optionsString.Append("ylabel near ticks");
            optionsString.Append(Helper.LineFeed());

            if (IsUsedForBoxPlots)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "boxplot/draw direction", BoxPlotDrawDirection.ToString());
            }

            foreach (var groupLineEntry in GroupLines)
            {
                addSeparator(optionsString);
                optionsString.Append(groupLineEntry);
            }

            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "axis x line" + (XAxisArrow ? String.Empty : "*"), XAxisPosition);

            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "axis y line" + (YAxisArrow ? String.Empty : "*"), YAxisPosition);

            if (XAxisIsHidden)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "hide x axis", "true");
            }
            if (YAxisIsHidden)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "hide y axis", "true");
            }

            if (!String.IsNullOrEmpty(BackgroundColor))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "axis background/.style", "{" + String.Format(FORMAT_STRING, "fill", BackgroundColor) + "}");
            }

            if (EnlargeLimits)
            {
                addSeparator(optionsString);
                optionsString.Append("enlargelimits");
                optionsString.Append(Helper.LineFeed());
            }

            if (LegendOptions != null)
            {
                addSeparator(optionsString);
                optionsString.Append(LegendOptions);
                optionsString.Append(Helper.LineFeed());
            }

            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "xmode", XMode.ToString());
            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "ymode", YMode.ToString());

            if (!string.IsNullOrEmpty(XLabel))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "xlabel", _converter.StringToTeX(XLabel));
            }
            if (!string.IsNullOrEmpty(YLabel))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "ylabel", _converter.StringToTeX(YLabel));
            }
            if (!string.IsNullOrEmpty(Title))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "title", _converter.StringToTeX(Title));
            }

            //ranges
            if (XMax != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "xmax", ((float)XMax).ToString(CultureInfo.InvariantCulture));
            }
            if (XMin != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "xmin", ((float)XMin).ToString(CultureInfo.InvariantCulture));
            }
            if (YMin != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "ymin", ((float)YMin).ToString(CultureInfo.InvariantCulture));
            }
            if (YMax != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "ymax", ((float)YMax).ToString(CultureInfo.InvariantCulture));
            }

            if (XTicks != null && XTicks.Length > 0)
            {
                addSeparator(optionsString);
                var ticks = string.Join(",", Array.ConvertAll(XTicks, f => f.ToString(CultureInfo.InvariantCulture)));
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "xtick", ticks);
            }
            if (XTickLabels != null && XTickLabels.Length > 0)
            {
                addSeparator(optionsString);
                var tickLabels = $"{{{string.Join("}, {", _converter.StringToTeX(XTickLabels))}}}";
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "xticklabels", tickLabels);
            }
            if (!string.IsNullOrEmpty(XGroupLineOffset))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "group line offset", XGroupLineOffset);
            }
            if (!string.IsNullOrEmpty(XGroupLineTextOffset))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "text offset", XGroupLineTextOffset);
            }
            if (XTickLabelsRotateBy % 360 != 0)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat("xticklabel style = {{rotate={0}, anchor=east, yshift={1}}}", XTickLabelsRotateBy % 360, Helper.Length(-6, Helper.MeasurementUnits.pt));
            }
            if (XMinorTicks != null && XMinorTicks.Length > 0)
            {
                addSeparator(optionsString);
                var ticks = string.Join(",", Array.ConvertAll(XMinorTicks, f => f.ToString(CultureInfo.InvariantCulture)));
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "minor xtick", ticks);
            }
            if (YTicks != null && YTicks.Length > 0)
            {
                addSeparator(optionsString);
                var ticks = string.Join(",", Array.ConvertAll(YTicks, f => f.ToString(CultureInfo.InvariantCulture)));
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "ytick", ticks);
            }
            if (YTickLabels != null && YTickLabels.Length > 0)
            {
                addSeparator(optionsString);
                var tickLabels = $"{{{string.Join("}, {", _converter.StringToTeX(YTickLabels))}}}";
                optionsString.AppendFormat(FORMAT_STRING_LABEL, "yticklabels", tickLabels);
            }
            if (YTickLabelsRotateBy % 360 != 0)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat("yticklabel style = {{rotate={0}, anchor=east, xshift={1}}}", XTickLabelsRotateBy % 360, Helper.Length(-6, Helper.MeasurementUnits.pt));
            }
            if (YMinorTicks != null && YMinorTicks.Length > 0)
            {
                addSeparator(optionsString);
                var ticks = string.Join(",", Array.ConvertAll(YMinorTicks, f => f.ToString(CultureInfo.InvariantCulture)));
                optionsString.AppendFormat(FORMAT_STRING, "minor ytick", $"{{{ticks}}}");
            }
            //tick ranges
            if (XTickMax != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "xtickmax", ((float)XTickMax).ToString(CultureInfo.InvariantCulture));
            }
            if (XTickMin != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "xtickmin", ((float)XTickMin).ToString(CultureInfo.InvariantCulture));
            }
            if (YTickMin != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "ytickmin", ((float)YTickMin).ToString(CultureInfo.InvariantCulture));
            }
            if (YTickMax != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "ytickmax", ((float)YTickMax).ToString(CultureInfo.InvariantCulture));
            }

            // minor tick num
            if (MinorXTickNum != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "minor x tick num", MinorXTickNum);
            }
            if (MinorYTickNum != null)
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "minor y tick num", MinorYTickNum);
            }

            if (XMode == AxisMode.log || YMode == AxisMode.log)
            {
                if (LogTicksWithFixedPoint)
                {
                    addSeparator(optionsString);
                    optionsString.Append("log ticks with fixed point");
                }
            }

            // scaled ticks
            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "scaled x ticks", XScaledTicks ? "true" : "false");

            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "scaled y ticks", YScaledTicks ? "true" : "false");

            //discontinuities
            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "axis x discontinuity", XDiscontinuity);
            addSeparator(optionsString);
            optionsString.AppendFormat(FORMAT_STRING, "axis y discontinuity", YDiscontinuity);

            //grid
            if (XMajorGrid)
            {
                addSeparator(optionsString);
                optionsString.Append("xmajorgrids");
            }
            if (YMajorGrid)
            {
                addSeparator(optionsString);
                optionsString.Append("ymajorgrids");
            }
            if (XMinorGrid)
            {
                addSeparator(optionsString);
                optionsString.Append("xminorgrids");
            }
            if (YMinorGrid)
            {
                addSeparator(optionsString);
                optionsString.Append("yminorgrids");
            }

            //dimensions
            if (!String.IsNullOrEmpty(Width))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "width", Width);
            }
            if (!String.IsNullOrEmpty(Height))
            {
                addSeparator(optionsString);
                optionsString.AppendFormat(FORMAT_STRING, "height", Height);
            }

            return(optionsString.ToString());
        }