Hi,
I’m trying to add a small image as an annotation to the chart, but I couldn’t make it work… most likely doing something wrong, but I can’t quite figure out how this should be done. This is the direction I went for:
public void AddIcon()
{
Image image = new Image();
BitmapImage icon= new BitmapImage();
icon.UriSource = new Uri(@"D:\icon.png", UriKind.Absolute);
image.Source = icon;
var annotation = new CustomAnnotation()
{
X1 = 0,
Y1 = 0,
Content = image,
};
ChartAnnotations.Add(annotation);
}
What am I doing wrong? is there a proper and simple way to add image annotations to the chart in an MVVM manner?
Thank you!
- Ilan Rozen asked 4 years ago
- last edited 4 years ago
-
Does the image have a width and a height? If you point WPF Snoop at the application, what do you see in the visual tree?
- You must login to post comments
Images in annotations are demonstrated in our WPF Chart Examples Suite:
- Go to this example https://www.scichart.com/example/wpf-chart-example-create-annotations-dynamically/
- On the left, click the icon to add an annotation
- Select ‘My Custom Annotation’
- Click on the chart
this will place an image annotation on the chart itself.
Images as annotations is also covered in other questions on the forums:
- https://www.scichart.com/questions/question/insert-image-to-box-annotation-as-backgraoud
- https://www.scichart.com/questions/wpf/place-an-image-in-the-background-that-is-registered
Best regards,
Andrew
- Andrew Burnett-Thompson answered 4 years ago
- You must login to post comments
Please login first to submit.