:bar_chart: [wip] Create beautiful, responsive, animated charts using a simple and intuitive API.

Overview

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

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

Comments
  • set x and y axis values ordered

    set x and y axis values ordered

    Hi

    i have example code to show line chart, but X and Y axis values not ordered, how can i make it ordered from 0 to big number in series.

    `class SimpleLineChart extends StatelessWidget { // X value -> Y value static const myData = [ [2,5], [1,3], [10,9], ];

    @override Widget build(BuildContext context) { return new LineChart( lines: [ new Line<List, String, String>( data: myData, xFn: (datum) => datum[0], yFn: (datum) => datum[1], ), ], chartPadding: new EdgeInsets.fromLTRB(30.0, 10.0, 10.0, 30.0), ); } }`

    question 
    opened by nasr25 3
  • Control of chart animation

    Control of chart animation

    It would be great to have the ability to control the animation of the data being written to the charts. For example a line graph that would draw temperature in realtime while the use is watching it.

    opened by rubberbird 3
  • revision 6a3ff018b1 (2 weeks ago) • 2018-10-26 01:30:21 -0400 breaks fcharts 0.0.9

    revision 6a3ff018b1 (2 weeks ago) • 2018-10-26 01:30:21 -0400 breaks fcharts 0.0.9

    Flutter 0.10.1 • channel dev • https://github.com/flutter/flutter.git Framework • revision 6a3ff018b1 (2 weeks ago) • 2018-10-26 01:30:21 -0400

    Compiler message: file:///dev/pub.dartlang.org/fcharts-0.0.9/lib/src/bar/data.dart:14:7: Error: Inferred type argument '#lib1::ChartDrawable<dynamic, #lib1::ChartTouch>' violates the corresponding type variable bound of 'ChartData' in the supertype 'ChartData' of class 'BarGraphData'. Try specifying type arguments explicitly so that they conform to the bounds. class BarGraphData implements ChartData { ^ file:///dev/flutter/.pub-cache/hosted/pub.dartlang.org/fcharts-0.0.9/lib/src/chart_data.dart:4:26: Context: Bound of this variable is violated. abstract class ChartData<T extends ChartDrawable<T, ChartTouch>> { ^ Compiler terminated unexpectedly.

    Please help!

    bug high priority 
    opened by LiveRock 2
  • multi line charts documentation not sufficient

    multi line charts documentation not sufficient

    The documentation is not enough,please provide some detail documentation on How to use multi lines in in Linechart and please specify what each property is about

    opened by maheshmnj 1
  • [Question] Y axis order

    [Question] Y axis order

    Hello, how can I order the Y axis in order to show a kind of timeline chart? I'm trying something like this, but the Y axis is not ordering, it just appears in the order is set, '37.93' should appear at the top:

    static const myData = [
      ["2018-10-23","37.65"],
      ["2018-10-24","37.63"],
      ["2018-10-25","37.93"],
      ["2018-10-26","37.85"],
      ["2018-10-27","37.85"]
    ];
    

    ...

    LineChart(
                  lines:
                  [
                    new Line<List, String, double>(
                      stroke: PaintOptions.stroke(color: Colors.green,strokeWidth: 3.0),
                      marker: MarkerOptions(paint: PaintOptions.fill(color: Colors.blue)),
                      data: myData,
                      xFn: (datum) => datum[0],
                      yFn: (datum) => double.parse(datum[1]),
                    ),
                  ],
                  chartPadding: new EdgeInsets.fromLTRB(60.0, 10.0, 10.0, 30.0),
                )
    
    
    question 
    opened by marianoarga 1
  • Chart rotation

    Chart rotation

    Support for horizontal bar charts or vertical line charts is hacky right now.

    Requires some looking into, there are many approaches to accomplish it. The underlying axes shouldn't have to change, just the line chart and bar chart drawables.

    image

    enhancement 
    opened by thekeenant 1
  • Support categorical or continuous axes (both x and y)

    Support categorical or continuous axes (both x and y)

    X is strictly categorical right now, while Y is strictly continuous.

    One might want to represent time on the X axis, which is a continuous measurement. Or you might want categories such as colors on the Y axis.

    enhancement 
    opened by thekeenant 1
  • Add support for log scale or custom scales

    Add support for log scale or custom scales

    Currently only linear axes are supported. Perhaps some typedef which would map to a linear scale so it can be drawn like normal.

    i.e. for semi-log: 10,000 -> 1.0 1,000 -> 0.75 100 -> 0.5 10 -> 0.25 0 -> 0

    or for linear (the default): 10,000 -> 1.0 1,000 -> 0.1 100 -> 0.01 10 -> 0.001 0 -> 0

    enhancement 
    opened by thekeenant 1
  • LineChart not showing all lines in chart

    LineChart not showing all lines in chart

    Hello, i wrote a code to make a chart with 3 lines but only 2 shows on chart.

    CODE

    LineChart(
                          lines: [
    
                            Line<List, String, double>(
                              data: jic,
                              xFn: (datum) => datum[0],
                              yFn: (datum) => datum[1],
                              xAxis: xAxis,
                              yAxis: ChartAxis(
                                tickLabelFn: (jic) => jic.toString(),
                                tickLabelerStyle: TextStyle(color: Colors.orange, fontWeight: FontWeight.bold),
                                paint: PaintOptions.stroke(color: Colors.orange),
                              ),
                              marker: MarkerOptions(
                                paint: PaintOptions.fill(color: Colors.orange),
                              ),
                              stroke: PaintOptions.stroke(color: Colors.orange),
                              legend: LegendItem(
                                paint: PaintOptions.fill(color: Colors.orange),
                                text: 'Jidecoin',
                              ),
                            ),
    
    
                            Line<List, String, double>(
                              data: amc,
                              xFn: (datum) => datum[0],
                              yFn: (datum) => datum[1],
                              xAxis: xAxis,
                              yAxis: ChartAxis(
                                tickLabelFn: (amc) => amc.toString(),
                                tickLabelerStyle: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
                                paint: PaintOptions.stroke(color: Colors.red),
                              ),
                              marker: MarkerOptions(
                                paint: PaintOptions.fill(color: Colors.red),
                              ),
                              stroke: PaintOptions.stroke(color: Colors.red),
                              legend: LegendItem(
                                paint: PaintOptions.fill(color: Colors.red),
                                text: 'Amolecoin',
                              ),
                            ),
    
    
                            Line<List, String, double>(
                              data: bec,
                              xFn: (datum) => datum[0],
                              yFn: (datum) => datum[1],
                              xAxis: xAxis,
                              yAxis: ChartAxis(
                                tickLabelFn: (bec) => bec.toString(),
                                tickLabelerStyle: TextStyle(color: Colors.green, fontWeight: FontWeight.bold),
                                paint: PaintOptions.stroke(color: Colors.green),
                              ),
                              marker: MarkerOptions(
                                paint: PaintOptions.fill(color: Colors.green),
                              ),
                              stroke: PaintOptions.stroke(color: Colors.green),
                              legend: LegendItem(
                                paint: PaintOptions.fill(color: Colors.green),
                                text: 'Bekalucoin',
                              ),
                            ),
                          ],
                          chartPadding: EdgeInsets.fromLTRB(30.0, 22.0, 00.0, 30.0),
                        ),
    

    Result. Screen Shot 2019-06-04 at 3 55 40 PM

    The line third line is not showing..

    opened by JideGuru 0
  • Did x axis and y axis sort?

    Did x axis and y axis sort?

    Hi I create a line chart but I could not let the x axis and y axis sort same time.

    image

    if I sort the data for y axis, the graph will show ... image

    my line chart code...

    LineChart(
                chartPadding: new EdgeInsets.fromLTRB(50, 35, 50, 35),
                lines: [
                  new Line<FuelListDetailList, String, double>(
                    data: consumption,
                    xFn: (list) => list.record_date,
                    yFn: (list) => list.liters_per_km,
                    xAxis: xAxis,
                    yAxis: new ChartAxis(
                      tickLabelerStyle: new TextStyle(
                          color: Colors.blue, fontWeight: FontWeight.bold),
                      paint: const PaintOptions.stroke(color: Colors.blue),
                    ),
                    marker: const MarkerOptions(
                      paint: const PaintOptions.fill(color: Colors.blue),
                    ),
                    stroke: const PaintOptions.stroke(color: Colors.blue),
                    legend: new LegendItem(
                      paint: const PaintOptions.fill(color: Colors.blue),
                      text: ")",
                    ),
                  ),
    
                  // price line
                  new Line<FuelListDetailList, String, double>(
                    data: price,
                    xFn: (list) => list.record_date,
                    yFn: (list) => list.total_price,
                    xAxis: xAxis,
                    yAxis: new ChartAxis(
                      opposite: true,
                      paint: const PaintOptions.stroke(color: Colors.green),
                      tickLabelerStyle: new TextStyle(
                          color: Colors.green, fontWeight: FontWeight.bold),
                    ),
                    marker: const MarkerOptions(
                      paint: const PaintOptions.fill(color: Colors.green),
                      shape: MarkerShapes.square,
                    ),
                    stroke: const PaintOptions.stroke(color: Colors.green),
                    legend: new LegendItem(
                      paint: const PaintOptions.fill(color: Colors.green),
                      text: 'price',
                    ),
                  ),
                ],
              ),
    

    or can I fixed the y axis value like this...? image

    opened by ChloeSu 1
  • Any histogram example?

    Any histogram example?

    Hi, I'm looking for a histogram implementation, but I can't find any example of how to do it with fcharts, and it seems like it is possible, at least with this version https://pub.dev/packages/fcharts/versions/0.0.4 . Right now some histogram related methods are deprecated and I can't figure it out how to use them. Thanks.

    opened by ivnaru 0
  • Is chart can be in scaffold state?(swipable along X-axis)?

    Is chart can be in scaffold state?(swipable along X-axis)?

    HI,I have imported sparkline chart in my project,and the X-axis is aligning according to the number of data available(if there are 3 data,the spacing between them is equal,but if there are more data x-axis is overlapping).So,is there possibility to make the spacing between the data in x-axis constant and make all other data to be swipable horizontally as in scaffold state??...

    I'm attaching the code and image of the one i explained above..

    Screenshot_1568882862

    code for above pic is..

    ////---->below is the code for data. `const cities = [ const City("May 14", Level.Not, 4,3), const City("May 15", Level.Kinda, 4,4), const City("May 16", Level.Quite, 4,3), const City("May 17", Level.Quite, 4,2), const City("May 18", Level.Quite, 4,1), const City("May 19", Level.Quite, 4,3), const City("May 20", Level.Quite, 4,4),

    //const City("Palo Alto", Level.Very, 5), ];`

    ///--->below is the code for graph

    ` final xAxis = new ChartAxis();

    return new AspectRatio(
      aspectRatio: 4 / 3,
      child: new LineChart(
        chartPadding: new EdgeInsets.fromLTRB(60.0, 20.0, 40.0, 30.0),
        lines: [
          new Line<City, String, int>(
            data: cities,
            xFn: (city) => city.name,
            yFn: (city) => city.size,
            xAxis: xAxis,
            yAxis: new ChartAxis(
              span: new IntSpan(0, 6),
              tickGenerator: IntervalTickGenerator.byN(1),
              paint: const PaintOptions.stroke(color: Colors.blue),
              tickLabelerStyle: new TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
            ),
            marker: const MarkerOptions(
              paint: const PaintOptions.fill(color: Colors.blue),
              shape: MarkerShapes.square,
            ),
            stroke: const PaintOptions.stroke(color: Colors.blue),
            legend: new LegendItem(
              paint: const PaintOptions.fill(color: Colors.blue),
              text: 'Ideal',
            ),
          ),
          new Line<City, String, int>(
            data: cities,
            xFn: (city) => city.name,
            yFn: (city) => city.size1,
            xAxis: xAxis,
            yAxis: new ChartAxis(
              span: new IntSpan(0, 6),
              tickGenerator: IntervalTickGenerator.byN(1),
              paint: const PaintOptions.stroke(color: Colors.green),
              tickLabelerStyle: new TextStyle(color: Colors.green, fontWeight: FontWeight.bold),
            ),
            marker: const MarkerOptions(
              paint: const PaintOptions.fill(color: Colors.green),
              shape: MarkerShapes.square,
            ),
            stroke: const PaintOptions.stroke(color: Colors.green),
            legend: new LegendItem(
              paint: const PaintOptions.fill(color: Colors.green),
              text: 'Actual',
            ),
          ),
         
        ],
      ),
    );`
    
    opened by josephraj2k16 0
  • load json data into mydata

    load json data into mydata

    hi, how i do to load a json file like: {"data":[{"hour":"00:07:02","value":"31.5"},{"hour":"00:06:29","value":"31.5"}....} into the mydata value to automatically load data and generate the chart? thanks

    opened by alexlovar 0
  • Color themes/auto colors

    Color themes/auto colors

    Colors must be manually specified for each element currently. It would be nice to have some sort of a theme object which colors refer to when they are not explicitly given a color. Any color could still be overridden, but the theme options object would be what developers would primarily use to customize colors.

    enhancement 
    opened by thekeenant 3
Releases(0.0.10)
Owner
Keenan Thompson
Software Engineer
Keenan Thompson
Animated radial and pie charts for Flutter

Flutter Circular Chart A library for creating animated circular chart widgets with Flutter, inspired by Zero to One with Flutter. Overview Create easi

Victor Choueiri 387 Dec 26, 2022
Beautiful sparkline charts for Flutter

flutter_sparkline Beautiful sparkline charts for Flutter. Installation Install the latest version from pub. Quick Start Import the package, create a S

Victor Choueiri 255 Dec 21, 2022
Flutter package for creating simple yet modern looking charts

A package for creating simple yet modern looking charts. Five chart types Bar Gauge Line Pie Radar Canvas + DOM modern_charts combines Canvas and DOM

Man Hoang 68 Nov 4, 2022
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚡ A powerful & easy to use chart library for Android ⚡ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Dec 28, 2022
Elegant OHLC Candlestick and Trade Volume charts for @Flutter

flutter_candlesticks Elegant OHLC Candlestick and Trade Volume charts for Flutter Usage Install for Flutter with pub. Property Description data Requir

Trent Piercy 402 Dec 21, 2022
Flutter chart library contains depth charts supporting various indicators and zooming

flutter_k_chart 介绍 一个仿火币的flutter图表库包含深度图,支持各种指标及放大缩小、平移等操作 webdemo演示 Demo v0.1.0:下载 APK 演示 简单用例 1.在 pubspec.yaml 中添加依赖 本项目数据来自火币openApi,火币的接口可能需要翻墙,接口

gwh 259 Dec 30, 2022
Charts [2148⭐] - By Google Team.

Charts is a general charting library, currently enabled for the Flutter mobile UI framework. See the online gallery for supported chart types and exam

Google 2.8k Dec 31, 2022
A library to draw fantastic bar charts race in Flutter

bar_chart_race The first library to draw fantastic bar charts race in Flutter Usage Let's get started add the dependencies to your app: dependencies:

Mimene Younes 6 Jun 24, 2022
A flutter package which makes it easier to plot different types of charts with lots of customization, made purely in dart

multi_charts It is a library that provides different types of charts to plot data points. Currently it supports only Radar Chart, but will support mor

Intkhab Ahmed 28 Nov 9, 2022
Charts Library for Flutter, written in Dart with Flutter.

Table of Contents New in the current release Illustration of the new "iterative auto layout" feature Autolayout step 1 Autolayout step 2 Autolayout st

Milan Zimmermann 225 Dec 25, 2022
In this project you will see how to generate charts with the data from the Firestore.

FlutterChartFirestore Flutter Tutorial - Flutter Charts+Firestore Video series can be watched here https://youtu.be/HGkbPrTSndM Getting Started In thi

Whatsupcoders 49 Oct 21, 2022
Flutter Cryptocurrency Charts application based on Clean Architecture.

About the project The purpose of this project is to develop the best Cryptocurrency, markets data and charts experience. This project has been built u

null 25 Jan 1, 2023
kg_charts icon library. At present, there are only radar charts

kg_charts icon library. At present, there are only radar charts. Other types of charts may be added later

zhonghua 10 Oct 25, 2022
Animated line chart for flutter

fl_animated_linechart An animated chart library for flutter. Support for datetime axis Multiple y axis, supporting different units Highlight selection

null 51 Sep 25, 2022
A beautiful bezier line chart widget for flutter that is highly interactive and configurable.

Bezier Chart A beautiful bezier line chart widget for flutter that is highly interactive and configurable. Features Multi bezier lines Allow numbers a

Aeyrium 428 Dec 21, 2022
A simple app to track your financial life using flutter

Budget Budy Budget Budy is the easiest and most user friendly expense manager app. The simple fact is, by tracking your spending you will be able to s

MUFADDAL SHAKIR 20 Jan 2, 2023
A simple candlestick chart for flutter. Supports smooth scroll and zoom

simple_candlestick_chart A simple candlestick chart for flutter. Supports smooth

7c00 14 Oct 17, 2022
A simple radial chart for Flutter

A simple radial chart for Flutter

null 2 Jun 2, 2022
About using of canvas in the flutter

❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Facebook Group QQ Group Developer Flutter Open Flutter Open 963828159

Flutter开源社区 293 Dec 19, 2022