This is a demonstration that shows you a Line chart that has the "labelsAngled" feature enabled that may add labels to the line that follow the undulations of your line up and down.
Labels are drawn above the line, not the points that the line connects. You can have different text styles for up, down and level labels. All of the text configuration properties eventually fall back to the text* text styles. The property should be an array that contains three strings - the label for up, the label for down and the label for level, like this: labelsAngled: ["Up label", "Down label", "Level label"] However, if you're also setting the labelsAngledSpecific property then this must simply be set to true.
<?php
include_once "environment.php";
use phpRGraph\rgraph_chart;
use phpRGraph\rgraph_options;
// rgraph chart
$template = "default.php";
$draw_option = "draw()";
$width = "700";
$height = "350";
$chart = new rgraph_chart("cvs", null, "Line");
$data = array(1,9,5,6,3,4,8,5,2,2);
$chart->set_data($data);
$options = new rgraph_options("default.ini");
$options->set_option("title", "A chart with undulating labels");
$options->set_option("xaxisLabels",
array('Bob','Fred','John','Luis','Jo','Kane','Lou','Liam','Angie', 'Jim'));
$options->set_option('tickmarksSize', 5);
$options->set_option('tickmarksStyle', 'circle');
$options->set_option('marginInner', 15);
$options->set_option('textSize', 11);
$options->set_option('titleBold', true);
$options->$options->set_option('labelsAngled', true, true); // bypass type (array) check
$options->set_option('labelsAngledSpecific',
array('2013','2014','2015','2016','2017','2018','2019','2020','2021'));
$options->set_option('labelsAngledSize', 10);
$draw_option .= $options->getResponsiveFunction(array(0.4,990,1200,$width,$height));
$chart->set_options($options);
$rgraph_json = $chart->toString();
$chart_script = "";
$event_script = "";
include_once ($templates . $template);
?>