Comments (6)
I can confirm that the changes fixed this issue, thanks! Closing this issue as discussed with @wirew0rm .
from chart-fx.
@zanzica thanks for reporting. The fix is not quite as trivial without breaking the other use-cases. Hope that I found a good compromise. See also PR #131
from chart-fx.
I just noticed that the Javadoc for DefaultNumericAxis states:
Compared to the {@link NumberAxis}, this one has a few additional features:
* Re-calculates tick unit also when the {@link #autoRangingProperty() auto-ranging} is off
Is/was this supposed to be the correct behaviour?
from chart-fx.
yes, until you opened this issue. ;-)
The main original rationale was that one needs to (must) recompute the tick-unit if one zooms, drags or changes the axis range (e.g. sliding/increasing time-axis).
from chart-fx.
Unfortunately I realized that the implemented fix breaks custom TickUnitSuppliers. :-(
I'm reopening this issue (because this is related to its fix), but feel free to move this into a separate issue if it suits you better.
The use case for which I created a custom TickUnitSupplier is that I am working with timestamps in nanoseconds, and wanted to define custom tick units based on the range (instead of defining a static TickUnit).
In the attached example, the x axis unit (seconds -> millis -> micros -> nanos) can be configured with the "multiplier" variable.
DEMO_TickUnitSupplier.txt
The example works fine with revision 5385755 (before the fix was merged): For all x axis units, there are three tick marks visible, showing the correct time. (Screenshot is for nanoseconds, the others look the same.)
The example is broken in revision d73b66c (when the fix was merged): It works correctly for seconds (but shows "stripes"? -> screenshot). For millis and micros, the example hangs, then eventually shows chart (but does not show x tick labels). For nanos, it shows up quickly but does not display x tick labels (-> screenshot).
When x tick labels are not displayed, I see the following log message:
DEBUG [24 Mar 2020 18:01:55,831] (DefaultLoggingEventBuilder.java) - major ticks numerically not resolvable
This leads back to DefaultNumericAxis#calculateMajorTickValues:
if (firstTick + axisRange.getTickUnit() == firstTick) {
if (LOGGER.isDebugEnabled()) {
LOGGER.atDebug().log("major ticks numerically not resolvable");
}
return tickValues;
}
As no tick unit was explicitly specified (since it was now expected to be handled by the TickUnitSupplier, axisRange.getTickUnit()
defaults to 5. This offset is lost due to double precision when we compare firstTick + axisRange.getTickUnit() == firstTick
when the double value for firstTick is sufficiently large (for x unit >= millis).
I am not sure how to fix this properly to make both static tick units and TickUnitSuppliers work correctly.
Personally, I would suggest reverting the current "fix" for the original issue for now - always recalculating the tick unit was, apparently, the intended behaviour and even documented in the Javadoc (even though it confused me when I tried to set the tick unit explicitly - maybe the Javadoc for #setTickUnit should give users a heads-up?). I think the TickUnitSupplier functionality is quite elegant and flexible, and I would currently prefer having TickUnitSuppliers work correctly over having static TickUnits work correctly ...
from chart-fx.
Reverted back to the original behaviour, thanks for the detailed error description.
Regarding documentation, it is unfortunately not as simple as updating the Javadoc, since this the documented behaviour is correct for the other axis implementations. We will have to think about this some more.
from chart-fx.
Related Issues (20)
- [10pt, 10pt]Restructure layout computations to make rendered output more consistent HOT 3
- If the dataset is round-trip, when i zoom the chart, the line will disapear. HOT 4
- Feature request (bug?) center handle position in HeatmapChart Pixels HOT 1
- Feature Request: allow explicit setting of axis' tick marks HOT 1
- Moving XYCharts to a new scene causes improper scaling between the axis and series/gridlines HOT 4
- DragResizerUtil dont resize on south HOT 1
- ShortTimeFourierTransform: Amplitude change with zero padding
- Customize color schema of XYChart HOT 2
- Axis display problem HOT 2
- Noob developer
- Change CachedDataPoints access modifier to public
- Notes for future work past 11.3 HOT 1
- Eclipse cannot handle 11.3.0 for some reason HOT 19
- Several questions about axis HOT 2
- The Zoomer plugin has some problems when using the mouse wheel HOT 2
- Fix usage of `renderer.getAxes` in `DataPointToolTip` and other plugins
- com.sun.javafx.application.PlatformImpl startup WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @...' HOT 2
- (1) real time candlestick Chart with lines and points together (2) show at least two candlesticks together HOT 1
- Am I in the correct developer mode? developer mode for chartfx-chart/: An exception occurred while executing the Java class. Exception in Application start method HOT 1
- setTickUnit seems to be invalid and does not show the expected effect HOT 1
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 chart-fx.