Articles in this section
Category / Section

How to show custom data marker in the WPF Chart?

1 min read

Description

This article explains how to display a custom data marker in a WPF SfChartYou can show the custom adornment symbols in series using the SymbolTemplate property of ChartAdornmentInfo.


Solution


To show a custom symbol on the chart series, define the desired symbol in the ResourceDictionary using the DataTemplate, and assign it to the SymbolTemplate property of ChartAdornmentInfo as shown in the following code snippet.


XAML

 <syncfusion:SfChart >
          <syncfusion:SfChart.Resources>
              <ResourceDictionary>
                  <DataTemplate x:Key="crossTemplate">
                      <Grid Height="15" Width="15">
                           <Path Stretch="Fill" Stroke="{Binding Interior}" Fill="{Binding Interior}" Data="F1 M 133.133,45.7109L 154.307,
                                 24.5363L 175.482,45.7109L 154.307,66.8856L 175.482,88.0603L 154.307,109.235L 133.133,88.0603L 111.958,109.235L 90.7835,
                                 88.0603L 111.958,66.8856L 90.7835,45.7109L 111.958,24.5363L 133.133,45.7109 Z " />
                      </Grid>
                  </DataTemplate>                  
               </ResourceDictionary>
          </syncfusion:SfChart.Resources>
             ………      
          <syncfusion:LineSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue">
                <syncfusion:LineSeries.AdornmentsInfo>
                    <syncfusion:ChartAdornmentInfo SymbolTemplate="{StaticResource crossTemplate}">
                    </syncfusion:ChartAdornmentInfo>
                </syncfusion:LineSeries.AdornmentsInfo>
            </syncfusion:LineSeries>                 
  </syncfusion:SfChart>
 

Output

Symbol Template Image


See also:


How to show multiple custom data marker based on value in chart series

How to rotate text in data marker

How to display the labels inside segments


Conclusion

I hope you enjoyed learning about how to vary the custom shapes in WPF Chart.

You can refer to our  WPF Chart feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Chart documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied