Exemplo n.º 1
0
        public void Move(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
        {
            this.MoveDataRange(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount);
            DataMatrix <Sparkline> matrix = new DataMatrix <Sparkline>(rowCount, columnCount);

            for (int i = 0; i < rowCount; i++)
            {
                for (int k = 0; k < columnCount; k++)
                {
                    Sparkline sparkline = this.Sheet.GetSparkline(fromRow + i, fromColumn + k);
                    if (sparkline != null)
                    {
                        sparkline.Row    = toRow + i;
                        sparkline.Column = toColumn + k;
                        matrix.SetValue(i, k, sparkline);
                    }
                    this.Sheet.SetSparkline(fromRow + i, fromColumn + k, null);
                }
            }
            for (int j = 0; j < rowCount; j++)
            {
                for (int m = 0; m < columnCount; m++)
                {
                    this.Sheet.SetSparkline(toRow + j, toColumn + m, matrix.GetValue(j, m));
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds a sparkline to the group.
 /// </summary>
 /// <param name="item">The object to add.</param>
 public void Add(Sparkline item)
 {
     if (!this.Contains(item) && (item != null))
     {
         this.InnerList.Add(item);
         item.Group = this;
         this.AdjustGroupMaxMinValue();
         this.OnGroupChanged();
     }
 }
Exemplo n.º 3
0
 public void Copy(Worksheet src, int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
 {
     if (object.ReferenceEquals(src, this.Sheet))
     {
         this.Copy(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount);
     }
     else
     {
         int offsetRow    = toRow - fromRow;
         int offsetColumn = toColumn - fromColumn;
         for (int i = 0; i < rowCount; i++)
         {
             for (int j = 0; j < columnCount; j++)
             {
                 Sparkline sparkline = src.GetSparkline(fromRow + i, fromColumn + j);
                 if (sparkline != null)
                 {
                     Sparkline sparkline2 = sparkline.Clone();
                     sparkline2.Row    = toRow + i;
                     sparkline2.Column = toColumn + j;
                     CalcExpression dateAxisReference = sparkline2.DateAxisReference;
                     if (dateAxisReference != null)
                     {
                         if (CanOffset(dateAxisReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount))
                         {
                             sparkline2.DateAxisReference = dateAxisReference.Offset(offsetRow, offsetColumn, false, true);
                         }
                         else
                         {
                             sparkline2.DateAxisReference = new CalcErrorExpression(CalcErrors.Reference);
                         }
                     }
                     CalcExpression dataReference = sparkline2.DataReference;
                     if (dataReference != null)
                     {
                         if (CanOffset(dataReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount))
                         {
                             sparkline2.DataReference = dataReference.Offset(offsetRow, offsetColumn, false, true);
                         }
                         else
                         {
                             sparkline2.DataReference = new CalcErrorExpression(CalcErrors.Reference);
                         }
                     }
                     this.Add(sparkline2.Group);
                     this.Sheet.SetSparkline(toRow + i, toColumn + j, sparkline2);
                 }
                 else
                 {
                     this.Sheet.SetSparkline(toRow + i, toColumn + j, null);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public void RemoveRows(int row, int count)
 {
     foreach (SparklineGroup group in this.Groups.ToArray())
     {
         if (group.DisplayDateAxis)
         {
             CalcExpression expression = RemoveRowRange(row, count, group.DateAxisReference);
             if (expression != null)
             {
                 if (group.DateAxisReference != expression)
                 {
                     group.DateAxisReference = expression;
                 }
             }
             else
             {
                 group.Clear();
                 this.Remove(group);
                 continue;
             }
         }
         Sparkline[] array = new Sparkline[group.Count];
         group.CopyTo(array, 0);
         foreach (Sparkline sparkline in array)
         {
             if ((sparkline.Row >= row) && (sparkline.Row < (row + count)))
             {
                 group.Remove(sparkline);
             }
             else
             {
                 if (row <= sparkline.Row)
                 {
                     sparkline.Row -= count;
                 }
                 CalcExpression expression2 = RemoveRowRange(row, count, sparkline.DataReference);
                 if (expression2 != null)
                 {
                     if (sparkline.DataReference != expression2)
                     {
                         sparkline.DataReference = expression2;
                     }
                 }
                 else
                 {
                     group.Remove(sparkline);
                 }
             }
         }
         if (group.Count <= 0)
         {
             this.Remove(group);
         }
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Removes the first occurrence of a specific object from the group.
        /// </summary>
        /// <param name="item">The object to remove from the group.</param>
        /// <returns>
        /// true if <paramref name="item" /> was successfully removed from the group; otherwise, false. This method also returns false if <paramref name="item" /> is not found in the group.
        /// </returns>
        public bool Remove(Sparkline item)
        {
            bool flag = this.InnerList.Remove(item);

            if (flag)
            {
                item.Group = this.Clone();
                this.AdjustGroupMaxMinValue();
                this.OnGroupChanged();
            }
            return(flag);
        }
Exemplo n.º 6
0
        public void Copy(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
        {
            DataMatrix <Sparkline> matrix = new DataMatrix <Sparkline>(rowCount, columnCount);
            int offsetRow    = toRow - fromRow;
            int offsetColumn = toColumn - fromColumn;

            for (int i = 0; i < rowCount; i++)
            {
                for (int k = 0; k < columnCount; k++)
                {
                    Sparkline sparkline = this.Sheet.GetSparkline(fromRow + i, fromColumn + k);
                    if (sparkline != null)
                    {
                        Sparkline sparkline2 = sparkline.Clone();
                        sparkline2.Row    = toRow + i;
                        sparkline2.Column = toColumn + k;
                        CalcExpression dateAxisReference = sparkline2.DateAxisReference;
                        if (dateAxisReference != null)
                        {
                            if (CanOffset(dateAxisReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount))
                            {
                                sparkline2.DateAxisReference = dateAxisReference.Offset(offsetRow, offsetColumn, false, true);
                            }
                            else
                            {
                                sparkline2.DateAxisReference = new CalcErrorExpression(CalcErrors.Reference);
                            }
                        }
                        CalcExpression dataReference = sparkline2.DataReference;
                        if (dataReference != null)
                        {
                            if (CanOffset(dataReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount))
                            {
                                sparkline2.DataReference = dataReference.Offset(offsetRow, offsetColumn, false, true);
                            }
                            else
                            {
                                sparkline2.DataReference = new CalcErrorExpression(CalcErrors.Reference);
                            }
                        }
                        this.Add(sparkline2.Group);
                        matrix.SetValue(i, k, sparkline2);
                    }
                }
            }
            for (int j = 0; j < rowCount; j++)
            {
                for (int m = 0; m < columnCount; m++)
                {
                    this.Sheet.SetSparkline(toRow + j, toColumn + m, matrix.GetValue(j, m));
                }
            }
        }
Exemplo n.º 7
0
 Sparkline Find(int row, int column)
 {
     foreach (SparklineGroup group in this.Groups)
     {
         for (int i = 0; i < group.Count; i++)
         {
             Sparkline sparkline = group[i];
             if ((sparkline.Row == row) && (sparkline.Column == column))
             {
                 return(sparkline);
             }
         }
     }
     return(null);
 }
Exemplo n.º 8
0
        bool IsNeedAdjustGroupMaxMinValue(Sparkline removedSparkline)
        {
            bool flag  = this.setting.MaxAxisType == SparklineAxisMinMax.Group;
            bool flag2 = this.setting.MinAxisType == SparklineAxisMinMax.Group;
            bool flag3 = false;

            if (flag || flag2)
            {
                double minValue = double.MinValue;
                double maxValue = double.MaxValue;
                this.GetMaxMinValues(removedSparkline, out minValue, out maxValue);
                flag3 = (flag && (minValue == this.setting.GroupMaxValue)) || (flag2 && (maxValue == this.setting.GroupMinValue));
            }
            return(flag3);
        }
Exemplo n.º 9
0
        internal Sparkline Clone()
        {
            Sparkline sparkline = new Sparkline {
                Row    = this.Row,
                Column = this.Column
            };

            if (this.isDataSet)
            {
                sparkline.Data = this.Data;
            }
            sparkline.DataOrientation = this.DataOrientation;
            sparkline.DataReference   = this.DataReference;
            sparkline.Group           = this.group.Clone();
            return(sparkline);
        }
Exemplo n.º 10
0
 public void Swap(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
 {
     for (int i = 0; i < rowCount; i++)
     {
         for (int j = 0; j < columnCount; j++)
         {
             Sparkline sparkline = this.Sheet.GetSparkline(fromRow + i, fromColumn + j);
             sparkline.Row    = toRow + i;
             sparkline.Column = toColumn + j;
             Sparkline sparkline2 = this.Sheet.GetSparkline(toRow + i, toColumn + j);
             sparkline2.Row    = fromRow + i;
             sparkline2.Column = fromColumn + j;
             this.Sheet.SetSparkline(fromRow + i, fromColumn + j, sparkline2);
             this.Sheet.SetSparkline(toRow + i, toColumn + j, sparkline);
         }
     }
 }
Exemplo n.º 11
0
 public void Clear(int row, int column, int rowCount, int columnCount)
 {
     for (int i = row; i < (row + rowCount); i++)
     {
         for (int j = column; j < (column + columnCount); j++)
         {
             Sparkline item = this.Find(i, j);
             if (item != null)
             {
                 SparklineGroup group = item.Group;
                 group.Remove(item);
                 if (group.Count == 0)
                 {
                     this.Remove(group);
                 }
             }
         }
     }
 }
Exemplo n.º 12
0
        void GetMaxMinValues(Sparkline sparkline, out double max, out double min)
        {
            max = double.MinValue;
            min = double.MaxValue;
            ISparklineData data = sparkline.Data;

            if (data != null)
            {
                for (int i = 0; i < data.Count; i++)
                {
                    object obj2 = data.GetValue(i);
                    if (obj2 is double)
                    {
                        double num2 = (double)((double)obj2);
                        max = (max < num2) ? num2 : max;
                        min = (min > num2) ? num2 : min;
                    }
                }
            }
        }
Exemplo n.º 13
0
 public void Move(Worksheet src, int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
 {
     if (object.ReferenceEquals(src, this.Sheet))
     {
         this.Move(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount);
     }
     else
     {
         this.MoveDataRange(src, fromRow, fromColumn, toRow, toColumn, rowCount, columnCount);
         for (int i = 0; i < rowCount; i++)
         {
             for (int j = 0; j < columnCount; j++)
             {
                 Sparkline item = src.GetSparkline(fromRow + i, fromColumn + j);
                 if (item != null)
                 {
                     item.Row    = toRow + i;
                     item.Column = toColumn + j;
                     SparklineGroup group  = item.Group;
                     SparklineGroup group2 = group.Clone();
                     group.Remove(item);
                     if (group.Count <= 0)
                     {
                         src.SheetSparklineGroupManager.Remove(group);
                     }
                     group2.Add(item);
                     this.Add(group2);
                     this.Sheet.SetSparkline(toRow + i, toColumn + j, item);
                 }
                 else
                 {
                     this.Sheet.SetSparkline(toRow + i, toColumn + j, null);
                 }
                 ((ISparklineSheet)src).SetSparkline(fromRow + i, fromColumn + j, null);
             }
         }
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Creates a new instance of  the base sparkline view information.
 /// </summary>
 /// <param name="info">The sparkline information.</param>
 public BaseSparklineViewInfo(Sparkline info)
 {
     this.info = info;
     this.Reset();
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.Cells.Data.LineSparklineViewInfo" /> class.
 /// </summary>
 /// <param name="info">The sparkline info</param>
 public LineSparklineViewInfo(Sparkline info) : base(info)
 {
     this.linePos = new List <Tuple <Windows.Foundation.Point, Windows.Foundation.Point> >();
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.Cells.Data.WinLossSparklineViewInfo" /> class.
 /// </summary>
 /// <param name="info">The sparkline info</param>
 public WinLossSparklineViewInfo(Sparkline info) : base(info)
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.Cells.Data.ColumnSparklineViewInfo" /> class.
 /// </summary>
 /// <param name="info">The sparkline info</param>
 public ColumnSparklineViewInfo(Sparkline info) : base(info)
 {
     this.theSize = Windows.Foundation.Size.Empty;
 }
Exemplo n.º 18
0
 public void SetSparkline(int row, int column, Sparkline value)
 {
     this.sparklines.SetValue(row, column, value);
 }
Exemplo n.º 19
0
 public SparklineInfo(Dt.Cells.Data.Sparkline sparkline, CellRange dataRange, CellRange dataAxisRange)
 {
     Sparkline     = sparkline;
     DataRange     = dataRange;
     DataAxisRange = dataAxisRange;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Determines whether the group contains a specific value.
 /// </summary>
 /// <param name="item">The object to locate in the group.</param>
 /// <returns>
 /// true if <paramref name="item" /> is found in the group; otherwise, false.
 /// </returns>
 public bool Contains(Sparkline item)
 {
     return(this.InnerList.Contains(item));
 }