Skip to content

Commit 3d529fe

Browse files
committed
fix for #3 issue and some changes in code for better style code
1 parent a399f66 commit 3d529fe

14 files changed

+55
-30
lines changed

README.md

100644100755
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ return [
4040
```
4141
Where we have color setting in accordance with the chart type and according to the number of datasets that you will use.
4242

43-
For now, you must install and add to your layouts / templates the Chartjs library that can be easily
43+
For now, you must install and add to your layouts / templates the Chartjs library that can be easily
4444
found for download at: http://www.chartjs.org. This setting will also be improved.
4545

4646
# Usage:
@@ -104,6 +104,23 @@ Where $data is an array of information, the key serves as Label and the value is
104104
{!! app()->chartradar->render("RadarChart", $data) !!}
105105
```
106106

107+
4 - Line Chart:
108+
```php
109+
<div class="container-fluid">
110+
<canvas id="LineChart" style="width:50%;"></canvas>
111+
</div>
112+
113+
<?php
114+
$data = array(
115+
'Eating' => array(33, 34),
116+
'Coding' => array(32, 123),
117+
'Sleeping' => array(12, 90)
118+
);
119+
?>
120+
121+
{!! app()->chartline->render("LineChart", $data) !!}
122+
```
123+
107124
# OBS:
108125
This README as well as the package is in development but will be constantly updated and will keep you informed as soon as
109126
are ready for production. Thank you for understanding.

composer.json

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"require": {
1313
"php": ">=5.5.9",
14-
"laravel/framework": "5.1.*|5.0.*"
14+
"laravel/framework": "5.*"
1515
},
1616

1717
"autoload": {

src/ChartBar.php

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public function render($canvas, array $data, array $options = null)
5151
}
5252

5353
return view('chart-bar::chart-bar')
54-
->with(['element' => $canvas,
55-
'dataset' => $dataset,
56-
'labels' => $labels,
57-
'colours' => $colours,
58-
'qtdDatasets' => $datasetQnt
54+
->with(['element' => $canvas,
55+
'dataset' => $dataset,
56+
'labels' => $labels,
57+
'colours' => $colours,
58+
'qtdDatasets' => $datasetQnt
5959
]);
6060

6161
}

src/ChartLine.php

100644100755
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct(array $colours)
2626
*
2727
* @param $canvas
2828
* @param array $data
29+
* @param array $options
2930
* @return $this
3031
*/
3132
public function render($canvas, array $data, array $options = null)
@@ -50,11 +51,11 @@ public function render($canvas, array $data, array $options = null)
5051
}
5152

5253
return view('chart-line::chart-line')
53-
->with(['element' => $canvas,
54-
'dataset' => $dataset,
55-
'labels' => $labels,
56-
'colours' => $colours,
57-
'qtdDatasets' => $datasetQnt
54+
->with(['element' => $canvas,
55+
'dataset' => $dataset,
56+
'labels' => $labels,
57+
'colours' => $colours,
58+
'qtdDatasets' => $datasetQnt
5859
]);
5960

6061
}

src/ChartPieAndDoughnut.php

100644100755
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public function render($canvas, array $data, array $options = null)
5757
}
5858

5959
return view('chart-pie-doughnut::chart-pie-doughnut')
60-
->with(['element' => $canvas,
61-
'data' => $finalData,
62-
'qtdData' => $dataQtd,
63-
'type' => $type
60+
->with(['element' => $canvas,
61+
'data' => $finalData,
62+
'qtdData' => $dataQtd,
63+
'type' => $type
6464
]);
6565

6666
}

src/ChartRadar.php

100644100755
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct(array $colours)
2626
*
2727
* @param $canvas
2828
* @param array $data
29+
* @param array $options
2930
* @return $this
3031
*/
3132
public function render($canvas, array $data, array $options = null)
@@ -50,11 +51,11 @@ public function render($canvas, array $data, array $options = null)
5051
}
5152

5253
return view('chart-radar::chart-radar')
53-
->with(['element' => $canvas,
54-
'dataset' => $dataset,
55-
'labels' => $labels,
56-
'colours' => $colours,
57-
'qtdDatasets' => $datasetQnt
54+
->with(['element' => $canvas,
55+
'dataset' => $dataset,
56+
'labels' => $labels,
57+
'colours' => $colours,
58+
'qtdDatasets' => $datasetQnt
5859
]);
5960

6061
}

src/Contracts/Chartjs.php

100644100755
File mode changed.

src/Providers/ChartjsServiceProvider.php

100644100755
File mode changed.

src/config/chartjs.php

100644100755
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
'colours' => [
1515

1616
'line' => [
17-
'rgba(220,220,220,0.5)',
18-
'rgba(151,187,205,0.8)',
17+
'rgba(220,220,220,0.2)',
18+
'rgba(24, 164, 103, 0.7)',
19+
'rgba(151,187,205,0.2)',
1920
'rgba(24, 164, 103, 0.7)',
2021
],
2122

@@ -26,8 +27,9 @@
2627
],
2728

2829
'radar' => [
29-
'rgba(220,220,220,0.5)',
30-
'rgba(151,187,205,0.8)',
30+
'rgba(220,220,220,0.2)',
31+
'rgba(24, 164, 103, 0.7)',
32+
'rgba(151,187,205,0.2)',
3133
'rgba(24, 164, 103, 0.7)',
3234
],
3335

src/resources/views/autoload.blade.php

100644100755
File mode changed.

src/resources/views/chart-bar.blade.php

100644100755
File mode changed.

src/resources/views/chart-line.blade.php

100644100755
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
label.push("<?php echo $label; ?>");
1212
<?php endforeach; ?>
1313
14-
1514
/**
1615
* This function is responsible for loading the window.load and instantiate our chart.
1716
* The parameters of data and options are passed directly to avoid conflict with the
@@ -37,8 +36,10 @@
3736
label: "Dados primários",
3837
fillColor: "<?php echo $colours[$i]; ?>",
3938
strokeColor: "<?php echo $colours[$i]; ?>",
40-
highlightFill: "<?php echo $colours[$i]; ?>",
41-
highlightStroke: "<?php echo $colours[$i]; ?>",
39+
pointColor: "<?php echo $colours[$i]; ?>",
40+
pointStrokeColor: "#fff",
41+
pointHighlightFill: "#fff",
42+
pointHighlightStroke: "<?php echo $colours[$i]; ?>",
4243
data : [<?php echo $dado; ?>]
4344
4445
<?php
@@ -54,6 +55,7 @@
5455
// Options section
5556
// ---------------------------------------------------------------
5657
{
58+
5759
responsive:true
5860
});
5961
// End options section

src/resources/views/chart-pie-doughnut.blade.php

100644100755
File mode changed.

src/resources/views/chart-radar.blade.php

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
label: "Dados primários",
3838
fillColor: "<?php echo $colours[$i]; ?>",
3939
strokeColor: "<?php echo $colours[$i]; ?>",
40-
highlightFill: "<?php echo $colours[$i]; ?>",
41-
highlightStroke: "<?php echo $colours[$i]; ?>",
40+
pointColor: "<?php echo $colours[$i]; ?>",
41+
pointStrokeColor: "#fff",
42+
pointHighlightFill: "#fff",
43+
pointHighlightStroke: "<?php echo $colours[$i]; ?>",
4244
data : [<?php echo $dado; ?>]
4345
4446
<?php

0 commit comments

Comments
 (0)