java - How can I customise javafx.scene.chart.NumberAxis to change the hard-coded upper limit of 20 major tick marks -
i'm using javafx numberaxis component in application, , 99% of want. i'm dealing varying data sets, auto-range function hugely useful.
the auto-range algorithm tries come major tick units result in less 20 major tick marks along axis. , value of "20" hard-coded source. need less 20 in cases, ideally 10.
so ... how can modify numberaxis want?
the class final, , code makes autoranging work depends on other code further hierachy , within same package (numberaxis extends valueaxis, extends axis).
i resorted creating parallel class hierachy within source tree, , creating custom version of numberaxis class. within source tree have
jaxafx.scene.chart.customnumberaxis
and copied original source code numberaxis , modified auto-range method.
unfortunately raises illegalaccessexceptions. i'm guessing because runtime noticed code trying call package-protected methods sitting in jfxtr.jar.
is there way round this, or have copy autorange algorithm code out helper class, , try detangle chart package dependencies?
so gave on trying avoid duplication , went inelegant, brute-force solution.
created new package "customchart", , created 3 new classes customaxis, customvalueaxis , customnumberaxis. copied in code corresponding javafx originals. fixed few class references. added modification need... , seems work now.
all can create setter method 1 integer value.
Comments
Post a Comment