Search results

Data Markers

Data markers are used to provide information about the data points in the series. You can add a shape to adorn each data point.

Marker

Markers can be added to the points by enabling the Visible option of the marker property.

marker.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Width="60%"> 
        <ChartSeriesCollection> 
            <ChartSeries DataSource="@ConsumerReports" XName="X" YName="Y" Type="ChartSeriesType.Line"> 
                <ChartMarker Visible="true" Height="10" Width="10"> 
                </ChartMarker>
            </ChartSeries>
        </ChartSeriesCollection>
</EjsChart> 

@code{
    public class ChartData
    {
        public double X;
        public double Y;
    }

    public List<ChartData> ConsumerReports = new List<ChartData> 
      {
            new ChartData{ X= 2005, Y= 28 },
            new ChartData{ X= 2006, Y= 25 },
            new ChartData{ X= 2007, Y= 26 },
            new ChartData{ X= 2008, Y= 27 },
            new ChartData{ X= 2009, Y= 32 },
            new ChartData{ X= 2010, Y= 35 },
            new ChartData{ X= 2011, Y= 30 }
        };
}

Marker

Shape

Markers can be assigned with different shapes such as Rectangle, Circle, Diamond etc using the Shape property.

shape.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Width="60%">
        <ChartSeriesCollection> 
            <ChartSeries DataSource="@ConsumerReports" XName="X" YName="Y" Type="ChartSeriesType.Line">
                <ChartMarker Visible="true" Height="10" Width="10" Shape="ChartShape.Diamond"> 
                </ChartMarker> 
            </ChartSeries>  
        </ChartSeriesCollection> 
</EjsChart>

@code{
    public class ChartData
    {
        public double X;
        public double Y;
    }

    public List<ChartData> ConsumerReports = new List<ChartData> 
      {
            new ChartData{ X= 2005, Y= 28 },
            new ChartData{ X= 2006, Y= 25 },
            new ChartData{ X= 2007, Y= 26 },
            new ChartData{ X= 2008, Y= 27 },
            new ChartData{ X= 2009, Y= 32 },
            new ChartData{ X= 2010, Y= 35 },
            new ChartData{ X= 2011, Y= 30 }
        };
}

Shape

Note : To know more about the marker shape type refer the Shape.

Images

Apart from the shapes, you can also add custom images to mark the data point using the ImageUrl property.

images.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Width="60%">
        <ChartSeriesCollection>
            <ChartSeries DataSource="@ConsumerReports"XName="X" YName="Y" Type="ChartSeriesType.Line">
            <ChartMarker Visible="true" Height="10" Width="10" imageUrl = "sun_annotation.png">
                </ChartMarker>
            </ChartSeries>                                                               
        </ChartSeriesCollection>
</EjsChart>

@code{
    public class ChartData
    {
        public double X;
        public double Y;
    }

    public List<ChartData> ConsumerReports = new List<ChartData> 
      {
            new ChartData{ X= 2005, Y= 28 },
            new ChartData{ X= 2006, Y= 25 },
            new ChartData{ X= 2007, Y= 26 },
            new ChartData{ X= 2008, Y= 27 },
            new ChartData{ X= 2009, Y= 32 },
            new ChartData{ X= 2010, Y= 35 },
            new ChartData{ X= 2011, Y= 30 }
        };
}

Customization

Marker’s color and border can be customized using Fill and Border properties.

custom.razor
@using Syncfusion.EJ2.Blazor.Charts

<EjsChart Width="60%"> 
        <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category"> 
        </ChartPrimaryXAxis> 
  
        <ChartSeriesCollection> 
            <ChartSeries DataSource="@ConsumerReports" XName="X" YName="Y" Type="ChartSeriesType.Line">
                <ChartMarker Visible="true" Height="10" Width="10" Fill="red">
                    <ChartMarkerBorder Width="2" Color="blue"></ChartMarkerBorder> 
                </ChartMarker> 
            </ChartSeries> 
        </ChartSeriesCollection> 
</EjsChart>

@code{
    public class ChartData
    {
        public double X;
        public double Y;
    }

    public List<ChartData> ConsumerReports = new List<ChartData> 
      {
            new ChartData{ X= 2005, Y= 28 },
            new ChartData{ X= 2006, Y= 25 },
            new ChartData{ X= 2007, Y= 26 },
            new ChartData{ X= 2008, Y= 27 },
            new ChartData{ X= 2009, Y= 32 },
            new ChartData{ X= 2010, Y= 35 },
            new ChartData{ X= 2011, Y= 30 }
        };
}

Customization

See Also