FAQ Database Discussion Community

How to send data from activity to the fragment for update a graph?

public class GraphUpdate extends Fragment { private final Handler mHandler = new Handler(); private Runnable mTimer; private LineGraphSeries<DataPoint> mSeries; private double graph2LastXValue = 5d; private int value; private String TAG = "FRAGMENT"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); GraphView graph...

How to add GraphView into a Scroll pane in android?

I have a jjoe64 GraphView. I tried to add it into a HorizontalScrollView. In this scroll view I've added a Relative Layout and then GraphView in it. But It's cannot scrollable. Here is my xml, <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/horizontalScrollView" android:layout_alignParentBottom="true" android:layout_alignParentStart="true" android:layout_below="@+id/textViewHR" android:fillViewport="true" android:layout_alignParentEnd="true"> <RelativeLayout...

Set width of bars in bar graph

Is there a way to control the width of the bars in a bar graph? Currently I am seeing the first and last bars default to half the width of the remaining (middle) bars.

Draw a line graph with constantly updating data?

I'm trying to use Android Graph view to draw two line graphs, that's not a problem but unfortunately one of the line graphs is dynamically reading data from a hardware sensor. That does appear to be a problem as GraphView uses fixed length arrays. Which are difficult to add new...

Android - Get GraphView datapoint x y location

I'm using jjoe64's awesome GraphView for Android. At the moment I'm trying to determine 2 things: Is it possible, once plotted, to get a DataPoint's x,y location values? Also, is it possible to get that location in the onTap call? I'm trying to show a custom view just above the...

Can't optimize line chart using MPAndroidChart library

I am trying to make a good looking line chart iwht MPAndroidChart, but I am having some problems. Here is what I got now and here is the code for it public void createGraph() { chart.setTouchEnabled(false); chart.setDragEnabled(false); chart.setHighlightEnabled(false); chart.setDrawYLabels(true); chart.setDrawXLabels(true); chart.animateXY(2000, 2000); chart.setDrawBorder(true); chart.setPadding(30, 30, 30, 30); setData(); } private...

JJOE64 Android graphview reset function

I've been trying to make a "realtime" graph using the reset function to reset the data, trying to prepare myself for using an external dataset. Here's the code; class MyTimerTask extends TimerTask { int y = 0; public void run() { Random Rn = new Random(); int loopy = 0;...

Add space between graph and tick labels in GraphView?

I am trying out the GraphView Library for creating charts on Android. It looks quite decent, but I am wondering if there is a way to add some space between the tick labels and the graph itself. As you can see, there is basically none: I use the following code...

Difficulty in understanding complex multi threading in Android app

I have big problem with understanding multi threading in my application and because of that finding a bug. I've checked I think all possibilities and still I am getting various (sometimes unexpected) errors. Maybe someone here will be able to advice me, what I should do. In my project I...

Graphview legend position

I can place the legend top, middle, bottom, but its always on the right side of the graphview. How can I place it left side? The most important problem that "too long" texts doesn't fit in the box, so the end of the text is outside the box / screen....