Back to Devexpress

DxChartAxisBase<T>.Type Property

blazor-devexpress-dot-blazor-dot-dxchartaxisbase-1-82175676.md

latest5.1 KB
Original Source

DxChartAxisBase<T>.Type Property

Specifies an axis type.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(ChartAxisType.Auto)]
[Parameter]
public ChartAxisType Type { get; set; }

Property Value

TypeDefaultDescription
ChartAxisTypeAuto

An enumeration value.

|

Available values:

NameDescription
Auto

Automatically detects the series’s data type and uses it to render the axis. For integer and float data types, displays numeric arguments/values divided by ticks. For other data types, displays discrete arguments/values that correspond to chart points.

| | Continuous |

The axis uses a continuous scale to display numeric and date-time values.

| | Discrete |

Displays discrete arguments/values that correspond to chart points.

| | Logarithmic |

Displays numeric arguments/values that grow exponentially. Each axis argument/value equals the specified logarithm base raised to a power (for instance, 10⁻², 10⁻¹, 10⁰, 10¹, 10², etc.).

|

Remarks

The DxChart<T> component automatically detects the first series’s data type and uses it to render X (argument) and Y (value) axes.

Use the Type property to specify the type of an axis. The following types are available:

|

Value

|

Description

| | --- | --- | |

Auto (Default)

|

For integer and float data types, displays numeric arguments/values divided by ticks (the Continuous type). For other data types, displays discrete arguments/values that correspond to chart points (the Discrete type).

| |

Continuous

|

Displays numeric arguments/values divided by ticks.

| |

Discrete

|

Displays discrete arguments/values that correspond to chart points.

| |

Logarithmic

|

Displays numeric arguments/values that grow exponentially. Each axis argument/value equals to the LogarithmBase value raised to a power (for instance, 10⁻², 10⁻¹, 10⁰, 10¹, 10⁻², etc.).

|

You can also use the DxChartArgumentAxis.ArgumentType and DxChartValueAxis.ValueType properties to cast arguments and values to the specified data type.

The following example displays argument axes of the Discrete type, and value axes of Continuous and Logarithmic types, respectively. The LogarithmBase property for the second chart is set to 2.

razor
<DxChart Data="@GetData()">
    <DxChartTitle Text="@($"The loudness of sounds (continuous value axis)")" />
    <DxChartLegend Visible="false" />
    <DxChartArgumentAxis Type="ChartAxisType.Discrete" />
    <DxChartValueAxis Type="ChartAxisType.Continuous" />
    <DxChartLineSeries ArgumentField="@((DataPoint s) => s.Argument)" ValueField="@((DataPoint s) => s.Value)" />
</DxChart>
<DxChart Data="@GetData()">
    <DxChartTitle Text="@($"The loudness of sounds (logarithmic value axis)")" />
    <DxChartLegend Visible="false" />
    <DxChartArgumentAxis Type="ChartAxisType.Discrete" />
    <DxChartValueAxis Type="ChartAxisType.Logarithmic" LogarithmBase="2" />
    <DxChartLineSeries ArgumentField="@((DataPoint s) => s.Argument)" ValueField="@((DataPoint s) => s.Value)" />
</DxChart>
csharp
@code {
    List<DataPoint> GetData() {
        List<DataPoint> result = new List<DataPoint>(9);
        result.Add(new DataPoint("Whisper", 0.15));
        result.Add(new DataPoint("Street noise", 8));
        result.Add(new DataPoint("Jackhummer", 32));
        result.Add(new DataPoint("Subway train", 64));
        result.Add(new DataPoint("Loud music", 128));
        result.Add(new DataPoint("Pain threshold", 256));
        result.Add(new DataPoint("Buzzer", 512));
        result.Add(new DataPoint("Rocket start", 2048));
        result.Add(new DataPoint("Deadly level", 16348));
        return result;
    }

    struct DataPoint {
        public DataPoint (string argument, double value) { Argument = argument; Value = value; }
        public string Argument { get; set; }
        public double Value { get; set; }
    }
}

Online Demo

Charts - Axis Types

See Also

DxChartAxisBase<T> Class

DxChartAxisBase<T> Members

DevExpress.Blazor Namespace