Back to Devexpress

SeriesPoint.Argument Property

corelibraries-devexpress-dot-xtracharts-dot-seriespoint-865d4104.md

latest12.8 KB
Original Source

SeriesPoint.Argument Property

Gets the point’s argument value.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public string Argument { get; set; }
vb
Public Property Argument As String

Property Value

TypeDescription
String

A String value that specifies the data point’s argument.

|

Remarks

Each data point is defined by the values of two coordinates - X and Y - when speaking about most series types.

The X coordinate value of a point represents the point’s argument and is specified by the Argument property.

As for a point’s Y coordinate, it can be defined by one or more Y values which are stored in an array available via the SeriesPoint.Values property.

Note

Note that as distinct from the Y axis which always becomes a numerical axis used to measure point data values, the X axis which indicates point arguments can measure different types of data. You can control scale types of point arguments using the SeriesBase.ArgumentScaleType property.

Example

The following example shows how to obtain information about the chart element under the mouse pointer and use the ToolTipController Component to display this information.

csharp
ToolTipController toolTipController = new ToolTipController();
//....
private void chartControl_MouseMove(object sender, MouseEventArgs e) {
    ChartHitInfo hitInfo = chartControl.CalcHitInfo(e.Location);
    StringBuilder builder = new StringBuilder();
    if(hitInfo.InDiagram)
        builder.AppendLine("In diagram");
    if(hitInfo.InNonDefaultPane)
        builder.AppendLine("In non-default pane: " + hitInfo.NonDefaultPane.Name);
    if(hitInfo.InAxis) {
        builder.AppendLine("In axis: " + hitInfo.Axis.Name);
        if(hitInfo.AxisLabelItem != null)
            builder.AppendLine(" Label item: " + hitInfo.AxisLabelItem.Text);
        if(hitInfo.AxisTitle != null)
            builder.AppendLine(" Axis title: " + hitInfo.AxisTitle.Text);
    }
    if(hitInfo.InChartTitle)
        builder.AppendLine("In chart title: " + hitInfo.ChartTitle.Text);
    if(hitInfo.InLegend) {
        builder.AppendLine("In legend");
        if(hitInfo.Series != null && !hitInfo.InSeries)
            builder.AppendLine(" Series: " + ((Series)hitInfo.Series).Name);
    }
    if(hitInfo.InSeries)
        builder.AppendLine("In series: " + ((Series)hitInfo.Series).Name);
    if(hitInfo.InSeriesLabel) {
        builder.AppendLine("In series label");
        builder.AppendLine(" Series: " + ((Series)hitInfo.Series).Name);
    }
    if(hitInfo.InSeriesPoint) {
        builder.AppendLine(" Argument: " + hitInfo.SeriesPoint.Argument);
        if(!hitInfo.SeriesPoint.IsEmpty)
            builder.AppendLine(" Value: " + hitInfo.SeriesPoint.Values[0]);
    }
    if(hitInfo.InAnnotation)
        if(hitInfo.Annotation is TextAnnotation)
            builder.AppendLine("In annotation: " + ((TextAnnotation)hitInfo.Annotation).Name);
        else if(hitInfo.Annotation is ImageAnnotation)
            builder.AppendLine("In annotation: " + ((ImageAnnotation)hitInfo.Annotation).Name);
    if(builder.Length > 0)
        toolTipController.ShowHint("Hit-testing results:\n" + builder.ToString(), chartControl.PointToScreen(e.Location));
    else
        toolTipController.HideHint();
}
void chart_MouseLeave(object sender, EventArgs e) {
    toolTipController.HideHint();
}
vb
Dim toolTipController As ToolTipController = New ToolTipController()
'...
Private Sub chartControl_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
    Dim hitInfo As ChartHitInfo = chartControl.CalcHitInfo(e.Location)
    Dim builder As StringBuilder = New StringBuilder
    If hitInfo.InDiagram Then
        builder.AppendLine("In diagram")
    End If
    If hitInfo.InNonDefaultPane Then
        builder.AppendLine(("In non-default pane: " + hitInfo.NonDefaultPane.Name))
    End If
    If hitInfo.InAxis Then
        builder.AppendLine(("In axis: " + hitInfo.Axis.Name))
        If (Not (hitInfo.AxisLabelItem) Is Nothing) Then
            builder.AppendLine((" Label item: " + hitInfo.AxisLabelItem.Text))
        End If
        If (Not (hitInfo.AxisTitle) Is Nothing) Then
            builder.AppendLine((" Axis title: " + hitInfo.AxisTitle.Text))
        End If 
    End If   
    If hitInfo.InChartTitle Then
        builder.AppendLine(("In chart title: " + hitInfo.ChartTitle.Text))
    End If
    If hitInfo.InLegend Then
        builder.AppendLine("In legend")
        If ((Not (hitInfo.Series) Is Nothing) _
                    AndAlso Not hitInfo.InSeries) Then
            builder.AppendLine((" Series: " + CType(hitInfo.Series,Series).Name))
        End If
    End If
    If hitInfo.InSeries Then
        builder.AppendLine(("In series: " + CType(hitInfo.Series,Series).Name))
    End If

    If hitInfo.InSeriesLabel Then
        builder.AppendLine("In series label")
        builder.AppendLine((" Series: " + CType(hitInfo.Series,Series).Name))
    End If
    If hitInfo.InSeriesPoint Then
        builder.AppendLine((" Argument: " + hitInfo.SeriesPoint.Argument))
        If Not hitInfo.SeriesPoint.IsEmpty Then
            builder.AppendLine((" Value: " + hitInfo.SeriesPoint.Values(0)))
        End If
    End If
    If hitInfo.InAnnotation Then
        If (TypeOf hitInfo.Annotation Is TextAnnotation) Then
            builder.AppendLine(("In annotation: " + CType(hitInfo.Annotation,TextAnnotation).Name))
        ElseIf (TypeOf hitInfo.Annotation Is ImageAnnotation) Then
            builder.AppendLine(("In annotation: " + CType(hitInfo.Annotation,ImageAnnotation).Name))
        End If
    End If
    If (builder.Length > 0) Then
        toolTipController.ShowHint(("Hit-testing results:"& vbLf + builder.ToString), chartControl.PointToScreen(e.Location))
    Else
        toolTipController.HideHint
    End If       
