-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Get current axis interval between labels #2281
Comments
open func setLabelCount(_ count: Int, force: Bool)
{
self.labelCount = count
forceLabelsEnabled = force
} use this to set labelCount. open var labelCount: Int
{
get
{
return _labelCount
}
set
{
_labelCount = newValue
if _labelCount > 25
{
_labelCount = 25
}
if _labelCount < 2
{
_labelCount = 2
}
forceLabelsEnabled = false
}
} The setter is different. |
@liuxuan30 thats not the point though. I wanted to find a way to get the current interval (granularity) of my chart. As mentioned, the granularity I set is in my case not respected and thats fine since I want to force the labels but I would like to add the real granularity to my charts legend |
sorry I missed. No idea what's the convenient way to get interval. But one trick is to get two neighbor x values and use the ChartTransformer to calculate the interval in screen pixels. |
Thanks for the reply. So I got two neighbouring values. What property of ChartTransformer could I use? On a side note, shouldn't the _granularity property be updated to reflect the "real" granularity as opposed to granularity which we define as the minimum? |
I don't fully understand about granularity yet, but I do know granularity is used to be designed to filter repeated axis labels. so I am just thinking about getting intervals. |
In my case I'm setting both granularity and labelcount, with the intention of having an even grid, 20x20 grids (labels) and a certain minimum granularity. This seems to work but I can display the current interval.
Doing leftAxis.granularity would display the minimum I set and not the current axis interval. Is there any way to get that or do I have to do some computation like getting two values on that axis and subtracting them?
The text was updated successfully, but these errors were encountered: