Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JavaFX and the fly likes JavaFX chart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "JavaFX chart" Watch "JavaFX chart" New topic
Author

JavaFX chart

Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 135
Hi,
I am having a problem with JavaFX charts. I have the chart in the scene managed as part of a stack layout.
I have a button which fetches the data for the LineChart and updates the data as follows:

insert LineChart.Data {
xValue: Float.parseFloat(x)
yValue: Float.parseFloat(y)
} into chartSeries[0].data
The y values range from 0 to 10000 while the x values range from 0 to 1000.
The above line of code works, the chart displays the graph.
However, the tick labels for the y axis, which ranges from 0 to 10000 does not display properly. They get clipped after the first digit.

If I increase the height of the application or maximize the application, the y axis tick labels are displayed properly.


I tried setting the visibility to false and true hoping that the entire scene will get redrawn, but that did not work.
I tried calling the requestLayout, layout() methods on the chart, but that did not work.

My questions:
1) Why is the y axis which ranges from 0-10000 not getting redrawn properly? How can I fix this problem?
2) How can I get the entire stage redrawn?
Philippe Lhoste
Greenhorn

Joined: Oct 23, 2009
Posts: 28
The issue looks similar to the one shown in Y Axis Labels replaced with "..." on redraw thread.
The chart library is still young...

I don't know if you can force a redrawing, that's another quite common question...
I saw a workaround, a bit kludgy but at least working: resize the stage, increasing its width of some pixels, then resize it down... Downside: it is ugly!
Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 135
Yes, the problem I am having is the same. However, resizing up and then bringing it down does not seem to work.
I need to resize the stage by some pixels permanently. Here is my code:
if (stageheight < 701) {
stageheight = 701;
stagewidth = 850;
} else if (stageheight > 700) {
stageheight = 700;
stagewidth = 850;
}

Unfortunately, this means that everytime the chart is drawn a full refresh is needed.
That makes it pretty unusable for practical purposes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaFX chart