fcharts 0.0.7

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 64

fcharts

Build Status Pub Status

A work-in-progress chart library for Flutter. Until version 1.0.0 the API is subject to change drastically. Needless to say, fcharts is not production ready.

The goal of this project is to allow for creating beautiful, responsive charts using a simple and intuitive API.

Inspired by Mikkel Ravn's tutorial on Flutter widgets and animations. If you have used Recharts (ReactJS library) you will find the high level API to be somewhat familiar.

Demo

Bar chart demo Touch demo

0.0.5 - 0.0.6

  • Begin adding tests
  • dartfmt

0.0.2 - 0.0.4

Just dependency, documentation, and format fixes.

0.0.1

Started the project!

  • Chart, a widget for creating a viewable chart from meaningful params
  • ChartData for creating a drawable
  • ChartDrawable for drawing directly to a canvas

example/lib/main.dart

import 'package:fcharts/fcharts.dart';
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class Datum {
  DateTime time;
  int cookies;
  int brownies;

  Datum(this.time, this.cookies, this.brownies);

  String get name => time.month.toString();

  @override
  String toString() {
    return 'Day($time, cookies=$cookies, brownies=$brownies)';
  }
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    final data = [
      new Datum(new DateTime(2018, 1, 1), 0, 0),
      new Datum(new DateTime(2018, 1, 2), 10, 7),
      new Datum(new DateTime(2018, 1, 3), 20, 6),
      new Datum(new DateTime(2018, 1, 4), 30, 4),
      new Datum(new DateTime(2018, 1, 5), 80, 4),
      new Datum(new DateTime(2018, 1, 6), 50, 2),
      new Datum(new DateTime(2018, 1, 7), 0, 1),
    ];

    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Cookies & Brownies Consumption'),
        ),
        body: new Container(
          decoration: new BoxDecoration(
            color: Colors.white,
          ),
          child: new AspectRatio(
            aspectRatio: 4.0 / 3.0,
            child: new LineChart(
              lines: [
                new Line<Datum, DateTime, int>(
                  data: data,
                  xFn: (day) => day.time,
                  yFn: (day) => day.cookies,
                  xAxis: new ContinuousAxis<DateTime>(
                    measure: new ContinuousMeasure<DateTime>(
                      span: new TimeSpan(data.first.time, data.last.time),
                      tickGenerator: IntervalTickGenerator.byDuration(
                        const Duration(
                          hours: 24,
                        ),
                      ),
                    ),
                    tickLabelFn: (time) => time.day.toString(),
                  ),
                  yAxis: new ContinuousAxis<int>(
                    measure: new ContinuousMeasure(
                      span: new IntSpan(0, 100),
                    ),
                    paint: new PaintOptions.stroke(color: Colors.green),
                  ),
                  stroke: new PaintOptions.stroke(
                    color: Colors.green,
                    strokeWidth: 2.0,
                  ),
                  fill: new PaintOptions(
                    color: Colors.green[200].withOpacity(0.5),
                  ),
                  marker: new MarkerOptions(
                    paint: [
                      new PaintOptions(color: Colors.green[700]),
                    ],
                    size: 4.0,
                    shape: MarkerShapes.circle,
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  fcharts: "^0.0.7"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:fcharts/fcharts.dart';
        
Version Uploaded Documentation Archive
0.0.7 Apr 24, 2018 Go to the documentation of fcharts 0.0.7 Download fcharts 0.0.7 archive
0.0.6 Apr 13, 2018 Go to the documentation of fcharts 0.0.6 Download fcharts 0.0.6 archive
0.0.5 Apr 2, 2018 Go to the documentation of fcharts 0.0.5 Download fcharts 0.0.5 archive
0.0.4 Mar 23, 2018 Go to the documentation of fcharts 0.0.4 Download fcharts 0.0.4 archive
0.0.3 Mar 23, 2018 Go to the documentation of fcharts 0.0.3 Download fcharts 0.0.3 archive
0.0.2 Mar 23, 2018 Go to the documentation of fcharts 0.0.2 Download fcharts 0.0.2 archive
0.0.1 Mar 23, 2018 Go to the documentation of fcharts 0.0.1 Download fcharts 0.0.1 archive

Analysis

We analyzed this package on Apr 24, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6
  • Flutter: 0.3.2

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
27 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
64
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 warning 3 hints.

    Strong-mode analysis of lib/src/utils/random_charts.dart gave the following warning:

    line: 39 col: 14
    The parameter 'domain' is required.

    Strong-mode analysis of lib/src/line/drawable.dart gave the following hint:

    line: 167 col: 30
    'INFINITY' is deprecated and shouldn't be used.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
collection ^1.14.5 1.14.6 1.14.9
flutter 0.0.0
meta ^1.1.2 1.1.2
Transitive dependencies
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6
Dev dependencies
flutter_test
test >=0.12.20 <0.13.0