Pre loader

Wrong annotation position with xAxis on top

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


Hello! I am try to create chart with axis on top in my react native app, chart is create succesfuly, but when I start add annotation – it shift to top by axis height – whats may be wrong?


// create
surface = new CSciChartSurface(context);
surface.setRenderSurface(new RenderSurface(context));

// Initialize the SciChartBuilder

// Obtain the SciChartBuilder instance
sciChartBuilder = SciChartBuilder.instance();

 xAxis = sciChartBuilder
      .withGrowBy(0.0d, 0.04d)
// same yaxis and any

VerticalLineAnnotation verticalLine = sciChartBuilder.newVerticalLineAnnotation()
        .withPosition(10, 16)
        .withStroke(2, ColorUtil.Orange)

Collections.addAll(surface.getYAxes(), yAxis);
Collections.addAll(surface.getXAxes(), xAxis);
Collections.addAll(surface.getRenderableSeries(), lineRenderableSeries);
Collections.addAll(surface.getAnnotations(), verticalLine);

// add to view


  • You must to post comments
Best Answer

I found problem… i am use old version of this hack
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
child.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight());

and its move annotation surface to point 0, 0

now i use
private void refreshViewChildrenLayout(View view){
View.MeasureSpec.makeMeasureSpec(view.getMeasuredWidth(), View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(view.getMeasuredHeight(), View.MeasureSpec.EXACTLY));
view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());

and annotation render correctly!!

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.