• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JavaFX chart

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic