2014-02-12 57 views

回答

0

對於這一點,你有,因爲沒有這方面的任何直接的方法來編輯Achartengine源代碼。

畫圓而不是小線。對於不同顏色的圓圈,您可能不得不改變其他一些東西。

更改drawXLabels()方法XYChart.java

protected void drawXLabels(List<Double> xLabels, Double[] xTextLabelLocations, Canvas canvas, 
     Paint paint, int left, int top, int bottom, double xPixelsPerUnit, double minX, double maxX) { 
    int length = xLabels.size(); 
    boolean showLabels = mRenderer.isShowLabels(); 
    boolean showGridY = mRenderer.isShowGridY(); 
    boolean showTickMarks = mRenderer.isShowTickMarks(); 
    for (int i = 0; i < length; i++) { 
     double label = xLabels.get(i); 
     float xLabel = (float) (left + xPixelsPerUnit * (label - minX)); 
     if (showLabels) { 
     paint.setColor(mRenderer.getXLabelsColor()); 
     if (showTickMarks) { 
//   canvas.drawLine(xLabel, bottom, xLabel, bottom + mRenderer.getLabelsTextSize()/3, paint); 
      canvas.drawCircle(xLabel, bottom + mRenderer.getLabelsTextSize()/3,3, paint); 

     } 
     drawText(canvas, getLabel(mRenderer.getLabelFormat(), label), xLabel, 
      bottom + mRenderer.getLabelsTextSize() * 4/3 + mRenderer.getXLabelsPadding(), paint, 
      mRenderer.getXLabelsAngle()); 
     } 
     if (showGridY) { 
     paint.setColor(mRenderer.getGridColor(0)); 
//  canvas.drawLine(xLabel, bottom, xLabel, top, paint); 
     canvas.drawCircle(xLabel, top,3, paint); 
     } 
    } 
    drawXTextLabels(xTextLabelLocations, canvas, paint, showLabels, left, top, bottom, 
     xPixelsPerUnit, minX, maxX); 
    } 
相關問題