Back to Devexpress

DxChart<T>.SetArgumentAxisVisualRange(List<Object>) Method

blazor-devexpress-dot-blazor-dot-dxchart-1-dot-setargumentaxisvisualrange-x28-system-dot-collections-dot-generic-dot-list-system-dot-object-x29.md

latest3.5 KB
Original Source

DxChart<T>.SetArgumentAxisVisualRange(List<Object>) Method

Applies a specific visual range to the argument axis.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public void SetArgumentAxisVisualRange(
    List<object> range
)

Parameters

NameTypeDescription
rangeList<Object>

The data range.

|

Remarks

Call the SetArgumentAxisVisualRange method to modify the visual range of the argument axis.

You can also apply a specific visual range to the value axis using the SetValueAxisVisualRange method. To reset visual ranges for all axes, call the ResetVisualRange() method.

To respond to visual range changes, handle the Chart’s VisualRangeChanged event.

Example

The following code snippet displays a custom Reset Zoom button that sets the argument axis visual range to the initial range (specified via DxChartAxisRange.StartValue and DxChartAxisRange.EndValue properties):

razor
<DxChart @ref="@chart"
         T="DatePricePoint"
         Data="@UsdJpyData"
         Width="100%">
    @* ... *@
    <DxChartLineSeries T="DatePricePoint"
                       TArgument="DateTime"
                       TValue="double"
                       ArgumentField="i => i.DateTimeStamp"
                       ValueField="i => i.Price"
                       Name="USDJPY">
        <DxChartSeriesPoint Visible="false" />
        <DxChartAggregationSettings Enabled="true"
                                    Method="ChartAggregationMethod.Average" />
    </DxChartLineSeries>
    <DxChartArgumentAxis>
        <DxChartAxisRange StartValue="startDate"
                          EndValue="endDate" />
    </DxChartArgumentAxis>
    <DxChartZoomAndPanSettings ArgumentAxisZoomAndPanMode="ChartAxisZoomAndPanMode.Both" />
    <DxChartScrollBarSettings ArgumentAxisScrollBarVisible="true"
                              ArgumentAxisScrollBarPosition="ChartScrollBarPosition.Bottom" />
</DxChart>

<DxButton Text="Reset Zoom" Click="@SetArgumentAxisVisualRange" />

@code {
    IEnumerable<DatePricePoint> UsdJpyData;
    DxChart<DatePricePoint> chart;
    @inject ICurrencyExchangeDataProvider UsdJpyDataProvider

    DateTime startDate = new DateTime(2020, 01, 01);
    DateTime endDate = new DateTime(2021, 01, 29);

    public void SetArgumentAxisVisualRange() {
        chart.SetArgumentAxisVisualRange([startDate, endDate]);
    }

    protected override async Task OnInitializedAsync() {
        UsdJpyData = await UsdJpyDataProvider.GetDataAsync();
    }
}

Run Demo: Chart - Zoom and Pan

See Also

DxChart<T> Class

DxChart<T> Members

DevExpress.Blazor Namespace