Line plotting off axis on JFreeChart & two timeseries?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
lynzoid
Posts: 4
Joined: Fri Jan 20, 2017 9:03 am
antibot: No, of course not.

Line plotting off axis on JFreeChart & two timeseries?

Post by lynzoid » Fri Jan 20, 2017 9:08 am

Hi guys,

Sorry if i've not given enough information but i'm having the problem of the JFreeChart plotting slightly off the Y Axis and I can't seem to figure out why.
Currently it's on a timer every one second and gets a random value to plot.

Also is it possible to have two line graphs (time series) plotted on the same graph?

Much Appreciated, Lynzoid.

http://imgur.com/a/PZDrM - graph

http://ideone.com/bnIg6w - code

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

Re: Line plotting off axis on JFreeChart & two timeseries?

Post by paradoxoff » Fri Jan 20, 2017 5:43 pm

Code: Select all

chart.getXYPlot().setAxisOffset(RectangleInsets.ZERO_INSETS);

lynzoid
Posts: 4
Joined: Fri Jan 20, 2017 9:03 am
antibot: No, of course not.

Re: Line plotting off axis on JFreeChart & two timeseries?

Post by lynzoid » Sat Jan 21, 2017 12:27 am

Hi this still isn't working unless i've put it in the wrong spot?

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

Re: Line plotting off axis on JFreeChart & two timeseries?

Post by paradoxoff » Sat Jan 21, 2017 2:16 pm

lynzoid wrote:Hi this still isn't working unless i've put it in the wrong spot?
Since I cannot know where exactly you have put the statement, I can only respond with "Maybe, maybe not".
You need to place the line

Code: Select all

plot.setAxisOffset(RectangleInsets.ZERO_INSETS);
in your createChart-method.

lynzoid
Posts: 4
Joined: Fri Jan 20, 2017 9:03 am
antibot: No, of course not.

Re: Line plotting off axis on JFreeChart & two timeseries?

Post by lynzoid » Sun Jan 22, 2017 1:30 am

Hi sorry for not giving the full amount of information. The problem ended up being me adding a millisecond rather than a second to the time series and then it plots it based on that.
So I changed it to a second and it fixed it.

My other question is how can I plot two timeseries on the same chart?

-Thanks and sorry!

Locked