1 pièce(s) jointe(s)
[JpGraph] Probleme affichage la langue arabe sous Jpgraph
bonjour,j'ai un souci quand je mettre la legand en arabe avec la biblio jpgraph.le problème , les mots sont découpé
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| <?php
require 'jpgraph/src/jpgraph.php';
require 'jpgraph/src/jpgraph_pie.php';
require 'jpgraph/src/jpgraph_pie3d.php';
//require 'I18N/Arabic.php';
//include needed jpgraph classes
//include needed jpgraph classes
global $wpdb;
$sql=$wpdb->get_results("
SELECT COUNT(`الاسباب`) as total FROM `accidents` WHERE `الاسباب` like '%المداهمة%'
");
$sql2=$wpdb->get_results("SELECT COUNT(`الاسباب`) as ttsouker FROM `accidents` WHERE `الاسباب` like '%السياقة في حالة سكر%'");
$sql3=$wpdb->get_results("SELECT COUNT(`الاسباب`) as tintibeh FROM `accidents` WHERE `الاسباب` like '%السهو وعدم الانتباه%'");
$sql4=$wpdb->get_results("SELECT COUNT(`الاسباب`) as tarriere FROM `accidents` WHERE `الاسباب` like '%السير إلى الوراء%'");
$sql5=$wpdb->get_results("SELECT COUNT(`الاسباب`) as trapide FROM `accidents` WHERE `الاسباب` like '%السرعة%'");
$sql6=$wpdb->get_results("SELECT COUNT(`الاسباب`) as trues FROM `accidents` WHERE `الاسباب` like '%شق الطريق%'");
//image filename to save the chart
$fimg ='jpgraph-3d_pie.png';
//set chart data
//$data =[40,60,25,34];
//loop through the returned data
$data = array();
$datanom=array();
foreach ($sql as $key => $row) {
$data[] = $row->total;
}
foreach ($sql2 as $key => $row) {
$data[] = $row->ttsouker;
}
foreach ($sql3 as $key => $row) {
$data[] = $row->tintibeh;
}
foreach ($sql4 as $key => $row) {
$data[] = $row->tarriere;
}
foreach ($sql5 as $key => $row) {
$data[] = $row->trapide;
}
foreach ($sql6 as $key => $row) {
$data[] = $row->trues;
}
//var_dump($datanom);
//var_dump($data);
$graph = new PieGraph(800,400);
//customize the chart, using a predefined theme
$theme_class= new VividTheme;
$graph->SetTheme($theme_class);
$graph->SetShadow();
$graph->title->Set('توزيع الحوادث حسب الأسباب لسنة 2017 إلى غاية 16/11/2017');
$graph->title->SetFont(FF_FONT1,FS_BOLD);
//define data in chart
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice(1); //separate slice 1
$p1->SetCenter(0.5);
$p1->SetLegends(['المداهمة ','السياقة في حالة سكر','السهو وعدم الانتباه','السير إلى الوراء ','اللسياقة في حالة سكر ','السهو وعدم الإنتباه ',' السرعة ','شق الطريق ']);
$graph->legend->Pos(.088,0.9);
// $Arabic = new I18N_Arabic('Glyphs');
//$pl = $Arabic->utf8Glyphs($p1);
//add and save the chart
$graph->Add($p1);
$graph->Stroke($fimg);
$BASE_DIR="http://onsr2.clickerp.tn/jpgraph-3d_pie.png";
//if image file created, display it
if(file_exists($fimg)) echo '<img src="'. $BASE_DIR .'" />';
else echo 'Unable to create: '. $fimg;
?> |