lecho / hellocharts-android

Charts library for Android compatible with API 8+, several chart types with scaling, scrolling and animations 📊
Apache License 2.0
7.44k stars 1.61k forks source link

linechart how to create single point on line #340

Open lyq027 opened 8 years ago

lyq027 commented 8 years ago

i want to create only point on line ,and show a popupwindow on the point side. when i touch the line,a point can show for my touch area. how i get a point as a view to control the popupwindow. please help me.

lecho commented 8 years ago

Hi, if you want to create line with many point values but with only one point visible to the user you can create one line without visible points and second line (the same color) with only one point(visible point).

how i get a point as a view to control the popupwindow.

This is not implemented but you can try to use ChartComputator.computeRawX() and ChartComputator.computerRawY to calculate position of the point in pixels. Thanks to that you will be able to display popup window in the place of the point.

Chart interface has method Chart.getChartComputator() so maybe it will be enough for your needs.

lyq027 commented 8 years ago

i can't all understand you tell me that method.could you give me some code or process for how i get a point as a view to control the popupwindow.thks

Ankur008 commented 7 years ago

final Viewport v=new Viewport(chart.getMaximumViewport());

            v.top=600;
            v.bottom=0;
            v.left=-5;
            v.right=100;

            chart.setMaximumViewport(v);
            chart.setCurrentViewport(v);

I think this will solve your problem.