Skip to content

Commit

Permalink
Merge pull request #123 from LINCHENYU2030S/branch-v1.3
Browse files Browse the repository at this point in the history
Branch v1.3
  • Loading branch information
KamJiaYue authored Nov 2, 2023
2 parents 3f2a004 + ab58482 commit b6d3a9c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,23 @@ Examples:
* `bar s/` will show a bar chart categorized by student subject.
* `bar d/2023` will show a bar chart categorized by months in year 2023.

Below is the chart generated after entering `bar l/`.

![result for 'bar l/'](images/ug_images/barResult.png)

### Showing line chart
Showing a line chart describing number of students enrolled in each month in a specific year.

Format: `trend y/{year}`
* {year} is a 4 digit number representing year
* {} is not required

Examples:
* `trend y/2023` will show a line chart describing number of students enrolled
in each month in year 2023.

Below is the chart generated after typing `trend y/2023`
![result for 'trend y/2023'](images/ug_images/trendResult.png)

### Export visual representation : `export`

Expand Down Expand Up @@ -321,4 +338,5 @@ Action | Format, Examples
**Clear** | `clear`
**Show Table** | `table prefix/`<br> or `table d/YEAR` <br>
**Show Bar Chart** | `bar prefix/`<br> or `bar d/YEAR` <br>
**Show Line Chart** | `trend y/{year}`
**Help** | `help`
Binary file added docs/images/ug_images/barResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/ug_images/trendResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ public class TrendCommandParser implements Parser<TrendCommand> {
*/
public TrendCommand parse(String args) throws ParseException {
requireNonNull(args);
if (args.isEmpty() || !args.trim().matches("^\\d{4}$")) {
args = args.trim();
if (args.isEmpty() || !args.matches("^y/\\d{4}$")) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, TrendCommand.MESSAGE_USAGE)
);
}

return new TrendCommand(args.trim());
return new TrendCommand(args.substring(2));
}
}

0 comments on commit b6d3a9c

Please sign in to comment.