示例#1
0
        private DrilldownChartViewModel GetDrilldownChart(DimensionTree tree, TreeDimensionDto xDimension, Measure measure,
                                                          List <FlatDimensionDto> filters, bool requireDrilldownChart)
        {
            var drilldownGraphDto = _graphService.GetDrilldownGraph(tree, xDimension, measure, filters, requireDrilldownChart);

            return(_browseCubeMapper.Map(drilldownGraphDto));
        }
        public DrilldownGraphDto GetDrilldownGraph(DimensionTree allDimensionsTree, TreeDimensionDto xDimension,
                                                   Measure measure, List <FlatDimensionDto> filters, bool requireDrilldownChart)
        {
            var graph = new DrilldownGraphDto
            {
                DimensionName = xDimension.Name,
                Name          = $"Drilldown graph of {measure.Name} by {xDimension.Name}",
                Roots         = new List <GraphXAxisRootDto>()
            };
            var xDimIsRoot = allDimensionsTree.IsRoot(xDimension.Id);

            // if x-dimension is root dimension, there is no point for showing drilldown graph
            if (xDimIsRoot && !requireDrilldownChart)
            {
                return(null);
            }
            // otherwise values of x dimension will be root and its parents values will be leaves
            else if (!xDimIsRoot)
            {
                var filteredXValues = GetFilteredValues(allDimensionsTree, xDimension, filters);
                foreach (var xValue in filteredXValues)
                {
                    graph.Roots.Add(GetParentRoot(allDimensionsTree, xDimension, measure, xValue, filters));
                }
            }
            else
            {
                var filteredXValues = GetFilteredValues(allDimensionsTree, xDimension, filters).ToList();
                foreach (var xValue in filteredXValues)
                {
                    graph.Roots.Add(GetRoot(allDimensionsTree, xDimension, measure, filteredXValues, filters, xValue));
                }
            }
            return(graph);
        }
        private GraphXAxisRootDto GetRoot(DimensionTree allDimensionsTree, DimensionDto xDimension, Measure measure,
                                          IEnumerable <DimensionValueDto> filteredXValues, List <FlatDimensionDto> filters,
                                          DimensionValueDto xValue = null, DimensionDto legendDimension = null)
        {
            GraphXAxisRootDto xAxisRoot;

            if (legendDimension == null)
            {
                xAxisRoot = new DrilldownGraphXAxisRootDto
                {
                    Id          = xValue?.Id ?? 0,
                    Name        = xValue?.Value ?? string.Empty,
                    XAxisLeaves = new List <GraphXAxisLeafDto>()
                };
                var leaf = GetLeaf(allDimensionsTree, xDimension, xValue, measure, filters);
                xAxisRoot.XAxisLeaves.Add(leaf);
            }
            else
            {
                xAxisRoot = new GroupedGraphXAxisRootDto
                {
                    Id          = xValue?.Id ?? 0,
                    Name        = xValue?.Value ?? string.Empty,
                    XAxisLeaves = new List <GraphXAxisLeafDto>()
                };
                foreach (var dimValue in filteredXValues)
                {
                    var leaf = GetLeaf(allDimensionsTree, xDimension, dimValue, measure, filters, legendDimension);
                    xAxisRoot.XAxisLeaves.Add(leaf);
                }
            }

            return(xAxisRoot);
        }
示例#4
0
        public IEnumerable <DimensionValueDto> GetCorrespondingValues(DimensionTree tree, int dimensionId, DimensionDto child)
        {
            var childDimension = tree.GetDimensionDto(child.Id);
            var oldIds         = new List <int>();

            oldIds.AddRange(child.DimensionValues.Select(dv => dv.Id));
            var newIds = new List <int>();

            while (childDimension.Id != dimensionId)
            {
                var parentDimension = tree.GetDimensionDto((int)childDimension.ParentId);
                var selectors       = new List <List <Column> >
                {
                    oldIds.Select(childId => new Column {
                        Name = childDimension.IdName, Value = childId.ToString()
                    })
                    .ToList()
                };
                oldIds = newIds;
                var currentIds = QueryBuilder.Select(parentDimension.TableName, selectors);
                newIds.Clear();
                newIds.AddRange(from DataRow currentId in currentIds.Rows select Convert.ToInt32(currentId[Constants.String.Id]));
                childDimension = parentDimension;
            }
            var ret = new List <DimensionValueDto>();

            foreach (var newId in newIds)
            {
                ret.AddRange(GetValuesOfDimension(tree.GetDimensionDto(dimensionId), new Column {
                    Name = Constants.String.Id, Value = newId.ToString()
                }));
            }
            return(ret);
        }
        public GroupedGraphDto GetGroupedGraph(DimensionTree allDimensionsTree, TreeDimensionDto xDimension,
                                               DimensionDto legendDimension, Measure measure, List <FlatDimensionDto> filterDimensions, bool group)
        {
            var graph = new GroupedGraphDto
            {
                Name  = $"Grouped graph of {measure.Name} by {xDimension.Name} and {legendDimension.Name}",
                Roots = new List <GraphXAxisRootDto>()
            };
            var xDimIsRoot      = allDimensionsTree.IsRoot(xDimension.Id);
            var filteredXValues = GetFilteredValues(allDimensionsTree, xDimension, filterDimensions);

            // if x-dimension is root dimension, its values will be leaves
            // x-dim values will be also leaves if graph should not be grouped
            if (xDimIsRoot || !group)
            {
                graph.Roots.Add(GetRoot(allDimensionsTree, xDimension, measure, filteredXValues, filterDimensions, null, legendDimension));
            }
            // otherwise its values will be root and its parents values will be leaves
            else
            {
                foreach (var xValue in filteredXValues)
                {
                    graph.Roots.Add(GetParentRoot(allDimensionsTree, xDimension, measure, xValue, filterDimensions, legendDimension));
                }
            }
            return(graph);
        }
示例#6
0
        private GroupedChartViewModel GetGroupedChart(DimensionTree tree, TreeDimensionDto xDimension, DimensionDto legendDimension,
                                                      Measure measure, List <FlatDimensionDto> filters, bool group)
        {
            var groupedGraphDto = _graphService.GetGroupedGraph(tree, xDimension, legendDimension, measure, filters, group);

            return(_browseCubeMapper.Map(groupedGraphDto));
        }
        public static List <FlatDimensionDto> GetBakeryFilter(DimensionTree tree)
        {
            var dimensions = new List <Tuple <int, int[]> > {
                Tuple.Create(4, new[] { 1 })
            };

            return(GetFilters(tree, dimensions));
        }
        public static List <FlatDimensionDto> GetBreadMilkEuropeFilter(DimensionTree tree)
        {
            var dimensions = new List <Tuple <int, int[]> > {
                Tuple.Create(3, new[] { 1, 3 }), Tuple.Create(2, new[] { 1 })
            };

            return(GetFilters(tree, dimensions));
        }
 private void Populate(DimensionTree tree)
 {
     foreach (var dimensionDto in tree.GetDimensionDtos())
     {
         var dimensionValues = _starSchemaQuerier.GetValuesOfDimension(dimensionDto);
         dimensionDto.Populate(dimensionValues);
     }
 }
 public List <SelectListItem> ConvertTreeToSelectList(DimensionTree tree)
 {
     Items.Clear();
     foreach (var rootDimension in tree.RootDimensions)
     {
         AddSelectListItem(rootDimension, 0);
     }
     return(Items);
 }
 private void Setup(List <Dimension> dimensions, DimensionTree tree)
 {
     _data.Setup(d => d.GetDimension(It.IsAny <int>())).Returns((int x) => dimensions.Single(d => d.Id == x));
     _data.Setup(d => d.GetAllDimValues(It.IsAny <int>())).Returns((int x) => dimensions.Single(d => d.Id == x).DimensionValues.ToList());
     _querier.Setup(q => q.GetValuesOfDimension(It.IsAny <DimensionDto>(), It.IsAny <Column>()))
     .Returns(
         (DimensionDto d, Column c) =>
         tree.GetDimensionDto(d.Id).DimensionValues.Where(dv => c.Value == dv.Value).ToList());
 }
        public static DimensionTree CreateDimensionTree(string datasetName)
        {
            var tree        = new DimensionTree(datasetName);
            var placeValues = new List <DimensionValueDto>
            {
                new DimensionValueDto {
                    Id = 1, Value = "Czech republic"
                },
                new DimensionValueDto {
                    Id = 2, Value = "Slovakia"
                },
                new DimensionValueDto {
                    Id = 3, Value = "Russia"
                },
            };
            var regionValues = new List <DimensionValueDto>
            {
                new DimensionValueDto {
                    Id = 1, Value = "Europe"
                },
                new DimensionValueDto {
                    Id = 2, Value = "Asia"
                }
            };
            var productValues = new List <DimensionValueDto>
            {
                new DimensionValueDto {
                    Id = 1, Value = "Bread"
                },
                new DimensionValueDto {
                    Id = 2, Value = "Bun"
                },
                new DimensionValueDto {
                    Id = 3, Value = "Milk"
                },
            };
            var categoryValues = new List <DimensionValueDto>
            {
                new DimensionValueDto {
                    Id = 1, Value = "Bakery"
                },
                new DimensionValueDto {
                    Id = 2, Value = "Dairy"
                }
            };

            tree.Add(CreateDimensionDto(datasetName, 1, "Place", null, typeof(string), placeValues));
            tree.Add(CreateDimensionDto(datasetName, 2, "Region", 1, typeof(string), regionValues));
            tree.Add(CreateDimensionDto(datasetName, 3, "Product", null, typeof(string), productValues));
            tree.Add(CreateDimensionDto(datasetName, 4, "Category", 3, typeof(string), categoryValues));
            return(tree);
        }
示例#13
0
 private void SetupDataLayer(DimensionTree tree)
 {
     _treeBuilderMock.Setup(c => c.ConvertToTree(1, It.IsAny <bool>())).Returns(tree);
     _dataMock.Setup(c => c.GetDimension(It.IsAny <int>()))
     .Returns((int id) => new Dimension {
         Name = tree.GetDimensionDto(id).Name, Id = id
     });
     _dataMock.Setup(c => c.GetMeasure(1)).Returns(new Measure {
         Id = 1
     });
     _starSchemaQuerierMock.Setup(c => c.GetValuesOfDimension(It.IsAny <DimensionDto>(), It.IsAny <Column>()))
     .Returns((DimensionDto dd, Column col) => tree.GetDimensionDto(dd.Id).DimensionValues);
 }
        private IEnumerable <DimensionValueDto> GetFilteredValues(DimensionTree allDimensionsTree, DimensionDto dimension,
                                                                  List <FlatDimensionDto> filterDimensions, List <DimensionValueDto> dimensionValues = null)
        {
            var dimensionFilter = filterDimensions.SingleOrDefault(fd => fd.Id == dimension.Id);

            if (dimensionValues == null)
            {
                dimensionValues = _querier.GetValuesOfDimension(dimension);
            }
            var childrenInFilters   = filterDimensions.Where(fd => allDimensionsTree.GetDimensionDto(dimension.Id).GetSubtreeIds().Contains(fd.Id)).ToList();
            var valuesFromFilter    = new List <DimensionValueDto>();
            var valuesFromAncestors = new List <DimensionValueDto>();

            if (dimensionFilter != null)
            {
                valuesFromFilter =
                    dimensionFilter.DimensionValues
                    .Select(filterValue => dimensionValues.SingleOrDefault(v => v.Id == filterValue.Id))
                    .Where(v => v != null).ToList();
            }
            if (childrenInFilters.Any())
            {
                foreach (var child in childrenInFilters)
                {
                    var dimensionCorrespondingValues = _querier.GetCorrespondingValues(allDimensionsTree, dimension.Id, child);
                    foreach (var correspondingValue in dimensionCorrespondingValues)
                    {
                        if (dimensionValues.Select(dv => dv.Id).Contains(correspondingValue.Id))
                        {
                            valuesFromAncestors.Add(correspondingValue);
                        }
                    }
                }
            }
            if (valuesFromFilter.Any() && valuesFromAncestors.Any())
            {
                var filteredValues = valuesFromFilter.Select(v1 => v1.Id)
                                     .Where(v => valuesFromAncestors.Select(v2 => v2.Id)
                                            .Contains(v)).ToList();
                return(filteredValues.Any() ? dimensionValues.Where(xdv => filteredValues.Contains(xdv.Id)) : dimensionValues);
            }
            else if (valuesFromFilter.Any())
            {
                return(valuesFromFilter);
            }
            else if (valuesFromAncestors.Any())
            {
                return(valuesFromAncestors);
            }
            return(dimensionValues);
        }
        public List <EquivalencyClass> GetEquivalencyClasses(DimensionTree tree)
        {
            var equivalencyClasses = new List <EquivalencyClass>();

            foreach (var rootDim in tree.RootDimensions)
            {
                var eqC = new EquivalencyClass
                {
                    Name       = "eq_class_" + rootDim.Name,
                    Dimensions = new List <DimensionDto>()
                };
                eqC.Dimensions.AddRange(rootDim.GetSubtreeDimensionDtos());
                equivalencyClasses.Add(eqC);
            }
            return(equivalencyClasses);
        }
        public static List <FlatDimensionDto> GetFilters(DimensionTree tree, List <Tuple <int, int[]> > dimensionsAndValues)
        {
            var ret = new List <FlatDimensionDto>();

            foreach (var dimension in dimensionsAndValues)
            {
                var dimensionInTree = tree.GetDimensionDto(dimension.Item1);
                ret.Add(new FlatDimensionDto
                {
                    Id              = dimensionInTree.Id,
                    Name            = dimensionInTree.Name,
                    DatasetName     = dimensionInTree.DatasetName,
                    DimensionValues = dimension.Item2.Select(dv => dimensionInTree.DimensionValues.Single(dvt => dvt.Id == dv)).ToList()
                });
            }
            return(ret);
        }
