2

我正在尝试更改图形点的大小,但是当我执行 mRenderer.setPointSize(size); 它永远不会改变..

这是我的图表的完整代码:

public class ShowGraph extends Activity {

    private XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset();
    private XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
    private XYSeries mCurrentSeries;
    private XYSeriesRenderer mCurrentRenderer;
    private GraphicalView mChartView;
    int x,y;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.graph_layout);
        LinearLayout layout = (LinearLayout) findViewById(R.id.chart);

        mRenderer.setPanLimits(new double[] { 00, 600 , 00, 300 });     //xmin,xmax,ymin,ymax  bars/grids limit
        mRenderer.setZoomLimits(new double[]{00, 200, 00, 30});     //xmin,xmax,ymin,ymax  zoom limit
        String seriesTitle = "Series " + (mDataset.getSeriesCount() + 1);
        XYSeries series = new XYSeries(seriesTitle);
        ArrayList<String> accuracy = getIntent().getExtras().getStringArrayList("accuracy");
        ArrayList<String> time = getIntent().getExtras().getStringArrayList("time");
        for (int i = 0; i < time.size(); i++) {
            series.add(Double.parseDouble(time.get(i)), Double.parseDouble(accuracy.get(i)));
        }
        mDataset.addSeries(series);
        mCurrentSeries = series;
        mRenderer.setYLabelsAlign(Paint.Align.RIGHT);
        XYSeriesRenderer renderer = new XYSeriesRenderer();
        mRenderer.addSeriesRenderer(renderer);
        mRenderer.setPointSize(15f);
        mCurrentRenderer = renderer;

        if(mChartView== null){

            //ADD VALUE OF X,Y HERE to the series
            mCurrentSeries.add(x,y);

            if (mChartView != null) {
                mChartView.repaint();
            }
            mChartView = ChartFactory.getScatterChartView(ShowGraph.this, mDataset, mRenderer);
            mChartView.addPanListener(new PanListener() {
                public void panApplied() {
                    System.out.println("New X range=[" + mRenderer.getXAxisMin() + ", " + mRenderer.getXAxisMax()
                        + "], Y range=[" + mRenderer.getYAxisMax() + ", " + mRenderer.getYAxisMax() + "]");
                }
            });
            layout.addView(mChartView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));

        }
        Toast.makeText(this, "" + mRenderer.getPointSize(), 3000).show();
    }
}

知道如何使积分变大吗?它们太小了,你几乎看不到它们

4

1 回答 1

8

在您将 XYSeriesRenderer 的点样式设置为PointStyle.POINT. 要获得球式积分,请执行以下操作:

XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setPointStyle(PointStyle.CIRCLE);
renderer.setFillPoints(true);
mRenderer.addSeriesRenderer(renderer);
mRenderer.setPointSize(2.0f);
于 2013-03-08T14:43:57.057 回答