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

The Archive Base Latest Questions

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

I’m running into a problem of how to display sequences of core data entities

  • 0

I’m running into a problem of how to display sequences of core data entities on a single graph, if there are time gaps between sequences.

I got a fixed-length bar graph (backed by UITableView) with each bar represented by a core data entity, all entities are timestamped and follow each other, so sorting such data results in a graph like below. The good thing about such graph is that NSFetchedResultsController can be used to dynamically update the table view in response to new events being added. The result is that it appears to the user that new bars are added on the left as time goes by.
Sleep cycle graph

My problem is that I want to expand this graph and make it 24 hour long and scrollable side to side. In this case, there will be episodes where no data will be present in the app. The end result is that if I rely on NSFetchedResultsController when there are gaps in data, and I want to display blank cells for missing data.

I’m interested in how you would approach the problem.

I see two potential solutions:

1) Drop the approach of using NSFetchedResultsController, and instead manually calculate the number of bars in a UITableView. Each bar is defined by a start date and an end date. Then I can use NSFetchRequest with predicate to query each bar’s data. If there’s an event with a timestamp that falls within the bar’s date range, then a bar is shown, otherwise a blank is shown.

The problem with approach #1 is that it is slow, and while it does allow scrolling through the entire data set, it is slow and laggy, as each fetch request is executed for each new bar. Additionally, I need to manually refresh the table in response to new data being added, which is difficult to implement properly.

2) Maybe I can pre-populate the data set with blank events, and then “fill them in” as data becomes available. This would allow me to keep the table view with fetched results controller, resulting in smoother scrolling, but at the price of significantly increasing the persistent storage used by the app (as blank entities will be created between app use).

I’m wandering if there’s an additional approach that I’m not thinking of. How would you create a side scrollable bar graph that would allow for “gaps” in the app’s persistent data storage?

Thank you for your input!

  • 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-12T12:57:39+00:00Added an answer on June 12, 2026 at 12:57 pm

    Your question really doesn’t have (or shouldn’t have) anything to do with Core Data or NSFetchedResultsController. How your graph view draws the data it’s given is entirely up to the graph view. There’s no reason that you couldn’t write a graph view that uses NSFetchedResultsController and deals appropriately with gaps in the data, but UITableView was never intended to deal with missing/empty cells.

    The problem is not that you’re using either Core Data or NSFetchedResultsController. The problem is that you’re abusing UITableView.

    Drawing a bar graph is pretty easy — it’s just a series of rectangles drawn at appropriate locations. You can give your view a fetched results controller and have it look at the fetchedObjects property to get the current list of objects. It can then render as many of those objects as it likes, and it can use the start and end date of each object to locate the drawing on the graph. Put your graph in a UIScrollView so that you don’t have to worry about scrolling. If the graph can get large, add tiling so that you’re only drawing the parts that the user is looking at, just like UITableView does.

    It looks like you’re currently drawing some content above your table view, too. If you create your own graph view, you might consider drawing that additional content (the red line, the red and green bubbles, the high REM probability thing) at the same time. Doing that will make it easy to ensure that all that content is located correctly on the graph (which is probably a bit of a pain with your current scheme).

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

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.