Reputation: 119
I have created a graph with AchartEngine
and want to make the following alterations:
1.Move Y-Axis Title ( called Values)
to the left so that it is off the graph area
2.Increase Size of legend and move it down away from the graph
3.Increase thickness of lines on graph
How can I do so?
Below shows the code relating to my single and multiple Renderers
:
//declaring the Multiple series dataset that the single data sets are added to
XYMultipleSeriesDataset dataset= new XYMultipleSeriesDataset();
//adding multiple series
dataset.addSeries(series);
dataset.addSeries(series2);
dataset.addSeries(series3);
//renderer that changes the look etc of the first line (score)
XYSeriesRenderer renderer= new XYSeriesRenderer();
renderer.setColor(Color.YELLOW);//set line colour
renderer.setPointStyle(PointStyle.SQUARE);
renderer.setFillPoints(true);
//renderer that changes the look etc of the second line (score)
XYSeriesRenderer renderer2= new XYSeriesRenderer();
renderer2.setColor(Color.WHITE);//set line colour
renderer2.setPointStyle(PointStyle.SQUARE);
renderer2.setFillPoints(true);
// renderer that changes the look etc of the second line (score)
XYSeriesRenderer renderer3 = new XYSeriesRenderer();
renderer3.setColor(Color.RED);// set line colour
renderer3.setPointStyle(PointStyle.SQUARE);
renderer3.setFillPoints(true);
//Only related to the display of the graphs x and y values
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
float val = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 18, metrics);
//renderer that changes the look etc of the overall graph
XYMultipleSeriesRenderer multRenderer= new XYMultipleSeriesRenderer();
//adding single to multiple
multRenderer.addSeriesRenderer(renderer);
multRenderer.addSeriesRenderer(renderer2);
multRenderer.addSeriesRenderer(renderer3);
multRenderer.setApplyBackgroundColor(true);
multRenderer.setBackgroundColor(Color.BLACK);
multRenderer.setLabelsTextSize(val);
multRenderer.setChartTitle("");
multRenderer.setChartTitleTextSize(40);
multRenderer.setXTitle("Games");
multRenderer.setYTitle("Value");
//setting size of text for labels, legend etc
multRenderer.setChartValuesTextSize(12);
multRenderer.setDisplayChartValues(true);
multRenderer.setAxisTitleTextSize(val);
//creating the intent
Intent intent= ChartFactory.getLineChartIntent(context, dataset, multRenderer, "Summary Graph");
Screenshot
of Current Graph (note the y-axis and legend don't look correct) :
Upvotes: 1
Views: 203
Reputation: 119
I was able to solve the size and location of the Legend
by doing the following:
multRenderer.setLegendHeight(50);
multRenderer.setLegendTextSize(20;
And the location of the Y-axis title (and x) by doing:
multRenderer.setAxisTitleTextSize(25);
As far as I know there is no way to increase graph line size, but I may be incorrect.
Upvotes: 1