flutter candlesticks
elegant ohlc candlestick and trade volume charts for flutter.
usage
install for flutter with pub.
property | description |
---|---|
data | required. list of maps containing open, high, low, close and volumeto |
enablegridlines | required. enable or disable grid lines |
volumeprop | required. proportion of container to be given to volume bars |
linewidth | default 1.0 . width of most lines |
gridlineamount | default 5 . number of grid lines to draw. labels automatically assigned |
gridlinewidth | default 0.5 . width of grid lines |
gridlinecolor | default colors.grey . color of grid lines |
gridlinelabelcolor | default colors.grey . color of grid line labels |
labelprefix | default "$" . prefix before grid line labels. |
increasecolor | default colors.green . color of increasing candles. |
decreasecolor | default colors.red . color of decreasing candles. |
examples
no grid lines
new ohlcvgraph(
data: sampledata,
enablegridlines: false,
volumeprop: 0.2
)
)
candle size dynamically changes by amount of data
grid lines
new ohlcvgraph(
data: sampledata,
enablegridlines: true,
volumeprop: 0.2,
gridlineamount: 5,
gridlinecolor: colors.grey[300],
gridlinelabelcolor: colors.grey
)
)
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
),
),
),
)
)
);
}
Comments are closed.