Skip to content
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

xAxis when zooming #1655

Closed
phucnd0604 opened this issue Oct 13, 2016 · 8 comments
Closed

xAxis when zooming #1655

phucnd0604 opened this issue Oct 13, 2016 · 8 comments

Comments

@phucnd0604
Copy link

how to disable auto generate label when zooming
eg my xAxis is 100,200,300,400,500 but when zoom it auto generate to 110, 120, 130 etc but i dont want it, just 100, 200, 300 , 400 , 500

@liuxuan30
Copy link
Member

then what is the meaning of zooming in and how can users know where they are?

@phucnd0604
Copy link
Author

but i dont need to know where they are because when they zooming in for example my axisx is people count like : 1, 2, 3, 4, 5. Then they show 1.2, 1.4 people etc but i dont want it.

@liuxuan30
Copy link
Member

set granularity = 1

    /// The minimum interval between axis values.
    /// This can be used to avoid label duplicating when zooming in.
    ///
    /// **default**: 1.0
    open var granularity: Double
    {
        get
        {
            return _granularity
        }
        set
        {
            _granularity = newValue

            // set this to `true` if it was disabled, as it makes no sense to set this property with granularity disabled
            granularityEnabled = true
        }
    }

@phucnd0604
Copy link
Author

but this still not show the correct label, eg my labels is 1, 2, 10, 20 , 23, 30 then if i set granularity = 2 or 1 it still display 1, 2, 3, 4, ... etc when zooming. i just want to show exactly the labels like version 2 before

@liuxuan30
Copy link
Member

liuxuan30 commented Oct 17, 2016

Chart 3.0 changed the way how x axis works, you have to follow the new implementation.

I don't understand your question as you change it in every comment, first 100,200,300,400,500 then 1.2, 1.4 and then 1, 2, 10, 20 , 23, 30.

If you want to use custom x values, then you should implement your own IAxisValueFormatter protocol to display whatever you want.

@phucnd0604
Copy link
Author

right, actually i have a array of values by timestamp, then i custom to show the date with human formatter. but the time interval is not equal for every timestamp so if i set the minimun is 1s or 10s it will show 0h00s, 0h10s, 020s 0h30s, 0h40s ... when zoom in
but the original timestamp is only 0h00s, 0h30s, 0h40s.

@liuxuan30
Copy link
Member

yes because in Chart 2.x, it uses 'index based' for x axis, however in 3.0, x axis behaves like y axis.

@liuxuan30
Copy link
Member

liuxuan30 commented Oct 17, 2016

also, I would argue what is x axis - it is axis that shows static interval and grids normally; you have non-equal intervals, which should not be a good way to display in terms of x axis; the chart will be not easy to read; you can show it as values, but not x axis labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants