DrillDownItem.Parameters Property

Returns the field name to field value map that specifies the filter parameters that are applied to the Chart's data source at the detail level that this item defines.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.2.dll

Declaration

public ReadOnlyDictionary<string, object> Parameters { get; }
Public ReadOnly Property Parameters As ReadOnlyDictionary(Of String, Object)

Property Value

Type Description
ReadOnlyDictionary<String, Object>

The field name to field value map that specifies the filter parameters that are applied to the Chart's data source at the detail level that this item defines.

Remarks

The following example demonstrates how to use this mapping to apply several appearance changes to the Chart Control.

Examples

chartControl.DrillDownStateChanged += this.OnChartControlDrillDownStateChanged;
chartControl.DrillDownStateChanging += this.OnChartControlDrillDownStateChanging;

private void OnChartControlDrillDownStateChanging(object sender, DrillDownStateChangingEventArgs e) {
    if (e.States.Length != 0) {
        object categoryValue = null;
        if (e.States.Last().Parameters.TryGetValue("Category", out categoryValue)) {
            int seriesIndex = chartControl.Series.IndexOf(chartControl.Series[(string)categoryValue]);
            int colorIndex = seriesIndex % chartControl.PaletteRepository[chartControl.PaletteName].Count + 1;
            chartControl.PaletteBaseColorNumber = colorIndex;
        }
        if (chartControl.Diagram is XYDiagram diagram) {
            diagram.AxisX.Label.Font = new Font("Tahoma", 8.25f, FontStyle.Regular);
        }
    } else {
        chartControl.PaletteBaseColorNumber = 0;
        if (chartControl.Diagram is XYDiagram diagram) {
            diagram.AxisX.Label.Font = new Font("Tahoma", 8.25f, FontStyle.Underline);
        }
    }
}
private void OnChartControlDrillDownStateChanged(object sender, DrillDownStateChangedEventArgs e) {
    if (!(chartControl.Diagram is XYDiagram diagram)) return;
    if (e.States.Length == 0) {
        diagram.Rotated = true;
        return;
    }
    diagram.Rotated = IsDrillToSeriesFromHome(e.States);
}
private bool IsDrillToSeriesFromHome(DrillDownItem[] drillDownItems) {
    if (drillDownItems.Length != 1) return false;
    IReadOnlyDictionary<string, object> drillDownParams = drillDownItems[0].Parameters;
    if (drillDownParams.Count != 1) return false;
    return drillDownParams.ContainsKey("Category");
}
See Also