Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just scrolling instead of browsing? #21

Closed
aionescu-zz opened this issue Jul 6, 2013 · 11 comments
Closed

Just scrolling instead of browsing? #21

aionescu-zz opened this issue Jul 6, 2013 · 11 comments
Assignees

Comments

@aionescu-zz
Copy link

Is it possible to configure the cal-heatmap to look like it's configured for browsing (with next and previous buttons), but to do just a scrolling instead of the already loaded data?
I.e. to not load anything new from server, but just to scroll with one domain to the left or the right?

Thank you.

@wa0x6e
Copy link
Owner

wa0x6e commented Jul 6, 2013

Can you give a concrete example ?

As the domains are infinite, it'll be pretty hard to do, or are you talking about something else ?

@aionescu-zz
Copy link
Author

Can you give a concrete example ?

Let's say I have data loaded for 12 domains (12 months groups).
If where the chart is displayed, there's enough place, than all the 12 domains will show.
If however I need to place the chart in a 2-column layout, than I can show only 6 or 7 domains at once.
I would like to be able to scroll the same way visually how the user would use the cal-heatmap browse controls
inside this loaded once domain (but this to trigger no further Ajax requests, since all the data was already loaded).

As the domains are infinite, it'll be pretty hard to do, or are you talking about something else ?

Yes. Just scrolling. The domains might be infinite, but there's a "first" and a "last" item that will correspond to a domain.

@ghost ghost assigned wa0x6e Jul 7, 2013
@wa0x6e
Copy link
Owner

wa0x6e commented Jul 7, 2013

Are you talking about responsive design ? Where you want the calendar to resize to show less domains when asked to ?

Or you want to save ajax request by loading more datas than showed with the first request ?

@aionescu-zz
Copy link
Author

Or you want to save ajax request by loading more datas than showed with the first request ?

Yes. Not just save Ajax requests, but server code too: some data comes from other systems where would complicated to modify it ( to have extra parameters for the browsing), since we have no control over it, so just scrolling would be enough.

@wa0x6e
Copy link
Owner

wa0x6e commented Jul 7, 2013

From the server data, you want to preload all the data it's returning, or you want to filter them first ? (limiting with a first and end date).

@aionescu-zz
Copy link
Author

From the server data, you want to preload all the data it's returning, or you want to filter them first ? (limiting with a first and end date).

From a user's perspective I don't really know what's the difference between "preload" and "filter" :).
Of course I wouldn't want to give an extra first and end property since there's already a start and range property, so the chart can figure out everything else.

What I want is just an extra setting (e.g. scroll:true or even better: browsing:'scroll' ). When this is used, and the user clicks on the browsing buttons, the chart would "scroll" or visibly "shift" or "re-render" with one domain at left or right if there's data in those previous or next domains.

@wa0x6e
Copy link
Owner

wa0x6e commented Jul 8, 2013

When this is used, and the user clicks on the browsing buttons, the chart would "scroll" or visibly "shift" or "re-render" with one domain at left or right if there's data in those previous or next domains.

I'm wondering how do you fill these datas in the "hidden" domain. I believe you're loading these in the same ajax request than the visible domains.

Let's say the ajax request can return datas for a whole month, and you're just displaying one week. So for the remaining 3 weeks, it'll be loaded automatically the first time, so when browsing, there's no more ajax request.

What I want to know is if you want to use all the datas return by the server (3 weeks), or want to limit them with a first and end date (just use the data for let's say 2 weeks).

@aionescu-zz
Copy link
Author

What I want to know is if you want to use all the datas return by the server (3 weeks), or want to limit them with a first and end date (just use the data for let's say 2 weeks).

I want to use the entire data (4 weeks) loaded in one single AJAX request. The chart would scroll to the left or to the right, so jumping one domain (like it is doing with browsing too) until there's a domain with no more data.

@wa0x6e
Copy link
Owner

wa0x6e commented Jul 8, 2013

until there's a domain with no more data

I guess you want to disable browsing beyond certain date ?

@aionescu-zz
Copy link
Author

see here an illustration. I hope it helps http://www.asciiflow.com/#Draw5106642043834590516/1312689001

I guess you want to disable browsing beyond certain date ?

If there's no more data in the next domain than can be the domains where the scrolling ends on the right or the left side.

@wa0x6e
Copy link
Owner

wa0x6e commented Sep 21, 2013

Maybe you can do that "outside" cal-heatmap ? With the new features added since version 3, it should be possible, or close.

First, don't pass the data's API url directly to cal-heatmap, fetch the data first and extract the first and last date, then pass them to init() via the minDate and maxDate => your calendar is now bounded.

Now that you have a json object, just pass it directly to cal-heatmap via data, since it can takes directly a json object.

Example:

var data = d3.json('www.api.com/data.html');

// Extract the timestamps
var dates = Object.keys(data);

// Convert all string timestamp to integer
dates.map(function(d) { return parseInt(d, 10); });

// Sort the dates
dates.sort();

var cal = new CalHeatMap();
cal.init({
   data: data,
   minDate: dates.shift(),
   maxDate: dates.pop()
});

@wa0x6e wa0x6e closed this as completed Sep 22, 2013
wa0x6e pushed a commit that referenced this issue Nov 8, 2022
…cb195f

[Snyk] Security upgrade karma-coverage from 0.2.7 to 0.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants