2012-01-13 203 views
2

我使用achartEngine繪製堆疊bar-graph.My情節爲X的Y值重疊和情節比其他較小值被擠壓out.Below是我builddataset和ChartFactory的achartengine堆疊條形圖的X和Y圖彼此重疊?

protected XYMultipleSeriesDataset buildBarDataset(String[] titles, List<double[]> values) { 
     XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); 
     int length = titles.length; 
     for (int i = 0; i < length; i++) { 
      CategorySeries series = new CategorySeries(titles[i]); 
      double[] v = values.get(i); 
      int seriesLength = v.length; 
      for (int k = 0; k < seriesLength; k++) { 
       series.add(v[k]); 
      } 
      dataset.addSeries(i,series.toXYSeries()); 
     } 
     return dataset; 
    } 

我ChartFactory的:

mChartView = ChartFactory.getBarChartView(NTViewGraph.this, buildBarDataset(titles, values), renderer, 
       Type.STACKED); 

回答

1

按給定鏈路:

http://community.developer.motorola.com/t5/MOTODEV-For-Enterprise/Enterprise-Grade-Charts-part-II/ba-p/23420 

Use below methods and pass 0 to that methods. 
If you set it to 0 then it will not show any label and shows label that is externally set by You. And if you pass 1 then it shows 1 label in the interval of 10. 

renderer.setXLabels(0);  
renderer.setYLabels(0); 

我希望這會幫助你。