I am charting latitude and longitude values on a standard chart to show a racetrack outline.
Depending on where in the world the track is the chart has to be scaled to make it look correct. I am doing this calculation and then using an AspectRatio widget to create this scale.
The problem I am experiencing is that the chart is not filling the parent. The documentation states:
Chart renders based on the parent widget size. If you need the chart to be rendered in specific size, then set the size(width/height) to the parent widget.
I have added a red background colour to show the size of the AspectRatio widget to show the size of it in syncfusion_chart.png and other_library.png.
You can see that in syncfusion_chart.png that the chart is filling the width but not the height. I would expect the same behaviour that is seen in other_library.png. Is there a way to make this happen? If you turn on the chart border you can see it fills the AspectRatio widget, example in clipping_border.png
Is there a way to size multiple charts to be the exact same size? I have a Column of 3 Expanded widgets, each containing a chart. In the image missaligned_due_to_y_axis.png you can see that the bottom chart has slimmer Y axis labels causing the chart to be wider. The problem with this is that the trackball vertical lines do not align as the bottom chart isn't the same width. You can see in expected_alignment_other_library.png that using another library you can set the allowed space for the axis labels meaning you can keep all charts the same width. Is this possible with syncfusion?
Edit: Maybe there is a better way for having multiple charts on top of each other with the same X axis and different Y axis instead of having three individual charts like I have?
Attachment: images_db5a97c5.zip
Hi Aaron,
We are validating your query at our end, and we will update further details in two business days within May 16, 2024. We appreciate your patience until then.
Regards,
Preethika Selvam.
Hi Aaron,
Query 1: The chart is filling the width but not the height.
We would like to inform you that the series will be rendered based on the data points only. We still need more details about your requirement. Could you please provide the following information, which will be helpful for us to provide a solution sooner?
- What type of series is used in the SfCartesianChart?
- What type of axis is used in the SfCartesianChart?
- How many data points are used in the SfCartesianChart?
Query 2: The line for this chart is getting slightly clipped on the width.
We would like to inform you that, when the width of the series is 2, the width equally renders on both the left and right side of the segment. In your case, the datapoint is placed at the edge of the plot area. So, the half of the segment width get clipped. To resolve this issue, we suggest you set the half of the width value to the plotOffset in x-axis, it will add a padding between the series and the plot area. By using this, the series will render without clipping when it is close to the edge of the plot area. We have shared user guide documentation link for your reference.
UG Link,
https://help.syncfusion.com/flutter/cartesian-charts/axis-customization#offset-the-rendering
Query 3: Is there a way to size multiple charts to be the exact same size.
We have validated the attached screenshot and noticed that the axis range was not same for third chart as in the first chart and second chart. To overcome this, we suggest you set the maximumLabelWidth in the Axis. By using this, axis label width will increase. We have shared an online sample link for your reference below.
Sample Browser link,
https://flutter.syncfusion.com/#/cartesian-charts/axis-features/maximum-width-for-labels
Regards,
Lokesh P.
primaryYAxis: NumericAxis(
isVisible: false,
plotOffset: plotOffset,
minimum: 546202798,
maximum: 546250881,
),
Hi Aaron,
Query 1 and Query 2:
We are happy to hear that the solution was found by yourself. If you have any further queries, please get back to us. We are always happy to assist you.
Query 3:
You can achieve your requirement by using the margin property in the SfCartesianChart. By using this, you can move the chart to the right. We have shared code snippet for your reference. Please let us know if you need any further assistance.
Code Snippet:
|
SfCartesianChart( margin: EdgeInsets.only(left: 10), ), |
Regards,
Lokesh P.
@ Geometry Dash , Please wait patiently for your query validation information to be updated with further details in two business days. Validation period will be May 16, 2024.
Hi Bean | Geometry,
We have already shared solution for your requirement on May 15, 2024. We kindly request you to check the provided details on May 15, 2024. Please let us know if you need any further assistance.
Regards,
Lokesh P.