I am using WInforms UltraDataChart v18.1. I have line series data of about 100 points. I would like to mark (put a box around) selected points. So out of the 100 points I want to mark only two. These marks show the start and end of a baseline.
Is there any way to do this with UltraDataChart or XamDataChart?
Thanks
Hello James,
I have been investigating into this behavior you are looking to achieve, and there are a couple of recommendations I can make to achieve this with the UltraDataChart.
The first is to use an additional PointSeries to your LineSeries. If you have a property to use as a ValueMemberPath that is a nullable double?, you can return null for the points that you do not wish to be shown, and then return a value for the points that you want a marker drawn at.
The alternative in this case would be to use a custom MarkerTemplate for your LineSeries. This property takes a CustomRenderTemplate, who you need to pass a new DataTemplateRenderHandler and DataTemplateMeasureHandler to the Render and Measure properties of, respectively. Both of these elements take a method as their constructor’s parameter, and these methods are voids that take a DataTemplateRenderInfo and DataTemplateMeasureInfo, respectively.
It appears that for some reason, the Infragistics.Controls.Charts.DataContext object that is returned by the DataTemplateRenderInfo.Data property is an internal type, and so to actually get your underlying data item, I would have to recommend using reflection. This type should not be internal, in my opinion, though, and so I will be bringing this up with our development teams.
I am attaching a sample project to demonstrate the custom marker template to only highlight a couple of LineSeries points. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
UltraDataChartMarkerTemplateDemo.zip
Hi Andrew,
I implemented the example and was able to isolate points to show markers. Now I have another issue.
The DataTemplateRenderHandler callback is not receiving all of the datapoint that are in the series datasource. Only a range of points is being sent. This is a problem because some of the missing datapoints are the points I need for markers. Is there something I need to do to initialize the callback to make it accept all of the points. There's about 60 points in total.
I believe this is likely because there is marker collision functionality by default on the series – by default, the DataTemplateRenderHandler will only be fired for markers that would normally be drawn. You can ensure that all markers are drawn by setting the MarkerCollisionAvoidance property on your series to “CategorySeriesMarkerCollisionAvoidance.None.”
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
Setting the MarkerCollisionAvoidance value now shows all the points. Thank you.
With this answer I have a somewhat related question - all of the information you provided is not detailed in the online documents or the samples. Do you have another document resource where users can find this information?
Andrew,
Thanks for you help.
Thank you for your update on this matter. I am glad the MarkerCollisionAvoidance property worked for you in this case.
At the moment, it appears you are correct that there doesn’t exist a sample or a direct documentation resource, and as such, I will be bringing this up to the rest of our Windows Forms docs/support team.
Regarding another public document resource where users can find this information, it seems that at the moment, that would be this forum thread, as this does not currently exist outside of our API documentation for the chart. Again, though, I will be bringing this up to our docs/support team to get a formal documentation topic written and potentially a sample project made.