コード例 #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));
                }
            }
        }
コード例 #2
0
ファイル: SparklineGroup.cs プロジェクト: Daoting/dt
 /// <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();
     }
 }
コード例 #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);
                 }
             }
         }
     }
 }
コード例 #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);
         }
     }
 }
コード例 #5
0
ファイル: SparklineGroup.cs プロジェクト: Daoting/dt
        /// <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);
        }
コード例 #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));
                }
            }
        }
コード例 #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);
 }
コード例 #8
0
ファイル: SparklineGroup.cs プロジェクト: Daoting/dt
        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);
        }
コード例 #9
0
ファイル: Sparkline.cs プロジェクト: Daoting/dt
        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);
        }
コード例 #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);
         }
     }
 }
コード例 #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);
                 }
             }
         }
     }
 }
コード例 #12
0
ファイル: SparklineGroup.cs プロジェクト: Daoting/dt
        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;
                    }
                }
            }
        }
コード例 #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);
             }
         }
     }
 }
コード例 #14
0
ファイル: BaseSparklineViewInfo.cs プロジェクト: Daoting/dt
 /// <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();
 }
コード例 #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> >();
 }
コード例 #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)
 {
 }
コード例 #17
0
ファイル: ColumnSparklineViewInfo.cs プロジェクト: Daoting/dt
 /// <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;
 }
コード例 #18
0
ファイル: StorageBlock.cs プロジェクト: Daoting/dt
 public void SetSparkline(int row, int column, Sparkline value)
 {
     this.sparklines.SetValue(row, column, value);
 }
コード例 #19
0
ファイル: SparklineInfo.cs プロジェクト: Daoting/dt
 public SparklineInfo(Dt.Cells.Data.Sparkline sparkline, CellRange dataRange, CellRange dataAxisRange)
 {
     Sparkline     = sparkline;
     DataRange     = dataRange;
     DataAxisRange = dataAxisRange;
 }
コード例 #20
0
ファイル: SparklineGroup.cs プロジェクト: Daoting/dt
 /// <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));
 }