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 7520343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:03:20+00:00 2026-05-30T02:03:20+00:00

I have an issue with an achartengine graph – as in this screenshot: It

  • 0

I have an issue with an achartengine graph – as in this screenshot:

the broken layout

It looks like the X axis is given too much bottom padding, and the values are duplicated (one representation of each value is in the graph proper, and reacts properly to panning, while the other is located at the bottom of the graph view, but can’t be manipulated in any way).

Here’s the code used to create the graph:

protected void onCreate(Bundle savedInstanceState) {
        ...
        gDataset = new XYMultipleSeriesDataset();

        gRenderer = new XYMultipleSeriesRenderer();
        gRenderer.setApplyBackgroundColor(true);
        gRenderer.setPointSize(10);

        chart = new TimeBarChart(gDataset, gRenderer);
        graphView = new GraphicalView(this, chart);
        graphHolder.addView(graphView);
        //Mode is just an internal enum
        chart.setDateFormat(curMode == Mode.DAY ? "HH:mm dd.MM.yyyy" : "dd.MM.yyyy");
        ....
}

And to populate it:

...
//some DB stuff goes here, result is the cursor

curSeries = new XYSeries("");
gDataset.addSeries(curSeries);

XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setColor(Color.RED);
renderer.setPointStyle(PointStyle.POINT);
gRenderer.addSeriesRenderer(renderer);
while (!result.isAfterLast()) {
    .....
    curSeries.add(timestamp,value);
      ....
}
.....
graphView.invalidate();
graphView.repaint();

And here’s the graph holder’s view definition in the layout XML (main container is RelativeLayout of course) :

<LinearLayout
    android:id="@+id/graphHolder"
    android:layout_width="fill_parent"
    android:layout_height="200dp"
    android:layout_alignParentTop="true"
    android:minHeight="200dp">
</LinearLayout>

A couple of things:

  • I’m using the 0.7 version.
  • The TimeBarChart class is nothing else than a TimeChart with the simple change to extend BarChart instead. The code is copied from the 0.7 revision. Regardless, I was using ChartFactory#getTimeChartView() previously and the result was the same – so this isn’t the cause of the problem.
  • I’ve tried checking whether the height layout parameter causes the problem, but that wasn’t it as well.
  • graphHolder is injected by RoboGuice.
  • the problem was encountered in the 2.3 emulator.

Obviously, I’m doing something wrong, but I’m at a loss what. Any help is greatly appreciated.

PS. I’ve tried to post it on the achartengine group, but it looks like the mods are hibernating for the winter ;).

  • 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-30T02:03:21+00:00Added an answer on May 30, 2026 at 2:03 am

    I finally had time to reinvestigate this, and figured it out.

    The gist:

    The bars on the bottom are the legend. I had a bug in my code that caused it to create a series for each datapoint, hence the multiple “bars”, in reality legend graphics. The series had no names, which added to the confusion.

    Fixing the bug and adding setShowLegend(false) dealed with the issue.

    I’ve discovered this while evaluating AndroidPlot (BTW, I recommend it as an alternative to achartengine, as graphs can be defined in XML, and can be way more liberally customized graphically than the screenshots suggest).

    I somehow failed to notice the legend in the achartengine screenshots, but I recognized them in AndroidPlot. And yes, I do feel quite stupid now :).

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

Sidebar

Related Questions

Much of my sql code is generated (from POD). Now i have issue where
I have issue with IE 8 padding setting. If you look at my web
Seems like everyone have issue accessing local machine or internet etc from emulator. All
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that is driving me a bit nuts: Using a UserProfileManager
We have an issue using the PEAR libraries on Windows from PHP . Pear
We have an issue related to a Java application running under a (rather old)
We have an issue on our page whereby the first time a button posts
I have some issue with a Perl script. It modifies the content of a
I have an issue with using AWK to simply remove a field from a

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.