Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
xqwzts committed Mar 16, 2018
1 parent 300d024 commit 3f93332
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 1 deletion.
138 changes: 137 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,146 @@
# WIP
[pub badge]

# flutter_sparkline

Beautiful sparkline charts for Flutter.

![screenshot](/screenshots/sparkline.png)

## Installation

Install the latest version from pub.

## Quick Start

Import the package, create a `Sparkline`, and pass it your data.

```dart
import 'package:flutter/material.dart';
import 'package:flutter_sparkline/flutter_sparkline.dart';
void main() {
var data = [0.0, 1.0, 1.5, 2.0, 0.0, 0.0, -0.5, -1.0, -0.5, 0.0, 0.0];
runApp(
new MaterialApp(
home: new Scaffold(
body: new Center(
child: new Container(
width: 300.0,
height: 100.0,
child: new Sparkline(
data: data,
),
),
),
),
),
);
}
```

![example screenshot](/screenshots/example_base.png)


## Customization

### Sparkline

| Property | Default |
|-----------|:----------------:|
| lineWidth | 2.0 |
| lineColor | Colors.lightBlue |

Example:

```dart
new Sparkline(
data: data,
lineWidth: 5.0,
lineColor: Colors.purple,
);
```

![exmaple screenshot](/screenshots/example_lineopts.png)

---

### Points

| Property | Default |
|------------|:---------------------:|
| pointsMode | PointsMode.none |
| pointSize | 4.0 |
| pointColor | Colors.lightBlue[800] |

| PointsMode | Description |
|:--------------:|-------------------------------------------|
| none (default) | Do not draw individual points. |
| all | Draw all the points in the data set. |
| last | Draw only the last point in the data set. |

Example:

```dart
new Sparkline(
data: data,
pointsMode: PointsMode.all,
pointSize: 8.0,
pointColor: Colors.amber,
);
```

![all points example screenshot](/screenshots/example_points_all.png)

```dart
new Sparkline(
data: data,
pointsMode: PointsMode.last,
pointSize: 8.0,
pointColor: Colors.amber,
);
```

![last point example screenshot](/screenshots/example_points_last.png)

---

### Fill

| Property | Default |
|-----------|:---------------------:|
| fillMode | FillMode.none |
| fillColor | Colors.lightBlue[200] |

| FillMode | Description |
|:--------------:|---------------------------------------|
| none (default) | Do not fill, draw only the sparkline. |
| above | Fill the area above the sparkline. |
| below | Fill the area below the sparkline. |

Example:

```dart
new Sparkline(
data: data,
fillMode: FillMode.below,
fillColor: Colors.red[200],
);
```

![fill below example screenshot](/screenshots/example_fill_below.png)

```dart
new Sparkline(
data: data,
fillMode: FillMode.above,
fillColor: Colors.red[200],
);
```

![fill above example screenshot](/screenshots/example_fill_above.png)

---

### Todo:

- [x] simple sparkline
Expand All @@ -25,3 +160,4 @@ Beautiful sparkline charts for Flutter.
- [ ] axis labels
- [ ] gradient shader on line paint
- [ ] multiple overlapping sparklines on a shared axis
- [ ] tests
Binary file added screenshots/example_base.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 screenshots/example_fill_above.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 screenshots/example_fill_below.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 screenshots/example_lineopts.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 screenshots/example_points_all.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 screenshots/example_points_last.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 modified screenshots/sparkline.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3f93332

Please sign in to comment.