Achartengine注释对齐

时间:2014-07-21 09:24:07

标签: annotations alignment achartengine

我正在尝试根据给定条件对齐achartengine提供的注释,但它似乎对注释的对齐没有任何影响。影响的对齐始终是第一个IF条件中提供的对齐。任何人都可以指出问题吗?以下是我的代码

int xaxis = 1;

for(int yaxis = 0; yaxis < scaleData.length; yaxis++)
{
    factorsSeries.addAnnotation(annotationDate, xaxis,
                scaleData[yaxis]+0.2);

    if(xaxis == 1)
    {
        r.setAnnotationsTextAlign(Align.RIGHT);

        Toast.makeText(Graphs_MulipleDatesAllinOne.this, 
                "setAnnotationsTextAlign(Align.RIGHT)", 
                Toast.LENGTH_SHORT).show();
    }
    else if(xaxis == 6)
    {
        r.setAnnotationsTextAlign(Align.LEFT);

        Toast.makeText(Graphs_MulipleDatesAllinOne.this, 
                "setAnnotationsTextAlign(Align.LEFT)", 
                Toast.LENGTH_SHORT).show();
    }
    else
    {
        r.setAnnotationsTextAlign(Align.CENTER);

        Toast.makeText(Graphs_MulipleDatesAllinOne.this, 
                "setAnnotationsTextAlign(Align.CENTER)", 
                Toast.LENGTH_SHORT).show();
    }

    xaxis++;
}

1 个答案:

答案 0 :(得分:0)

这是因为代码中的xaxis始终为1。请注意,您正在yaxis上进行迭代,if条件位于xaxis