Giter Club home page Giter Club logo

d3plus-timeline's Introduction

d3plus-timeline

An easy-to-use javascript timeline.

Installing

If using npm, npm install d3plus-timeline. Otherwise, you can download the latest release from GitHub or load from a CDN.

import modules from "d3plus-timeline";

d3plus-timeline can be loaded as a standalone library or bundled as part of D3plus. ES modules, AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3plus global is exported:

<script src="https://cdn.jsdelivr.net/npm/d3plus-timeline@1"></script>
<script>
  console.log(d3plus);
</script>

Examples

Live examples can be found on d3plus.org, which includes a collection of example visualizations using d3plus-react. These examples are powered by the d3plus-storybook repo, and PRs are always welcome. 🍻

API Reference


Timeline <>

This is a global class, and extends all of the methods and functionality of Axis.

# Timeline.render([callback]) <>

Draws the timeline.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.buttonPadding([value]) <>

If value is specified, sets the button padding and returns the current class instance. If value is not specified, returns the current button padding.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.brushing([value]) <>

If value is specified, toggles the brushing value and returns the current class instance. If value is not specified, returns the current brushing value.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.brushFilter([value]) <>

If value is specified, sets the brush event filter and returns the current class instance. If value is not specified, returns the current brush event filter.

This is a static method of Timeline, and is chainable with other methods of this Class.

function() {
  return !event.button && event.detail < 2;
}

# Timeline.brushMin([value]) <>

Sets the minimum number of "ticks" to allow to be highlighted when using "ticks" buttonBehavior. Helpful when using x/y plots where you don't want the user to select less than 2 time periods. Value passed can either be a static Number, or a function that is expected to return a Number.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.buttonAlign([value]) <>

If value is specified, toggles the horizontal alignment of the button timeline. Accepted values are "start", "middle" and "end". If value is not specified, returns the current button value.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.buttonBehavior([value]) <>

If value is specified, toggles the style of the timeline. Accepted values are "auto", "buttons" and "ticks". If value is not specified, returns the current button value.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.buttonHeight([value]) <>

If value is specified, sets the button height and returns the current class instance. If value is not specified, returns the current button height.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.handleConfig([value]) <>

If value is specified, sets the handle style and returns the current class instance. If value is not specified, returns the current handle style.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.handleSize([value]) <>

If value is specified, sets the handle size and returns the current class instance. If value is not specified, returns the current handle size.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.on([typename], [listener]) <>

Adds or removes a listener for the specified brush event typename. If a listener is not specified, returns the currently-assigned listener for the specified event typename. Mirrors the core d3-brush behavior.

This is a static method of Timeline, and is chainable with other methods of this Class.

Param Type
[typename] String | Object
[listener] function

# Timeline.playButton([value]) <>

Determines the visibility of the play button to the left the of timeline, which will cycle through the available periods at a rate defined by the playButtonInterval method.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.playButtonConfig([value]) <>

The config Object for the Rect class used to create the playButton.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.playButtonInterval([value]) <>

The value, in milliseconds, to use when cycling through the available time periods when the user clicks the playButton.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.selectionConfig([value]) <>

If value is specified, sets the selection style and returns the current class instance. If value is not specified, returns the current selection style.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.selection([value]) <>

If value is specified, sets the selection and returns the current class instance. If value is not specified, returns the current selection. Defaults to the most recent year in the timeline.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.snapping([value]) <>

If value is specified, toggles the snapping value and returns the current class instance. If value is not specified, returns the current snapping value.

This is a static method of Timeline, and is chainable with other methods of this Class.


Documentation generated on Thu, 22 Jun 2023 21:31:52 GMT

d3plus-timeline's People

Contributors

cnavarreteliz avatar davelandry avatar dependabot[bot] avatar ffigueroal avatar greenkeeper[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

d3plus-timeline's Issues

button timeline does not work with Date objects

Expected Behavior

I would expect to be able to pass fully-validated JavaScript Date objects to the various methods.

Current Behavior

Setting the domain, ticks, in addition to the current selection causes bugs.

Steps to Reproduce (for bugs)

http://jsfiddle.net/xs5p2ujh/1/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: macOS High Sierra

An in-range update of d3plus-axis is breaking the build 🚨

The dependency d3plus-axis was updated from 0.4.3 to 0.4.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

d3plus-axis is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v0.4.4
  • updates documentation (c399a7c)
  • updates minor d3plus dependencies (4d79df8)
  • fixes bug where disabling labels would not draw Axis (d928f48)
Commits

The new version differs by 4 commits.

  • c399a7c updates documentation
  • 4d79df8 updates minor d3plus dependencies
  • d928f48 fixes bug where disabling labels would not draw Axis
  • 2d2c82a compiles v0.4.3

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Problem with Timeline render

Weird rendering when dates comes from different year-months.

Expected Behavior

Behavior is ok. It renders 4 options (my 4 different dates) and on click the viz changes properly.
The problem is in presentation and formatting.

Current Behavior

Timelie is shown like this:
captura de pantalla 2018-12-10 a la s 16 38 54

Why are they rotated? How can I format this strings in the timeline (I need to show quarters)?

Steps to Reproduce (for bugs)

  1. See timeline here: https://jsfiddle.net/palamago/d46qae3v/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version:

timeline breaks with large number of monthly ticks

const months = ["01/01/2012", "02/01/2012", "03/01/2012", "04/01/2012", "05/01/2012", "06/01/2012", "07/01/2012", "08/01/2012", "09/01/2012", "10/01/2012", "11/01/2012", "12/01/2012", "01/01/2013", "02/01/2013", "03/01/2013", "04/01/2013", "05/01/2013", "06/01/2013", "07/01/2013", "08/01/2013", "09/01/2013", "10/01/2013", "11/01/2013", "12/01/2013", "01/01/2014", "02/01/2014", "03/01/2014", "04/01/2014", "05/01/2014", "07/01/2014", "08/01/2014", "09/01/2014", "11/01/2014", "12/01/2014", "01/01/2015", "02/01/2015", "03/01/2015", "04/01/2015", "06/01/2015", "07/01/2015", "08/01/2015", "09/01/2015", "10/01/2015", "11/01/2015", "12/01/2015", "01/01/2016", "02/01/2016", "03/01/2016", "04/01/2016", "05/01/2016", "06/01/2016", "07/01/2016", "08/01/2016", "09/01/2016", "10/01/2016", "11/01/2016", "01/01/2017", "02/01/2017", "03/01/2017", "04/01/2017"];

new d3plus.Timeline()
  .domain([months[0], months[months.length - 1]])
  .ticks(months)
  .render();

fix align behavior in button timeline

Expected Behavior

align should change the vertical alignment of the timeline, regardless of "buttons" or "ticks" behavior. Timelines should always be horizontally centered (for now)

Current Behavior

This one is my fault, I told you to make align change the horizontal alignment of the button timeline.

Steps to Reproduce (for bugs)

http://jsfiddle.net/cfgyorpd/1/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: macOS Mojave

weird behavior in buttons

Expected Behavior

I would expect to have buttons with same widths and correct brushing between them.

Current Behavior

The width in buttons are differents and brushing is not working correctly.

Steps to Reproduce (for bugs)

http://jsfiddle.net/xs5p2ujh/3/

Your Environment

  • Browser Name: Google Chrome
  • Operating System and Version: MacOS High Sierra

alternate timeline view when all ticks can be displayed

The old d3plus had 2 different modes:

  1. if all labels can be displayed, show them as buttons (seen here)
  2. if all labels cannot be displayed, show the timeline as an axis with ticks (current behavior, visible here in DataViva)

We need to implement the first mode (the second mode is the current behavior).

Please disregard the play button in those old examples for now.

improve performance timeline axis

I want to improve how to manipulate the timeline properties for projects with months / quarters / years, and too much labels in small sizes.

Some ideas:

  • Set specific behaviors, like .timelineBehavior("Quarter") for quarters.
  • Try to improve buttonBehavior

An in-range update of d3plus-dev is breaking the build 🚨

Version 0.4.11 of d3plus-dev just got published.

Branch Build failing 🚨
Dependency d3plus-dev
Current Version 0.4.10
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As d3plus-dev is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v0.4.11
Commits

The new version differs by 35 commits.

There are 35 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.