in Education by
I'm trying to use the Android GraphView library (http://www.android-graphview.org/), but no matter what I try I can't seem to get the horizontal axis title and labels to appear. The Y-axis and Title don't seem to have any problems. Based on this previous S.O. answer "GraphView, how to show x-axis label?", it should've been as easy as GridLabelRenderer gridLabel = graphView.getGridLabelRenderer(); gridLabel.setHorizontalAxisTitle("X Axis Title"); I've tried that however and it doesn't work for me either. My code is the following: fragment_results.xml <?xml version="1.0" encoding="utf-8"?> onCreate() in ResultsFragment.java View v = inflater.inflate(R.layout.fragment_results, container, false); mGraph = v.findViewById(R.id.results_graph); mGraph.getViewport().setScalable(true); // enables horizontal zooming and scrolling mGraph.getViewport().setScalableY(true); // enables vertical zooming and scrolling mGraph.getViewport().setYAxisBoundsManual(true); // Prevents auto-rescaling the Y-axis mGraph.getViewport().setXAxisBoundsManual(true); // Prevents auto-rescaling the X-axis mGraph.setTitleTextSize(96); mGraph.setTitle("Title"); mGraph.getGridLabelRenderer().setHumanRounding(true); mGraph.getGridLabelRenderer().setVerticalAxisTitleTextSize(64); mGraph.getGridLabelRenderer().setVerticalAxisTitle("Y Axis Title"); mGraph.getGridLabelRenderer().setHorizontalAxisTitleTextSize(64); mGraph.getGridLabelRenderer().setHorizontalAxisTitle("X Axis Title"); mGraph.getGridLabelRenderer().setHorizontalLabelsVisible(true); LineGraphSeries series = new LineGraphSeries<>(new DataPoint[]{ new DataPoint(34.3, -21.0), new DataPoint(37.0, -21.0), new DataPoint(37.3, -18.0), new DataPoint(41.0, -18.0), new DataPoint(41.3, -15.0), new DataPoint(46.0, -15.0), new DataPoint(46.3, -12.0), new DataPoint(54.0, -12.0), new DataPoint(54.3, -9.0), new DataPoint(65.0, -9.0), new DataPoint(65.3, -6.0), new DataPoint(84.0, -6.0), new DataPoint(84.3, -3.0), new DataPoint(124.0, -3.0), new DataPoint(124.3, 0.0) }); series.setTitle("TEST"); series.setColor(Color.rgb(115,230,115)); mGraph.addSeries(series); The result is this: JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I made a new Android Studio project, copied the above code over, and everything worked just fine. Frustrated, I took the brute force approach of just comparing the code in every single file. The only difference I found was that I had hardware acceleration turned off in my AndroidManifest.xml ... After removing that line from the manifest, the X-axis title and labels finally showed up!

Related questions

0 votes
    I'm graphing data with ggplot and animating it using gganimate. I have colors as my labels and when I add a ... changing the labels from color names to the number codes. df...
asked Apr 3, 2022 in Education by JackTerrance
0 votes
    I'm graphing data with ggplot and animating it using gganimate. I have colors as my labels and when I add a ... changing the labels from color names to the number codes. df...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    I have two lists, same size, one is y_data and one is x_data x_data is a time hh:mm:ss during ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Axes, axis labels and titles all appear in the ________ of the figure. (a) Directions (b) Margin labels ( ... Networks of R Programming Select the correct answer from above options...
asked Feb 11, 2022 in Education by JackTerrance
0 votes
    Annotation of plots in any plotting system involves adding points, lines, or text to the plot, in addition to ... of R Programming Select the correct answer from above options...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I have a fragment with a view and an options menu: public class OfferingsFragment extends Fragment { public ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a fragment with a view and an options menu: public class OfferingsFragment extends Fragment { public ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    I am struggling to get my AppCenter to build my Android app, so I wanted to try and understand a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    I am seeking an Android solution to calculate the distance to an object and then determine the size (height ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    How to remove a image in imageview in android and also how to hide the entire image. Here I have ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    I am trying to build a mailto: uri to send a mail using the GMail app. I would like to use the ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I'm looking at making an custom Android object Serializable. Should be simple I just cannot find a easy ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I've made a fresh eclipse reinstall + Android SDK v4.0. I am trying to create a new 4.0 AVD ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    I'm trying to execute the following command: arp -a and I would like to redirect the output to a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 26, 2022 in Education by JackTerrance
0 votes
    Here some snippet of my code. when first time RecyclerView create I have to used recyclerView.scrollToPosition( ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
...