Skip to content

Conversation

@Koichi5
Copy link

@Koichi5 Koichi5 commented May 1, 2025

Summary

Added a new feature to display labels at each vertex of the RadarChart.
Fixes this issue: #1886

What's included

New Classes and Methods

  • Added RadarChartVerticeLabel class to handle vertex label configuration
    • text: Displays the label text
    • positionPercentageOffset: Controls label position relative to vertex

Tests

Added comprehensive test cases for drawVerticeLabels:

  1. Test case for when no vertex labels are configured
  2. Test case for basic vertex label display
  3. Test case for custom position percentage offset

Screenshot

スクリーンショット 2025-05-01 23 47 26

@imaNNeo
Copy link
Owner

imaNNeo commented May 7, 2025

I didn't get what the difference between positionPercentageOffset and verticeLabelPositionPercentageOffset is. Can you explain it please?

@imaNNeo
Copy link
Owner

imaNNeo commented May 7, 2025

And your sample looks beautiful. Can you please add it in our samples list?

@Koichi5
Copy link
Author

Koichi5 commented May 10, 2025

Thank you for your feedback!

After reconsidering, I realized that positionPercentageOffset and verticeLabelPositionPercentageOffset essentially serve the same purpose. Therefore, I would like to remove verticeLabelPositionPercentageOffset for clarity and simplicity.

The role of positionPercentageOffset in RadarChartVerticeLabel is the same as in the RadarChartTitle method: it controls the distance between each vertex and its corresponding label.

positionPercentageOffset in RadarChartVerticeLabel = 0 positionPercentageOffset in RadarChartVerticeLabel = 1

I will also add the sample to the samples list as you suggested!

@Koichi5
Copy link
Author

Koichi5 commented Jun 20, 2025

@imaNNeo
Hi! I’ve added the Radar Chart sample and removed the verticalLabelPositionPercentageOffset as discussed.
Whenever you get a chance, I’d appreciate a quick review. Thanks!

final TextStyle? titleTextStyle;

/// Defines style of showing [RadarChart] vertice labels.
final TextStyle? verticeLabelTextStyle;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you forgot to add this verticeLabelTextStyle property in the copyWith and lerp functions

}

/// Defines a label for [RadarChart] vertices
class RadarChartVerticeLabel {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo here, and this is what I've got from the Chatgpt:
image

/// [positionPercentageOffset] is the place of showing label on the [RadarChart] vertices
/// The higher the value of this field, the more labels move away from the chart vertices.
/// This value should be between 0 and 1
final double? positionPercentageOffset;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just add a final double offset; here? I mean it makes it much simpler, as we know where it draws (at the position of our vertex point). So we can just have a simple offest property

@Koichi5 Koichi5 requested a review from imaNNeo August 14, 2025 13:56
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

Successfully merging this pull request may close these issues.

2 participants