chartjs-plugin-datalabels icon indicating copy to clipboard operation
chartjs-plugin-datalabels copied to clipboard

adding `direction: rtl;` to body in css messes with center alignment

Open FLasH3r opened this issue 5 years ago • 3 comments

I've tried it with bar graph

body { direction: rtl; }

image

without body { direction: rtl; }

image

var graph_data = {
            labels: [200,301,404,500],
            datasets: [
                {
                    data: [67,1,0,0]
                    options: {
                        responsive:false
                    }
                }
            ]
        };
var myBarChart = new Chart(graph_ctx, {
            type: 'bar',
            data: graph_data,
            options: {
                legend: {
                    display: false
                },
                title: {
                    text: "bar graph",
                    display:true
                },
                animation: {
                    duration: 2000,
                },
                plugins: {
                    datalabels: {
                        color:'white',
                        display: function(context) {
                            return context.dataset.data[context.dataIndex] !== 0; // or >= 1 or ...
                        },
                        textShadowColor: 'black',
                        textShadowBlur: 2
                    }
                }
            }

FLasH3r avatar Jun 06 '20 18:06 FLasH3r

@FLasH3r can you create a codepen that reproduces your issue so it's easier for us to debug?

simonbrunel avatar Nov 14 '20 12:11 simonbrunel

I have been able to reproduce this issue but I don't have solution yet on how to fix it.

simonbrunel avatar Dec 23 '20 10:12 simonbrunel

use textAlign: "center", default is start

besufkadmenji avatar Jan 14 '22 15:01 besufkadmenji