Pre loader

Rollover Modifier malfunction when using with flipped coordinates

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

Answered
0
0

final IAxis yAxis = sciChartBuilder.newNumericAxis()
.withAxisAlignment(AxisAlignment.Bottom)
.withFlipCoordinates(true)
.build();
final IAxis xAxis = sciChartBuilder.newNumericAxis()
.withAxisAlignment(AxisAlignment.Left)
.withFlipCoordinates(true)
.build();
Collections.addAll(surface.getYAxes(), yAxis);
Collections.addAll(surface.getXAxes(), xAxis);
surface.getChartModifiers().add(new RolloverModifier());

In this case rollover modifier will only catch the very first point of line series.

Version
2.2.2.2424
  • You must to post comments
Best Answer
0
0

Hi Zhengyang,

For now you can use next workaround which should fix issue for line series – you’ll need to customize NearestXyPointProvider and override method which performs search of nearest point which is used by RolloverModifier:

class CustomFastLineRenderableSeries extends FastLineRenderableSeries {
    public CustomFastLineRenderableSeries() {
        super(new LineRenderPassData(), new CompositeHitProvider(new PointMarkerHitProvider(), new LineHitProvider()), new CustomNearestXyPointProvider());
    }
}

class CustomNearestXyPointProvider extends NearestXyPointProvider {
    @Override
    public void setNearestHorizontalPointResult(HitTestInfo hitTestResult, float x, float y) {
        final FloatValues xCoords = currentRenderPassData.xCoords;

        // always assume that data is unsorted - this fixes incorrect index in case of flipped coords
        final int nearestPointIndex = SciListUtil.instance().findIndex(xCoords.getItemsArray(), 0, xCoords.size(), false, x, SearchMode.Nearest);

        if (nearestPointIndex != -1) {
            final int dataPointIndex = currentRenderPassData.indices.get(nearestPointIndex);

            hitTestResult.set(x, y, 0, dataPointIndex, nearestPointIndex);
        }
    }
}

Hope this will help you!

Best regards,
Yura

  • You must to post comments
0
0

Hi Zhengyang,

Thanks, I could reproduce this issue on my PC. It looks that we have a bug in our HitTest API so I’ve created a task in our bug tracker to investigate why this happens. May I ask what renderable series do you use in your application?

Best regards,
Yura

  • zhengyang qu
    Hi Yura, Thanks for your reply. I use FastLineRenderableSeries with a XyDataSeries. Best regards, Zhengyang
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies