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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:40:27+00:00 2026-05-25T09:40:27+00:00

I want to add a value from SQLite to an XY series to create

  • 0

I want to add a value from SQLite to an XY series to create a diagram. Here is what I’ve done so far:

 Double a, b;
 mDbHelper = new NotesDbAdapter(this);
 mDbHelper.open();

 Cursor notesCursor = mDbHelper.fetchAllNotes();
 startManagingCursor(notesCursor);
 ArrayList x = new ArrayList();
 ArrayList y = new ArrayList();
 notesCursor.moveToFirst();

 for(int i = 0; i<notesCursor.getCount();i++){
     a = notesCursor.getDouble(notesCursor.getColumnIndex(mDbHelper.KEY_ROWID));
     b = notesCursor.getDouble(notesCursor.getColumnIndex(mDbHelper.KEY_RESULT));
 }
 x.add(a);
 y.add(b);

 notesCursor.moveToNext();

 mCurrentSeries.add(x, y);
 if (mChartView != null) {
      mChartView.repaint();
 }

But I’ve got a problem at the line:

mCurrentSeries.add(x, y);

How I can add an Array to an XY series? Any suggestions?

  • 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-25T09:40:28+00:00Added an answer on May 25, 2026 at 9:40 am

    not sure what library you are using here to create your diagram (chart?). I use aChartEngine which is pretty good. The code I use to get a dataset containing a time series in aChartEngine is:

    public static XYMultipleSeriesDataset getDemoDataset(Cursor c,
                String title, String... columnName) {
            XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
    
            TimeSeries series = new TimeSeries(title);
    
    
            try {
                if (c.moveToFirst()) {
                    do {
                        int mins = c.getInt(c.getColumnIndex(columnName[0]));
    
    
                        java.util.Date date =null;
                        try{
                            date = DateFactory.stringToDate(c.getString(c.getColumnIndex(columnName[1])));
                        }catch(Exception e){
    
                        }
                        if(date==null){
                            continue;
                        }
                        series.add(date, mins);
                    } while (c.moveToNext());
                } else {
                    Log.d(TAG, "There were no values in the cursor.");
                }
            } finally {
                Log.d(TAG, "finally from getDemoDataset being called");
                c.close();
            }
    
            dataset.addSeries(series);
    
            return dataset;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add the value from my database to a label. The value
I want to add value of 3 columns into one new column but there
I want to add multiple text value in text field. The values comes from
I want to add and fetch the value from dynamically created textfield with tag
Often I want to add a value to a table or update the value
I want to add a constant value onto an incoming bound integer. In fact
I want to add an additional value into an array before passing it to
In my ASP.NET MVC application I want a user to add a value into
I have two variables, key and value , and I want to add them
If I want to loop over a Dictionary(Key, Value)... why cant I add 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.