-
-
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
Radar plot center point is zero #1351
Comments
Hello, I am also having the same question. Are we missing something here? |
I didn't understand your issue |
Same here... If you have any solution, just let me know please! |
Guys I "solved" the problem by superimposing my desired data with another dataset (made transparent so not actually shown) having both 0 and 100 as values |
I've encountered this problem too. May I ask when will the author fix it? |
Can someone please give me a reproducible code (a main.dart file) to let me fix the issue? |
You can use the example and replace rawDataSets in example/lib/presentation/samples/radar/radar_chart_sample1.dart
|
May I ask if there is any progress on this issue |
#1078 broke the behaviour after version 0.6.2, i reverted to 0.6.1, and it works and to have the correct scale have a transparent dataset that contains max value and min value along with my actual dataset RadarDataSet(
entryRadius: 8,
fillColor: Colors.transparent,
borderColor: Colors.transparent,
borderWidth: 2,
dataEntries: [
// Make sure the length of this dataset match the length of your original dataset.
RadarEntry(value: 0), //minValue
RadarEntry(value: 5) //maxValue
],
), |
in radar_chart_painter.dart. if the dataSet has some data is zero, return default chart center. double getChartCenterValue(RadarChartData data) {
final dataSetMaxValue = data.maxEntry.value;
final dataSetMinValue = data.minEntry.value;
// add this
if(dataSetMinValue == 0) return getDefaultChartCenterValue();
final tickSpace = getSpaceBetweenTicks(data);
final centerValue = dataSetMinValue - tickSpace;
return dataSetMaxValue == dataSetMinValue
? getDefaultChartCenterValue()
: centerValue;
} |
@imaNNeo Versions import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: RadarChart(
RadarChartData(
radarShape: RadarShape.polygon,
tickCount: 3,
dataSets: [
RadarDataSet(
dataEntries: [
RadarEntry(value: 0),
RadarEntry(value: 20),
RadarEntry(value: 100),
],
),
],
),
),
),
);
}
} |
I was able to find a temporary workaround to fix this issue by extending the
And then using this class:
|
@tim-kodirov Thank you. It worked perfectly. |
|
For the scaling issue this solution by @collamaf works. it scales the radar correctly add min and max value transparent radar to the dataSets: [
/// Data for max value
RadarDataSet(
fillColor: Colors.transparent,
borderColor: Colors.transparent,
borderWidth: 0,
entryRadius: 0,
dataEntries: [
const RadarEntry(value: 1),
const RadarEntry(value: 1),
const RadarEntry(value: 1),
],
),
/// Data for min value
RadarDataSet(
fillColor: Colors.transparent,
borderColor: Colors.transparent,
borderWidth: 0,
entryRadius: 0,
dataEntries: [
const RadarEntry(value: 0),
const RadarEntry(value: 0),
const RadarEntry(value: 0),
],
),
], |
I want the points with the value of zero to be concentrated on the center point as shown in the figure, but I don't know how to set it
The text was updated successfully, but these errors were encountered: