Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added .fromItem constructor to BarChart #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions example/lib/widgets/bar_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@ class BarChart<T> extends StatelessWidget {
this.itemOptions = const BarItemOptions(),
this.stack = false,
Key? key,
}) : _mappedValues = [data.map((e) => BarValue<T>(dataToValue(e))).toList()],
}) : _mappedValues = [
data.map((e) => ChartItem<T>(dataToValue(e))).toList()
],
super(key: key);

BarChart.fromItem({
required List<ChartItem<T>> data,
this.height = 240.0,
this.backgroundDecorations = const [],
this.foregroundDecorations = const [],
this.chartBehaviour = const ChartBehaviour(),
this.itemOptions = const BarItemOptions(),
this.stack = false,
Key? key,
}) : _mappedValues = [data],
super(key: key);

const BarChart.map(
Expand All @@ -30,7 +44,7 @@ class BarChart<T> extends StatelessWidget {
Key? key,
}) : super(key: key);

final List<List<BarValue<T>>> _mappedValues;
final List<List<ChartItem<T>>> _mappedValues;
final double height;

final bool stack;
Expand Down