示例#1
0
 void AddEditableTitle(EditableTitle title, String format, ColumnViewModel column0, ColumnViewModel column1, ColumnViewModel column2)
 {
     AddEditableTitle(title, format, new List <ColumnViewModel>()
     {
         column0, column1, column2
     });
 }
示例#2
0
 public void Initialize()
 {
     view.ExplorationView.Initialize();
     TopPageView.ViewModel.ViewStatus = new ViewStatus();
     previewingColumnViewModel        = null;
     selectedPageViews.Clear();
 }
示例#3
0
        public void PreviewColumn(ColumnViewModel columnViewModel)
        {
            mainPageViewModel.TableViewModel.SkipAllAnimationToFill();

            previewingColumnViewModel = columnViewModel;

            if (ViewStatus.SelectedColumnViewModels.IndexOf(previewingColumnViewModel) >= 0)
            {
                return;
            }

            // 현재 선택된 view status를 가져옴
            ViewStatus selectedViewStatus = ViewStatus.Clone();

            // 새 컬럼 추가
            selectedViewStatus.SelectedColumnViewModels.Add(columnViewModel);
            selectedViewStatus.Refresh();

            // 현재 추가된 컬럼으로 groupedRows와 GroupedRowViewModels를 만듦.
            selectedViewStatus.Generate(mainPageViewModel.SheetViewModel);

            // 탑 페이지 뷰 모델 가져와서
            PageViewModel pageViewModel = TopPageView.ViewModel;

            // 복제한 view status를 추가 한 다음
            pageViewModel.ViewStatus = selectedViewStatus;
            pageViewModel.State      = PageViewModel.PageViewState.Previewing;

            // 이걸로 pageView를 채움
            pageViewModel.Reflect(ReflectReason.Preview); // ReflectType2.TrackPreviousParagraph | ReflectType2.OnCreate, ReflectReason2.PreviewRequested);
            TopPageView.ReflectState();

            ExpandFilters();
        }
示例#4
0
        void AddEditableTitle(EditableTitle title, String format, List <ColumnViewModel> columnViewModels)
        {
            foreach (String f in format.Split('|'))
            {
                Match match = Regex.Match(f, @"{([^d]+):([c|a|u])}");

                if (match.Success)
                {
                    String          num             = match.Groups[1].Value;
                    String          type            = match.Groups[2].Value;
                    ColumnViewModel columnViewModel = columnViewModels[Int32.Parse(num)];

                    if (type == "a") // aggregated
                    {
                        AddAggregatedColumnComboBox(title, columnViewModel, false);
                    }
                    else if (type == "c")
                    {
                        AddColumnComboBox(title, columnViewModel);
                    }
                    else if (type == "u")
                    {
                        AddAggregatedColumnComboBox(title, columnViewModel, true);
                    }
                }
                else
                {
                    AddText(title, f);
                }
            }
        }
示例#5
0
        uint activatedPointerId; // for cancel indexing

        public void IndexColumn(uint id, Int32 index)
        {
            if (ignoredPointerId == id)
            {
                return;
            }

            Double totalHeight = SheetViewHeight;
            Int32  columnIndex = index;

            if (columnIndex < 0 || columnIndex >= SheetViewModel.ColumnViewModels.Count)
            {
                return;
            }

            ColumnViewModel columnViewModel = SheetViewModel.ColumnViewModels.Where(cvm => !cvm.IsSelected).OrderBy(cvm => cvm.Order).ElementAt(index);

            activatedPointerId = id;

            if (view.TableView.ColumnHighlighter.ColumnViewModel != columnViewModel)
            {
                view.TableView.ScrollToColumnViewModel(columnViewModel);

                view.TableView.ColumnHighlighter.Update(columnViewModel);

                Logger.Instance.Log($"indexed,{columnViewModel.Column.Name}");
                IsIndexing = true;

                mainPageViewModel.ExplorationViewModel.PreviewColumn(columnViewModel);
            }
        }
示例#6
0
 SelectionChangedEventHandler CreateColumnChangedHandler(ColumnViewModel currentColumnViewModel)
 {
     if (currentColumnViewModel.Type == ColumnType.Numerical)
     {
         return(CreateColumnChangedHandler(currentColumnViewModel, currentColumnViewModel.AggregativeFunction));
     }
     return(CreateColumnChangedHandler(currentColumnViewModel, null));
 }
示例#7
0
        public void CancelPreviewColumn()
        {
            previewingColumnViewModel = null;
            if (TopPageView.ViewModel.State == PageViewModel.PageViewState.Previewing)
            {
                TopPageView.ViewModel.State = PageViewModel.PageViewState.Empty;
                TopPageView.ViewModel.Reflect(ReflectReason.CancelPreview); // ReflectType2.Default, ReflectReason2.PreviewRequested);
                TopPageView.ReflectState();

                ExpandFilters();
            }
        }
示例#8
0
        SelectionChangedEventHandler CreateAggregationChangedHandler(ColumnViewModel columnViewModel)
        {
            return(new SelectionChangedEventHandler((sender, args) =>
            {
                ComboBox comboBox = sender as ComboBox;
                String selectedName = (comboBox.SelectedItem as ComboBoxItem).Content.ToString();
                AggregativeFunction.BaseAggregation aggregativeFunction = AggregativeFunction.FromName(selectedName);

                Logger.Instance.Log($"aggregation changed,{columnViewModel.Column.Name},{columnViewModel.AggregativeFunction.Name},{aggregativeFunction.Name}");

                columnViewModel.AggregativeFunction = aggregativeFunction;

                mainPageViewModel.ReflectAll(ReflectReason.ColumnChanged); //.ColumnViewModelChanged);
            }));
        }
示例#9
0
        void AddAggregatedColumnComboBox(EditableTitle title, ColumnViewModel numerical, Boolean withSameUnit)
        {
            String format = Const.Loader.GetString("AggregatedColumnName");

            foreach (String f in format.Split('|'))
            {
                if (f == "{0}")
                {
                    if (IsSelected)
                    {
                        AddComboBox(
                            title,
                            numerical.AggregativeFunction.Name,
                            AggregativeFunction.Names,
                            CreateAggregationChangedHandler(numerical),
                            String.Empty
                            );
                    }
                    else
                    {
                        AddText(title, $"<b>{numerical.AggregativeFunction.Name}</b>");
                    }
                }
                else if (f == "{1}")
                {
                    if (IsSelected)
                    {
                        AddComboBox(
                            title,
                            numerical.Name,
                            mainPageViewModel.SheetViewModel.ColumnViewModels.Where(
                                cvm => cvm.Type == ColumnType.Numerical && (withSameUnit ? cvm.Unit == numerical.Unit : true)
                                ).Select(cvm => cvm.Name),
                            CreateColumnChangedHandler(numerical),
                            numerical.Column.Name
                            );
                    }
                    else
                    {
                        AddText(title, $"<b>{numerical.Name}</b>");
                    }
                }
                else
                {
                    AddText(title, f);
                }
            }
        }
示例#10
0
        public void SetAside(ColumnViewModel columnViewModel)
        {
            if (columnViewModel.IsHidden)
            {
                return;
            }

            columnViewModel.IsHidden = true;
            IEnumerable <ColumnViewModel> nexts = columnViewModels.Where(c => c.Order > columnViewModel.Order);

            foreach (ColumnViewModel cvm in nexts)
            {
                cvm.Order--;
            }

            columnViewModel.Order = columnViewModels.Count - 1;
        }
示例#11
0
 void AddColumnComboBox(EditableTitle title, ColumnViewModel columnViewModel)
 {
     if (IsSelected)
     {
         AddComboBox(
             title,
             columnViewModel.Name,
             mainPageViewModel.SheetViewModel.ColumnViewModels.Where(cvm => cvm.Type == columnViewModel.Type).Select(cvm => cvm.Name),
             CreateColumnChangedHandler(columnViewModel),
             columnViewModel.Column.Name
             );
     }
     else
     {
         AddText(title, $"<b>{columnViewModel.Name}</b>");
     }
 }
示例#12
0
        public void BringFront(ColumnViewModel columnViewModel)
        {
            if (!columnViewModel.IsHidden)
            {
                return;
            }

            columnViewModel.IsHidden = false;
            Int32 order = columnViewModels.Count(c => !c.IsHidden && c.Index < columnViewModel.Index);
            IEnumerable <ColumnViewModel> nexts = columnViewModels.Where(c => order <= c.Order && c.Order < columnViewModel.Order);

            foreach (ColumnViewModel cvm in nexts)
            {
                cvm.Order++;
            }

            columnViewModel.Order = order;
        }
示例#13
0
        SelectionChangedEventHandler CreateColumnChangedHandler(ColumnViewModel currentColumnViewModel, AggregativeFunction.BaseAggregation defaultAggregativeFunction)
        {
            return(new SelectionChangedEventHandler((sender, args) =>
            {
                ComboBox comboBox = sender as ComboBox;
                String selectedName = (comboBox.SelectedItem as ComboBoxItem).Content.ToString();
                ColumnViewModel selectedColumnViewModel = mainPageViewModel.SheetViewModel.ColumnViewModels.First(cvm => cvm.Name == selectedName);

                // selectedColumnViewModel로 이제 바꾸면 됨. 이 과정에 대해서는 explorationViewModel의 PageViewTapped를 참고하면 좋다.

                Logger.Instance.Log($"column changed,{currentColumnViewModel.Column.Name},{selectedColumnViewModel.Column.Name}");

                // 1. 컬럼의 상태 변경
                if (selectedColumnViewModel.IsSelected)
                {
                    Int32 index1 = ViewStatus.SelectedColumnViewModels.FindIndex(cvm => cvm == currentColumnViewModel);
                    Int32 index2 = ViewStatus.SelectedColumnViewModels.FindIndex(cvm => cvm == selectedColumnViewModel);
                    ViewStatus.SelectedColumnViewModels[index1] = selectedColumnViewModel;
                    ViewStatus.SelectedColumnViewModels[index2] = currentColumnViewModel;
                    ViewStatus.Refresh();
                }
                else
                {
                    currentColumnViewModel.IsSelected = false;
                    selectedColumnViewModel.IsSelected = true;

                    Int32 index = ViewStatus.SelectedColumnViewModels.FindIndex(cvm => cvm == currentColumnViewModel);
                    ViewStatus.SelectedColumnViewModels[index] = selectedColumnViewModel;
                    ViewStatus.Refresh();
                }

                if (selectedColumnViewModel.Type == ColumnType.Numerical && defaultAggregativeFunction != null)
                {
                    selectedColumnViewModel.AggregativeFunction = defaultAggregativeFunction;
                }

                mainPageViewModel.ReflectAll(ReflectReason.ColumnChanged); // 2.ColumnViewModelChanged);
            }));
        }
示例#14
0
 public void Sort(ColumnViewModel columnViewModel, SortOption sortOption)
 {
     columnViewModel.SortOption   = sortOption;
     columnViewModel.SortPriority = sortPriority++;
 }
示例#15
0
        private AnimationScenario PlayExpandAnimation(ViewStatus viewStatus, ColumnViewModel columnViewModel)
        {
            AnimationHint hint = null;// stashedViewStatus.AnimationHint;
            IEnumerable <RowViewModel> previousRowViewModels = (stashedViewStatus.TableViewState == TableViewState.AllRow) ? SheetViewModel.AllRowViewModels : stashedViewStatus.GroupedRowViewModels;
            IEnumerable <RowViewModel> currentRowViewModels  = viewStatus.IsAllRowViewModelVisible ? SheetViewModel.AllRowViewModels : viewStatus.GroupedRowViewModels;
            Double     beforeX    = hint.ColumnViewModelPosition[columnViewModel];
            Double     afterX     = columnViewModel.X;
            Int32      index      = 0;
            Storyboard storyboard = new Storyboard();
            Double     horizontalAnimationDuration = 0;

            Canvas canvas = view.TableView.AnimatingRowCanvas;

            canvas.Children.Clear();

            RowViewModel               rootGroupedRowViewModel = stashedViewStatus.GroupedRowViewModels[0];
            Int32                      rootIndex = 0;
            IEnumerable <Row>          rows      = rootGroupedRowViewModel.Rows;
            IEnumerable <RowViewModel> expandingRowViewModels =
                currentRowViewModels
                .Where(rvm => (rvm.Row == null ? rows.Intersect(rvm.Rows).Count() > 0 : rows.Contains(rvm.Row)) && rvm.Y < mainPageViewModel.Bounds.Height)
                .OrderBy(rvm => rvm.Y)
                .Take(50);

            if (expandingRowViewModels.Count() < 5)
            {
                index = 0;
                foreach (GroupedRows groupedRows in stashedViewStatus.GroupedRows)
                {
                    IEnumerable <RowViewModel> candidate =
                        currentRowViewModels
                        .Where(rvm => (rvm.Row == null ? groupedRows.Rows.Intersect(rvm.Rows).Count() > 0 : groupedRows.Rows.Contains(rvm.Row)) && rvm.Y < mainPageViewModel.Bounds.Height)
                        .OrderBy(rvm => rvm.Y)
                        .Take(50);

                    if (candidate.Count() >= 5)
                    {
                        rootGroupedRowViewModel = stashedViewStatus.GroupedRowViewModels[index];
                        rows = groupedRows.Rows;
                        expandingRowViewModels = candidate;
                        rootIndex = index;
                        break;
                    }
                    index++;
                }
            }

            viewStatus.ColorRowViewModels(allRowViewModels, viewStatus.GroupedRowViewModels, viewStatus.GroupedRows);


            if (viewStatus.IsAllRowViewModelVisible)
            {
                // root
                {
                    AnimatingRowViewModel arvm = new AnimatingRowViewModel()
                    {
                        RowViewModel    = rootGroupedRowViewModel,
                        X               = beforeX,
                        ColumnViewModel = columnViewModel
                    };

                    AnimatingRowPresenter arp = new AnimatingRowPresenter()
                    {
                        AnimatingRowViewModel = arvm
                    };

                    arp.Opacity = 1;
                    arp.Update();
                    canvas.Children.Add(arp);
                    Canvas.SetTop(arp, rootGroupedRowViewModel.StashedY);
                    arp.CellPresenter.Foreground = new SolidColorBrush(rootGroupedRowViewModel.Color);

                    storyboard.Children.Add(Util.Animator.Generate(arp, "Opacity", 0, UnitAnimationDuration, DelayBeforeAnimation));
                }

                index = 0;
                foreach (RowViewModel rvm in expandingRowViewModels)
                {
                    AnimatingRowViewModel arvm = new AnimatingRowViewModel()
                    {
                        RowViewModel    = rvm,
                        X               = beforeX,
                        ColumnViewModel = columnViewModel
                    };

                    AnimatingRowPresenter arp = new AnimatingRowPresenter()
                    {
                        AnimatingRowViewModel = arvm
                    };

                    arp.Opacity = 0;
                    arp.Update();
                    canvas.Children.Add(arp);

                    Canvas.SetTop(arp, rootGroupedRowViewModel.StashedY);
                    arp.CellPresenter.Foreground = new SolidColorBrush(rootGroupedRowViewModel.Color);

                    storyboard.Children.Add(Util.Animator.Generate(arp, "(Canvas.Top)", rvm.Y, UnitAnimationDuration, DelayBeforeAnimation));
                    storyboard.Children.Add(Util.Animator.Generate(arp, "Opacity", 1, UnitAnimationDuration, DelayBeforeAnimation));

                    storyboard.Children.Add(
                        Util.Animator.GenerateColorAnimation(arp.CellPresenter, "(TextBlock.Foreground).(SolidColorBrush.Color)", rvm.Color, UnitAnimationDuration, DelayBeforeAnimation)
                        );

                    if (beforeX != afterX)
                    {
                        storyboard.Children.Add(Util.Animator.Generate(arp.CellPresenter, "(Canvas.Left)", afterX, UnitAnimationDuration, DelayBeforeAnimation + UnitAnimationDuration));
                        horizontalAnimationDuration = UnitAnimationDuration;
                    }
                    index++;
                }
            }
            else // grouped row visible
            {
            }

            stashedViewStatus = null;
            return(new AnimationScenario()
            {
                TotalAnimationDuration = DelayBeforeAnimation + UnitAnimationDuration + horizontalAnimationDuration,
                TableHeaderUpdateTime = DelayBeforeAnimation + UnitAnimationDuration,
                AnimationStoryboard = storyboard
            });
        }
示例#16
0
        private AnimationScenario PlayCollapseAnimation(List <RowViewModel> previousRowViewModels, List <RowViewModel> currentRowViewModels, ColumnViewModel columnViewModel)
        {
            Double beforeX = columnViewModel.StashedX;
            Double afterX  = columnViewModel.X;

            Storyboard storyboard = new Storyboard();

            Canvas canvas = view.TableView.AnimatingRowCanvas;

            RowViewModel               rootRowViewModel        = currentRowViewModels[0];
            IEnumerable <Row>          rows                    = rootRowViewModel.Rows;
            IEnumerable <RowViewModel> collapsingRowViewModels =
                previousRowViewModels
                .Where(rvm => (rvm.Row == null ? rows.Intersect(rvm.Rows).Count() > 0 : rows.Contains(rvm.Row)) && rvm.Y < mainPageViewModel.Bounds.Height)
                .OrderBy(rvm => rvm.Y)
                .Take(50);

            if (collapsingRowViewModels.Count() < 5)
            {
                foreach (RowViewModel groupedRowViewModel in currentRowViewModels)
                {
                    IEnumerable <RowViewModel> candidate =
                        previousRowViewModels
                        .Where(rvm => (rvm.Row == null ? groupedRowViewModel.Rows.Intersect(rvm.Rows).Count() > 0 : groupedRowViewModel.Rows.Contains(rvm.Row)) && rvm.Y < mainPageViewModel.Bounds.Height)
                        .OrderBy(rvm => rvm.Y)
                        .Take(50);

                    if (candidate.Count() >= 5)
                    {
                        rows = groupedRowViewModel.Rows;
                        collapsingRowViewModels = candidate;
                        rootRowViewModel        = groupedRowViewModel;
                        break;
                    }
                }
            }

            Double colorChangingAnimationDuration = 0;
            Double horizontalAnimationDuration    = 0;

            if (collapsingRowViewModels.Any(rvm => rvm.StashedColor != rootRowViewModel.Color))
            {
                colorChangingAnimationDuration = UnitAnimationDuration;
            }

            if (beforeX != afterX)
            {
                horizontalAnimationDuration = UnitAnimationDuration;
            }


            // root
            {
                AnimatingRowViewModel arvm = new AnimatingRowViewModel()
                {
                    RowViewModel    = rootRowViewModel,
                    X               = beforeX,
                    ColumnViewModel = columnViewModel
                };

                AnimatingRowPresenter arp = new AnimatingRowPresenter()
                {
                    AnimatingRowViewModel = arvm
                };

                arp.Opacity = 0;
                arp.Update();
                canvas.Children.Add(arp);
                arp.CellPresenter.Foreground = new SolidColorBrush(rootRowViewModel.Color);
                Canvas.SetTop(arp, rootRowViewModel.Y);

                storyboard.Children.Add(Util.Animator.Generate(arp, "Opacity", 1, UnitAnimationDuration, DelayBeforeAnimation + colorChangingAnimationDuration));

                if (beforeX != afterX)
                {
                    storyboard.Children.Add(Util.Animator.Generate(arp.CellPresenter, "(Canvas.Left)", afterX, UnitAnimationDuration, DelayBeforeAnimation + UnitAnimationDuration + colorChangingAnimationDuration));
                }
            }

            foreach (RowViewModel rvm in collapsingRowViewModels)
            {
                AnimatingRowViewModel arvm = new AnimatingRowViewModel()
                {
                    RowViewModel    = rvm,
                    X               = beforeX,
                    ColumnViewModel = columnViewModel
                };

                AnimatingRowPresenter arp = new AnimatingRowPresenter()
                {
                    AnimatingRowViewModel = arvm
                };

                arp.Opacity = 1;
                arp.Update();
                canvas.Children.Add(arp);

                Canvas.SetTop(arp, rvm.StashedY);
                arp.CellPresenter.Foreground = new SolidColorBrush(rvm.StashedColor);

                if (colorChangingAnimationDuration > 0)
                {
                    storyboard.Children.Add(
                        Util.Animator.GenerateColorAnimation(arp.CellPresenter, "(TextBlock.Foreground).(SolidColorBrush.Color)", rootRowViewModel.Color, UnitAnimationDuration, DelayBeforeAnimation)
                        );
                }

                // 그 다음 세로로 모음
                storyboard.Children.Add(Util.Animator.Generate(arp, "(Canvas.Top)", rootRowViewModel.Y, UnitAnimationDuration, DelayBeforeAnimation + colorChangingAnimationDuration));
                storyboard.Children.Add(Util.Animator.Generate(arp, "Opacity", 0, UnitAnimationDuration, DelayBeforeAnimation + colorChangingAnimationDuration));

                // 그 다음 가로로 이동
                if (beforeX != afterX)
                {
                    storyboard.Children.Add(Util.Animator.Generate(arp.CellPresenter, "(Canvas.Left)", afterX, UnitAnimationDuration, DelayBeforeAnimation + UnitAnimationDuration + colorChangingAnimationDuration));
                }
            }

            stashedViewStatus = null;

            return(new AnimationScenario()
            {
                TotalAnimationDuration = DelayBeforeAnimation + UnitAnimationDuration + horizontalAnimationDuration + colorChangingAnimationDuration,
                TableHeaderUpdateTime = DelayBeforeAnimation + UnitAnimationDuration + colorChangingAnimationDuration,
                AnimationStoryboard = storyboard,
                SpotlightColumnViewModel = columnViewModel
            });
        }
示例#17
0
        public void FilterRowsByValueAtPosition(Double x, Double y)
        {
            ColumnViewModel columnViewModel = SheetViewModel.ColumnViewModels.First(cvm => cvm.X <= x && x < cvm.X + cvm.Width);

            if (columnViewModel == null)
            {
                return;
            }
            RowViewModel rowViewModel = null;

            if (mainPageViewModel.ExplorationViewModel.ViewStatus.IsN)
            {
                return;
            }
            if (mainPageViewModel.ExplorationViewModel.ViewStatus.CategoricalCount > 0)
            {
                if (columnViewModel.Type == ColumnType.Numerical)
                {
                    return;
                }
                if (mainPageViewModel.ExplorationViewModel.ViewStatus.SelectedColumnViewModels.IndexOf(columnViewModel) < 0)
                {
                    return;
                }
            }

            if (State == TableViewState.AllRow || State == TableViewState.SelectedRow)
            {
                rowViewModel = allRowViewModels.First(rvm => rvm.Y <= y && y < rvm.Y + Const.RowHeight);
            }
            else if (State == TableViewState.GroupedRow)
            {
                rowViewModel = groupedRowViewModels.First(rvm => rvm.Y <= y && y < rvm.Y + Const.RowHeight);
            }

            if (rowViewModel == null)
            {
                return;
            }
            if (columnViewModel.Type == ColumnType.Categorical)
            {
                Category category = rowViewModel.Cells[columnViewModel.Index].Content as Category;
                category.IsKept = false;
                ColumnViewModel cvm = category.ColumnViewModel;

                if (cvm.Categories.All(c => c.IsKept))
                {
                    cvm.IsKept = true;
                }
                else if (cvm.Categories.All(c => !c.IsKept))
                {
                    cvm.IsKept = false;
                }
                else
                {
                    cvm.IsKept = null;
                }

                mainPageViewModel.SheetViewModel.UpdateFilter();
                mainPageViewModel.ReflectAll(ReflectReason.RowFiltered);
            }
        }
示例#18
0
        public void Preview(ViewStatus viewStatus)
        {
            UIElementCollection children = pivotTableView.PivotTable.Children;

            children.Clear();
            pivotTableView.PivotTable.ColumnDefinitions.Clear();
            pivotTableView.PivotTable.RowDefinitions.Clear();

            var groupedRows              = viewStatus.GroupedRows;
            var groupedRowViewModels     = viewStatus.GroupedRowViewModels;
            var selectedColumnViewModels = viewStatus.SelectedColumnViewModels.OrderBy(cvm => (cvm.Type == ColumnType.Categorical ? -1000 : 0) + cvm.Order);

            if (viewStatus.IsN)
            {
                Int32 rowN    = groupedRows.Count + 1, // 테이블 전체 로우의 개수
                      columnN = 2;

                Int32 i, index, j;

                // 개수만큼 추가 컬럼 및 로우 정의 추가. 이중선 말고는 별 특별한 점 없음.
                for (i = 0; i < rowN; ++i)
                {
                    RowDefinition rowDefinition = new RowDefinition();
                    rowDefinition.Height = GridLength.Auto;
                    pivotTableView.PivotTable.RowDefinitions.Add(rowDefinition);
                }

                for (i = 0; i < columnN; ++i)
                {
                    ColumnDefinition columnDefinition = new ColumnDefinition();
                    pivotTableView.PivotTable.ColumnDefinitions.Add(columnDefinition);
                }

                // 가로 이름 넣기 (인덱스 열 포함)

                index = 0;
                foreach (ColumnViewModel columnViewModel in selectedColumnViewModels)
                {
                    Border border = new Border()
                    {
                        Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style
                    };
                    TextBlock textBlock = new TextBlock()
                    {
                        Text  = columnViewModel.FormatPivotTableHeaderName(viewStatus),
                        Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style
                    };
                    border.Child = textBlock;

                    children.Add(border);
                    Grid.SetRow(border, 0);
                    Grid.SetColumn(border, index++);
                }

                {
                    Border border = new Border()
                    {
                        Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style
                    };
                    TextBlock textBlock = new TextBlock()
                    {
                        Text = String.Format(
                            Const.Loader.GetString("CountColumnName").Replace("|", ""),
                            selectedColumnViewModels.First().Name
                            ),
                        Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style
                    };
                    border.Child = textBlock;

                    children.Add(border);
                    Grid.SetRow(border, 0);
                    Grid.SetColumn(border, index++);
                }

                // 데이터 넣기
                i = 0;
                foreach (GroupedRows grs in groupedRows.Take(MaximumRowNumber))
                {
                    j = 0;
                    foreach (ColumnViewModel columnViewModel in selectedColumnViewModels)
                    {
                        Bin bin = grs.Keys[columnViewModel] as Bin;

                        String content = bin.ToString();
                        Border border  = GetNewBorder(content);

                        (border.Child as TextBlock).Foreground = ViewStatus.Category10FirstSolidColorBrush;

                        children.Add(border);
                        Grid.SetRow(border, 1 + i);
                        Grid.SetColumn(border, j++);
                    }
                    {
                        Border border = GetNewBorder(grs.Rows.Count);

                        children.Add(border);
                        Grid.SetRow(border, 1 + i);
                        Grid.SetColumn(border, j++);
                    }
                    i++;
                }
            }
            else
            {
                // TODO Cx 의 경우 Count 컬럼 추가하고 값 넣어야함

                Int32 rowN       = groupedRows.Count + 1,                         // 테이블 전체 로우의 개수
                      columnN    = selectedColumnViewModels.Count() /* + 1 + 1*/; // 테이블 전체 컬럼의 개수
                Boolean isOnlyCn = viewStatus.IsOnlyCn;

                Int32 i, index, j;
                if (isOnlyCn)
                {
                    columnN++;
                }

                // 개수만큼 추가 컬럼 및 로우 정의 추가. 이중선 말고는 별 특별한 점 없음.
                for (i = 0; i < rowN; ++i)
                {
                    RowDefinition rowDefinition = new RowDefinition();
                    rowDefinition.Height = GridLength.Auto;
                    pivotTableView.PivotTable.RowDefinitions.Add(rowDefinition);
                }

                for (i = 0; i < columnN; ++i)
                {
                    ColumnDefinition columnDefinition = new ColumnDefinition();
                    pivotTableView.PivotTable.ColumnDefinitions.Add(columnDefinition);
                }

                // 가로 이름 넣기 (인덱스 열 포함)

                index = 0;
                foreach (ColumnViewModel columnViewModel in selectedColumnViewModels)
                {
                    Border border = new Border()
                    {
                        Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style
                    };
                    TextBlock textBlock = new TextBlock()
                    {
                        Text  = columnViewModel.FormatPivotTableHeaderName(viewStatus),
                        Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style
                    };
                    border.Child = textBlock;

                    children.Add(border);
                    Grid.SetRow(border, 0);
                    Grid.SetColumn(border, index++);
                }

                if (isOnlyCn)
                {
                    Border border = new Border()
                    {
                        Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style
                    };
                    TextBlock textBlock = new TextBlock()
                    {
                        Text  = Const.Loader.GetString("Count"),
                        Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style
                    };
                    border.Child = textBlock;

                    children.Add(border);
                    Grid.SetRow(border, 0);
                    Grid.SetColumn(border, columnN - 1);
                }

                // 데이터 넣기
                i = 0;
                ColumnViewModel lastCategorical = viewStatus.LastCategorical;

                foreach (RowViewModel rowViewModel in groupedRowViewModels.Take(MaximumRowNumber))
                {
                    j = 0;
                    foreach (ColumnViewModel columnViewModel in selectedColumnViewModels)
                    {
                        Border border = GetNewBorder(rowViewModel.Cells[columnViewModel.Index].Content);

                        children.Add(border);

                        if (columnViewModel == lastCategorical)
                        {
                            (border.Child as TextBlock).Foreground = new SolidColorBrush(rowViewModel.Color);
                        }

                        Grid.SetRow(border, 1 + i);
                        Grid.SetColumn(border, j++);
                    }

                    if (isOnlyCn)
                    {
                        Border border = GetNewBorder(rowViewModel.Rows.Count().ToString());

                        children.Add(border);

                        Grid.SetRow(border, 1 + i);
                        Grid.SetColumn(border, columnN - 1);
                    }
                    i++;
                }
            }
        }