private void openChart(){
double[] data = {0.2, 1.11, 100 };
// Creating an XYSeries for Income
XYSeries expenseSeries = new XYSeries("");
// Adding data to Income and Expense Series
for(int i=0;i<data.length;i++){
expenseSeries.add(i,data[i]);
}
// Creating a dataset to hold each series
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
// Adding Expense Series to dataset
dataset.addSeries(expenseSeries);
// Creating XYSeriesRenderer to customize expenseSeries
XYSeriesRenderer expenseRenderer = new XYSeriesRenderer();
expenseRenderer.setColor(Color.RED);
expenseRenderer.setFillPoints(false);
expenseRenderer.setLineWidth(2);
// Creating a XYMultipleSeriesRenderer to customize the whole chart
XYMultipleSeriesRenderer multiRenderer = new XYMultipleSeriesRenderer();
multiRenderer.setYAxisMin(0);
multiRenderer.setYAxisMax(500);
multiRenderer.setXTitle("Annualized");
multiRenderer.setYTitle("Rate");
multiRenderer.setBarSpacing(1.0);
multiRenderer.setXLabels(0);
multiRenderer.setMargins(new int[] { 20 ,20, 20, 30 });
multiRenderer.setZoomRate(0.2f);
multiRenderer.setFitLegend(true);
multiRenderer.setShowGrid(true);
multiRenderer.setZoomEnabled(false);
multiRenderer.setPanEnabled(false,false);
for(int i=0; i< data.length;i++){
multiRenderer.addXTextLabel(i, mMonth[i]);
}
multiRenderer.addSeriesRenderer(expenseRenderer);
// Creating an intent to plot bar chart using dataset and multipleRenderer
Intent intent = ChartFactory.getBarChartIntent(getBaseContext(), dataset, multiRenderer, Type.DEFAULT);
// Start Activity
startActivity(intent);
}
我想从左侧边距开始。它隐藏在左侧,所以我看不到第一张图。它怎么可能?我附上屏幕截图以及制作图表的方法。我还想删除底部的标签图像?并将白色背景放入整个条形图中?我试过但没用?