No Domain Grid Lines visible

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
devent
Posts: 4
Joined: Sat Dec 25, 2010 3:18 am
antibot: No, of course not.

No Domain Grid Lines visible

Post by devent » Sat Apr 02, 2011 11:50 am

Hello,
I have a Scatter Plot with createScatterPlot() and I like to hide the range grid lines but show the domain grid lines. So I have this code below. Now I don't have any grid lines at all. Why aren't the domain grid lines shown?

I'm using JFreeChart 1.0.12.

I see, the grid lines are only visible if the plot is big enough. How can I set when the grid is visible?

Code: Select all

		XYPlot plot = (XYPlot) chart.getPlot();

		plot.setDomainGridlinesVisible(true);
		plot.setDomainMinorGridlinesVisible(true);
		plot.setDomainCrosshairVisible(true);
		plot.setDomainCrosshairLockedOnData(true);
		plot.setDomainZeroBaselineVisible(true);

		plot.setRangeGridlinesVisible(false);
		plot.setRangeMinorGridlinesVisible(false);
		plot.setRangeCrosshairVisible(false);
		plot.setRangeCrosshairLockedOnData(false);
		plot.setRangeZeroBaselineVisible(false);

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: No Domain Grid Lines visible

Post by paradoxoff » Sun Apr 03, 2011 8:28 am

Your code looks ok. What do you mean by
the grid lines are only visible if the plot is big enough
?
Are we talking about the physical size of the plot in pixel or the data range of domain and range axis ?
In the latter case, I assume that you are using a user defined tick unit and then set the range of the domain axis in a way that there is no tick within the visible axis range?
Do only the grid lines disappear or the tick marks (if any) as well?

devent
Posts: 4
Joined: Sat Dec 25, 2010 3:18 am
antibot: No, of course not.

Re: No Domain Grid Lines visible

Post by devent » Sun Apr 03, 2011 10:20 pm

I think it's physical size. Here are two screen shots from the JFreeChart Demo application. One don't show the grid lines of the domain axis, but the other does. The only difference is that I made the window a few pixels wider. (The demo application is from JFreeChart 1.0.13)

No Lines http://www.flickr.com/photos/53303115@N ... /in/stream
With Lines http://www.flickr.com/photos/53303115@N ... /in/stream

I don't know if that the intended behavior of the application but I would expect to see the domain grid lines even in a small windows. My monitor is big, 1920 pixels and I need to make the demo application to the full width of the monitor to see the domain grid lines. It's the same with other graphs in the demo application, like XYSplineRenderer, Eurodollar Futures Contract, etc. The grid lines in the range axis are visible even if the window is small.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: No Domain Grid Lines visible

Post by paradoxoff » Mon Apr 04, 2011 9:30 pm

When you scale a ChartPanel beyond certain limits, the ChartPanel may start to draw the chart on an scaled image (see the methods ChartPanel.set[Maximum/Minimum]Draw[Width/Height]). If this scaling makes your grid lines disappear, maybe you could use a a thicker stroke? What kind of stroke are you using at present? The default is a BasicStroke with a thickness of 0.5, i.e. a hair line.

Locked