flutter_candlesticks 0.1.4

pub package

flutter_candlesticks #

Elegant OHLC Candlestick and Trade Volume charts for Flutter

Usage #

Install for Flutter with pub.

PropertyDescription
dataRequired. List of maps containing open, high, low, close and volumeto
enableGridLinesRequired. Enable or disable grid lines
volumePropRequired. Proportion of container to be given to volume bars
lineWidthDefault 1.0. Width of most lines
gridLineAmountDefault 5. Number of grid lines to draw. Labels automatically assigned
gridLineWidthDefault 0.5. Width of grid lines
gridLineColorDefault Colors.grey. Color of grid lines
gridLineLabelColorDefault Colors.grey. Color of grid line labels
labelPrefixDefault "$". Prefix before grid line labels.
increaseColorDefault Colors.green. Color of increasing candles.
decreaseColorDefault Colors.red. Color of decreasing candles.

Examples #

No Grid Lines #

new OHLCVGraph(
    data: sampleData,
    enableGridLines: false,
    volumeProp: 0.2
    )
)

xx

Candle size dynamically changes by amount of data

xx

Grid Lines #

new OHLCVGraph(
    data: sampleData,
    enableGridLines: true,
    volumeProp: 0.2,
    gridLineAmount: 5,
    gridLineColor: Colors.grey[300],
    gridLineLabelColor: Colors.grey
    )
)

xx

Full App Example #

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

void main() {
  List sampleData = [
    {"open":50.0, "high":100.0, "low":40.0, "close":80, "volumeto":5000.0},
    {"open":80.0, "high":90.0, "low":55.0, "close":65, "volumeto":4000.0},
    {"open":65.0, "high":120.0, "low":60.0, "close":90, "volumeto":7000.0},
    {"open":90.0, "high":95.0, "low":85.0, "close":80, "volumeto":2000.0},
    {"open":80.0, "high":85.0, "low":40.0, "close":50, "volumeto":3000.0},
  ];

  runApp(
    new MaterialApp(
      home: new Scaffold(
        body: new Center(
          child: new Container(
            height: 500.0,
            child: new OHLCVGraph(
                data: sampleData,
                enableGridLines: false,
                volumeProp: 0.2
            ),
          ),
        ),
      )
    )
  );
}

[0.1.4] - 2019-04-28

  • Fix unused label prefix

[0.1.3] - 2019-04-28

  • Dart 2

[0.1.2] - 2018-08-31

  • Update version constraints for Dart 2.1.0

[0.1.1] - 2018-08-06

  • Added increaseColor and decreaseColor options

[0.1.0] - 2018-07-09

  • Fix gridLineWidth not being used
  • Better grid line label text handling

[0.0.9] - 2018-04-26

  • Fix label value bug
  • Added labelPrefix param

[0.0.8] - 2018-04-26

  • Update to Flutter SDK 0.3.1

[0.0.7] - 2018-04-20

  • Moved labels to right of grid lines

[0.0.6] - 2018-04-12

  • Improved labeling efficiency

[0.0.5] - 2018-04-10

  • Corrected README.md

[0.0.4] - 2018-04-10

  • Fix screenshots for pub

[0.0.3] - 2018-04-10

  • Update README.md
  • Screenshots
  • Fix volume label color

[0.0.2] - 2018-04-10

  • LICENSE
  • Example

[0.0.1] - 2018-04-09

  • Initial Release

example/example.dart

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

void main() {
  List sampleData = [
    {"open":50.0, "high":100.0, "low":40.0, "close":80, "volumeto":5000.0},
    {"open":80.0, "high":90.0, "low":55.0, "close":65, "volumeto":4000.0},
    {"open":65.0, "high":120.0, "low":60.0, "close":90, "volumeto":7000.0},
    {"open":90.0, "high":95.0, "low":85.0, "close":80, "volumeto":2000.0},
    {"open":80.0, "high":85.0, "low":40.0, "close":50, "volumeto":3000.0},

    {"open":50.0, "high":100.0, "low":40.0, "close":80, "volumeto":5000.0},
    {"open":80.0, "high":90.0, "low":55.0, "close":65, "volumeto":4000.0},
    {"open":65.0, "high":120.0, "low":60.0, "close":90, "volumeto":7000.0},
    {"open":90.0, "high":95.0, "low":85.0, "close":80, "volumeto":2000.0},
    {"open":80.0, "high":85.0, "low":40.0, "close":50, "volumeto":3000.0},

    {"open":50.0, "high":100.0, "low":40.0, "close":80, "volumeto":5000.0},
    {"open":80.0, "high":90.0, "low":55.0, "close":65, "volumeto":4000.0},
    {"open":65.0, "high":120.0, "low":60.0, "close":90, "volumeto":7000.0},
    {"open":90.0, "high":95.0, "low":85.0, "close":80, "volumeto":2000.0},
    {"open":80.0, "high":85.0, "low":40.0, "close":50, "volumeto":3000.0},
  ];

  runApp(
    new MaterialApp(
      home: new Scaffold(
        body: new Center(
          child: new Container(
            height: 500.0,
            child: new OHLCVGraph(
                data: sampleData,
                enableGridLines: false,
                volumeProp: 0.2
            ),
          ),
        ),
      )
    )
  );
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_candlesticks: ^0.1.4

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:flutter_candlesticks/flutter_candlesticks.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Jul 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/flutter_candlesticks.dart. (-0.50 points)

Analysis of lib/flutter_candlesticks.dart reported 1 hint:

line 190 col 57: 'text' is deprecated and shouldn't be used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin