-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
149 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# fcharts_example | ||
|
||
Demonstrates how to use the fcharts plugin. | ||
Demonstrates how to use the fcharts plugin. | ||
|
||
See `lib/line` for example charts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
|
||
/// 4-tiered level system. | ||
enum Level { | ||
Very, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:fcharts/fcharts.dart'; | ||
import 'package:fcharts_example/data.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:meta/meta.dart'; | ||
|
||
/// A city in the world. | ||
@immutable | ||
class City { | ||
const City(this.name, this.coolness); | ||
|
||
/// The name of the city. | ||
final String name; | ||
|
||
/// How cool this city is, this is how we measure the city in the chart. | ||
final Level coolness; | ||
} | ||
|
||
/// Our city data. | ||
final cities = [ | ||
new City("District X", Level.Not), | ||
new City("Gotham", Level.Kinda), | ||
new City("Mos Eisley", Level.Quite), | ||
new City("Palo Alto", Level.Very), | ||
]; | ||
|
||
class CityCoolnessChart extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return new LineChart.single( | ||
chartPadding: new EdgeInsets.fromLTRB(60.0, 10.0, 10.0, 20.0), | ||
line: new Line<City, String, Level>( | ||
data: cities, | ||
xFn: (city) => city.name, | ||
yFn: (city) => city.coolness, | ||
yAxis: new ChartAxis( | ||
tickLabelFn: (coolness) => | ||
coolness.toString().replaceFirst("Level\.", ""), | ||
), | ||
marker: | ||
const MarkerOptions(paint: const PaintOptions(color: Colors.blue)), | ||
stroke: const PaintOptions.stroke(color: Colors.blue), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters