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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:06:16+00:00 2026-06-17T17:06:16+00:00

I am having a problem in xychart with achart engine. Practically the background color

  • 0

I am having a problem in xychart with achart engine. Practically the background color is set only inside the axis area.
my code:

private XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset();
private XYMultipleSeriesRenderer mRendererXY = new   XYMultipleSeriesRenderer();

private XYSeries mSeriesXY;
private GraphicalView mXYView;

private ViewFlinger mFlingy;
private int index = 0;

public StatChallengeTabManager(Context ctx, ViewFlinger flingy) {
    mCtx = ctx;
    mFlingy = flingy;
    mStatDBManagerCh = new StatDBManagerChallenge(ctx);
}

public void drawStats() {
    LayoutInflater inflate = (LayoutInflater) mCtx
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    v1 = inflate.inflate(R.layout.v1, null);
    v2 = inflate.inflate(R.layout.v2, null);
    mFlingy.addView(v1);
    mFlingy.addView(v2);

    drawFirstChart();
    drawSecondChart();

}

private void drawFirstChart() {

    if (mXYView == null) {

        mRendererXY.setAxisTitleTextSize(30);
        mRendererXY.setChartTitleTextSize(40);
        mRendererXY.setChartTitle(mCtx.getString(R.string.score_trend));
        mRendererXY.setLabelsColor(Color.BLACK);
        mRendererXY.setXLabelsColor(Color.BLACK);
        mRendererXY.setYLabelsColor(0, Color.BLACK);
        mRendererXY.setMargins(new int[] { 50, 60, 0, 50 });
        mRendererXY.setLabelsTextSize(30);
        mRendererXY.setZoomButtonsVisible(false);
        mRendererXY.setPointSize(8);
        mRendererXY.setDisplayValues(true);
        mRendererXY.setShowLegend(false);
        mRendererXY.setScale(.8f);

        XYSeriesRenderer r = new XYSeriesRenderer();
        r.setColor(COLORS[0]);
        r.setPointStyle(PointStyle.CIRCLE);
        r.setFillBelowLine(false);
        r.setFillPoints(true);
        mRendererXY.addSeriesRenderer(r);

        mRendererXY.setXTitle(mCtx.getString(R.string.game_id));
        mRendererXY.setYTitle(mCtx.getString(R.string.game_score));
        mRendererXY.setFitLegend(true);
        mRendererXY.setAxesColor(Color.BLACK);
        mRendererXY.setShowGrid(true);
        mRendererXY.setXAxisMin(-0.5);
        mRendererXY.setYAxisMin(0);
        mRendererXY.setXAxisMax(10.5);
        mRendererXY.setZoomEnabled(false);
        mRendererXY.setYAxisMax(100000);
        mRendererXY.setInScroll(true);
        mRendererXY.setClickEnabled(true);

        mRendererXY.setBackgroundColor(Color.argb(255, 255, 248, 220));
        mRendererXY.setApplyBackgroundColor(true);

        int[] res = mStatDBManagerCh.getGameScores();
        mSeriesXY = new XYSeries(mCtx.getString(R.string.score_trend));
        for (int i = 0; i < res.length; i++) {
            if (res[i] == 0)
                continue;
            mSeriesXY.add(i, res[i]);

        }
        mDataset.addSeries(mSeriesXY);
        mXYView = ChartFactory.getLineChartView(mCtx, mDataset, mRendererXY);

        LinearLayout layout = (LinearLayout) v1.findViewById(R.id.chart1);
        layout.addView(mXYView, new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    } else {
        LinearLayout layout = (LinearLayout) v1.findViewById(R.id.chart1);
        layout.addView(mXYView, new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        mXYView.repaint();
    }

}

While v1.xml is:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/chart1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="horizontal" />
</LinearLayout>

And the result is https://www.dropbox.com/s/z2wuq1j0bjwz1wj/problem.png

  • 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-06-17T17:06:18+00:00Added an answer on June 17, 2026 at 5:06 pm

    Just call mRendererXY.setMarginsColor(color); and you will have the margins background set as well.

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

Sidebar

Related Questions

I'm having problem with datagrid view. I have attached an image with the code
I am having problem with drawing multiple lines during repaint. The code is as
Having problem with this bit of code qith jQuery. it should pick the values
I am having problem on getting just one thumbnail on mouse over inside an
i having problem in converting this C# code into VB.net. The loadLecturer seem to
Currently having problem with a SQL query, It is as follows UPDATE table SET
I am having problem displaying values set by select elements created by FormHelper .
I am having problem with inet_aton to convert a network address. The code below
I'm having problem with a code. This is my main. int main() { cin>>xG>>yG;
I am having problem typing character glottal stop into a JTable, and only 0241

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.