JavaFX NumberAxis turn off Auto Hide/Scale behavior - javafx

Using JavaFX 2.1 the NumberAxis, when used with a chart such as a ScatterChart, has a feature that as the viewable is resized the chart is resized.The NumberAxis resizes and as it gets smaller it will hide Labels that don't fit, or as it gets bigger will add new ticks between labels that are show. (Even if setMinorTickVisible(false) is called).
In my case I have specific labels I want to use for certain numeric values. So I wrote my own StringConverter and called setTickLabelFormatter() on the NumberAxis
The problem is as it resizes I want to make sure exactly ALL of the labels show up in the display. However resizing will hide the labels I want to show (if it gets too small) or add unwanted ticks if it gets too large.
How can I override the behavior of the Number Axis to not do this?
Or alternatively How can I properly size my chart to show just the labels I need/want (adding a scroll pane if needed).
Thanks for the help I am a long time Java Developer that is just learning JavaFX

Related

GridPane cuts off Label when using COMPUTED_SIZE

I have a GridPane displaying descriptive Labels on the left side and content Labels on the right side. I set everything to USE_COMPUTED_SIZE in SceneBuilder and added padding to my elements so they don't stick together too closely. This works well if it wasn't for the fact, that the left-side Labels are cut off, if the content is big enough to take up the whole width of the scene:
Is there a way of making sure that my left-side labels are displayed in full, before the right side labels get their share of available width? Setting the minimum width of the first column to a concrete value works, but i would like JavaFX to determine the needed size for the first column.
Use Texts (can be found in Shapes) instead of Labels in the first column. In contrast to Labels Texts are not resizeable and GridPane cannot resize the first column to become smaller than the largest of the Text nodes in this column.

How to disable auto hiding of labels on Category Axis?

In amCharts column chart, labels on category axis are alternately hidden when user reduces the browser width.
Please refer JSFiddle in the comments (When the JSFiddle output box is dragged inwards, amCharts starts hiding alternative labels on category axis as shown in screenshot above).
How to disable auto hiding of labels on category axis? Requirement is to scale down the chart (without hiding any label), when user reduces the browser size. This issue occurs when you add more columns beyond certain count.
There is a way to increase the number of labels shown, however it won't force them to show, when they're out of the renderrange of the chart. (I've also tested forceShowField, but this doesn't work for me)So the way how you could do it is setting the minHorizontalGap to zero (or at least a lower value than default which is 75). Check docs and your modified JSFiddle.
"categoryAxis": {
"gridPosition": "start",
autoWrap:false,
minHorizontalGap:0,
}

Javafx chart show more empty space

I am customizing the javafx charts a bit adding valuelabels etc above bars and sliding out certain parts of piecharts. The problem is some of the extras come outside of the visual area.
Is there a simple way to get piecharts to become smaller (but the chart component itself retain its size so that there is more empty space surround the pie?
The same issue with barcharts. I need more empty space above my vertical bars, and more empty space to the right of my horizontal bars.
All data in the table has Number(mostly BigDeicmal) for its value and String for its key and series.

Flex BarChart long text

In my application, I am using a BarChart to display data. However, the text in the category axis can be too long to display on the chart, so flex adjusts the font size automatically to the point that the data is either unreadable, or the text is partially visible.
The length of the text varies every time new data comes in, so I can't set the gutterLeft attribute to a static value at runtime.
Two things that come to my mind are:
Change the gutter dynamically according to new data
Have a scroll bar on the categoryaxis so that if any text won't fit in the space, the user can scroll to see it
Any help would be appreciated.
EDIT:
I have hundreds of rows of data being graphed at once, so I can't really use a legend for each item.
Also, I have no idea how to change the gutterLeft property with actionscript. Doing it in MXML is as simple as
gutterLeft="100"
but I cannot access the property using actionscript. I also tried to bind the gutterLeft variable to an integer and change that integer and it still didn't work. :|
the problem is that gutterleft is a style, and therefor needs to be set as one when using actionscript.
I was hoping to see your code to give a more detailed answer but what you want to do is:
mychart.setStyle("gutterLeft",500);

Flex - Placement of Legend for a chart

I would like to be able to specify the placement of a legend for a linechart. Currently, it continues to appear to the right of the chart. I have tried playing with the width/height of the chart to no avail... Putting the legend before the linechart in the mxml causes it to appear to the left. I can't seem to get it appear at the bottom though. I can't seem to find any good examples for this. They don't seem to specify anything but the legend usually shows up below the chart, I can't seem to do it. Optionally, it would be okay to somehow minimize the legend..
what container are your line chart and legend in? its sounds like you are using either an HBox or an application with the layout="horizontal". To move the legend below use either a VBox or application layout of vertical. Or you can use a canvas and use constraints (left, right, top, bottom) or x and y coordinates

Resources