0

こんにちは、私は欲しいチャートを作るのにかなり苦労してきました。

まず、YAXIS #1 にあるはずの株式ポートフォリオのパフォーマンス データがあります。次に、YAXIS #2 のベンチマークが必要です... ライン プロットは機能しますが、スケールが変です。

ここに画像の説明を入力

50 から始まり、10、15、20 などになっていることに注意してください。私のデータの範囲であるため、スケールは 3400 から 3800 の間である必要があります。

これが私のコードです:

    <?php // content="text/plain; charset=utf-8"
require($_SERVER['DOCUMENT_ROOT'] . '/wp-blog-header.php');
require_once ('jpgraph.php');
require_once ('jpgraph_line.php');
require_once ('jpgraph_date.php');
require_once ('jpgraph_utils.inc.php');

// Get a dataset
$data = get_transient( 'daily_nav' );
$ydata = $data[1];
$xdata = $data[0];

$data2 = get_transient( 'CAC40_history' );
$ydata2 = array_reverse($data2[1]);
$xdata2 = array_reverse($data2[0]);


$dateUtils = new DateScaleUtils();
list($tickPositions, $minTickPositions) = DateScaleUtils::GetTicks($xdata);

// Setup a basic graph
$width=800; $height=500;
$graph = new Graph($width, $height);
$graph->SetScale('datlin');

$graph->SetYScale(0,'lin');
$graph->SetYScale(1,'lin');

$graph->SetMargin(60,20,40,60);
$graph->xaxis->SetPos('min');
$graph->xaxis->SetTickPositions($tickPositions,$minTickPositions);

// Setup the titles
$graph->title->SetFont(FF_GEORGIA,FS_NORMAL,16);
$graph->title->Set('Performance vs. CAC40');
$graph->subtitle->SetFont(FF_ARIAL,FS_ITALIC,10);
$graph->subtitle->Set('graphique journalier depuis la création en juin 2012');

// Setup the labels to be correctly format on the X-axis
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
$graph->xaxis->SetLabelAngle(30);

// The second paramter set to 'true' will make the library interpret the
// format string as a date format. We use a Month + Year format m-d-Y
$graph->xaxis->SetLabelFormatString('m-Y',true);


// And then add line. We use two plots in order to get a
// more distinct border on the graph
$lp2 = new LinePlot($ydata,$xdata);
$lp2->SetColor('#71a7da');
$graph->Add($lp2);
$graph->xgrid->Show();
$graph->AddY(0,$lp2);

// second chart
$lp3 = new LinePlot($ydata2, $xdata2);
$lp3->SetColor('blue');
//$graph->Add($lp3);
//$graph->xgrid->Show();
$graph->AddY(1,$lp3);


// And send back to the client
$graph->Stroke();
?>

誰かが助けることができれば素晴らしいだろう、これを理解することはできません。ありがとう

4

1 に答える 1