示例#17
0
        private List <List <Column> > ConvertToSelectors(DimensionTree allValues, IEnumerable <List <DimensionValueIds> > filters)
        {
            var selectors = new List <List <Column> >();

            foreach (var filter in filters)
            {
                var listToAdd = new List <Column>();
                foreach (var valueIds in filter)
                {
                    listToAdd.AddRange(valueIds.ValueIds.Select(dId => new Column {
                        Name = allValues.GetDimensionDto(valueIds.DimensionId).IdName, Value = dId.ToString()
                    }));
                }
                selectors.Add(listToAdd);
            }
            return(selectors);
        }
 public FilterViewModel Map(DimensionTree tree)
 {
     var viewModel = new FilterViewModel { Dimensions = new List<FilterDimensionViewModel>() };
     var dimensionDtos = tree.GetDimensionDtos().ToList();
     foreach (var dimensionDto in dimensionDtos)
     {
         var dimensionViewModel = new FilterDimensionViewModel
         {
             DimensionId = dimensionDto.Id,
             DimensionName = dimensionDto.Name,
             Values = new List<DimensionValueViewModel>()
         };
         dimensionViewModel.Values.AddRange(dimensionDto.DimensionValues
             .Select(v => new DimensionValueViewModel {Id = v.Id, Value = v.Value, Checked = true}));
         viewModel.Dimensions.Add(dimensionViewModel);
     }
     return viewModel;
 }
