SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

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.