patternfly-timeline icon indicating copy to clipboard operation
patternfly-timeline copied to clipboard

eventZoom recieves full dataset, not the d3 scale at the end of the zoom.

Open goulu opened this issue 6 years ago • 1 comments

creating a timeline with eventZoom callback as:

    var timelineChart = d3.chart.timeline()
        .eventZoom(function (d,i) {console.log(d,i);});

    d3.select('#timeline')
        .datum(data)
        .call(timelineChart);

when zooming, d parameter contains the full datum/data structure, not the d3 scale as stated in the doc.

(how to access to the scale's min+max ?)

goulu avatar Apr 30 '18 11:04 goulu

did it this way:

var timeline = d3.chart.timeline()
            .eventZoom(function (d,i) {
                let scale = timeline.Zoom.scales.x.domain(),
                startdate = scale[0].getTime(),
                enddate = scale[1].getTime();
                //...
})

goulu avatar May 01 '18 06:05 goulu