Open lucasharada opened 7 years ago
Tried to create a Highlight object and use it to get the XPx
and YPx
, but I keep getting those values as 0. This is what I tried:
final Entry entry = mData.get(getNearestXValue(progress));
final Highlight highlight = new Highlight(entry.getX(), entry.getY(), getNearestXValue(progress));
mChart.highlightValue(highlight);
RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
p.addRule(RelativeLayout.ABOVE, seekBar.getId());
p.setMargins(
Math.round(highlight.getXPx()), Math.round(highlight.getYPx()), 0, 0
); // XPx: 0; YPx: 0;
I'm currently highlighting an Entry based on promixity with my SeekBar and it's working like a charm. Now I need to show a label near to the Entry which is Highlighted.
I found a related problem on #2993 , but it didn't fix my problem. Instead, changing from
to
made the call
mChart.getHighlight()
returnnull
instead of one Highlight. Also, the Highlight only appeared when targetting the first Entry point.The rest of my code follow below: