Flutter Docs
  • Flutter Docs
  • Charts
    • Chart It
    • Guides
      • Cartesian Charts
        • Chart Structuring
          • Grid Styling
          • Axes Styling
          • Axis Labels
        • Charts
          • Bar Chart
            • BarSeries
            • Bar Groups
              • SimpleBar
              • MultiBar
            • Styling
            • Bar Interactions
              • Snap to Bar
              • Fuzziness
      • Radial Charts
        • Charts
          • Pie & Donut Chart
            • PieSeries
            • SliceData
            • Styling
            • Interactions
      • Animations
      • Interactions
    • API Documentation
Powered by GitBook
On this page
  1. Charts
  2. Guides
  3. Cartesian Charts
  4. Charts
  5. Bar Chart
  6. Bar Groups

SimpleBar

The SimpleBar is a type of BarGroup which accepts only one yValue and tells the Widget to draw a Single Bar of height representing the yValue.

...
import 'package:chart_it/chart_it.dart';

class TestBarCharts extends StatefulWidget {
  const TestBarCharts({Key? key}) : super(key: key);

  @override
  State<TestBarCharts> createState() => _TestBarChartsState();
}

class _TestBarChartsState extends State<TestBarCharts> {
  @override
  Widget build(BuildContext context) {
    return BarChart(
      ... // any chart configs
      data: BarSeries(
        barData: <BarGroup>[
          SimpleBar(
            xValue: 1,
            yValue: BarData(yValue: 23),
          ),
          SimpleBar(
            xValue: 2,
            yValue: BarData(yValue: 44),
          ),
          SimpleBar(
            xValue: 3,
            yValue: BarData(yValue: 35),
          ),
        ],
      ),
    );
  }
}

Class Properties

Name
Type
Required
Default Value

xValue

num

true

-

yValue

num

true

-

padding

double

false

10.0

style

BarDataStyle?

false

null

PreviousBar GroupsNextMultiBar

Last updated 1 year ago