npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ameasurejs-timeline

v1.2.1

Published

AMeasure Timeline Component

Downloads

2

Readme

A-Measure Timeline


A timeline service and screen for PM Engine results.

Getting Started

Install the timeline via npm.

npm install ameasurejs-timeline --registry http://nuget.ma.aptima.com/npm/AMeasureJSNPM

Add 'ameasure.timeline' module as dependency.

angular.module('orcid', ['ameasure.timeline'])

Include the vendor.js and timeline.js files in your index.

<script src="node_modules/ameasurejs-timeline/dist/vendor.js"></script>
<script src="node_modules/ameasurejs-timeline/dist/timeline.js"></script>

Setting Configuration Options

In your module's .run() function, include the 'timelineConfig' constant. Ex:

angular.module('orcid', ['ameasure.timeline'])
    .run(function(timelineConfig) {
        timelineConfig.autoUpdateTime = false;
    })

Available Options

|Name |Type |Description | |--------------|---------|-----------------------------------------------------------------------------| |autoUpdateTime|boolean|Automatically adjusts the time domain if a bar, line, tick extends beyond it.|

Creating the Timeline

Timeline

Construct the timeline object.

.controller('orcidCtrl', function ($scope, Timeline) {
    $scope.timeline = new Timeline();
})

Use the default timeline.

<timeline data="timeline"></timeline>

Or construct your own timeline with individual directives.

<timeline-zoom data="timeline"></timeline-zoom>
<timeline-phases data="timeline"></timeline-phases>
<timeline-row ng-repeat="row in timeline.rows" datarow="row" data="timeline"></timeline-row>

Listening to events

These are $rootScope events that are broadcasted based on interactions with the timeline.

|Name |Arguments |Description | |------------|------------------------|-----------------------------------------------------------------------------------| |rowHover |string name, Date time|Whenever a bar, line, or tick is hovered over in that row, it returns the name of the row and the time where the mouse is hovered over.| |commentClick|string text, Date time|This is broadcasted when a comment is clicked on. It returns any text associated and the time of the comment.|

Objects API

Timeline

Properties

|Name |Type |Description | |---------------|----------------|------------------------------------------------------------------------------------| |rows |TimelineRow[] |Array that stores all of the rows on the timeline. | |phases |Array |Array that stores all of the phases on the timeline. Can be a TimelineBar or a tick.| |comments |Array |Array that stores all of the comments on the timeline. | |timeService |TimeService |A service object that handles the timing (i.e. time domain, current time) | |adjustDomainCb |function |A callback related to adjusting the domain in time service that is saved to rows/bars to handle auto-adjustment of the time domain when data is added.|

Methods

|Function |Description | |---------------------------------------------------------------|----------------------------------------------------------------------| |addPhaseTick(Date startTime, string imageUrl) |Adds a phase tick to the phase row at the given time, display the given image.| |addPhaseBar(TimelineBar bar) |Adds a bar to the phase row. | |addComment(Date startTime[, string text]) |Adds a comment at the given time. Can be provided with comment text. | |addRow(string name) |Creates a TimelineRow with the given measure name and adds it to the timeline.| |createSubRow(string name) |Creates a TimelineRow with the given measure name and returns it. | |createLine(Date start, Date end[, string fill, string text]) |Creates a TimelineBar with the start and end time and returns it. | |createBar(Date start, Date end[, string fill, string text]) |Creates a TimelineBar with the start and end time and returns it. | |autoSetTimeDomain() |Will automatically generate the time domain with the start at the earliest piece of data, and end at the latest piece of data currently in the system.|

TimeService

Properties

|Name |Type |Description | |-------------------------|--------------|----------------------------------------------------------------------------------| |updateZoomDomainCallbacks|Array |Stores callbacks for zoom updates. | |updateTimeDomainCallbacks|Array |Stores callbacks for time domain updates. | |currentTimeCallbacks |Array |Stores callbacks for current time callbacks. | |currentTime |Date |Current time on the timeline. | |timeDomain |[Date, Date]|Time domain of the entire timeline. | |zoom |[Date, Date]|Domain of the zoomed in zone. | |sharedProperties |Object |Holds properties that are shared between timeline individual component directives.|

Methods

|Function |Description | |----------------------------------------|-------------------------------------------------------------------------------| |reset() |Zooms out and calls all redraw callbacks. | |createTimeScaleAndAxis(int rowWidth) |Creates the time scale (D3) and corresponding axis for the zoom based on the width (in pixels) of the timeline.| |updateZoomDomain(Date[] time) |Takes in a time domain (array of two Date objects) and updates the zoom domain.| |updateTimeDomain(Date start, Date end)|Takes a start and end time and updates the overall time domain of the timeline.| |updateCurrentTime(Date time) |Updates the current time marker to that time.

TimelineRow

Properties

|Name |Type |Description | |-------|-----------------|-----------------------------------------------| |name |string |Name of the row/measure. | |bars |TimelineBar[] |Array that stores all of the bars. | |ticks |Array |Array that stores all of the ticks in the row. | |lines |Array |Array that stores all of the lines in the row. | |subRows|TimelineRows[] |Array that stores any sub-rows/sub-measures. | |checked|Boolean |Flag that will hide/show the row. |

Methods

|Function |Description | |----------------------------------|-------------------------------------------------------------------------------------------------------------------------------| |addBar(TimelineBar bar) |Stores a TimelineBar in its array of bars. Autoupdates the time domain if configuration option is on. | |addLine(TimelineBar line) |Stores a TimelineBar in its array of lines. Autoupdates the time domain if configuration option is on. | |addRow(TimelineRow row) |Stores a TimelineRow in its array of sub-rows. | |addTick(Date time, string image)|Saves a tick which takes a Date and the url of the image to display. Autoupdates the time domain if configuration option is on.|

TimelineBar

Properties

|Name |Type |Description | |-------|-----------------|---------------------------------------------------------------------| |start |Date |Starting time of the bar | |end |Date |End time of the bar | |fill |string |The fill color of the bar. | |text |string |The text that is displayed inside the bar in the case of a phase bar.|

Methods

|Function |Description | |----------------------------------|-------------------------------------------------------------------| |addTime(int duration) |Stores a TimelineBar in its array of bars. Autoupdates the time domain if configuration option is on.|

Examples

Adding a row with a bar, line, and tick

$scope.timeline.addRow('Measure 1')
    .addBar($scope.timeline.createBar(new Date(2016, 8, 31, 10, 40), new Date(2016, 8, 31, 10, 50)))
    .addLine($scope.timeline.createLine(new Date(2016, 8, 31, 11), new Date(2016, 8, 31, 11, 15), 'red'))
    .addTick(new Date(2016, 8, 31, 11, 20), 'images/threatdestroyed.png');

Adding a sub-row with a bar to a row

row
    .addRow($scope.timeline.createSubRow('Sub measure 1')
        .addBar($scope.timeline.createBar(new Date(2016, 8, 31, 11), new Date(2016, 8, 31, 12), 'green')));

Listening to a rowHover event

$rootScope.$on('rowHover', function (e, args) {
    console.log(args.name, args.time);
});