저는 웹용 파이 차트와 응용 프로그램 (영어 + 아랍어) 다국어 사이트 (pdf보기)를 작성 중입니다. 웹 버전 용 나는 영어와 아랍어 모두보기 PDF에 대한 잘 작동하는 원형 차트를 만들기위한 JQplot js 플러그인을 사용하고 있습니다. 나는 Jpgraph PHP 라이브러리를 사용하고 있습니다. 아랍어로보기의 PDF 버전은 입니다. 문제는 전설이 역순으로오고 있습니다. 여기 범례가 아랍어 jpgraph에서 역순으로 변환됩니다.
내가 PDF에 대한 파이 차트를 생성하기 위해 사용하고있는 코드입니다.
function create_graph($chart_array, $plan_id,$lang,$site_lang){
require_once dirname(dirname(dirname(__FILE__))).'/application/third_party/jpgraph/src/jpgraph.php';
require_once dirname(dirname(dirname(__FILE__))).'/application/third_party/jpgraph/src/jpgraph_pie.php';
if(!empty($chart_array)){
foreach($chart_array as $chart){
if ($site_lang=='ar') {
$leg[] = $this->utf8_strrev($chart['0']); // to fix the reverse order issue originally it was only ($leg[] = $chart['0'] - no condition)
}else{
$leg[] = $chart['0'];
}
$data[] = $chart['1'];
}
$flag = true;
foreach($data as $_data){
if($_data != 0)
$flag = false;
}
if(!$flag){
// Create the Pie Graph.
$graph = new PieGraph(1000,950,"auto");
$graph->SetShadow();
$graph ->legend->Pos(0.25,0.8,"right" ,"right");
//$graph->legend->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->title->SetMargin (20);
// Create plots
$size=0.25;
$p1 = new PiePlot($data);
$p1->SetLegends($leg);
$p1->SetSize($size);
$p1->SetGuideLines(true,false);
$p1->SetGuideLinesAdjust(1.8,3);
$p1->SetCenter(0.25,0.32);
//$p1->value->SetFont(FF_VERDANA);
$p1->title->Set($lang->line('initial_investment_data'));
$p1->title->SetMargin(45);
$p1->SetSliceColors(array('red','orange','yellow','green','purple','blue','brown','black'));
$graph->Add($p1);
$graph->Stroke('assets/graph/initial_investment_'.$plan_id.'.png');
}
}
}
는이에
function utf8_strrev($str){
preg_match_all('/./us', $str, $ar);
return join('', array_reverse($ar[0]));
}
다음 내가 사용했던 역순으로 문제를 해결하기 위해 내가 무엇입니까 모든 공간 (예는 : 버그 흘려 넣기로 변경)로 반전 문자열입니다, 그래서이 단어를 푼다 의미.
jpgraph가 범례를 뒤집는 이유와이 역 문제를 해결하는 방법을 찾을 수 없습니다.