Closed 978740431 closed 3 years ago
Hey,
With GridDecoration or VerticalAxisDecoration you have valueFromIndex
. This is a function that will return you index and you can return any string you want as label text.
Hope that helps 😄
Thank you very much, it is ready to use. I hope there is a case in the demo, because my English and flutter technology is very poor, so after reading your reply I still took some time to solve it, if the case has examples, it will be very good to help sdk users
Great 🎉 Okay, thanks for input. I'll add that to readme and maybe some examples 😃
For anyone looking to do this, here is an example that adds three letter day names to the horizontal axis (starting from today - var now = new DateTime.now();
GridDecoration(
showHorizontalValues: false,
showVerticalValues: true,
verticalAxisValueFromIndex: (int value) {
return DateFormat.E().format(now.add(new Duration(days: value))).toString();
},
verticalAxisStep: 1,
horizontalAxisStep: 3,
textStyle: TextStyle(color: Colors.grey),
gridColor: Theme.of(context).dividerColor,
),
Now the display is 0~N, I want to display the date, how do I need to set