Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.
The data adapter that uses data objects with aggregation and composition relationships as data sources for different detail levels when the Chart control is in the Drill Mode.
publicinterfaceINameable {
string Name { get; }
}
publicsealedclassDevAVBranch: INameable {
publicstring Name { get; set; }
public List<DevAVProductCategory> Categories { get; set; }
publicdouble TotalIncome { get => Categories.Sum(c => c.TotalIncome); }
}
publicsealedclassDevAVProductCategory: INameable {
publicstring Name { get; set; }
public List<DevAVProduct> Products { get; set; }
publicdouble TotalIncome { get => Products.Sum(p => p.TotalIncome); }
}
publicsealedclassDevAVProduct: INameable {
publicstring Name { get; set; }
public List<DevAVMonthlyIncome> Sales { get; set; }
publicdouble TotalIncome { get => Sales.Sum(s => s.Income); }
}
publicclassDevAVMonthlyIncome {
public DateTime Month { get; set; }
publicdouble Income { get; set; }
}
PublicInterface INameable
ReadOnlyProperty Name AsStringEndInterfacePublicClass DevAVBranch
Implements INameable
PublicProperty Name AsStringImplements INameable.Name
PublicProperty Categories As List(Of DevAVProductCategory)
PublicReadOnlyProperty TotalIncome AsDoubleGetReturn Categories.Sum(Function(c) c.TotalIncome)
EndGetEndPropertyEndClassPublicClass DevAVProductCategory
Implements INameable
PublicProperty Name AsStringImplements INameable.Name
PublicProperty Products As List(Of DevAVProduct)
PublicReadOnlyProperty TotalIncome AsDoubleGetReturn Products.Sum(Function(p) p.TotalIncome)
EndGetEndPropertyEndClassPublicClass DevAVProduct
Implements INameable
PublicProperty Name AsStringImplements INameable.Name
PublicProperty Sales As List(Of DevAVMonthlyIncome)
PublicReadOnlyProperty TotalIncome AsDoubleGetReturn Sales.Sum(Function(s) s.Income)
EndGetEndPropertyEndClassPublicClass DevAVMonthlyIncome
PublicProperty Month As DateTime
PublicProperty Income AsDoubleEndClass
classMainViewModel {
public IReadOnlyList<DevAVBranch> Branches { get; }
publicMainViewModel() {
Branches = new BranchDAO().GetBranches();
}
}
Class MainViewModel
Private _branches As IReadOnlyList(Of DevAVBranch)
PublicReadOnlyProperty Branches As IReadOnlyList(Of DevAVBranch)
GetReturn _branches
EndGetEndPropertyPublicSubNew()
_branches = new BranchDAO().GetBranches();
EndSubEndClass
<Window.DataContext><local:MainViewModel/></Window.DataContext><Window.Resources><!-- Other resources are here. --><local:DevAVSeriesTemplateSelectorx:Key="seriesTemplateSelector"AllCategoriesTemplate="{StaticResource stackedBarTemplate}"BranchCategoriesTemplate="{StaticResource barTemplate}"CategoryProductsTemplate="{StaticResource stackedSplineAreaTemplate}"ProductTemplate="{StaticResource splineTemplate}"></local:DevAVSeriesTemplateSelector><local:DevAVSeriesChildrenSelectorx:Key="childrenSelector"/><local:DevAVBreadcrumbTextProviderx:Key="textProvider"/><Window.Resources><dxc:ChartControl><dxc:XYDiagram2Dx:Name="diagram"SeriesItemTemplateSelector="{StaticResource seriesTemplateSelector}"DrillDownStateChanged="XYDiagram2D_DrillDownStateChanged"><dxc:XYDiagram.SeriesItemsSource><dxc:HierarchicalDataAdapterDataSource="{Binding Branches}"ChildrenSelector="{StaticResource childrenSelector}"BreadcrumbTextProvider="{StaticResource textProvider}"/></dxc:XYDiagram.SeriesItemsSource></dxc:XYDiagram2D><!-- Other Chart Settings.--></dxc:ChartControl>
classMainWindow: Window {
publicMainWindow() {
InitializeComponent()
}
privatevoidOnDrillDownStateChanged(object sender, DrillDownStateChangedEventArgs e) {
diagram.Rotated = e.BreadcrumbItems.Last().IsHome;
}
}
privatevoidOnDrillDownStateChanged(object sender, DrillDownStateChangedEventArgs e) {
diagram.Rotated = e.BreadcrumbItems.Last().IsHome;
}
classDevAVSeriesChildrenSelector : IChildrenSelector {
public IEnumerable SelectChildren(object item) {
if (item as DevAVBranch branch) returnnew List<DevAVBranch> { branch };
if (item as DevAVProductCategory category) return category.Products;
if (item as DevAVProduct product) returnnew List<DevAVProduct> { product };
returnnull;
}
}
classDevAVSeriesTemplateSelector : DataTemplateSelector {
public DataTemplate AllCategoriesTemplate { get; set; }
public DataTemplate BranchCategoriesTemplate { get; set; }
public DataTemplate CategoryProductsTemplate { get; set; }
public DataTemplate ProductTemplate { get; set; }
publicoverride DataTemplate SelectTemplate(object item, DependencyObject container) {
Diagram diagram = (Diagram)container;
if (item is DevAVBranch && diagram.BreadcrumbItems.Count == 1)
return AllCategoriesTemplate;
if (item is DevAVBranch)
return BranchCategoriesTemplate;
if (item is DevAVProduct && diagram.BreadcrumbItems[diagram.BreadcrumbItems.Count - 1].SourceObject is DevAVProduct)
return ProductTemplate;
if (item is DevAVProduct)
return CategoryProductsTemplate;
returnnull;
}
}
classDevAVBreadcrumbTextProvider : IBreadcrumbTextProvider {
publicstringGetText(object seriesSourceObj, object pointSourceObj) {
StringBuilder sb = new StringBuilder("(");
if (seriesSourceObj != null) sb.Append(GetName(seriesSourceObj));
if (seriesSourceObj != null && pointSourceObj != null) sb.Append(", ");
if (pointSourceObj != null) sb.Append(GetName(pointSourceObj));
sb.Append(")");
return sb.ToString();
}
privatestringGetName(object obj) {
if (obj is INameable nameable) return nameable.Name;
return String.Empty;
}
}
PublicClass MainWindow
PrivateSub Diagram_DrillDownStateChanged(sender AsObject, e As DrillDownStateChangedEventArgs)
diagram.Rotated = e.BreadcrumbItems.Last().IsHome
EndSubEndClassPublicClass DevAVSeriesChildrenSelector
Implements IChildrenSelector
PublicFunction SelectChildren(item AsObject) As IEnumerable Implements IChildrenSelector.SelectChildren
Dim branch = TryCast(item, DevAVBranch)
If (branch IsNotNothing) ThenReturnNew List(Of DevAVBranch) From { branch }
Dim category = TryCast(item, DevAVProductCategory)
If (category IsNotNothing) ThenReturn category.Products
Dim product = TryCast(item, DevAVProduct)
If (product IsNotNothing) ThenReturnNew List(Of DevAVProduct) From { product }
ReturnNothingEndFunctionEndClassClass DevAVSeriesTemplateSelector
Inherits DataTemplateSelector
PublicProperty AllCategoriesTemplate As DataTemplate
PublicProperty BranchCategoriesTemplate As DataTemplate
PublicProperty CategoryProductsTemplate As DataTemplate
PublicProperty ProductTemplate As DataTemplate
PublicOverridesFunction SelectTemplate(item AsObject, container As DependencyObject) As DataTemplate
Dim diagram = CType(container, Diagram)
Dim branch = TryCast(item, DevAVBranch)
If (branch IsNotNothing) And (diagram.BreadcrumbItems.Count = 1) ThenReturn AllCategoriesTemplate
If (branch IsNotNothing) ThenReturn BranchCategoriesTemplate
Dim product = TryCast(item, DevAVProduct)
Dim lastLevelSourceProduct = TryCast(diagram.BreadcrumbItems(diagram.BreadcrumbItems.Count - 1).SourceObject, DevAVProduct)
If (product IsNotNothing) And (lastLevelSourceProduct IsNotNothing) ThenReturn ProductTemplate
If (product IsNotNothing) ThenReturn CategoryProductsTemplate
ReturnNothingEndFunctionEndClassPublicClass DevAVBreadcrumbTextProvider
Implements IBreadcrumbTextProvider
PublicFunction GetText(seriesSourceObj AsObject, pointSourceObj AsObject) AsStringImplements IBreadcrumbTextProvider.GetText
Dim sb = New StringBuilder("(")
If (seriesSourceObj IsNotNothing) Then sb.Append(GetName(seriesSourceObj))
If (seriesSourceObj IsNotNothingAnd pointSourceObj IsNotNothing) Then sb.Append(", ")
If (pointSourceObj IsNotNothing) Then sb.Append(GetName(pointSourceObj))
sb.Append(")")
Return sb.ToString()
EndFunctionPrivateFunction GetName(obj AsObject) AsStringDim nameable = TryCast(obj, INameable)
If (nameable IsNotNothing) ThenReturn nameable.Name
ReturnString.Empty
EndFunctionEndClass
The table below lists classes and properties the code above includes:
Gets or sets the collection of objects used to generate series.
HierarchicalDataAdapter
The data adapter that uses data objects with aggregation and composition relationships as data sources for different detail levels when the Chart control is in the Drill Mode.