fcharts 0.0.11

  • Readme
  • Changelog
  • Example
  • Installing
  • 88

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

Example Usage #

class SimpleLineChart extends StatelessWidget {
  // X value -> Y value
  static const myData = [
    ["A", "✔"],
    ["B", "❓"],
    ["C", "✖"],
    ["D", "❓"],
    ["E", "✖"],
    ["F", "✖"],
    ["G", "✔"],
  ];
  
  @override
  Widget build(BuildContext context) {
    return new LineChart(
      lines: [
        new Line<List<String>, String, String>(
          data: myData,
          xFn: (datum) => datum[0],
          yFn: (datum) => datum[1],
        ),
      ],
      chartPadding: new EdgeInsets.fromLTRB(30.0, 10.0, 10.0, 30.0),
    );
  }
}

The above code creates:

line chart

0.0.9 - 0.0.10 #

  • Fix for latest Dart/Flutter updates
  • Dispose animation controller
  • Improved bar chart support

Note: Next updates will be focused on an improved API, better bar chart support, and interactive charts. I've got some additional time to dedicate to the library.

0.0.8 #

  • Added more examples
  • Wrapped up automatic span calculation

0.0.7 #

  • New API for creating a line chart widget

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/README.md

fcharts_example #

Demonstrates how to use the fcharts plugin.

See lib/line for example charts.

Use this package as a library

1. Depend on it

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


dependencies:
  fcharts: ^0.0.11

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub 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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
86
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Jan 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Fix lib/src/widgets/bar_chart.dart. (-1.99 points)

Analysis of lib/src/widgets/bar_chart.dart reported 4 hints:

line 4 col 8: Unused import: 'package:fcharts/src/decor/axis.dart'.

line 5 col 8: Unused import: 'package:fcharts/src/decor/decor.dart'.

line 6 col 8: Unused import: 'package:fcharts/src/utils/chart_position.dart'.

line 13 col 8: Unused import: 'dart:math'.

Fix lib/src/utils/monotone_interpolator.dart. (-0.50 points)

Analysis of lib/src/utils/monotone_interpolator.dart reported 1 hint:

line 61 col 11: Name non-constant identifiers using lowerCamelCase.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: 255 stdout: parsing /tmp/pub-dartlang-dartdocQIIYMT/pkg/lib/fcharts.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/collection/collection.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/developer/developer.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/internal/internal.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/interceptors.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/io/io.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/isolate/isolate.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/convert/convert.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/async/async.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/typed_data/typed_data.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_empty.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/js_util/js_util_dart2js.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/html/html_dart2js.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/math/math.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/core/core.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_http/http.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/ui/ui.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/js/js_dart2js.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/ffi/ffi.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/wasm/wasm.dart... [...] parsing /tmp/pub-dartlang-dartdocQIIYMT/pkg/lib/src/widgets/bar_chart.dart... parsing /tmp/pub-dartlang-dartdocQIIYMT/pkg/lib/src/widgets/base.dart... parsing /tmp/pub-dartlang-dartdocQIIYMT/pkg/lib/src/widgets/chart_view.dart... parsing /tmp/pub-dartlang-dartdocQIIYMT/pkg/lib/src/widgets/line_chart.dart... parsing /tmp/pub-dartlang-dartdocQIIYMT/pkg/lib/src/line/drawable.dart... parsing /tmp/pub-dartlang-dartdocQIIYMT/pkg/lib/src/widgets/sparkline.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/js_array.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/js_number.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/js_string.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/meta-1.1.8/lib/dart2js.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/typed_data-1.1.6/lib/typed_data.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/collection-1.14.11/lib/algorithms.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/collection-1.14.11/lib/iterable_zip.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/collection-1.14.11/lib/priority_queue.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/collection-1.14.11/lib/wrappers.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/collection-1.14.11/lib/equality.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_operations.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_lists.dart... parsing /tmp/pub-cache-dirQLDZIU/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_geometry.dart... stderr: Documenting fcharts... Unhandled exception: Stack Overflow #0 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1175:3) #1 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #2 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1321:13) #3 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #4 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #5 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:2197:16) #6 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1388:14) #7 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1367:11) #8 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #9 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #10 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1321:13) #11 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #12 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #13 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:2197:16) #14 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1388:14) #15 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1367:11) #16 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #17 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #18 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1321:13) #19 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #20 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #21 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:2197:16) #22 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1388:14) #23 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1367:11) #24 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #25 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #26 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1321:13) #27 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #28 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #29 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:2197:16) #30 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1388:14) #31 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1367:11) #32 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #33 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #34 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1321:13) #35 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #36 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #37 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:2197:16) #38 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1388:14) #39 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1367:11) #40 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) #41 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1282:14) #42 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1321:13) #43 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1289:14) ... ... #6874 ResolverVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:1308:13) #6875 FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:4969:49) #6876 ArgumentListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7520:20) #6877 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:1552:10) #6878 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:278:37) #6879 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6048:15) #6880 ReturnStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:8508:18) #6881 ResolverVisitor.visitReturnStatement (package:analyzer/src/generated/resolver.dart:1552:10) #6882 ReturnStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:8504:49) #6883 BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7520:20) #6884 ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:1552:10) #6885 BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1081:49) #6886 ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:1552:10) #6887 ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:721:13) #6888 MethodDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1036:49) #6889 UnifyingAstVisitor.visitMethodDeclaration (package:analyzer/dart/ast/visitor.dart:2140:2) #6890 ScopedVisitor.visitMethodDeclaration (package:analyzer/src/generated/resolver.dart:2779:11) #6891 ResolverVisitor.visitMethodDeclaration (package:analyzer/src/generated/resolver.dart:1488:13) #6892 MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:6943:49) #6893 ScopedVisitor.visitClassDeclaration (package:analyzer/src/generated/resolver.dart:3096:112088) #6894 ResolverVisitor.visitClassDeclaration (package:analyzer/src/generated/resolver.dart:764:13) #6895 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1519:49) #6896 ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:806:23) #6897 CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2095:49) #6898 LibraryAnalyzer._resolveFile (package:analyzer/src/dart/analysis/library_analyzer.dart:717:10) #6899 LibraryAnalyzer.analyzeSync.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the 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.11 1.14.12
flutter 0.0.0
meta ^1.1.2 1.1.8
Transitive dependencies
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
test ^1.3.0