Back to PhocacartStatistics class

Method renderChartJsLine2

public
renderChartJsLine2
(mixed $id, mixed $dataA, mixed $dataALabel, mixed $dataX)

Method renderChartJsLine2 - Source code

public function renderChartJsLine2($id, $dataA, $dataALabel, $dataX)
{
    $bC = 'rgba(52,140,212,1)';
    $baC = 'rgba(52,140,212,0.3)';
    $pbC = 'rgba(255,255,255,1)';
    $pbaC = 'rgba(52,140,212,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\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: '#000000' } }, \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: '#ffffff',\r\n\t\t\t\t\tzeroLineColor: '#ffffff',\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: '#000000'}\r\n\t\t\t}],\r\n\t\t\tyAxes: [{\r\n\t\t\t\ttype: 'linear',\r\n\t\t\t\tdisplay: false,\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: '#ffffff',\r\n\t\t\t\t\tzeroLineColor: '#ffffff',\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: '#000000',\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: '#ffffff',\r\n\t\t\t\t\tzeroLineColor: '#ffffff',\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: '#000000',\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);
}