Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts not displaying data labels for Pie chart in arabic

Tags:

highcharts

I am using Highcharts, I am facing a problem in Pie Charts for Arabic. Its working fine for English. I tried rtl & ltr but its not working.

var chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'pie' },

title: {
    text: 'یک نمودار؟!',
    useHTML: true, //bug fixed `IE9` and `EDGE`
    style: {
        fontSize: '20px',
        fontFamily: 'tahoma',
        direction: 'rtl',
    },
},

tooltip: {
    useHTML: true,
    style: {
        fontSize: '20px',
        fontFamily: 'tahoma',
        direction: 'rtl',
    },
},

plotOptions: {
    pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        dataLabels: {
            enabled: true,
            y: -5, //Optional
            format: '\u202B' + '{point.name}', // \u202B is RLE char for RTL support
            style: {
                fontSize: '15px',
                fontFamily: 'tahoma',
                textShadow: false, //bug fixed IE9 and EDGE
            },
        },
    },
},

series: [{
    name: 'برند',
    colorByPoint: true,
    data: [{
        name: 'الحجم الفعلي',
        y: 56.33
    }, {
        name: 'خرسانة جاهزة',
        y: 24.03,
    }, {
        name: 'خرسانة جاهزة',
        y: 10.38
    }, {
        name: 'سفاری؟!',
        y: 4.77
    }, {
        name: 'اوپرا؟!',
        y: 0.91
    }, {
        name: 'دیگر؟!',
        y: 0.2
    }],
}],

});

Example is here https://jsfiddle.net/NabiKAZ/h4kv0t9v/4/

like image 542
Khaan Avatar asked May 20 '17 05:05

Khaan


1 Answers

In plotOption add useHTML: true,

Forked Fiddle

    plotOptions: {
    pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        dataLabels: {
            enabled: true,
            y: -5, //Optional
            format: '\u202B' + '{point.name}', // \u202B is RLE char for RTL support
            style: {
                fontSize: '15px',
                fontFamily: 'tahoma',
                textShadow: false, //bug fixed IE9 and EDGE
            },
            useHTML: true,
        },
        //showInLegend: true,
    },
},
like image 167
Deep 3015 Avatar answered Oct 12 '22 23:10

Deep 3015