Skip to main content

ConstantLineTitle.Alignment Property

Gets or sets the alignment of the constant line title.

Namespace: DevExpress.XamarinForms.Charts

Assembly: DevExpress.XamarinForms.Charts.dll

NuGet Package: DevExpress.XamarinForms.Charts

Declaration

public ConstantLineTitleAlignment Alignment { get; set; }

Property Value

Type Description
ConstantLineTitleAlignment

A ConstantLineTitleAlignment enumeration value that specifies how to align the constant line title.

Available values:

Name Description
Near

The title is aligned near to the axis to which the constant line belongs.

ConstantLineTitleAlignment.Near

Far

The title is aligned far from the axis to which the constant line belongs.

ConstantLineTitleAlignment.Far

Remarks

Use the Alignment property to specify the alignment of a constant line title relative to the corresponding axis.

Property Value

Constant Line Title Alignment

Near

AxisTitle.Alignment Near

Far

AxisTitle.Alignment Far

Example

This example shows how to add a constant line to a numeric y-axis, customize its appearance and show it in the chart legend. To do this, add a NumericConstantLine object with the specified properties to the NumericAxisY.ConstantLines collection.

NumericAxisY Constant Line

<dxc:ChartView>
  <!--...-->

  <dxc:ChartView.AxisY>
      <dxc:NumericAxisY>
          <dxc:NumericAxisY.ConstantLines>
              <dxc:NumericConstantLine AxisValue="{Binding ViewModel.NightTempAverage}"
                                       ShowBehind="True"
                                       VisibleInLegend="True"
                                       LegendText="Average Annual">
                  <!-- Customize the constant line title. -->
                  <dxc:NumericConstantLine.Title>
                      <dxc:ConstantLineTitle Text="{Binding ViewModel.NightTempAverage, StringFormat='{0}°C'}"
                                             Alignment="Far" 
                                             ShowBelowLine="False">
                          <dxc:ConstantLineTitle.Style>
                              <dxc:TitleStyle>
                                  <dxc:TitleStyle.TextStyle>
                                      <dxc:TextStyle Color="#7f43bf" Size="12"/>
                                  </dxc:TitleStyle.TextStyle>
                              </dxc:TitleStyle>
                          </dxc:ConstantLineTitle.Style>
                      </dxc:ConstantLineTitle>
                  </dxc:NumericConstantLine.Title>
                  <!-- Customize the constant line appearance. -->
                  <dxc:NumericConstantLine.Style>
                      <dxc:ConstantLineStyle Stroke="#7f43bf" Thickness="2" Dashes="7 3"/>
                  </dxc:NumericConstantLine.Style>
              </dxc:NumericConstantLine>
          </dxc:NumericAxisY.ConstantLines>
      </dxc:NumericAxisY>
  </dxc:ChartView.AxisY>
</dxc:ChartView>
See Also