I would like to be able to use a triangle annotation that has a size parameter, so that I can add triangles of different sizes to chart.
I have seen the “Trade Markers” example that uses custom annotations defined by a path. But those annotations are a fixed size. How can I give them a size parameter?
I have tried this, but the point of the triangle doesn’t align with the X value, instead the triangle starts to the right of the X value.
public static CustomAnnotation UpTriangle(int x, double y, double size, Brush color, string axis)
//——————————————————————————————————————-
{
PointCollection myPointCollection = new PointCollection
{
new Point(0, 0),
new Point(1, 1),
new Point(-1, 1)
};
return new CustomAnnotation()
{
X1 = x,
Y1 = y,
Content = new Polygon()
{
Points = myPointCollection,
Height = size,
Width = size,
Stretch = Stretch.Fill,
Fill = color,
Stroke = color,
StrokeThickness = 1,
},
YAxisId = axis
};
}
Thank you for your help.
- Steven M asked 5 years ago
- You must login to post comments
Hi Steven
We have a BoxAnnotation which has X1X2 Y1Y2 which you can template to create a scalable, resizable custom annotation.
Please have a look at the documentation here: The CustomAnnotation Type
Scroll down to the part which says
CustomAnnotation (X1,Y1, X2, Y2)
Best regards,
Andrew
- Andrew Burnett-Thompson answered 5 years ago
- You must login to post comments
Hello Andrew,
Congratulations on your Queen’s Award. You definitely deserve it for the best and most technologically sophisticated graphics package available.
Thank you for your suggestion.
It seems to me that if the x-axis is in days, then the x part of the box can only be scaled in multiples of days. I was hoping for something with finer control.
Regards,
Steven
- Steven M answered 5 years ago
-
Hi Steven, thank you for the congratulations, and as for the BoxAnnotation with DateTimeAxis, are you sure? The granularity of the DateTimeAxis should be 1-pixel (regardless of date). The CategoryDateTimeAxis however is limited to 1-bar or 1-data-point. This is a limitation of category axis in general, it is not possible to plot something sub-datapoint on this axis type (not without incurring significant performance hit). Best regards, Andrew
- You must login to post comments
Hello Andrew,
My mistake. I should have said that my program is for stock data. I would prefer to use a CategoryDateTimeAxis, since the DateTimeAxis does not collapse weekend gaps.
So I would like to use a CategoryDateTimeAxis to chart stock data, and I would like to mark certain dates with an annotation, such as a triangle, and I would like to be able to use triangles of various sizes to mark days of different levels of importance.
Thank you,
Steven
- Steven M answered 5 years ago
-
Hi Steven, understood. In this case, it is possible however the finest resolution is going to be limited to 1-bar in the stock chart application. This is because the CategoryDateTimeAxis measures by data-point index (by bar) so everything must be snapped to a bar. It is not possible to have a finer resolution at this time. Some other options for you: (1) try the DiscontinuousDateTimeAxis. It will provide finer resolution at expense of some config and some performance. (2) Also take a look if you have a moment at our complex Drawing Tools API. This shows some really complex types of annotation that show you how you can draw on stock charts. https://www.scichart.com/documentation/v5.x/webframe.html#Intro%20to%20the%20DrawingTools%20API.html Best regards, Andrew
- You must login to post comments
Thank you Andrew.
I will follow up on those suggestions.
Regards,
Steven
- Steven M answered 5 years ago
- You must login to post comments
Please login first to submit.