示例#19
0
        public List <CommensurabilityViewModel> GetCommensurableDimensions(DimensionTree tree)
        {
            var ret = new List <CommensurabilityViewModel>();

            foreach (var root in tree.RootDimensions)
            {
                ret.AddRange(root.GetSubtreeDimensionDtos().Select(d => new CommensurabilityViewModel
                {
                    Dimension = new DimensionViewModel
                    {
                        Id   = d.Id,
                        Name = d.Name,
                        Type = d.Type.ToString()
                    },
                    Checked = tree.IsLeaf(d.Id)
                }));
            }
            return(ret);
        }
示例#20
0
        public async Task AddDimension(string dimensionName, int dimensionParrent)
        {
            try
            {
                Dimension dim = new Dimension()
                {
                    DimensionName = dimensionName
                };
                //DimensionTable dimTable = Context.DimensionTables.Where()
                Context.Dimensions.Add(dim);
                await Context.SaveChangesAsync();

                var           dimensTree = Context.DimensionTrees.Where(x => x.DescendantId == dimensionParrent).ToList();
                DimensionTree parent     = new DimensionTree()
                {
                    Level = -1, ParentId = 0
                };
                if (dimensTree.Count != 0)
                {
                    parent = dimensTree.Where(x => x.DimensionId == x.DescendantId).FirstOrDefault();
                }
                foreach (DimensionTree tree in dimensTree)
                {
                    Context.DimensionTrees.Add(new DimensionTree()
                    {
                        DimensionId  = tree.DimensionId,
                        DescendantId = dim.DimensionId,
                        Level        = parent.Level + 1,
                        ParentId     = parent.DimensionId
                    });
                }
                Context.DimensionTrees.Add(new DimensionTree()
                {
                    DimensionId  = dim.DimensionId,
                    DescendantId = dim.DimensionId,
                    Level        = parent.Level + 1,
                    ParentId     = parent.DimensionId
                });
                await Context.SaveChangesAsync();
            }
            catch (Exception ex) { }
        }
        public DimensionTree ConvertToTree(IEnumerable <Dimension> dimensions, string prefix, bool populate = false)
        {
            var dimensionList = dimensions.ToList();
            var dimensionTree = new DimensionTree(dimensionList.First().DataSet.Name, prefix);

            while (dimensionTree.Count != dimensionList.Count)
            {
                foreach (var dimension in dimensionList)
                {
                    var dimToAdd = new TreeDimensionDto
                    {
                        Children    = new List <TreeDimensionDto>(),
                        Id          = dimension.Id,
                        Name        = dimension.Name,
                        ParentId    = dimension.ParentDimension?.Id,
                        DatasetName = dimension.DataSet.Name,
                        Type        = dimension.Type.ToType(),
                        Prefix      = prefix
                    };
                    if (!dimensionTree.Contains(dimToAdd))
                    {
                        if (dimension.ParentDimension == null)
                        {
                            dimensionTree.Add(dimToAdd);
                        }
                        else
                        {
                            if (dimensionTree.Contains((int)dimension.ParentDimension.Id))
                            {
                                dimensionTree.Add(dimToAdd);
                            }
                        }
                    }
                }
            }
            if (populate)
            {
                Populate(dimensionTree);
            }
            return(dimensionTree);
        }
        public Tuple <int, int> GetXAndLegendDimensionsId(AssociationRule rule, DimensionTree tree)
        {
            int xDimId, legendDimId;

            switch (rule.AntecedentValues.Count)
            {
            case 1:
                xDimId      = rule.AntecedentValues.Single().Dimension.Id;
                legendDimId = rule.ConditionValues.Any() ? rule.ConditionValues.First().Dimension.Id : 0;
                break;

            case 2:
                var firstDimension  = rule.AntecedentValues.ToList()[0].Dimension;
                var secondDimension = rule.AntecedentValues.ToList()[1].Dimension;
                var firstIsRoot     = tree.IsRoot(firstDimension.Id);
                var secondIsRoot    = tree.IsRoot(secondDimension.Id);
                if (firstIsRoot != secondIsRoot)
                {
                    if (firstIsRoot)
                    {
                        xDimId      = firstDimension.Id;
                        legendDimId = secondDimension.Id;
                    }
                    else
                    {
                        xDimId      = secondDimension.Id;
                        legendDimId = firstDimension.Id;
                    }
                }
                else
                {
                    xDimId      = firstDimension.Id;
                    legendDimId = secondDimension.Id;
                }
                break;

            default:
                throw new InvalidDataException($"Wrong count of antecedent values in rule {rule.Id}.");
            }
            return(Tuple.Create(xDimId, legendDimId));
        }
