0

I am going to build a timeline with drag-n-drop functionality. Drag-n-drop works fine for me in IE, Chrome, FF and Safari. Now for a timeline there is a range from -15x10^9 to 15x10^9. I've tried to customize timeline.js and d3.js to fit this range. But after 10^6 it gives an error of NaN.

I've referred this question as well.

Below is the code to test the max value in moment.js and it prints NaN on console.

<script type="text/javascript">
    var now = moment();
    console.log(':::now:::',now);

    var a = moment([-150000000, 0, 29]);
    var b = moment([150000000, 0, 28]);
    console.log(a.diff(b)); // 86400000

    console.log([Number.MAX_VALUE, Number.MIN_VALUE]);

    var iso_date = new Date(-15000000000).toISOString();
    console.log(':::iso_date:::',iso_date); //1969-07-11T09:20:00.000Z

    var string_date = new Date(-15000000000).toString();
    console.log(':::string_date:::',string_date); //Fri Jul 11 1969 14:50:00 GMT+0530 (India Standard Time)

</script>

How do I accommodate this range in javascript and display it on a timeline?

Update: logarithmic scale

Community
  • 1
  • 1
  • Can you show us the codes? – Raptor Dec 11 '13 at 07:32
  • Off-topic: you can use `-15e9` instead of `-15000000000` – Oriol Dec 15 '13 at 14:06
  • Timeline.js is dynamically setting the range to fit the content and seems to use DATETIME as input. But even if you succeed to have that kind of range, how many entries will you have? According to Timeline.js documentation: TimelineJS is optimized for 20-30 entries. If you have more entries, you run a risk of slow load times. Test your timeline to make sure you are satisfied. The best remedy for slow load times may be to edit your timeline to include fewer entries or to create a series of smaller timelines. That said, some publications have built timelines that have hundreds of entries. – Pixic Feb 07 '14 at 02:47

0 Answers0