End Sub
Private Sub chart_MouseLeave(ByVal sender As Object, ByVal e As EventArgs)
    toolTipController.HideHint
End Sub
MemberDescription
ChartHitInfoContains information about a specific point in a chart.
ChartControl.CalcHitInfoReturns information about the chart elements at the specified x and y coordinates.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Argument property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-charts-sort-stacked-bars-by-total-values-with-qualitativescalecomparer/CS/Form1.cs#L46

csharp
for (int i = 0;i < ArgumentNumber;i++) {
    string argument = series.Points[i].Argument;
    double total = GetTotalByArg(argument);

winforms-dashboard-custom-items/CS/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.cs#L68

csharp
string formattedValue = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row);
e.LabelText = e.SeriesPoint.Argument + " - " + formattedValue;
e.LegendText = e.SeriesPoint.Argument;

bi-dashboard-non-visual-custom-export/CS/DashboardExporterApp/ExportControlProviders/FunnelItemExportControlProvider.cs#L66

csharp
void CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e) {
    e.LabelText = e.SeriesPoint.Argument + " - " + e.LabelText;
    e.LegendText = e.SeriesPoint.Argument;

winforms-chart-draw-a-custom-legend-marker-for-a-series-point/CS/CustomSeriesPointDrawingSample/Form1.cs#L80

csharp
DXImage photo;
if (photoCache.TryGetValue(e.SeriesPoint.Argument, out photo))
    graphics.DrawImage(photo, photoRect);

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.cs#L63

csharp
string formattedValue = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row);
e.LabelText = e.SeriesPoint.Argument + " - " + formattedValue;
e.LegendText = e.SeriesPoint.Argument;

winforms-charts-sort-stacked-bars-by-total-values-with-qualitativescalecomparer/VB/Form1.vb#L46

vb
For i As Integer = 0 To ArgumentNumber - 1
    Dim argument As String = series.Points(i).Argument
    Dim total As Double = GetTotalByArg(argument)

winforms-dashboard-custom-items/VB/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.vb#L68

vb
Dim formattedValue As String = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row)
e.LabelText = e.SeriesPoint.Argument & " - " & formattedValue
e.LegendText = e.SeriesPoint.Argument

bi-dashboard-non-visual-custom-export/VB/DashboardExporterApp/ExportControlProviders/FunnelItemExportControlProvider.vb#L63

vb
Private Sub CustomDrawSeriesPoint(ByVal sender As Object, ByVal e As CustomDrawSeriesPointEventArgs)
    e.LabelText = e.SeriesPoint.Argument & " - " & e.LabelText
    e.LegendText = e.SeriesPoint.Argument

winforms-chart-draw-a-custom-legend-marker-for-a-series-point/VB/CustomSeriesPointDrawingSample/Form1.vb#L84

vb
Dim photo As DevExpress.Drawing.DXImage
    If Me.photoCache.TryGetValue(e.SeriesPoint.Argument, photo) Then graphics.DrawImage(photo, CustomSeriesPointDrawingSample.Form1.photoRect)
End Using

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.vb#L69

vb
Dim formattedValue As String = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row)
e.LabelText = e.SeriesPoint.Argument & " - " & formattedValue
e.LegendText = e.SeriesPoint.Argument

See Also

Values

ArgumentScaleType

SeriesPoint Class

SeriesPoint Members

DevExpress.XtraCharts Namespace