2014-03-12 3 views
1

Android 앱에서 차트 엔진을 사용하여 선형 차트를 그리려는 시도 중입니다. 그래프는 몇 초마다 자동 새로 고침됩니다. 문제는 다음과 같습니다. 플롯 할 데이터가 없으면 축이 보이지 않습니다. 플롯 할 것이 없다고해도 축을 나타나게하려면 어떻게해야합니까? 친절히 도와주세요.android achartengine : 플롯 데이터가 없어도 축을 표시합니다.

private XYMultipleSeriesDataset graphDataset = null; 
private XYMultipleSeriesRenderer graphRenderer = null; 
private GraphicalView graphView; 

..... 
..... 

    this.graphDataset = new XYMultipleSeriesDataset(); 
    this.graphRenderer = new XYMultipleSeriesRenderer(); 
    this.graphRenderer.setXLabels(0); 
... 
/// other initialization code, like labels & fonts 
... 
// then i add the data to the series 
     XYSeries series = new XYSeries("Simple graph"); 
      for (int i=0; i<valueArray.size();i++) { 
       series.add(valueArray.get(i), yValue.get(i)); 
      } 
    this.graphDataset.addSeries(series); 
      .... 
      // then I do renderer initialization 
    XYSeriesRenderer xyRenderer = this.setChartLineProperties(index); 
      ... 
      // then finally initializing the graphview 
    this.graphView = ChartFactory.getLineChartView(this, this.graphDataset, 
      this.graphRenderer); 
+0

현재 진행중인 작업을 보여줄 수 있습니까? – keshav

답변

0

축을 표시하려면 차트에 표시해야하는 값 범위가 무엇인지 알아야합니다. 데이터 세트에 값을 추가하지 않으면 범위를 다음과 같이 설정할 수 있습니다.

renderer.setXAxisMin(minX); 
renderer.setXAxisMax(maxX); 
renderer.setYAxisMin(minY); 
renderer.setYAxisMax(maxY); 
+0

감사합니다. @ 댄. 나는 어쨌든 이것을 설정하고 있다고 생각했다. 한번 더 확인하고 돌아 가자! achartengine lib에 대한 여러분의 멋진 작업에 감사드립니다! – user2903200

+0

나는 이미 이것을하고있다. 누락 된 것이 있습니까? 도와주세요. – user2903200

+0

minX, maxX, minY, maxY에 대해 어떤 값을 설정합니까? –