How do you change the colors of a series for the MChart component in Embarcadero's HTML5 Builder (Embarcadero® HTML5 Builder Version 5.1.167.137)? In my server mobile application, I use the code below to populate a chart from a DB with a parameter's values. I also create yellow low and high limit lines and red low and high limit lines. My problem is that I cannot figure out how to change the yellow and red series so that they are actually yellow and red.
Create a Server Mobile application, drop an MChart on the form, in the page OnShow event, use this code:
function MPage5Show($sender, $params)
{
// set up y-axis from 0 to 100
$this->MChart1->Axes->Left->Automatic=false;
$this->MChart1->Axes->Left->Minimum=0;
$this->MChart1->Axes->Left->Maximum=100;
$yellowLoValues = array();
$yellowHiValues = array();
$redLoValues = array();
$redHiValues = array();
$values = array();
// yellow low and hi limits
$ylo=30;
$yhi=70;
// red low and hi limits
$rlo=20;
$rhi=80;
for ($i=0;$i<10;$i++)
{
// generate random values, " Y, X "
array_unshift($values, rand(0,100).','.$i);
$yellowLoValues[] = $ylo;
$yellowHiValues[] = $yhi;
$redLoValues[] = $rlo;
$redHiValues[] = $rhi;
}
// MChart1->Data takes array with values as "Y,X"
$this->MChart1->Data = $values;
$series1=$this->MChart1->addSeries(new TeeLine($this));
$series1->ColorEach = ceNo;
$series1->Values=$yellowLoValues;
$series1->Title="Yellow Low Limit";
$series1=$this->MChart1->addSeries(new TeeLine($this));
$series1->ColorEach = ceNo;
$series1->Values=$yellowHiValues;
$series1->Title="Yellow High Limit";
$series1=$this->MChart1->addSeries(new TeeLine($this));
$series1->ColorEach = ceNo;
$series1->Values=$redLoValues;
$series1->Title="Red Low Limit";
$series1=$this->MChart1->addSeries(new TeeLine($this));
$series1->ColorEach = ceNo;
$series1->Values=$redHiValues;
$series1->Title="Red High Limit";
}