Is there a way to place AxisMarkerAnnotation
on top of the gridline as shown in the attached images?
Here are some code to defined the xAxis:
xAxis.axisAlignment = EAxisAlignment.Bottom;
xAxis.drawLabels = true;
xAxis.labelStyle.fontFamily = "Roboto";
xAxis.labelStyle.fontSize = 12;
xAxis.labelStyle.alignment = ELabelAlignment.Left;
xAxis.autoRange = EAutoRange.Never;
xAxis.labelStyle.padding = new Thickness (0, 0, 0, 0);
Note: I’m aware that CustomAnnotation
offers a better solution in placing the annotation into its designated position by setting y1 = 0
. But I need the annotation to drag only around the xAxis
, which can be done in AxisMarkerAnnotation
so far.
- Suzanne Ong asked 9 months ago
- You must login to post comments
AxisMarkerAnnotation has some properties like padding and margin which look like they should help here, but currently do not do anything. We have a task in the backlog to sort this out, but our immediate todo list is rather long right now.
I think you will get more flexibility using a CustomAnnotation and restricting it to only drag horizontally, like this:
class HorizontalDragAnnotation extends CustomAnnotation {
public calcDragDistance(xyValues: Point): void {
if (!this.prevValue) {
this.prevValue = xyValues;
return;
}
let { x1, x2, y1, y2 } = this.getAnnotationBorders();
if (
this.adornerDraggingPoint === EDraggingGripPoint.Body ||
this.adornerDraggingPoint === EDraggingGripPoint.x1y1
) {
x1 = this.x1 - (this.prevValue.x - xyValues.x);
// Do not update y coordinates
//y1 = this.y1 - (this.prevValue.y - xyValues.y);
this.x1 = x1;
//this.y1 = y1;
x2 = x2 - (this.prevValue.x - xyValues.x);
//y2 = y2 - (this.prevValue.y - xyValues.y);
}
this.prevValue = xyValues;
this.setAnnotationBorders(x1, x2, y1, y2);
}
}
Regards
David
- David Burleigh answered 9 months ago
- You must login to post comments
Please login first to submit.