Pre loader

Can we move AxisMarkerAnnotation to display on top of the axis grid line?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


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.

  • You must to post comments
Best Answer

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;
    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);



  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.