Skip to content

Latest commit

 

History

History
89 lines (69 loc) · 4.23 KB

bar_chart.md

File metadata and controls

89 lines (69 loc) · 4.23 KB

BarChart

How to use

FlChart(
   chart: BarChart(
      BarChartData(
         // read about it in the below section
      ),
   ),
);

BarChartData

PropName Description default value
barGroups list of BarChartGroupData to show the bar lines together, you can provide one item per group to show normal bar chart []
alignment a BarChartAlignment that determines the alignment of the barGroups, inspired by Flutter MainAxisAlignment BarChartAlignment.spaceBetween
titlesData check the FlTitlesData FlTitlesData()
backgroundColor a background color which is drawn behind th chart null
barTouchData BarTouchData holds the touch interactivity details BarTouchData()
gridData check the FlGridData FlGridData()
borderData check the FlBorderData FlBorderData()
maxY gets maximum y of y axis, if null, value will read from the input barGroups null

BarChartGroupData

PropName Description default value
x x position of the group on horizontal axis null
barRods list of BarChartRodData that are a bar line []
barsSpace the space between barRods of the group 2

BarChartAlignment

enum values {start, end, center, spaceEvenly, spaceAround, spaceBetween}

BarChartRodData

PropName Description default value
y endY position of the bar on vertical axis (height of the bar) null
color colors the bar rod Colors.blueAccent
width stroke width of the bar rod 8
isRound determines that the bar lines is round or qubic true
backDrawRodData if provided, draws a rod in the background of the line bar, check the BackgroundBarChartRodData null

BackgroundBarChartRodData

PropName Description default value
y same as BarChartRodData's y 8
show determines to show or hide this section false
color same as BarChartRodData's color Colors.blueGrey
PropName Description default value
enabled determines to enable or disable touch behaviors true
touchTooltipData a TouchTooltipData, that determines how show the tooltip on top of touched spots (appearance of the showing tooltip bubble) TouchTooltipData()
touchExtraThreshold an EdgeInsets class to hold a bounding threshold of touch accuracy EdgeInsets.all(4)
allowTouchBarBackDraw if sets true, touch works on backdraw bar line false
touchResponseSink a StreamSink<BarTouchResponse> to broadcast the touch response (with useful data) when touched on the chart null

BarTouchResponse

PropName Description default value
spot a BarTouchedSpot class to hold data about touched spot null
touchInput a FlTouchInput that is the touch behaviour null

BarTouchedSpot

PropName Description default value
touchedBarGroup the BarChartGroupData that user touched it's rod's spot null
touchedRodData the BarChartRodData that user touched it's spot null

some samples


Sample 1 (Source Code)

Sample 2 (Source Code)