2013-02-19 23 views
7

Highcharts non supporta rtl come valore predefinito. Quando si inseriscono testi rtl come ebraico/arabo, il testo viene completamente distrutto, rendendolo talvolta illeggibile. Come configurare HighCharts per supportare RTL?HighCharts per supportare RTL

Sto usando le dotnetHighCharts se aiuta ...

risposta

7

provare questo codice: Demo

var chart = new Highcharts.Chart({ 

chart: { 
    style:{ 
    direction: 'rtl' 
    }, 
    renderTo: 'container', 
    type: 'column' 
}, 

xAxis: { 
    categories: [ 
     ' تست a', 
     'حسن', 
     'كريم', 
     'محمود' 
    ], 
    reversed: true 
}, 

yAxis: { 

    labels: { 
     useHTML: true, 
      format: '{value} متر مربع' 
     }, 
    title: { 
     text: 'الاسم الأول', 
     useHTML: true 
    }, 
}, 
title: { 
    text: 'تست a', 
    useHTML: true 
}, 

legend: { 
    useHTML: true 
},  

tooltip: { 
    useHTML: true 

}, 

series: [{ 
    name: 'تست', 
    data: [10000,30000,20000,40000] 

}]}); 
2

È possibile utilizzare un carattere RLE (Start of right-to-left embedding) di controllo nel testo. essere simile a questo: Codice

format: '\u202B' + '{point.name}' 

Esempio:

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 
     }], 
    }], 

}); 

codice completo vedere in qui online: https://jsfiddle.net/NabiKAZ/h4kv0t9v/4/

+0

l'esempio non mostra alcun testo di etichetta tranne il titolo .. ho lo stesso problema ma non so come rimuovere questo problema ... https://jsfiddle.net/NabiKAZ/h4kv0t9v/4/ –

+0

@ MuhammadYasir sembra questo problema, c'è solo sul cromo. Lo lavoro –

+0

un po 'di body ha fatto per te .. per favore controllalo .. Basta aggiungere useHTML: true per tracciare le opzioni del tuo grafico https://jsfiddle.net/3me9h7k2/ –

0

è possibile impostare la direzione litri

Esempio:

<div id="container" style="direction: ltr"></div> 
4

Basta aggiungere useHTML: true per tracciare le opzioni del tuo grafico. Vedi demo qui jsfiddle.net/3me9h7k2

o

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 
      }, 
      useHTML: true, 
     }, 
     //showInLegend: true, 
    }, 
}, 

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 
    }], 
}], 

});