Skip to content

Commit 2dc5d3a

Browse files
authored
Merge pull request #5 from macocci7/dev_1.0.2
#4: Refactor codes to follow psr12.
2 parents 12de8bf + 13f0561 commit 2dc5d3a

14 files changed

Lines changed: 806 additions & 491 deletions

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "macocci7/php-scatterplot",
33
"description": "it's easy to use for creating scatter plots.",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"type": "library",
66
"license": "MIT",
77
"autoload": {
@@ -18,6 +18,11 @@
1818
"minimum-stability": "stable",
1919
"require": {
2020
"intervention/image": "^2.7",
21-
"macocci7/php-frequency-table": "^1.1"
21+
"macocci7/php-frequency-table": "^1.1",
22+
"macocci7/php-csv": "^1.0",
23+
"macocci7/php-combination": "^1.0"
24+
},
25+
"require-dev": {
26+
"squizlabs/php_codesniffer": "^3.7"
2227
}
2328
}

composer.lock

Lines changed: 140 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/BasicUsage.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
require('../vendor/autoload.php');
34

45
use Macocci7\PhpScatterplot\Scatterplot;

example/ChangingProperties.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
require('../vendor/autoload.php');
34

45
use Macocci7\PhpScatterplot\Scatterplot;

example/Matrix.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<?php
2+
23
require('../vendor/autoload.php');
3-
require('./class/CsvUtil.php');
4-
require('./class/Combination.php');
54

6-
use Macocci7\CsvUtil;
7-
use Macocci7\Combination;
85
use Macocci7\PhpScatterplot\Scatterplot;
6+
use Macocci7\PhpCsv\Csv;
7+
use Macocci7\PhpCombination\Combination;
98

10-
$cu = new CsvUtil();
9+
$cu = new Csv('csv/weather_tokyo.csv');
1110
$cb = new Combination();
1211

13-
$cu->load('csv/weather_tokyo.csv')
14-
->encode('SJIS', 'UTF-8')
15-
->offset(7);
16-
$heads = $cu->heads(4);
17-
$days = $cu->raw()->column(0);
12+
$cu->encode('SJIS', 'UTF-8')
13+
->offsetRow(7);
14+
$heads = $cu->row(5);
15+
$days = $cu->raw()->column(1);
1816

1917
$dictionary = [
2018
'平均気温(℃)' => 'Mean Temperature(℃)',
@@ -24,7 +22,7 @@
2422
'降水量の合計(mm)' => 'Precipitation Amount(mm)',
2523
'平均現地気圧(hPa)' => 'Mean Local Air Pressure(hPa)',
2624
];
27-
$columns = [1, 4, 7, 10, 14, 21];
25+
$columns = [2, 5, 8, 11, 15, 22];
2826
$parsed = [];
2927
$pairs = $cb->pairs($columns);
3028
foreach ($pairs as $index => $pair) {
@@ -36,7 +34,7 @@
3634
'y' => $cu->float()->column($y),
3735
],
3836
];
39-
37+
4038
$sp = new Scatterplot();
4139
$sp->layers($layers)
4240
->regressionLineOn()
@@ -50,7 +48,9 @@
5048
// Markdown -------------------------------------
5149

5250
echo "# Scatterplot Matrix: Weather in Tokyo\n\n";
53-
echo "## Data Source\n\n<a href='https://www.data.jma.go.jp/gmd/risk/obsdl/' target='_blank'>Japan Meteorological Agency</a>\n\n";
51+
echo "## Data Source\n\n"
52+
. "<a href='https://www.data.jma.go.jp/gmd/risk/obsdl/' target='_blank'>"
53+
. "Japan Meteorological Agency</a>\n\n";
5454
echo "## Period: " . $days[0] . '' . $days[count($days) - 1] . "\n";
5555
$count = count($columns);
5656
echo "<table>\n";

example/ParsedData.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
require('../vendor/autoload.php');
34

45
use Macocci7\PhpScatterplot\Analyzer;

example/UsingLayers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
require('../vendor/autoload.php');
34

45
use Macocci7\PhpScatterplot\Scatterplot;

example/class/Combination.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)