mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-07-10 15:06:26 -04:00
Set height for charts to 80% (#342)
Fix encoding issues for chartist data
This commit is contained in:
@@ -574,7 +574,7 @@ class Reports extends Secure_area
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type));
|
||||
|
||||
$labels = array();
|
||||
$series = '';
|
||||
$series = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$labels[] = $row['customer'];
|
||||
@@ -615,8 +615,8 @@ class Reports extends Secure_area
|
||||
"title" => $this->lang->line('reports_discounts_summary_report'),
|
||||
"subtitle" => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
"chart_type" => "reports/graphs/bar",
|
||||
"labels_1" => rtrim($labels, ", "),
|
||||
"series_data_1" => rtrim($series, ", "),
|
||||
"labels_1" => $labels,
|
||||
"series_data_1" => $series,
|
||||
"summary_data_1" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type)),
|
||||
"yaxis_title" => $this->lang->line('reports_count'),
|
||||
"xaxis_title" => $this->lang->line('reports_discount_percent')
|
||||
@@ -633,20 +633,20 @@ class Reports extends Secure_area
|
||||
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type));
|
||||
|
||||
$labels = '';
|
||||
$series = '';
|
||||
$labels = array();
|
||||
$series = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$labels .= "'" . $row['payment_type'] . "', ";
|
||||
$series .= $row['payment_amount'] . ", ";
|
||||
$labels[] = $row['payment_type'];
|
||||
$series[]= $row['payment_amount'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_payments_summary_report'),
|
||||
"subtitle" => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
"chart_type" => "reports/graphs/pie",
|
||||
"labels_1" => rtrim($labels, ", "),
|
||||
"series_data_1" => rtrim($series, ", "),
|
||||
"labels_1" => $labels,
|
||||
"series_data_1" => $series,
|
||||
"summary_data_1" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type))
|
||||
);
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
offset: 60
|
||||
},
|
||||
|
||||
width: '100%',
|
||||
height: '75%',
|
||||
|
||||
// plugins configuration
|
||||
plugins: [
|
||||
Chartist.plugins.ctAxisTitle({
|
||||
@@ -31,7 +34,7 @@
|
||||
axisClass: 'ct-axis-title',
|
||||
offset: {
|
||||
x: 0,
|
||||
y: 100
|
||||
y: 80
|
||||
},
|
||||
textAnchor: 'middle'
|
||||
},
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
offset: 120
|
||||
},
|
||||
|
||||
width: '80%',
|
||||
height: '80%',
|
||||
|
||||
// plugins configuration
|
||||
plugins: [
|
||||
Chartist.plugins.ctAxisTitle({
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
<script>
|
||||
// Labels and data series
|
||||
var data = {
|
||||
labels: [<?php echo $labels_1; ?>],
|
||||
series: [<?php echo $series_data_1; ?>]
|
||||
labels: <?php echo json_encode($labels_1); ?>,
|
||||
series: <?php echo json_encode($series_data_1); ?>
|
||||
};
|
||||
|
||||
var sum = function(a, b) { return a + b };
|
||||
|
||||
// We are setting a few options for our chart and override the defaults
|
||||
var options = {
|
||||
chartPadding: 50,
|
||||
|
||||
width: '100%',
|
||||
height: '80%',
|
||||
|
||||
labelPosition: 'outside',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user