-
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
Chart are displayed incorrectly when axisMin and axisMax are set #94
Comments
Hi @iamiota Thanks for detailed report. I was able to reproduce it with your code easily and fixing it right now. There is a issue when calculating size for widgets when axisMin is set. I will add some tests to cover this case as well so we can be sure that values are displayed correctly 😄 |
@lukaknezic Hi Luka, thank you for your fix.❤️ However, I have encountered another issue when dynamically modifying the chart data. final List<List<ChartItem<double>>> _mappedValues = [
[ChartItem(2.0), ChartItem(5.0), ChartItem(8.0), ChartItem(3.0), ChartItem(6.0)]
];
axisMin: 2
axisMax: 8
/// AnimatedChart's duration: const Duration(milliseconds: 500),
/// If milliseconds = 30, everything is good.
/// data change to
final List<List<ChartItem<double>>> _mappedValues = [
[ChartItem(32.0), ChartItem(35.0), ChartItem(38.0), ChartItem(33.0), ChartItem(36.0)]
];
axisMin: 32
axisMax: 38 Sep-20-2023.18-47-26.mp4 |
negative minimum height should also be fixed, in same branch 😄 |
First of all, thank you for this amazing library, I really like the idea of using widgets to create charts.
I'm creating a line chart with
target line
(y: 3.6) andtarget area
(y: 0 ~ 2).I encountered some issues after setting
axisMin
andaxisMax
:1. I have a
TargetAreaDecoration
from 0 to 2, whenaxisMin
is set to 2, it is incorrectly displayed on the x-axis.The solution I came up with is to dynamically modify the
targetMin
andtargetMax
of theTargetAreaDecoration
based onaxisMin
andaxisMax
. For example, whenaxisMin
is 1, I would change theTargetAreaDecoration's targetMin
from 0 to 1, so it won't be displayed on the x-axis anymore.2. From the blue area in the graph, it can be observed that the rendering behavior of
widgetItemBuilder
is inconsistent with that ofSparkLineDecoration
. The size ofwidgetItemBuilder
is much larger thanSparkLineDecoration
.I created a
Position
Widget withinwidgetItemBuilder
and positioned the point widget using itstop
property. If theverticalMultiplier
parameter can be added towidgetItemBuilder
, I can calculate the correct position of the point:3. The target line is also being displayed in the wrong place.
The solution I came up with is similar to the first issue. I dynamically modify
verticalMultiplier * (3.6 - axisMin)
based onaxisMin
andaxisMax
.Do you have any suggestions? Thank you.
Codes
The text was updated successfully, but these errors were encountered: