Abstract base class for any plot.
Наследование: Value
Пример #1
0
        /// <summary>
        /// Adds a new subplot to the container.
        /// </summary>
        /// <param name="row">The 1-based row index.</param>
        /// <param name="column">The 1-based column index.</param>
        /// <param name="plot">The plot to add.</param>
        /// <param name="rowSpan">The row span.</param>
        /// <param name="columnSpan">The column span.</param>
        /// <returns>The current instance.</returns>
        public SubPlotValue AddSubPlot(int row, int column, PlotValue plot, int rowSpan = 1, int columnSpan = 1)
        {
            if (row < 1 || row > Rows)
            {
                throw new YAMPIndexOutOfBoundException(row, 1, Rows);
            }
            else if (column < 1 || column > Columns)
            {
                throw new YAMPIndexOutOfBoundException(column, 1, Columns);
            }

            for (var i = subplots.Count - 1; i >= 0; i--)
            {
                if (subplots[i].Column == column && subplots[i].Row == row)
                {
                    subplots.RemoveAt(i);
                }
            }

            subplots.Add(new SubPlot
            {
                Row        = row,
                RowSpan    = Math.Min(Rows - row + 1, rowSpan),
                Column     = column,
                ColumnSpan = Math.Min(Columns - column + 1, columnSpan),
                Plot       = plot
            });

            return(this);
        }
Пример #2
0
        /// <summary>
        /// Applies the template set for plots.
        /// </summary>
        /// <param name="plot">The plot which will adjusted to the default values.</param>
        /// <returns>The current context.</returns>
        ParseContext ApplyPlotTemplate(PlotValue plot)
        {
            if (_defaultProperties.ContainsKey("plot"))
            {
                var bin = _defaultProperties["plot"];

                foreach (var pair in bin)
                {
                    try { SetFunction.AlterProperty(plot, pair.Key, pair.Value); }
                    catch { }
                }
            }

            if (_defaultProperties.ContainsKey("series"))
            {
                var bin = _defaultProperties["series"];

                foreach (var pair in bin)
                {
                    try
                    {
                        for (var i = 0; i < plot.Count; i++)
                        {
                            SetFunction.AlterSeriesProperty(plot, i, pair.Key, pair.Value);
                        }
                    }
                    catch { }
                }
            }

            return(this);
        }
Пример #3
0
        public void Function(PlotValue plot, MatrixValue series, StringValue property, Value newValue)
        {
            var s = new List <String>();

            if (series is RangeValue)
            {
                var r    = series as RangeValue;
                var step = (Int32)r.Step;
                var end  = r.All ? plot.Count : (Int32)r.End;

                for (var j = (Int32)r.Start; j <= end; j += step)
                {
                    s.Add(j.ToString());
                    AlterSeriesProperty(plot, j - 1, property.Value, newValue);
                }
            }
            else
            {
                var end = series.Length;

                for (var i = 1; i <= end; i++)
                {
                    var n = series[i].GetIntegerOrThrowException("series", Name);
                    s.Add(n.ToString());
                    AlterSeriesProperty(plot, n - 1, property.Value, newValue);
                }
            }

            Context.RaiseNotification(new NotificationEventArgs(NotificationType.Failure, "Series " + String.Join(", ", s.ToArray()) + " changed."));
            plot.UpdateProperties();
        }
Пример #4
0
        public void Function(PlotValue plot, StringValue property, Value newValue)
        {
            var propertyName = property.Value;

            AlterProperty(plot, propertyName, newValue);
            plot.RaisePlotChanged(propertyName);
            Context.RaiseNotification(new NotificationEventArgs(NotificationType.Success, "Property changed"));
        }
Пример #5
0
 /// <summary>
 /// This is raised when the last plot has been changed.
 /// </summary>
 /// <param name="plot"></param>
 internal void RaiseLastPlotChanged(PlotValue plot)
 {
     if (OnLastPlotChanged != null)
     {
         var args = new PlotEventArgs(plot, string.Empty);
         OnLastPlotChanged(this, args);
     }
 }
Пример #6
0
        public void Function(PlotValue plot, ScalarValue series, StringValue property, Value newValue)
        {
            if (plot.Count == 0)
            {
                throw new YAMPNoSeriesAvailableException("The given plot contains no series.");
            }

            var n = series.GetIntegerOrThrowException("series", Name);

            if (n < 1 || n > plot.Count)
            {
                throw new YAMPArgumentRangeException("series", 1, plot.Count);
            }

            AlterSeriesProperty(plot, n - 1, property.Value, newValue);
            plot.UpdateProperties();
            Context.RaiseNotification(new NotificationEventArgs(NotificationType.Success, "Series " + n + " changed."));
        }
Пример #7
0
        public void Function(PlotValue plot, MatrixValue series, StringValue property, Value newValue)
        {
            var s = new List<String>();

            if (series is RangeValue)
            {
                var r = series as RangeValue;
                var step = (Int32)r.Step;
                var end = r.All ? plot.Count : (Int32)r.End;

                for (var j = (Int32)r.Start; j <= end; j += step)
                {
                    s.Add(j.ToString());
                    AlterSeriesProperty(plot, j - 1, property.Value, newValue);
                }
            }
            else
            {
                var end = series.Length;

                for (var i = 1; i <= end; i++)
                {
                    var n = series[i].GetIntegerOrThrowException("series", Name);
                    s.Add(n.ToString());
                    AlterSeriesProperty(plot, n - 1, property.Value, newValue);
                }
            }

            Context.RaiseNotification(new NotificationEventArgs(NotificationType.Failure, "Series " + String.Join(", ", s.ToArray()) + " changed."));
            plot.UpdateProperties();
        }
Пример #8
0
 /// <summary>
 /// Sets the lastplot to be used to the given value.
 /// </summary>
 /// <param name="plot">The plot to change to.</param>
 /// <returns>The current context.</returns>
 public ParseContext ChangeLastPlotTo(PlotValue plot)
 {
     _lastPlot = plot;
     RaiseLastPlotChanged(new PlotEventArgs(plot));
     return this;
 }
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="value">The PlotValue for the arguments.</param>
 public PlotEventArgs(PlotValue value)
 {
     Value = value;
 }
Пример #10
0
 /// <summary>
 /// Sets the lastplot to be used to the given value.
 /// </summary>
 /// <param name="plot">The plot to change to.</param>
 /// <returns>The current context.</returns>
 public ParseContext ChangeLastPlotTo(PlotValue plot)
 {
     _lastPlot = plot;
     RaiseLastPlotChanged(new PlotEventArgs(plot));
     return(this);
 }
Пример #11
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="value">The PlotValue for the arguments.</param>
 /// <param name="property">The name of the property.</param>
 public PlotEventArgs(PlotValue value, string property)
 {
     Value    = value;
     Property = property;
 }
Пример #12
0
 /// <summary>
 /// Sets the lastplot to be used to the given value.
 /// </summary>
 /// <param name="plot">The plot to change to.</param>
 /// <returns>The current context.</returns>
 public ParseContext ChangeLastPlotTo(PlotValue plot)
 {
     lastPlot = plot;
     RaiseLastPlotChanged(plot);
     return(this);
 }
Пример #13
0
 SubPlotValue AddSubPlot(ParseContext context, int row, int column, PlotValue plot, int rowSpan = 1, int columnSpan = 1)
 {
     AddSubPlot(row, column, plot, rowSpan, columnSpan);
     context.ChangeLastPlotTo(this);
     return this;
 }
Пример #14
0
        /// <summary>
        /// Adds a new subplot to the container.
        /// </summary>
        /// <param name="row">The 1-based row index.</param>
        /// <param name="column">The 1-based column index.</param>
        /// <param name="plot">The plot to add.</param>
        /// <param name="rowSpan">The row span.</param>
        /// <param name="columnSpan">The column span.</param>
        /// <returns>The current instance.</returns>
        public SubPlotValue AddSubPlot(int row, int column, PlotValue plot, int rowSpan = 1, int columnSpan = 1)
        {
            if (row < 1 || row > Rows)
                throw new YAMPIndexOutOfBoundException(row, 1, Rows);
            else if (column < 1 || column > Columns)
                throw new YAMPIndexOutOfBoundException(column, 1, Columns);

            for (var i = subplots.Count - 1; i >= 0; i--)
            {
                if (subplots[i].Column == column && subplots[i].Row == row)
                    subplots.RemoveAt(i);
            }

            subplots.Add(new SubPlot
            {
                Row = row,
                RowSpan = Math.Min(Rows - row + 1, rowSpan),
                Column = column,
                ColumnSpan = Math.Min(Columns - column + 1, columnSpan),
                Plot = plot
            });

            return this;
        }
Пример #15
0
        public void Function(PlotValue plot, ScalarValue series, StringValue property, Value newValue)
        {
            if (plot.Count == 0)
                throw new YAMPNoSeriesAvailableException("The given plot contains no series.");

            var n = series.GetIntegerOrThrowException("series", Name);

            if (n < 1 || n > plot.Count)
                throw new YAMPArgumentRangeException("series", 1, plot.Count);

            AlterSeriesProperty(plot, n - 1, property.Value, newValue);
            plot.UpdateProperties();
            Context.RaiseNotification(new NotificationEventArgs(NotificationType.Success, "Series " + n + " changed."));
        }
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="value">The PlotValue for the arguments.</param>
 /// <param name="propertyName">The name of the property.</param>
 public PlotEventArgs(PlotValue value, String propertyName)
 {
     Value = value;
     PropertyName = propertyName;
 }
Пример #17
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="value">The PlotValue for the arguments.</param>
 /// <param name="propertyName">The name of the property.</param>
 public PlotEventArgs(PlotValue value, String propertyName)
 {
     Value = value;
     PropertyName = propertyName;
 }
Пример #18
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="value">The PlotValue for the arguments.</param>
 public PlotEventArgs(PlotValue value)
 {
     Value = value;
 }
Пример #19
0
 SubPlotValue AddSubPlot(ParseContext context, int row, int column, PlotValue plot, int rowSpan = 1, int columnSpan = 1)
 {
     AddSubPlot(row, column, plot, rowSpan, columnSpan);
     context.ChangeLastPlotTo(this);
     return(this);
 }
Пример #20
0
        /// <summary>
        /// Applies the template set for plots.
        /// </summary>
        /// <param name="plot">The plot which will adjusted to the default values.</param>
        /// <returns>The current context.</returns>
        ParseContext ApplyPlotTemplate(PlotValue plot)
        {
            if (_defaultProperties.ContainsKey("plot"))
            {
                var bin = _defaultProperties["plot"];

                foreach (var pair in bin)
                {
                    try { SetFunction.AlterProperty(plot, pair.Key, pair.Value); }
                    catch { }
                }
            }

            if (_defaultProperties.ContainsKey("series"))
            {
                var bin = _defaultProperties["series"];

                foreach (var pair in bin)
                {
                    try
                    {
                        for(var i = 0; i < plot.Count; i++)
                            SetFunction.AlterSeriesProperty(plot, i, pair.Key, pair.Value);
                    }
                    catch { }
                }
            }

            return this;
        }
Пример #21
0
 public void Function(PlotValue plot, StringValue property, Value newValue)
 {
     var propertyName = property.Value;
     AlterProperty(plot, propertyName, newValue);
     plot.RaisePlotChanged(propertyName);
     Context.RaiseNotification(new NotificationEventArgs(NotificationType.Success, "Property changed"));
 }