Moved chart styles to reports.css (#342)

This commit is contained in:
FrancescoUK
2016-05-22 21:07:11 +01:00
parent 41e4285d65
commit bd208c6d0d
9 changed files with 46 additions and 112 deletions

View File

@@ -422,6 +422,7 @@ class Reports extends Secure_area
$this->load->view("reports/graphical", $data);
}
// escape js text to avoid any issue with php strings having only one \ where js requires \\
private function _escapeJavaScriptText($string)
{
return str_replace("\n", '\n', str_replace('"', '\"', addcslashes(str_replace("\r", '', (string)$string), "\0..\37'\\")));
@@ -469,7 +470,7 @@ class Reports extends Secure_area
$series = '';
foreach($report_data as $row)
{
$labels .= "'" . $row['category'] . "', ";
$labels .= "'" . $this->_escapeJavaScriptText($row['category']) . "', ";
$series .= $row['total'] . ", ";
}
@@ -497,7 +498,7 @@ class Reports extends Secure_area
$series = '';
foreach($report_data as $row)
{
$labels .= "'" . $row['supplier'] . "', ";
$labels .= "'" . $this->_escapeJavaScriptText($row['supplier']) . "', ";
$series .= $row['total'] . ", ";
}
@@ -525,7 +526,7 @@ class Reports extends Secure_area
$series = '';
foreach($report_data as $row)
{
$labels .= "'" . $row['employee'] . "', ";
$labels .= "'" . $this->_escapeJavaScriptText($row['employee']) . "', ";
$series .= $row['total'] . ", ";
}
@@ -581,7 +582,7 @@ class Reports extends Secure_area
$series = '';
foreach($report_data as $row)
{
$labels .= "'" . $row['customer'] . "', ";
$labels .= "'" . $this->_escapeJavaScriptText($row['customer']) . "', ";
$series .= $row['total'] . ", ";
}

View File

@@ -64,7 +64,7 @@
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=50ab19585f"/>
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=feb26bc97a"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=8a467f3c3b"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=2236ceec88" language="javascript"></script>

View File

@@ -1,30 +1,3 @@
<style>
/* style X axis labels to be rotated of 60 degrees */
.ct-label.ct-horizontal {
/* Safari */
-webkit-transform: rotate(-60deg);
/* Firefox */
-moz-transform: rotate(-60deg);
/* IE */
-ms-transform: rotate(-60deg);
/* Opera */
-o-transform: rotate(-60deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
/* set all lables to be black with font size 1.2rem */
.ct-label {
fill: rgba(0,0,0,1);
color: rgba(0,0,0,1);
font-size: 1.2rem;
}
</style>
<script>
// Labels and data series
var data = {
@@ -47,12 +20,7 @@
// Y-Axis specific configuration
axisY: {
// Lets offset the chart a bit from the labels
offset: 60,
// The label interpolation function enables you to modify the values
// used for the labels on each axis.
// labelInterpolationFnc: function(value) {
// return '$' + value;
// }
offset: 60
},
// plugins configuration
@@ -78,6 +46,7 @@
flipTitle: false
}
}),
Chartist.plugins.ctPointLabels({
textAnchor: 'middle'
})

View File

@@ -1,30 +1,3 @@
<style>
/* style X axis labels to be rotated of 60 degrees */
.ct-label.ct-horizontal {
/* Safari */
-webkit-transform: rotate(-60deg);
/* Firefox */
-moz-transform: rotate(-60deg);
/* IE */
-ms-transform: rotate(-60deg);
/* Opera */
-o-transform: rotate(-60deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
/* set all lables to be black with font size 1.2rem */
.ct-label {
fill: rgba(0,0,0,1);
color: rgba(0,0,0,1);
font-size: 1.2rem;
}
</style>
<script>
// Labels and data series
var data = {
@@ -49,12 +22,7 @@
// Y-Axis specific configuration
axisY: {
// Lets offset the chart a bit from the labels
offset: 120,
// The label interpolation function enables you to modify the values
// used for the labels on each axis.
// labelInterpolationFnc: function(value) {
// return '$' + value;
// }
offset: 120
},
// plugins configuration
@@ -80,6 +48,7 @@
flipTitle: false
}
}),
Chartist.plugins.ctPointLabels({
textAnchor: 'middle'
})

View File

@@ -1,30 +1,3 @@
<style>
/* style X axis labels to be rotated of 60 degrees */
.ct-label.ct-horizontal {
/* Safari */
-webkit-transform: rotate(-60deg);
/* Firefox */
-moz-transform: rotate(-60deg);
/* IE */
-ms-transform: rotate(-60deg);
/* Opera */
-o-transform: rotate(-60deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
/* set all lables to be black with font size 1.2rem */
.ct-label {
fill: rgba(0,0,0,1);
color: rgba(0,0,0,1);
font-size: 1.2rem;
}
</style>
<script>
// Labels and data series
var data = {
@@ -36,7 +9,7 @@
};
// We are setting a few options for our chart and override the defaults
var options = {
var options = {
// Draw the line chart points
showPoint: true,
@@ -92,6 +65,7 @@
flipTitle: false
}
}),
Chartist.plugins.ctPointLabels({
textAnchor: 'middle'
})

View File

@@ -1,12 +1,3 @@
<style>
/* set all lables to be black with font size 1.2rem */
.ct-label {
fill: rgba(0,0,0,1);
color: rgba(0,0,0,1);
font-size: 1.2rem;
}
</style>
<script>
// Labels and data series
var data = {
@@ -19,7 +10,9 @@
// We are setting a few options for our chart and override the defaults
var options = {
chartPadding: 50,
labelPosition: 'outside',
// interpolate labels to show lable, value and %
labelInterpolationFnc: function(label, index) {
return label + ": " + data.series[index] + " / " + Math.round(data.series[index] / data.series.reduce(sum) * 100) + '%';

View File

@@ -23,7 +23,35 @@
{
}
#chart_wrapper
/* set the chart to be centered */
.ct-chart
{
text-align: center;
}
/* style chart X axis labels to be rotated of 60 degrees */
.ct-label.ct-horizontal
{
/* Safari */
-webkit-transform: rotate(-60deg);
/* Firefox */
-moz-transform: rotate(-60deg);
/* IE */
-ms-transform: rotate(-60deg);
/* Opera */
-o-transform: rotate(-60deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
/* set all lables to be black with font size 1.2rem */
.ct-label
{
fill: rgba(0,0,0,1);
color: rgba(0,0,0,1);
font-size: 1.2rem;
}

View File

File diff suppressed because one or more lines are too long

View File

@@ -61,7 +61,7 @@
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=50ab19585f"/>
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=feb26bc97a"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=8a467f3c3b"/>
<!-- end mincss template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- start minjs template tags -->