Only one number shows nothing in AndroidPlot

I want to display a row and a histogram for a question / answer session undertaken by the user. I use AndroidPlot 0.6.0. Session time is the domain, and Range is the number of questions that are answered by Yesor No.

Problem: A list with a single item does not display anything on the chart. For example, the first user session:

A list with at least two items displays the graph correctly. The graph correctly shows two sessions with a date as a domain and a yes / no quantity as a range:

My line chart code is as follows:

XYSeries answeredYesSeries = new SimpleXYSeries(answeredYesList,
                SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, 
// Y_VALS_ONLY means use the element index as the x value
                "Answered Yes"); // Title of this series
        // Create a formatter to use for draw ing a series using
        // LineAndPointRenderer
        // and configure it from xml:
        LineAndPointFormatter series1Format = new LineAndPointFormatter();
        series1Format.setPointLabelFormatter(new PointLabelFormatter());
        series1Format.configure(getApplicationContext(),
                R.xml.line_point_formatter_with_plf1);

        // add count of questions answered with yes series to the xyplot:
        xyPlot.addSeries(answeredYesSeries, series1Format);

        XYSeries answeredNoSeries = new SimpleXYSeries(answeredNoList,
                SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, // Y_VALS_ONLY means
                                                    // use the element
                                                        // index as the x
                                                        // value
                "Answered No"); // Title of this series
        // Create a formatter to use for draw ing a series using
        // LineAndPointRenderer
        // and configure it from xml:
        LineAndPointFormatter series2Format = new LineAndPointFormatter();
        series2Format.setPointLabelFormatter(new PointLabelFormatter());
        series2Format.configure(getApplicationContext(),
                R.xml.line_point_formatter_with_plf2);

        // add count of questions answered with no series to the xyplot:
        xyPlot.addSeries(answeredNoSeries, series2Format);

Does anyone have a solution?

+4
source share
1

, Androidplot , / .

, [1,1]. ? x/y 0 - 2? - - , . , , , 1 10 000? , 0 1.

, , ( ), Androidplot . :

plot.setDomainBoundaries(-1, 1, BoundaryMode.FIXED);
plot.setRangeBoundaries(0, 2, BoundaryMode.FIXED);

, , , , , .

+1

Source: https://habr.com/ru/post/1537162/


All Articles