3

I have created a LineGraph, it´s look like this:

enter image description here

But I want fill the area below the grap like this:

enter image description here

How can I implement this feature? Can you help me?

Pepa Zapletal
  • 2,879
  • 3
  • 39
  • 69

2 Answers2

5

Use the setDrawBackground method to enable it.

LineGraphView graphView = new LineGraphView(this,"My Line Graph");
graphView.setDrawBackground(true);
Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
devnoel
  • 66
  • 4
2

For more current versions of GraphView, set the background colour and drawBackground on the series:

GraphView graph = (GraphView) findViewById(R.id.YOUR_GRAPH_ID_HERE);
LineGraphSeries<DataPoint> mySeries = new LineGraphSeries<DataPoint>(new DataPoint[] {
    new DataPoint(0, 0),
    new DataPoint(1, 5),
    new DataPoint(2, 10)
});

mySeries.setBackgroundColor(Color.GREEN);
mySeries.setDrawBackground(true);

graph.addSeries(mySeries);
Terry Seidler
  • 2,043
  • 15
  • 28