fl_chart icon indicating copy to clipboard operation
fl_chart copied to clipboard

Allow overriding of Radar Chart min/max values for tick calculation

Open zmeggyesi opened this issue 3 years ago • 6 comments

In cases where the possible minimum/maximum values are known in advance, it should be possible to use these to determine the starting/ending ticks of Radar Charts. This would allow stable and comparable charts across disparate data sets.

Currently, the tick spacing and the supporting titles are calculated by taking the minimum and maximum data entry values, which is fine for the general case, but makes it hard to compare datasets against absolute margins, as the ticks change position according to the entries.

zmeggyesi avatar Jul 08 '22 11:07 zmeggyesi

A workaround is to create a transparent RadarDataSet with a maximum value.

 RadarDataSet(
    entryRadius: 4,
    fillColor: color.primary.withOpacity(0.5),
    borderColor: color.primary,
    dataEntries: [
      RadarEntry(value: aiScoreState.accuracy),
      RadarEntry(value: aiScoreState.angle),
      RadarEntry(value: aiScoreState.balance),
      RadarEntry(value: aiScoreState.inertia),
      RadarEntry(value: aiScoreState.moment),
    ],
  ),
// max val
RadarDataSet(
  entryRadius: 4,
  fillColor: Colors.transparent,
  borderColor: Colors.transparent,
  dataEntries: [
    RadarEntry(value: 1),
    RadarEntry(value: 1),
    RadarEntry(value: 1),
    RadarEntry(value: 1),
    RadarEntry(value: 1),
  ],
),

bluejoyq avatar Nov 12 '22 08:11 bluejoyq

This workaround does not work in my case: I have values ranged from 0 to 2000, but i'd like to 'group' all the values below 800 to 0. So basically my range is [0; 2000] and i want to cast it to [800; 2000] where 800 is the first drawn tick, and values below that should be set to 0 or drawn between 0 and the first tick

Seems this can't be done for the moment

image

riccardocescon avatar Apr 08 '23 11:04 riccardocescon

What about overriding the <800 data points to zero before you pass them to the chart for drawing?

zmeggyesi avatar Apr 08 '23 11:04 zmeggyesi

I tried that but then other values, such as 800.0 won't be on the first tick, because this will re-distribute all the values between [0-2000], so the value 800 would be almost on the central tick insead of the first tick

riccardocescon avatar Apr 08 '23 11:04 riccardocescon

Is this issue related to #1293?

imaNNeo avatar Apr 10 '23 16:04 imaNNeo

I don't understand how tick calculation works. Can someone help me?

hungify avatar Apr 26 '25 15:04 hungify