示例#23
0
        public double GetFactTableSum(DimensionTree allValues, List <FlatDimensionDto> filters,
                                      List <FlatDimensionDto> conditions, Measure measure)
        {
            var factTableName         = allValues.FactTableName;
            var filterRootValueIds    = new List <List <DimensionValueIds> >();
            var conditionRootValueIds = new List <List <DimensionValueIds> >();

            foreach (var filter in filters)
            {
                filterRootValueIds.Add(filter.DimensionValues.Select(value => GetRootDimensionIds(allValues, filter.Id, value.Id)).ToList());
            }
            foreach (var condition in conditions)
            {
                conditionRootValueIds.Add(condition.DimensionValues.Select(value => GetRootDimensionIds(allValues, condition.Id, value.Id)).ToList());
            }

            var allFilteringIds = filterRootValueIds.Concat(conditionRootValueIds);
            var selectors       = ConvertToSelectors(allValues, allFilteringIds);
            var queryResult     = QueryBuilder.Select(factTableName, selectors);

            return(AggregateData(queryResult, measure.Name));
        }
示例#24
0
        // Returns root dimension and list of its ids for concrete non-root dimension
        private DimensionValueIds GetRootDimensionIds(DimensionTree tree, int dimensionId, int valueId)
        {
            var isRoot         = tree.IsRoot(dimensionId);
            var childDimension = tree.GetDimensionDto(dimensionId);
            var oldIds         = new List <int> {
                valueId
            };
            var newIds = new List <int> {
                valueId
            };

            while (!isRoot)
            {
                var parentDimension = tree.GetDimensionDto((int)childDimension.ParentId);
                var selectors       = new List <List <Column> >
                {
                    oldIds.Select(childId => new Column {
                        Name = childDimension.IdName, Value = childId.ToString()
                    })
                    .ToList()
                };
                oldIds = newIds;

                var currentIds = QueryBuilder.Select(parentDimension.TableName, selectors);
                newIds.Clear();
                newIds.AddRange(from DataRow currentId in currentIds.Rows select Convert.ToInt32(currentId[Constants.String.Id]));
                childDimension = parentDimension;
                if (childDimension.ParentId == null)
                {
                    isRoot = true;
                }
            }
            return(new DimensionValueIds
            {
                DimensionId = childDimension.Id,
                ValueIds = new HashSet <int>(newIds)
            });
        }
        private GraphXAxisRootDto GetParentRoot(DimensionTree allDimensionsTree, TreeDimensionDto childDimension,
                                                Measure measure, DimensionValueDto xValue, List <FlatDimensionDto> filters, DimensionDto legendDimension = null)
        {
            GraphXAxisRootDto xAxisRoot;

            if (legendDimension == null)
            {
                xAxisRoot = new DrilldownGraphXAxisRootDto
                {
                    Id          = xValue.Id,
                    Name        = xValue.Value,
                    XAxisLeaves = new List <GraphXAxisLeafDto>()
                };
            }
            else
            {
                xAxisRoot = new GroupedGraphXAxisRootDto
                {
                    Id          = xValue.Id,
                    Name        = xValue.Value,
                    XAxisLeaves = new List <GraphXAxisLeafDto>()
                };
            }
            var parentDimension = allDimensionsTree.GetDimensionDto((int)childDimension.ParentId);
            var xDimValues      = _querier.GetValuesOfDimension(
                parentDimension, new Column {
                Name = childDimension.IdName, Value = xValue.Id.ToString()
            });
            var filteredValues = GetFilteredValues(allDimensionsTree, parentDimension, filters, xDimValues);

            foreach (var dimValue in filteredValues)
            {
                var leaf = GetLeaf(allDimensionsTree, allDimensionsTree.GetDimensionDto((int)childDimension.ParentId), dimValue, measure, filters, legendDimension);
                xAxisRoot.XAxisLeaves.Add(leaf);
            }
            return(xAxisRoot);
        }
示例#26
0
 public List <CommensurabilityViewModel> GetCommensurableDimensions(DimensionTree tree)
 {
     return(_taskMapper.GetCommensurableDimensions(tree));
 }
示例#27
0
 private Dictionary <int, AllStructValueObject> addElement(Dictionary <int, AllStructValueObject> list, DimensionTree tree)
 {
     if (tree.ParentId == 0 || (tree.Level == 0 && tree.ParentId == tree.DimensionId))
     {
         string Name = Dimensions.Where(dim => dim.DimensionId == tree.DescendantId).FirstOrDefault().DimensionName;
         list.Add(tree.DescendantId, new AllStructValueObject()
         {
             Name        = Name,
             Descendants = new Dictionary <int, AllStructValueObject>()
         });
     }
     else
     {
         if (tree.DimensionId != tree.DescendantId)
         {
             tree.Level -= 1;
             addElement(list[tree.DimensionId].Descendants, tree);
         }
     }
     return(list);
 }
        private GraphXAxisLeafDto GetLeaf(DimensionTree allDimensionsTree, DimensionDto xDimension, DimensionValueDto xValue, Measure measure,
                                          List <FlatDimensionDto> filters, DimensionDto legendDimension = null)
        {
            if (legendDimension == null)
            {
                var conditionDto = new FlatDimensionDto
                {
                    Id              = xDimension.Id,
                    DatasetName     = xDimension.DatasetName,
                    Name            = xDimension.Name,
                    DimensionValues = new List <DimensionValueDto> {
                        new DimensionValueDto {
                            Id = xValue.Id
                        }
                    }
                };
                return(new DrilldownGraphXAxisLeafDto
                {
                    Id = xValue.Id,
                    Name = xValue.Value,
                    Value = _querier.GetFactTableSum(allDimensionsTree,
                                                     filters, new[] { conditionDto }.ToList(), measure)
                });
            }
            var leaf = new GroupedGraphXAxisLeafDto
            {
                Id           = xValue.Id,
                Name         = xValue.Value,
                LegendValues = new List <GraphLegendValueDto>()
            };
            var legendFilteredValues = GetFilteredValues(allDimensionsTree, legendDimension, filters, legendDimension.DimensionValues);

            foreach (var legendValue in legendFilteredValues)
            {
                var xDimensionDto = new FlatDimensionDto
                {
                    Id              = xDimension.Id,
                    DatasetName     = xDimension.DatasetName,
                    Name            = xDimension.Name,
                    DimensionValues = new[] { new DimensionValueDto {
                                                  Id = xValue.Id
                                              } }.ToList()
                };
                var legendDimensionDto = new FlatDimensionDto
                {
                    Id              = legendDimension.Id,
                    DatasetName     = legendDimension.DatasetName,
                    Name            = legendDimension.Name,
                    DimensionValues = new[] { new DimensionValueDto {
                                                  Id = legendValue.Id
                                              } }.ToList()
                };
                leaf.LegendValues.Add(new GraphLegendValueDto
                {
                    Legend = new GraphLegendDto
                    {
                        Id   = legendValue.Id,
                        Name = legendValue.Value
                    },
                    Value = _querier.GetFactTableSum(allDimensionsTree, filters, new[] { xDimensionDto, legendDimensionDto }.ToList(), measure)
                });
            }
            return(leaf);
        }
示例#29
0
 private FilterViewModel GetFilterValues(DimensionTree tree)
 {
     return(_browseCubeMapper.Map(tree));
 }