Thanks Bright, in my case data source is from MySql query and I have tried already to combine category name using this rule directly in query, but it doeasn't work if defined in "columns". I can combine such a string directly in query using:
->query( "SELECT CONCAT('[\'',OrderNumber,'\',\'',Worker,'\']') AS WorkerComb,(...)
(...)
->pipe(new ColumnRename(array(
"WorkerComb"=>"Pracownik",
(...)
...but how to refer to this in xaxis | categories ?
At the moment I have following:
protected function setup() {
//Select the data source
$this->src("3Mreport")
->query("
SELECT CONCAT_WS('\n',OrderNumber,Worker) AS WorkerComb, Station, WGCode, WGName,unit,EffectiveTime, TotalTime, QtyDone, Efektywność, Wydajność, GoalMAX, GoalMIN, EGoal
FROM WE_STA_TempFinal
")
->pipe(new ColumnRename(array(
"WorkerComb"=>"Pracownik",
"Station"=>"Stanowisko",
"WGCode"=>"Kod wyrobu",
"WGName"=>"Nazwa wyrobu",
"unit"=>"Jedn.",
"EffectiveTime"=>"Czas efektywny",
"TotalTime"=>"Czas całkowity",
"QtyDone"=>"Ilość",
"GoalMAX"=>"Norma MAX",
"GoalMIN"=>"Norma MIN",
"EGoal"=>"Norma akt."
)))
->pipe($this->dataStore("results"));
}
}
in BarChart create I have:
\koolreport\apexcharts\BarChart::create(array(
"name"=>"testchart",
"dataSource"=>$this->dataStore('results'),
"columns" => array(
'Pracownik',
'Wydajność' => array(
'type'=>'number',
'decimals'=>2,
),
'Norma MAX' => array(
'type'=>'number',
'decimals'=>2,
'marker' => [
'strokeWidth' => 5,
'strokeColor' => '#775DD0'
]
),
'Norma MIN' =>[
'marker' => [
'strokeWidth' => 5,
'strokeColor' => '#775DD0'
]
],
'Norma akt.'=>[
'marker' => [
'strokeWidth' => 5,
'strokeColor' => '#775DD0'
]
]
),
"options"=>array(
"chart" => array(
"height" => '200px',
),
"xaxis"=>array(
"labels"=>array(
"show" => true,
"maxWidth" => 300
))
),
"maxWidth" => "80%",
));