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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:41:57+00:00 2026-06-12T07:41:57+00:00

I want to plot data against two Y-axis vs. X-axis. I debug and did

  • 0

I want to plot data against two Y-axis vs. X-axis. I debug and did all on my side, however did not come to solution. I want to plot both lines against same X-axis, howver its not like that.

My Source code:

public LinearLayout execute(Context context) {
        List<double[]> x = new ArrayList<double[]>();

        cigLen = CommentsDataSource.cigList.size();

        double xDays [] = new double [cigLen];

        // It will runtime decide how many days(X)
        for (int i = 0; i < cigLen; i++) {
            xDays[i] = i;
        }

        double cig [] = new double [cigLen];
        double points [] = new double [cigLen];

        String[] titles = new String[] { "Ciggars"};

        for (int i = 0; i < titles.length; i++) {
          x.add(xDays);
          x.toArray();
        }

        xLen = x.get(0).length;

        for (int i = 0; i < xLen ; i++){
            cig [i] =  CommentsDataSource.cigList.get(i);
            points [i] =  CommentsDataSource.pointList.get(i);           
        }

        List<double[]> values = new ArrayList<double[]>();
        // Add cigars values
        values.add(cig);
        values.toArray();

        // Set color of lines
        int[] colors = new int[] { Color.BLUE, Color.YELLOW };
        PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE, PointStyle.DIAMOND};

        XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(2);
        setRenderer(renderer, colors, styles);
        int length = renderer.getSeriesRendererCount();
        for (int i = 0; i < length; i++) {
          ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true);
        }

        setChartSettings(renderer, "Average Cigeretes", "Days", "", 0, 7, 0, 50, Color.LTGRAY, Color.LTGRAY);
        // fragments on X and Y-axis to be divided
        renderer.setXLabels(7);
        renderer.setYLabels(10);
        renderer.setShowGrid(true);
        renderer.setXLabelsAlign(Align.RIGHT);
        renderer.setYLabelsAlign(Align.RIGHT);
        renderer.setZoomButtonsVisible(true);
        renderer.setZoomRate(1.05f);
        renderer.setLabelsColor(Color.WHITE);
        renderer.setXLabelsColor(Color.GREEN);

        renderer.setYLabelsColor(0, colors[0]);
        renderer.setYLabelsColor(1, colors[1]);

        //renderer.setYTitle("% Tar/Nicotine", 1);
        renderer.setYAxisAlign(Align.RIGHT, 1);
        renderer.setYLabelsAlign(Align.LEFT, 1);
        renderer.setYAxisAlign(Align.CENTER,1);
        renderer.setYAxisMin(0, 1);
        renderer.setYAxisMax(100, 1);
        //renderer.setXAxisMin(1);

        XYMultipleSeriesDataset dataset = buildDataset(titles, x, values);
        values.clear();

        // Add Tar/Nicotine values
        values.add(points);
        values.toArray();

        addXYSeries(dataset, new String[] { "% Tar/Nicotine" }, x, values, 1);

        // set background color
        renderer.setApplyBackgroundColor(true);     
        renderer.setBackgroundColor(Color.GRAY);
        renderer.setMarginsColor(Color.GRAY);

        GraphicalView gview = ChartFactory.getCubeLineChartView(context, dataset, renderer, 0.0f);

        LinearLayout lnr = null;
        lnr = new LinearLayout(context);
        lnr.addView(gview);

        return lnr;
  }
  • 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-12T07:41:59+00:00Added an answer on June 12, 2026 at 7:41 am

    The solution to this is to not call the setChartSettings method as that is setting the bounds for the first scale axis only.

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

Sidebar

Related Questions

I have the data in two files. I want to plot a graph the
I want to use core-plot for drawing line graph dynamically. data won't come at
I'm trying to plot two data sets with gnuplot. They are both (x, y,
I want to plot data from different data frames with ggplot. However, I'm having
I want to plot a barplot of some data with some x-axis labels but
I have a data which I want to plot in cumulative function. The R
I have some data that I want to display as a box plot using
Possible Duplicate: How to plot two histograms together in R? I want to plot
I need to plot non-numeric data against dates as a simple line graph. I
I want to plot some data into a web graph control(preferably javascript or php).

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.