Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

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.

Take the survey Not interested

ChartControl.ConstantLineMoved Event

Occurs when a user moves a constant line.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.UI.dll

NuGet Package: DevExpress.Win.Charts

#Declaration

public event ConstantLineMovedEventHandler ConstantLineMoved

#Event Data

The ConstantLineMoved event's data class is ConstantLineMovedEventArgs. The following properties provide information specific to this event:

Property Description
ConstantLine Returns a constant line that is being moved.
OldValue Returns the previous axis value.

#Remarks

Users can move constant lines if their RuntimeMoving option is enabled.

#Example

The following example adds a horizontal constant line with an editable title. Once a user moves a constant line, the title is updated to display the current constant line value.

private void OnFormLoad(object sender, EventArgs e) {

    ConstantLine constantLine = new ConstantLine();
    constantLine.AxisValue = 65.0;
    constantLine.Title.Text = "Title";    
    constantLine.RuntimeTitleEditing = true;
    constantLine.RuntimeMoving = true;

    XYDiagram diagram = chartControl1.Diagram as XYDiagram;
    diagram.AxisY.ConstantLines.Add(constantLine);

    chartControl1.ConstantLineMoved += OnChartControlConstantLineMoved;
}

private void OnChartControlConstantLineMoved(object sender, ConstantLineMovedEventArgs e) {
    e.ConstantLine.Title.Text = String.Format("{0:f3}",e.ConstantLine.AxisValue);
}
See Also