Gathering detailed insights and metrics for react-lms-vis-timeline
Gathering detailed insights and metrics for react-lms-vis-timeline
Gathering detailed insights and metrics for react-lms-vis-timeline
Gathering detailed insights and metrics for react-lms-vis-timeline
npm install react-lms-vis-timeline
Typescript
Module System
Node Version
NPM Version
54.6
Supply Chain
90.3
Quality
74.8
Maintenance
100
Vulnerability
97.9
License
TypeScript (98.11%)
Shell (1.22%)
JavaScript (0.66%)
Total Downloads
2,326
Last Day
7
Last Week
53
Last Month
262
Last Year
1,585
1 Stars
71 Commits
1 Forks
1 Branches
1 Contributors
Latest Version
3.0.1
Package Id
react-lms-vis-timeline@3.0.1
Unpacked Size
40.10 kB
Size
11.72 kB
File Count
17
NPM Version
8.19.3
Node Version
18.13.0
Publised On
07 Apr 2023
Cumulative downloads
Total Downloads
Last day
-30%
7
Compared to previous day
Last week
23.3%
53
Compared to previous week
Last month
30.3%
262
Compared to previous month
Last year
113.9%
1,585
Compared to previous year
8
27
React component for the vis-timeline
timeline module.
npm install --save react-lms-vis-timeline
OR
yarn add react-lms-vis-timeline
1import Timeline from 'react-lms-vis-timeline' 2 3// https://visjs.github.io/vis-timeline/docs/timeline/#Configuration_Options 4 5const options = { 6 width: '100%', 7 height: '100px', 8 // ... 9 // ... 10} 11 12// JSX 13<Timeline options={options} />
react-visjs-timeline
?Written in Typescript
Using vis-timeline
library! without the old vis.js
No unnecessary re-renders
The old lib caused re-renders on each prop changed, and using immutable objects to detect changes. This was very problematic and caused performance issues. We don't want to re-render the whole timeline, just because 1 item added to the items array.
API changes (items, groups)
vis-timeline already knows how to detect changes with vis-data
's DataSet object.
So in this library, we take it as an advantage and using these DataSets.
While exposing them to the user within ref
.
You can also insert initial data with props, and update/add/remove later with ref API.
Expose the timeline's API.
Methods like focus
, fit
, and many more native vis-timeline methods exposed as well in optional ref
.
Items follow the exact same for format as they do in `vis-timeline``. See the vis-timeline documentation for more information.
1const items = [{ 2 start: new Date(2010, 7, 15), 3 end: new Date(2010, 8, 2), // end is optional 4 content: 'Trajectory A', 5}] 6 7<Timeline 8 options={options} 9 initialItems={items} 10/>
Groups follow the exact same for format as they do in vis-timeline. See the vis-timeline documentation for more information.
1const groups = [{ 2 id: 1, 3 content: 'Group A', 4}] 5 6<Timeline 7 options={options} 8 initialGroups={groups} 9/>
CustomTimes defined more declaratively in the component, via the customTimes
prop.
1const customTimes = [ 2 { 3 id: 'one', 4 datetime: new Date() 5 }, 6 { 7 id: 'two', 8 datetime: 'Tue May 10 2016 16:17:44 GMT+1000 (AEST)' 9 } 10]
When the customTimes
prop changes, the updated times will be reflected in the timeline.
All events are supported via prop function handlers. The prop name follows the convention <eventName>Handler
and the specified function will receive the same arguments as the vis-timeline counterparts.
Some vis-timeline event names are not camelcased (e.g. rangechange
), so the corresponding React prop names need to follow that convention where necessary:
1<Timeline 2 options={options} 3 clickHandler={clickHandler} 4 rangechangeHandler={rangeChangeHandler} 5/> 6 7function clickHandler(props) { 8 // handle click event 9} 10 11function rangeChangeHandler(props) { 12 // handle range change 13}
You can enable animation (when the options start/end values change) by passing a prop of animation
to the component. The available options for this prop follow the same conventions as setWindow
in vis-timeline
. So you can either pass a boolean value (true
by default) or an object specifying your animation configuration, e.g:
1// animate prop... 2{ 3 duration: 3000, 4 easingFunction: 'easeInQuint' 5}
Import your custom CSS after you import the component from the module, e.g:
1import Timeline from 'react-lms-vis-timeline'; 2import './my-custom-css.css';
No vulnerabilities found.
No security vulnerabilities found.