Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On executing draw/redraw the slider not rendering after first time calling the draw method of chaps link library timeline. #361

Open
navneetpersi0935 opened this issue Mar 29, 2016 · 1 comment

Comments

@navneetpersi0935
Copy link

Please help its urgent, actually there is a feature we need to implement in our project that if i change the first and last time to change the range on timeline, so at the same time i want to change the first and last item on another timeline accordingly by using draw.redraw method but we are getting blank timeline and also not getting any error. so please help.

    $scope.changeVisibleChartRange = function(dateObj){
        //charttimeline.setVisibleChartRange(dateObj.startr, dateObj.endr);
        $scope.externalStartDate = dateObj.startr;
        $scope.externalEndDate = dateObj.endr;

        $scope.charttimelinedata2 = [
                {'start': $scope.externalStartDate, 'content': 'First'},
                {'start': $scope.externalEndDate, 'content': 'Last'} 
        ];

        //set data for redrawing the timeline
        //charttimeline.redraw($scope.charttimelinedata2);

        //$scope.drawVisualization();
        charttimeline.redraw();
    }

    // handler to draw timeline slider
    $scope.drawVisualization = function(){

        // create and populate an array with data
        $scope.charttimelinedata = [
                {'start': $scope.timelineStartSelector, 'content': 'First'},
                {'start': $scope.timelineEndRange, 'content': 'Last'} 
        ];

        var maxRange = $scope.addMinutes($scope.timelineEndRange, 2);

        // specify options
        $scope.timelineoptions = {
            "width":  "100%",
            "height": "120px",
            "min": $scope.timelineStartRange,          // lower limit of visible range
            "max": maxRange,         // upper limit of visible range
            "zoomMin": 1000 * 60,            // one day in milliseconds
            "zoomMax": 1000 * 60 * 60 * 24 * 31,  // zoom level for maximum 31 days
            "editable": true
        };

        // Instantiate our timeline object.
        charttimeline = new links.Timeline(document.getElementById('timeline_slider'), $scope.timelineoptions);    
        links.events.addListener(charttimeline, 'changed', $scope.onRangeChange);
        links.events.addListener(charttimeline, 'add', $scope.onadd);
        // Draw our timeline with the created data and options
        charttimeline.draw($scope.charttimelinedata);  

        charttimeline.setSelection([{'row':0}]);
        charttimeline.move(0.5);
        charttimeline.zoom(-0.1);
        $scope.rangeSetExternally = false;
    }    
@josdejong
Copy link
Contributor

You probably mean to call charttimeline.draw(data) instead of redraw, which doesn't accept data.

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

No branches or pull requests

2 participants