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.
- zhengyang qu asked 5 years ago
- You must login to post comments
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
- Yura Khariton answered 5 years ago
-
Thanks! This solves the problem.
- You must login to post comments
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
- Yura Khariton answered 5 years ago
-
Hi Yura, Thanks for your reply. I use FastLineRenderableSeries with a XyDataSeries. Best regards, Zhengyang
- You must login to post comments
Please login first to submit.