我正在尝试更改图表中点的大小,但是当我这样做时 mRenderer.setPointSize(大小); 它永远不会改变..
以下是该图表的完整代码:
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();
}
}
知道如何让积分更大吗?它们很小,你几乎看不到它们
答案 0 :(得分:8)
在将XYSeriesRenderer的点样式设置为PointStyle.POINT
以外的值之前,实际上不会显示这些点。要获得球式点数,请执行以下操作:
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setPointStyle(PointStyle.CIRCLE);
renderer.setFillPoints(true);
mRenderer.addSeriesRenderer(renderer);
mRenderer.setPointSize(2.0f);