2014-04-19 5 views
4

사용자가 시도한 질문/답변 세션에 대한 선 및 막대 그래프를 표시하려고합니다. AndroidPlot 0.6.0을 사용하고 있습니다. 세션 날짜 시간은 도메인이고 범위는 Yes 또는 No으로 응답 된 질문의 수입니다.AndroidPlot에 하나의 번호 만 표시됩니다.

문제 : 단일 항목이있는 목록은 그래프에 아무 것도 표시하지 않습니다. 예를 들어, 사용자가 첫 번째 세션 : 두 개 이상의 항목

목록이 제대로 그래프를 보여줍니다. 그래프는 제대로의 도메인 카운트와 같은 날짜에 두 개의 세션을 보여줍니다 예/아니오 범위로하지 :

다음과 같이 선 그래프에 대한 나의 코드는 다음과 같습니다

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); 

누군가를합니까 해결책이 있으십니까?

+0

같은 문제가 발생했습니다. –

답변

1

이것은 Androidplot에 단일 지점에서 합리적인 도메인/범위 척도가 무엇인지 자동으로 계산할 수있는 정보가 충분하지 않기 때문에 발생합니다.

데이터가 [1,1] 점으로 구성됩니다. 어떻게 이것을 제시해야합니까? x/y 비율은 0 - 2일까요? 데이터가 1 ​​주일에 먹을 수있는 스테이크 수를 나타내는 경우라면 괜찮을 것입니다. 그러나 데이터에 1에서 10,000 사이의 난수와 같은 방대한 스케일이 있다면 어떨까요? 또는 규모가 0에서 1 사이 일 경우 어떻게 될까요?

의미있는 척도가 무엇인지 (오히려 할 수 있거나 논증 할 수 있듯이) 가정하기보다는 Androidplot에이 정보가 제공되어야합니다. 여기에 고정 된 영역으로 그래프의 경계를 고정하는 간단한 예는 다음과 같습니다

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

당신은 당신이 원하는 경우에, 당신이 그리는하려는 요점을 포함 경계 올해야합니다 유의하십시오 볼 수 있습니다.

관련 문제