Back to PhocacartStatistics class

Method renderChartJsLine

public
renderChartJsLine
(mixed $id, mixed $dataA, mixed $dataALabel, mixed $dataB, mixed $dataBLabel, mixed $dataX)

Method renderChartJsLine - Source code

public function renderChartJsLine($id, $dataA, $dataALabel, $dataB, $dataBLabel, $dataX)
{
    /*$bC 	= 'rgba(79,152,195,1)';
            $baC	= 'rgba(79,152,195,0.5)';
            $pbC	= 'rgba(79,152,195,1)';
            $pbaC 	= 'rgba(255,255,255,1)';
    
            $bC2 	= 'rgba(210,214,222,1)';
            $baC2	= 'rgba(210,214,222,0.5)';
            $pbC2	= 'rgba(210,214,222,1)';
            $pbaC2 	= 'rgba(255,255,255,1)';*/
    $bC = 'rgba(247,99,151,1)';
    $baC = 'rgba(247,99,151,0.5)';
    $pbC = 'rgba(247,99,151,0.8)';
    $pbaC = 'rgba(255,255,255,1)';
    $bC2 = 'rgba(255, 170, 0,1)';
    $baC2 = 'rgba(255, 170, 0,0.5)';
    $pbC2 = 'rgba(255, 170, 0,0.8)';
    $pbaC2 = 'rgba(255,255,255,1)';
    $o = "\r\nvar config" . $id . " = {\r\ntype: 'line',             \r\ndata: {\r\n\tdatasets: [{\r\n\t\tdata: [" . $dataA . "],\r\n\t\tyAxisID: 'y-axis-2',\r\n\t\tpointRadius : 4,\r\n\t\tborderColor : '" . $bC . "',\r\n\t\tbackgroundColor : '" . $baC . "',\r\n\t\tpointBorderColor : '" . $pbC . "',\r\n\t\tpointBackgroundColor :'" . $pbaC . "',\r\n\t\tpointBorderWidth : 1,\r\n\t\tradius: 4,\r\n\t\tpointHoverRadius: 5,\r\n\t\t \r\n\t\tlabel: '" . htmlspecialchars($dataALabel) . "',\r\n\t\t/*fillColor: '#fff',\r\n\t\tstrokeColor: '#fff',\r\n\t\tpointColor: '#fff',\r\n\t\tpointStrokeColor: '#fff',\r\n\t\tpointHighlightFill: '#000',\r\n\t\tpointHighlightStroke: '#fff'*/\r\n\r\n\t}, {\r\n\t   data: [" . $dataB . "],\r\n\t\tyAxisID: 'y-axis-1',\r\n\t\tborderColor : '" . $bC2 . "',\r\n\t\tbackgroundColor : '" . $baC2 . "',\r\n\t\tpointBorderColor : '" . $pbC2 . "',\r\n\t\tpointBackgroundColor :'" . $pbaC2 . "',\r\n\t\tpointBorderWidth : 1,\r\n\t\tradius: 4,\r\n\t\tpointHoverRadius: 5,\r\n\t\t\r\n\t\tlabel: '" . htmlspecialchars($dataBLabel) . "',\r\n\r\n\t}],\r\n\tlabels: [" . htmlspecialchars($dataX) . "\r\n\t],\r\n},\r\nscaleIntegersOnly: true,\r\noptions: {  \r\n\t\tresponsive: true,\r\n\t\thoverMode: 'label',\r\n\t\tstacked: false,\r\n\t\tlegend: { labels: { fontColor: 'rgba(255,255,255,0.8)' } }, \r\n\t\tscales: {\r\n\t\t\txAxes: [{\r\n\t\t\t\tdisplay: true,\r\n\t\t\t\tgridLines: {\r\n\t\t\t\t\tdrawOnChartArea: true,\r\n\t\t\t\t\toffsetGridLines: false,\r\n\t\t\t\t\tshow: true,\r\n\t\t\t\t\tcolor: 'rgba(255,255,255,0.2)',\r\n\t\t\t\t\tzeroLineColor: 'rgba(255,255,255,0.2)',\r\n\t\t\t\t\tlineWidth: 1,\r\n\t\t\t\t\t/*drawOnChartArea: true,\r\n\t\t\t\t\tdrawTicks: true,\r\n\t\t\t\t\tzeroLineWidth: 10,\r\n\t\t\t\t\tzeroLineColor: '#fff300'*/\t\t\t\t\t\r\n\t\t\t\t},\r\n\t\t\t\tticks: {fontColor: 'rgba(255,255,255,0.9)'}\r\n\t\t\t}],\r\n\t\t\tyAxes: [{\r\n\t\t\t\ttype: 'linear',\r\n\t\t\t\tdisplay: true,\r\n\t\t\t\tposition: 'left',\r\n\t\t\t\tid: 'y-axis-1',\r\n\t\t\t\tgridLines: {\r\n\t\t\t\t\tdrawOnChartArea: true,\r\n\t\t\t\t\tcolor: 'rgba(255,255,255,0.2)',\r\n\t\t\t\t\tzeroLineColor: 'rgba(255,255,255,0.2)',\r\n\t\t\t\t\tlineWidth: 1,\r\n\t\t\t\t},\r\n\t\t\t\tlabel: 'text',\r\n\t\t\t\tticks: {\r\n\t\t\t\t    fontColor: 'rgba(255,255,255,0.9)',\r\n\t\t\t\t\tcallback: function(value) {\r\n\t\t\t\t\t\tif (value % 1 === 0) {\r\n\t\t\t\t\t\t\treturn Math.floor(value);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treturn '';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, {\r\n\t\t\t\ttype: 'linear',\r\n\t\t\t\tdisplay: true,\r\n\t\t\t\tposition: 'right',\r\n\t\t\t\tid: 'y-axis-2',\r\n\t\t\t\tgridLines: {\r\n\t\t\t\t\tdrawOnChartArea: false,\r\n\t\t\t\t\tcolor: 'rgba(255,255,255,0.2)',\r\n\t\t\t\t\tzeroLineColor: 'rgba(255,255,255,0.2)',\r\n\t\t\t\t},\r\n\t\t\t\tlabel: 'text',\r\n\t\t\t\tticks: {\r\n\t\t\t\t    fontColor: 'rgba(255,255,255,0.9)',\r\n\t\t\t\t\tcallback: function(value) {\r\n\t\t\t\t\t\tif (value % 1 === 0) {\r\n\t\t\t\t\t\t\treturn Math.floor(value);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treturn '';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}],\r\n\t\t},\r\n\t}\r\n};";
    Factory::getDocument()->addScriptDeclaration($o);
}