Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:51:26+00:00 2026-05-27T14:51:26+00:00

I am new to Graph concept in android. In my app i want implement

  • 0

I am new to Graph concept in android. In my app i want implement the line graph using achartengine. I have the demo of achartengine it consists a lot of code. I am not able to understand the line graph. I want simple Line graph using achartengine. Please can anybody help me.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:51:26+00:00Added an answer on May 27, 2026 at 2:51 pm

    Following method will generate random points (x,y) and add it to XYSeries (it is series of points to be plotted on chart).

    private XYMultipleSeriesDataset getDemoDataset() {
        XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
        final int nr = 7;
        Random r = new Random();
        for (int i = 0; i < SERIES_NR; i++) {
            XYSeries series = new XYSeries("Demo series " + (i + 1));
            for (int k = 0; k < nr; k++) {
                series.add(k, 20 + r.nextInt() % 100);
            }
            dataset.addSeries(series);
        }
        return dataset;
    }
    

    Following Method will return a multiple renderer which is used to draw line charts.

    private XYMultipleSeriesRenderer getDemoRenderer() {
        XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
        renderer.setAxisTitleTextSize(12);
        renderer.setChartTitleTextSize(12);
        renderer.setLabelsTextSize(15);
        renderer.setLegendTextSize(15);
        renderer.setPointSize(5f);
        renderer.setMargins(new int[] { 20, 30, 15, 0 });
        XYSeriesRenderer r = new XYSeriesRenderer();
        r.setColor(Color.BLACK);
        r.setPointStyle(PointStyle.CIRCLE);
        r.setFillBelowLine(false);
        r.setFillPoints(true);
        renderer.addSeriesRenderer(r);
        setChartSettings(renderer);
        return renderer;
    }
    

    Following method will set the settings for your chart. You can look for more options in docs provided by AChartEngine.

    private void setChartSettings(XYMultipleSeriesRenderer renderer) {
        renderer.setChartTitle("Chart demo");
        renderer.setXTitle("x values");
        renderer.setYTitle("y values");
        renderer.setApplyBackgroundColor(false);
        renderer.setRange(new double[] {0,6,-70,40});
        renderer.setFitLegend(false);
        renderer.setAxesColor(Color.BLACK);
        renderer.setShowGrid(true);
        renderer.setXAxisMin(0.5);
        renderer.setXAxisMax(10.5);
        renderer.setYAxisMin(0);
        renderer.setZoomEnabled(false);
        renderer.setYAxisMax(30);
      }
    

    You can now get the line chart in two ways:

    • Chart as a view which can be added to any layout:

      ChartFactory.getLineChartView(this,
      getDemoDataset(), getDemoRenderer());

    • Chart as an Intent for a new activity alltogether

      ChartFactory.getLineChartIntent(this,
      getDemoDataset(), getDemoRenderer());

    PS: SERIES_NR is a constant which tells how many line series you want to draw.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started developing a Facebook app using the new Graph API. I want to
I am migrating my old FB app to the new graph API using the
In my program I want to draw a simple score line graph. I have
I am new to the concept of analyzing deadlock graph in profiler.I want to
I'm a relatively new convert to Python. I've written some code to grab/graph data
im trying to update my news feed on facebook. Im using the new graph
I want to implement in Java a class for handling graph data structures. I
I am working on a new graph for my site, using CSS3/HTML5 (canvas tag).
I have just started with the new graph api for facebook. I have gotten
I have an undirected weighted graph and derive a new graph based on groups

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.