-
Notifications
You must be signed in to change notification settings - Fork 803
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
x Axis dupblicate based on width increase (SfCartesianChart) #1932 #1933
Comments
Hi @Nick141620, We have analyzed your query and found that you have used a CategoryAxis as the primaryXAxis. According to our current implementation, the arrangeByIndex property in CategoryAxis is false, when the arrangeByIndex property is false, by default the data points will be grouped and plotted based on the x-values. This is a current behavior. For example: If arrangeByIndex property is false and data points have a x values of apple, banana, apple, orange and graphs. Here the duplicate x values is apples, according to default behavior the duplicate x value will considered as a single group, so the x axis label will not render twice. Output Screenshot: According to our current behavior we can’t be able to replicate the reported issue with and without duplicate x value in the data points. However, we can replicate the reported issue when enabling the arrangeByIndex property in CategoryAxis, with a duplicate x-value in the data points. This is because when enabling the arrangeByIndex property, the data points can't be grouped and rendered based on the data point index. For example: When the arrangeByIndex property is true and data points have a x values of apple, banana, apple, orange and graphs. Here the duplicate x values is apples, according to the implementation each data points has a unique data point index, so axis label will render twice for apple. Output Screenshot: Therefore, we suspect that you have enabled the arrangeByIndex property in CategoryAxis with a duplicate x-value in the data points. Therefore, we suggest removing or replacing the duplicate x value from your dataSource or disabling the arrangeByIndex property. We have shared an output below. Case 1: Duplicate x value with arrangeByIndex as true with as container width as MediaQuery.of(context).size.width - 20: Case 2: Duplicate x value with arrangeByIndex as false with as container width as MediaQuery.of(context).size.width - 20: If you still face the issue after updating the arrangeByIndex property or your dataSource without duplicate x values, we kindly request you to try replicating the reported issue in the test sample attached below. Please revert to us so that we can assist you in a better way. Regards, |
Thanks issue has been resolved after changing interval |
Dear Team,
My Container Width = width: MediaQuery.of(context).size.width - 20,
Please check 21 is duplicate
My Container Width = width: MediaQuery.of(context).size.width - 100,
But UI is not proper
please help this issue to fix how to stick width of my container and graph display proper in based on device width
`Widget viewGraph(
BuildContext context,
List market,
List nasMarket,
List spMarket,
Color color,
Color nasColor,
Color spColor,
bool isIndividual,
String duration,
{bool isSingle = false,
bool isFromDetail = false,
bool isCrypto = false,
bool isHideYAxis = true}) {
var minimumValue = findMinimumTotalAmount(isIndividual
? market.isNotEmptyOrNull
? market
: spMarket.isNotEmptyOrNull
? spMarket
: nasMarket
: nasMarket);
var maximumValue = findMaximumTotalAmount(isIndividual
? market.isNotEmptyOrNull
? market
: spMarket.isNotEmptyOrNull
? spMarket
: nasMarket
: nasMarket);
if (!isCrypto && duration == "1D") {
if (market.isNotEmptyOrNull) {
market.addAll(generateDataWithInterval(market));
}
if (nasMarket.isNotEmptyOrNull) {
nasMarket.addAll(generateDataWithInterval(nasMarket));
}
if (spMarket.isNotEmptyOrNull) {
spMarket.addAll(generateDataWithInterval(spMarket));
}
}
if (isIndividual == false) {
if (market.length < 1 && nasMarket.length < 1 && spMarket.length < 1) {
isFromDetail = true;
isHideYAxis = false;
} else {
isHideYAxis = true;
}
} else {
if (market.length < 1 && nasMarket.length < 1 && spMarket.length < 1) {
isFromDetail = true;
isHideYAxis = false;
} else {
isHideYAxis = true;
}
}
return Container(
height: Dim.dim_250.h,
width: MediaQuery.of(context).size.width - Dim.dim_80.w,
//width: MediaQuery.of(context).size.width - Dim.dim_20.w,
child: SfCartesianChart(
crosshairBehavior: CrosshairBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
lineDashArray: [2, 2],
),
tooltipBehavior: TooltipBehavior(
enable: false,
),
trackballBehavior: TrackballBehavior(
enable: false,
tooltipDisplayMode: isIndividual
? TrackballDisplayMode.floatAllPoints
: TrackballDisplayMode.groupAllPoints,
lineDashArray: [2, 2],
),
zoomPanBehavior: ZoomPanBehavior(
enablePanning: true,
),
primaryXAxis: CategoryAxis(
);
}
List performance(
List dowMarket,
List spyMarket,
List nasMarket,
Color dowColor,
Color spyColor,
Color nasColor) {
List series = [];
series.add(
SplineSeries<MarketData, String>(
animationDuration: 0,
dataSource: dowMarket,
color: dowColor,
// emptyPointSettings: EmptyPointSettings(mode: EmptyPointMode.drop),
xValueMapper: (MarketData data, _) {
return data.date!;
},
yValueMapper: (MarketData data, _) =>
data.percentageChange == 12434443355555
? null
: data.percentageChange),
);
series.add(
SplineSeries<MarketData, String>(
animationDuration: 0,
dataSource: nasMarket,
color: nasColor,
// emptyPointSettings: EmptyPointSettings(mode: EmptyPointMode.drop),
xValueMapper: (MarketData data, _) {
return data.date!;
},
yValueMapper: (MarketData data, _) =>
data.percentageChange == 12434443355555
? null
: data.percentageChange),
);
series.add(
SplineSeries<MarketData, String>(
animationDuration: 0,
dataSource: spyMarket,
color: spyColor,
xValueMapper: (MarketData data, _) {
return data.date!;
},
yValueMapper: (MarketData data, _) =>
data.percentageChange == 12434443355555
? null
: data.percentageChange),
);
return series;
}`
The text was updated successfully, but these errors were encountered: