Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

allow custom label formatting via functions #1098

Closed
wants to merge 1 commit into from

Conversation

Fice
Copy link
Contributor

@Fice Fice commented Jul 16, 2015

This allows you to use another formatter than format.js or use functions like fromNow() like

    function formatter(date, scale) {
      moment(date).fromNow(); //gives you sth. like '4 days ago'
   }

Or you could do any integerbased axis by giving the timeline integers

var items = VisDataSet([{id: 0, content: 'item 0', start: 1, end: 300000}]);

and use a custom formater and get the integer back via date.getTime(). Now you would be able to do any integer based axis. So this should enable a workaround for #92

@Fice Fice mentioned this pull request Jul 16, 2015
@josdejong
Copy link
Contributor

Thanks for your PR Fice, we will have a look at it next Monday.

Until then, can you please re-do the pull request to the develop branch instead of master?

@josdejong
Copy link
Contributor

This will be a nice improvement. A few things:

  • I'm wondering if it't enough to pass the date and scale, you may also want to know the current step size. We could pass that as third parameter.
  • Can you redo the PR to the develop branch?
  • Can you update the docs to reflect this new feature?

@Fice
Copy link
Contributor Author

Fice commented Jul 22, 2015

I'm not at my dev machine atm, will do it as soon as I have some time (probably this weekend).

@mojoaxel
Copy link
Member

mojoaxel commented Aug 9, 2016

@Fice I would like to merge this. It would be very nice if you would make the changes, pointed out by josdejong. You can just make the changes in your local branch Fice:labelFunctions and push them. All changes get updated here in the pull request. Thanks!

mojoaxel pushed a commit that referenced this pull request Oct 17, 2016
* Hide vertically hidden ranged items in groups that are not visible
* Add custom function format for time labels
* fix misspell
* remove spaces
* remove backspace
* add backspaces
* Add docs and examples
* Fix docs
@mojoaxel
Copy link
Member

closed with #2145

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants