-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Color choices between line segments. #96
Comments
Hi, pleasure, |
@imaNNeoFighT Thank you for quick reply :-) I managed to use your trick to display different colors in line segments. Do you know how I can display only one tooltip instead of two for the points where line segments are touching. Please see the attached image. |
Use this code: FlChart(
chart: LineChart(
LineChartData(
.
.
.
lineTouchData: LineTouchData(
enabled: true,
touchTooltipData: TouchTooltipData(
getTooltipItems: (touchedSpots) {
final tooltipItems = <TooltipItem>[];
for (int i = 0; i < touchedSpots.length; i++) {
if (i >= 1) {
tooltipItems.add(null);
continue;
}
final spot = touchedSpots[i];
tooltipItems.add(TooltipItem(
spot.spot.y.toString(),
TextStyle(color: spot.getColor()),
));
}
return tooltipItems;
}
)
),
.
.
.
)
),
) Inside the getTooltipItems you can return null to skip show the TooltipItem. |
Thanks a lot @imaNNeoFighT for your reply, it works :-) |
@imaNNeo sorry to awake this old issue, I didn't think I should open a new one just to ask this. How do you make the lines match when they are curved and have any smoothness? |
Hi, No problem |
Thanks a lot for amazing package, I was wondering if it's possible to choose a color for different line segments. For example, if I have 4 points: A, B, C, D. I want to color the line between A-B in red, B-C in blue, C-D in green.
The text was updated successfully, but these errors were encountered: