Yatin
Yatin

Reputation: 3120

Customising Graph in android

Hi I am using achartengine for designing graph in Android I want to space out the Y axis values as seen in the image . How can I achieve it .

Graph from Achart Engine

I have use the following values to design the graph

Series 1 :

   int x[] = {5, 10, 15, 20, 30 , 35, 45};
   int y[] = {50, 100, 300, 200, 250 , 250 , 300};

and

Series 2 :

    int x1[]={10,20,30,40,50,60,70};
    int y1[]={50, 100, 300, 200, 250 , 250 , 300};

To add the series I am using the following code

XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
            dataset.addSeries(series);
            dataset.addSeries(series1);

To add the renderer file I am using the following code

XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
            XYSeriesRenderer renderer = new XYSeriesRenderer();
            XYSeriesRenderer renderer1 = new XYSeriesRenderer();





  mRenderer.setXLabelsAlign(Align.CENTER);

        mRenderer.setYLabelsAlign(Align.RIGHT);

Then this series is added into the mRenderer and the Graphical View is set up

mRenderer.addSeriesRenderer(renderer);
            mRenderer.addSeriesRenderer(renderer1);

            GraphicalView view = ChartFactory.getLineChartView(context, dataset, mRenderer);

Upvotes: 1

Views: 101

Answers (2)

Dan D.
Dan D.

Reputation: 32391

Just do this:

mRenderer.setYLabelsPadding(15);

Upvotes: 1

Muhammad Ali Hassan
Muhammad Ali Hassan

Reputation: 192

have a look at this library https://code.google.com/p/achartengine/ it might help you

Upvotes: 0

Related Questions