Comments (10)
from vico.
Hello! The HorizontalAxis.TickPosition.Center
constructor has a spacing
parameter. The default value is 1. Once you change the value to n, ticks, vertical grid lines, and labels will be displayed every n entries. This is demonstrated in the second sample chart. See here for the relevant code. You appear to be using an AxisValueFormatter
to display a label every 10 entries, which is why unwanted vertical grid lines can be seen. Please note that this approach is no longer recommended.
from vico.
Thank you for your tip! It works for me
But my case is show upcoming data (1-10 dots per sec).
In case when x-values of chart entry are Ints, grid is ok, when I use Floats the grid is gone and blinks sometimes.
Maybe I missed some initial settings?
private val entries: MutableList<FloatEntry> = MutableList(0) { FloatEntry(0f, 0f) }
val producer = ChartEntryModelProducer(entries)
from vico.
I’m glad to hear that the spacing
parameter did the trick. Regarding the grid issue, would you be able to provide a minimal reproducible example?
from vico.
I’m glad to hear that the
spacing
parameter did the trick. Regarding the grid issue, would you be able to provide a minimal reproducible example?
https://github.com/EzzPress/VicoExample
check the viewmodel comments in init function
from vico.
Cheers!
from vico.
I’m glad to hear that the
spacing
parameter did the trick. Regarding the grid issue, would you be able to provide a minimal reproducible example?
Some updates - grid disappears when the new x value is not a divisor to the grid range.
For example:
- 1f step for new chart values - ok
- 0.5f step for new chart values - ok
- 0.51f step for new chart values - grid fails
from vico.
Thanks for the update! At the moment, Vico doesn’t support entirely arbitrary distances between the x values of entries, which is why the grid is misbehaving. x values can be skipped, but a level of consistency is expected. For example, (0, 1, 2, 4) works, but (0, 0.49, 1.23, 5.34) causes issues. If you’d like to display entries with arbitrary x values in an equidistant manner, you can use an AxisValueFormatter
implementation (see here). We plan on adding support for arbitrarily spaced entries in the future (#112). In order to make things clearer, we’ll be looking into having an exception thrown when the differences between the x values in a data set aren’t consistent enough for charts to behave properly.
from vico.
I’ve taken a closer look at the function responsible for calculating the x step, and it would appear that instead of calculating the greatest common denominator of the x values, it finds the pair of values with the smallest difference and treats said difference as the step, the assumption being that the smallest difference divides all other differences. It’d be preferable if the greatest common denominator were used, so I’ll be updating the function accordingly. Once this is done, the issue you’ve described will no longer occur. However, it’s worth noting that the greatest common denominator of 0.5 and 0.51 is 0.01, so if the set of x values is (0, 0.5, 0.51), the grid will be correctly drawn, but there will be a large number of empty segments between the entry with an x value of 0 and the entry with an x value of 0.5. Therefore, a custom AxisValueFormatter
implementation will still be the way to go as far as displaying entries with arbitrary x values in an equidistant manner is concerned.
from vico.
Vico 1.6.1, which is now rolling out, introduces the changes described in my last comment. As it turns out, the direct cause of the issue with the bottom axis was that HorizontalAxis
handled fractional x values improperly. That too has been resolved. Consequently, I’ll be closing this issue. Thanks for your feedback!
from vico.
Related Issues (20)
- ChartValuesProvider "IllegalStateException" HOT 14
- Chart fails to load all sets after loading 0 values HOT 6
- Compose Recomposition causing an Error HOT 3
- Marker Color field is always overridden HOT 6
- Decoration is not drawn above chart in ComposedChart HOT 4
- StackOverflowError when calling ChartEntryModelProducer::setEntries() HOT 7
- MutableExtraStore is making tests fail HOT 6
- Chart does not update bar colors properly HOT 1
- Only One AxisValueOverrider Used HOT 3
- Unexpected background shader when using View Mode in examples Chart 7. HOT 2
- The library prevents effective minification (by depending on `androidx.compose.ui:ui-tooling`) HOT 4
- Crash and no display if only one value on X HOT 8
- Missing LinearGradientShader for view module HOT 1
- Not able to grab a screenshot test of a graph HOT 13
- Not able to see x-axis and y-axis labels in some devices. HOT 8
- Incorrect values displayed on X axis HOT 3
- IllegalStateException on ComposedChart with different xStep in children charts HOT 4
- Unresolved reference: com.patrykandpatrick.vico.compose.chart.CartesianChartHost HOT 5
- Animation from Y = 0 to real value
- `DynamicShader` equality checks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vico.