You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am seeing an issue with the horizontal bar chart. I am attempting to show a bar chart with 2 - 3 values in it. There's times on the X axis and doubles on the Y axis.
The issue occurs when all of the Y values are the same. For example, if there are 2 Y values and both of them are 1.67, it's incorrectly rounding them to 2. If one of the Y values was 1.67 and the other was 2, it works correctly.
This screenshot is taken where both values are 1.67.
This is taken where one value is 1.67 and the other is 2.
The number itself is very important in this application, rounding it to 2 would not work.
The text was updated successfully, but these errors were encountered:
This is becuase it will calculate the digits it needs by default value formatter:
internalfunc calculateFormatter(min min:Double, max:Double){
// check if a custom formatter is set or not
varreference=Double(0.0)
if (_data ==nil || _data.xValCount <2){letabsMin=fabs(min)letabsMax=fabs(max)
reference = absMin > absMax ? absMin : absMax
}else{
reference =fabs(max - min)}letdigits=ChartUtils.decimals(reference)
_defaultValueFormatter.maximumFractionDigits = digits
_defaultValueFormatter.minimumFractionDigits = digits
}
in your case only two equal values exist, and the reference would be 0, so the fraction digits are 0, that's why you see it's rounded, by the formatter.
What you can do is pass your valueFormater in dataSet, so you can get rid of the default formatter.
I won't consider it's a bug, because it's a default value foramtter, and it has a default logic to adjust its FractionDigits. There are always values can have more digits than maximumFractionDigits limit. So it's user's choice how to deal with it.
Hi,
I am seeing an issue with the horizontal bar chart. I am attempting to show a bar chart with 2 - 3 values in it. There's times on the X axis and doubles on the Y axis.
The issue occurs when all of the Y values are the same. For example, if there are 2 Y values and both of them are 1.67, it's incorrectly rounding them to 2. If one of the Y values was 1.67 and the other was 2, it works correctly.
This screenshot is taken where both values are 1.67.
This is taken where one value is 1.67 and the other is 2.
The number itself is very important in this application, rounding it to 2 would not work.
The text was updated successfully, but these errors were encountered: