I am using a large amount of JSON data from an API for D3 bar charts. I would like to show only 10-20 bars at a time. Is there a way to paginate using D3 or do I need to do this another way (php)? Any best practices or suggestions are welcome.
相关问题
- Is there a limit to how many levels you can nest i
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- How to toggle on Order in ReactJS
- StackExchange API - Deserialize Date in JSON Respo
Please go thorugh this piece of code but it makes sense if you go through my block. I have only put the essential part of the code. Link: http://bl.ocks.org/pragyandas
I know this is a late question, but maybe this can still help you out.
I would create pagination in d3 by creating a second array that only contains the data you want shown at a particular time. This sliced array would come from your primary data array. By controlling where the array is sliced, you control the pagination.
I've created a simple example here with a long array divided into five-bar 'pages'.
http://jsfiddle.net/zNxgn/2/