-
Notifications
You must be signed in to change notification settings - Fork 42
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
Please add exactly explanation for scrolling to your docs #93
Comments
Hey @desmeit, thanks for reporting this, I will update the documentation to explain that part better. For scrollable charts you need to:
Also from your code you will have to remove SizedBox (Since chart cannot be scrollable if it's to smal box that fits in the screen) Center(
child: SingleChildScrollView(
controller: _scrollController,
scrollDirection: Axis.horizontal,
child: SizedBox(
height: 300,
child: Chart(
width: 300,
state: ChartState<void>(
data: ChartData.fromList(
[2, 3, 4, 4, 7, 6, 2, 5, 4].map((e) => ChartItem<void>(e.toDouble())).toList(),
axisMax: 10,
axisMin: 1,
),
itemOptions: BarItemOptions(
padding: const EdgeInsets.symmetric(horizontal: 2.0),
barItemBuilder: (_) => BarItem(
color: Theme.of(context).colorScheme.secondary,
radius: BorderRadius.vertical(top: Radius.circular(12.0)),
),
),
behaviour: ChartBehaviour(
scrollSettings: const ScrollSettings(visibleItems: 3),
onItemClicked: (value) => print("clicked"),
),
// itemOptions: WidgetItemOptions(
// widgetItemBuilder: (_) => Container()),
backgroundDecorations: [
HorizontalAxisDecoration(
axisStep: 2,
showValues: true,
lineColor: Colors.green,
),
GridDecoration(
showVerticalValues: true,
showHorizontalValues: true,
verticalAxisStep: 1,
horizontalAxisStep: 1,
gridColor: Colors.grey,
textStyle: const TextStyle(
color: Colors.black,
fontSize: 14,
),
),
],
foregroundDecorations: [
SparkLineDecoration(
lineWidth: 2.0,
smoothPoints: true,
),
],
),
),
),
),
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to use a line chart with scrolling but didnt find any explanation or sample code for it.
I added
SingleChildScrollView
but there is noisScrollable
option inside of behaviour.Furthermore, it is not clear to me where the maximum X Axis should be added so that scrolling can work.
I always see everything in one view.
visibleItems
is not working as well.The text was updated successfully, but these errors were encountered: