Git Product home page Git Product logo

Comments (5)

teddybugs avatar teddybugs commented on August 16, 2024

more info, this is how i call the script:

$(function () {
var staff = $(".staffList").val();
var myStaffListArr = myStaffList.split(',');
var options = {
    type          : 'bar',
    startDatetime : '2019-01-21 0:00',
    scale         : 'day',

    headline      : {
        display   : true,
        title     : '',
        range     : true,
        locale    : 'en-US',
        format    : { timeZone: 'Asia/Kuala_Lumpur', hour12: false, year: 'numeric', month: 'numeric', day: 'numeric' }
    },
    footer        : {
        display   : false,
        range     : true,
        locale    : 'en-US',
        format    : { timeZone: 'Asia/Kuala_Lumpur', hour12: false, year: 'numeric', month: 'numeric', day: 'numeric' }
    },
    sidebar       : {
        sticky : true,
        list   : staff,
    },
    ruler         : {
        top    : {
            lines      : [ 'year', 'month', 'day', 'weekday' ],
            height     : 26,
            fontSize   : 13,
            color      : '#869e86',
            background : '#FFF',
            locale     : 'en-US',
            format     : { timeZone: 'Asia/Kuala_Lumpur', hour12: false, decade: 'ordinal', lustrum: 'ordinal', year: 'zerofill', month: 'long', weekday: 'short', hour: 'numeric', minute: 'numeric' },
        }
    },
    eventMeta       : {
        display     : false,
        scale       : 'days',
       
    },
    zoom          : false,
};
$('#my-timeline').Timeline( options );

    
});

and the html look like following:

<div id="my-timeline">
    <ul class="timeline-events">
        <li data-timeline-node='{"row":"1","start":"2019-02-01 00:00","end":"2019-02-01 00:00","bgColor":"#ffc107","color":"#FFFFFF","label":"Annual Leave"}'>DAVID MORIS</li>        
        <li data-timeline-node='{"row":"2","start":"2019-02-04 00:00","end":"2019-02-04 00:00","bgColor":"#ffc107","color":"#FFFFFF","label":"Annual Leave"}'>Joss Melon</li>        
        <li data-timeline-node='{"row":"3","start":"2019-02-04 00:00","end":"2019-02-08 00:00","bgColor":"#ffc107","color":"#FFFFFF","label":"Annual Leave"}'>Angeline Tan</li
    </ul>        
</div>

from the data above, only 3 will show the timeline from 2019-02-04 to 2019-02-08, the other not showing because the start date and end date are same. How to make it show?
thanks

from jquery.timeline.

teddybugs avatar teddybugs commented on August 16, 2024

after debug, i able to see both 1 day date and non 1 day date are able to go in into:

                if ( params.x + params.width <= _props.fullwidth ) {
                    // The event end datetime is less than before the timeline end datetime (regular event) (:> イベント終点がタイムラインの終点以下(通常イベント)
                    // OK
					
					console.log(params.eventId," 3. we are inside params.x + params.width <= _props.fullwidth params.x: ",params.x," | params.width : ",params.width,"| _props.fullwidth :",_props.fullwidth);
                }

the only different is the 1 day date has
params.width : " 0 "

other has value with it..

from jquery.timeline.

ka215 avatar ka215 commented on August 16, 2024

Hi, sorry for my late reply.

In the "bar" type timeline, the events where the time difference between the start date and end date of the event is not greater than 0 are invalid events and are not displayed. Also if the event where the time difference is greater than 0 and the width of the event block on the timeline container is not greater than 1px will be invalid too.

To avoid this feature, you should modify the source of the _registerEventData() method as follows.

    _registerEventData( event_element, params ) {
        let _opts     = this._config,
            _props    = this._instanceProps,
            new_event = {
                ...EventParams,
                ...{
                    uid   : this.generateUniqueID(),
                    label : $(event_element).html()
                }
            },
            _relation = {},
            _x, _w, _c //, _pointSize
        
        if ( params.hasOwnProperty( 'start' ) && ! this.is_empty( params.start ) ) {
            _x = this._getCoordinateX( params.start )
            new_event.x = this.numRound( _x, 2 )
            if ( params.hasOwnProperty( 'end' ) && ! this.is_empty( params.end ) ) {
                _x = this._getCoordinateX( params.end )
                _w = _x - new_event.x
                if ( _opts.type === 'bar' ) { // <= add this
                    _w = _w < 1 ? 1 : _w
                }
                new_event.width = this.numRound( _w, 2 )
                
                ...(The rest is omitted.)

Also, I'm going to add the "mixed" in the type of timeline at the next release. In the "mixed" type, we will be able to use already settable types of the "bar" and "point" together. Therefore, the "point" type events are outputted that set the start date only, and the "bar" type events that have an interval, together.

Thank you,

from jquery.timeline.

teddybugs avatar teddybugs commented on August 16, 2024

Arigatou gozaimasu : ) thank you sir. now working great.
1
i also added following:

                if ( _opts.type === 'bar' ) { // <= add this
                    _w = _w < 1 ? 20 : _w
                }
				
                if ( _opts.type === 'bar') { // <= fix the bar size missing 20px on the end.
                    _w = _w < 21 ? 20 : (_w+20)
                }

from jquery.timeline.

ka215 avatar ka215 commented on August 16, 2024

This issue has already been resolved.

from jquery.timeline.

Related Issues (20)

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.