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

TimeScale Formatter Error #22

Closed
pome90 opened this issue Nov 16, 2021 · 1 comment
Closed

TimeScale Formatter Error #22

pome90 opened this issue Nov 16, 2021 · 1 comment

Comments

@pome90
Copy link

pome90 commented Nov 16, 2021

Hello using TimeScale class with formatter result in this error:

Dart Unhandled Exception: type '(DateTime) => String' is not a subtype of type '(dynamic) => String', stack trace: #0 TickInfoOp.evaluate.
package:graphic/…/axis/axis.dart:211

Example code:

final data = [
{"Date": DateTime(2021, 4, 1), "ET": 6,},
{"Date": DateTime(2021, 5, 3), "ET": 5},
{"Date": DateTime(2021, 5, 5), "ET": 8},
{"Date": DateTime(2021, 5, 7), "ET": 10},
{"Date": DateTime(2021, 5, 20), "ET": 11},
{"Date": DateTime(2021, 5, 29), "ET": 9}
];

Chart(
data: data,
variables: {
'Date': Variable(
accessor: (Map map) =>
(map['Date'] ?? double.nan) as DateTime,
scale: TimeScale(
tickCount: 3,
formatter: (x) {
return '${x.day}';
}
)
),
'ET': Variable(
accessor: (Map map) =>
(map['ET'] ?? double.nan) as num,
),
},
)

@entronad
Copy link
Owner

It is caused by a generic bug of Scale.formatter.
It has been fixed in v0.5.0. Please upgrade and try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants