JDK-8115669 : LineChart snapshot render incorrectly
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 7u6
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • Submitted: 2012-06-20
  • Updated: 2015-06-17
  • Resolved: 2012-07-16
Related Reports
Relates :  
Description
If I take a snapshot of a LineChart, the chart is shown, but the axis tickmark labels are not.

Attached is a sample test case (LineChartExport.java), which captures a snapshot image then renders it - the rendered image should include axis tickmarks on the LineChart, but it does not. Sample output of the test case is also attached (missingslices.PNG) - the chart with a blue background is rendered from an snapshot, the chart from with a white background is rendered normally in the scene - the two charts should be identical, but are not.

This issue is similar to "PieChart snapshot renders incorrectly" which had a workaround of adding the PieChart to a Scene before creating a snapshot.  However in this case, the add to Scene workaround does not work.
Comments
This is not a bug. By default, charts will animate the tick marks and labels on the axis, and a variety of other things over a period of time (up to 700 msec). So at the time the chart is created, the text labels are not yet created and won't be until after animation has run. We should document this limitation, though (I will add a note to RT-21572). There are two possible approaches that an application can take: 1) set the animated property on the X and Y axes and the chart to false. xAxis.setAnimated(false); yAxis.setAnimated(false); chart.setAnimated(false); 2) Wait for at least 700 msec for the animation to finish before taking the snapshot.
16-07-2012