CustomLegendItem.MarkerImage Property

Returns the custom legend item's marker image.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.2.dll

Declaration

[XtraChartsLocalizableCategory(XtraChartsCategory.Data)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ChartImage MarkerImage { get; }
<XtraChartsLocalizableCategory(XtraChartsCategory.Data)>
<PersistenceMode(PersistenceMode.InnerProperty)>
Public ReadOnly Property MarkerImage As ChartImage

Property Value

Type Description
ChartImage

A ChartImage object that defines the image used as a legend item marker.

Remarks

Use the Image property to load an image to the Chart Control. Use the ChartImage.ImageUrl property to define the URL of the image source for the WebChartControl.

Examples

This example demonstrates how to add a custom item to the legend.

The following code adds a custom legend item with an image and text.

private void Form1_Load(object sender, EventArgs e) {
    double total = CalculateTotal(chartControl.Series[0]);

    CustomLegendItem customLegendItem = new CustomLegendItem();
    customLegendItem.MarkerImage.Image = new Bitmap("..\\..\\Images\\sum-icon.png");
    customLegendItem.MarkerImageSizeMode = ChartImageSizeMode.Zoom;
    customLegendItem.Text = string.Format("Total: ${0}M", total);            
    chartControl.Legend.CustomItems.Add(customLegendItem);
    chartControl.Legend.ItemVisibilityMode = LegendItemVisibilityMode.AutoGeneratedAndCustom;
    chartControl.Legend.Direction = LegendDirection.TopToBottom;
}
public Double CalculateTotal (Series series) {
    double total = 0;
    foreach(SeriesPoint point in series.Points) {
        total += point.Values[0];
    }
    return total;
}
See Also