chartist icon indicating copy to clipboard operation
chartist copied to clipboard

Tooltip moves to top of screen away from chart after scrolling

Open linuxoid opened this issue 3 years ago • 1 comments

I set a bootstrap tooltip to a chart:

.on('draw', function(data) {
    if (data.type === 'point') {
        var index = data.index;
        var point = data.series.data[index];
        var value = point.value;
        var month = labels[index];
        data.element._node.setAttribute('data-chart-tooltip', 'steps-chart-total');
        data.element._node.setAttribute('title', month + ': ' + value);
        data.element.attr({
            style: 'stroke: #0099ff;',
        });
    }
})
.on('draw', function(data) {
    if (data.type === 'line') {
        data.element.attr({
            style: 'stroke: #0099ff;',
        });
    }
})
.on('created', function() {
    $('.steps-chart-total').tooltip({
        selector: '[data-chart-tooltip="steps-chart-total"]',
        container: '#steps_chart_total',
        html: true
    });
});

It shows correctly right above the line point only if the chart is at the top most part of the screen. If to see the chart you have to scroll the page, the tooltip moves well above the chart far away from the point nearly to the top of the screen.

How do I anchor it to the point even with scrolling?

How do I set pie chart slice colors with dynamic number of values in series. That is I don't now how many items I'll have so I can't assign classes to the slices.

linuxoid avatar Aug 10 '21 04:08 linuxoid

Hi @linuxoid!

Is the issue still relevant for you with the latest version (v1.1.2)?

Arantiryo avatar Sep 04 '22 15:09 Arantiryo