I'm using the SfCartesianChart widget and supplying the X-Axis with:
primaryXAxis: DateTimeAxis(...)
I'm not using interval or intervalType (although I've tried).
I've set maximumLabels to 3 (even though it says 3 is the default). And sometimes the number of labels exceeds 3. But more than that, 80% of the time, the labels are not evenly spaced on the X-Axis.
How can I go about setting an evenly spaced X-Axis?
Thank you for the sample. My question really is if you look at the charts on apps like Coinbase and Robinhood. When you select the 1H range: There are always 5 consistent labels, exactly in the same positions.
For me when I set the intervalType to 'minutes', I get a lot of unexpected behavior when the numbers are just floating at random intervals, etc. Do you have any suggestions on how to keep is consistent, when the data is changing and when the dates are not perfect (strange seconds, strange milliseconds, et
For example; How can I precisely put a label every 5 minutes, or every 15 minutes?
|
final DateTime minimum = DateTime(2010, 1, 1, 01, 11);
final DateTime maximum = DateTime(2010, 1, 1, 01, 20);
const int noOfLabelToDisplay = 5;
primaryXAxis: DateTimeAxis(
minimum: minimum,
maximum: maximum,
//For 5 consistent labels, here we have divided by 5,
//you can change this based on your scenario
interval: (maximum.minute - minimum.minute) / noOfLabelToDisplay,
intervalType: DateTimeIntervalType.minutes
), |
Doesn't this assume that you are only displaying data for the last hour or so?
when maximum minute is 30 and minimum is 50 then (30 - 50) / 5 = -4 ?
Also if I want to be able to scroll the graph, does changing these to visibleMax/Min the way to go? It's strange that I can't tell the graph library that I only want X labels and that they should be spaced 5 minutes apart.
|
final DateTime minimum = DateTime(2010, 1, 1, 01, 50);
final DateTime maximum = DateTime(2010, 1, 1, 02, 30);
const int noOfLabelToDisplay = 5;
primaryXAxis: DateTimeAxis(
minimum: minimum,
maximum: maximum,
interval: maximum.difference(minimum).inMinutes.toDouble() /
noOfLabelToDisplay
),
|
Was there a regression, when using the above with visibleMinimum property, there are some strange results on non-retina devices? The strange results that I'm referring to, mainly are: The number of intervals are no longer working as expected when they are computed, as prescribed above. In fact interval seems to be 100% ignored. I'm on 19.3.53 now.