Zoom in horizontal axis only (Newbie questions...)

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
antonioli
Posts: 12
Joined: Sat Apr 24, 2010 3:28 pm
antibot: No, of course not.

Zoom in horizontal axis only (Newbie questions...)

Post by antonioli » Sat Apr 24, 2010 4:41 pm

Hi!

I'm new in this forum and in the use of jFreeChart library to create charts.
I'm doing a work to school and have some doubts about some options.

I'm using this simple code to construct a graphic of sample sound:

Code: Select all

chartPanel = new ChartPanel(chart);
chartPanel.setDomainZoomable(true);
setContentPane(chartPanel);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
JPanel  main = new JPanel(new BorderLayout());
JPanel checkpanel = new JPanel();
voltar = new JButton("Initial Image");
Action alisten = new Action();
voltar.addActionListener(alisten);
checkpanel.add(back);
main.add(checkpanel, BorderLayout.SOUTH);
main.add(chartPanel);
setContentPane(main);
Two questions:
How I can define to zoom in horizontal axis only? Using ZOOM_IN_HORIZONTAL_ACTION_COMMAND constant? How can apply this in my code?
How can do a "average of points" (point average?) in my chart?

gengar
Posts: 26
Joined: Thu Mar 18, 2010 12:28 am
antibot: No, of course not.

Re: Zoom in horizontal axis only (Newbie questions...)

Post by gengar » Mon Apr 26, 2010 6:52 pm

You can set one axis to be zoomable and the other not zoomable with the setRangeZoomable and setDomainZoomable methods in ChartPanel:
http://www.jfree.org/jfreechart/api/jav ... e(boolean)
http://www.jfree.org/jfreechart/api/jav ... e(boolean)

I have no idea about what you mean by average of points.

antonioli
Posts: 12
Joined: Sat Apr 24, 2010 3:28 pm
antibot: No, of course not.

Re: Zoom in horizontal axis only (Newbie questions...)

Post by antonioli » Tue Apr 27, 2010 9:56 pm

Thks for the help, it results. About the average, i will try later and if i need i will try to explain you better.
But now, when i select a part of the chart to zoom, i want to put this part of the chart in another window, it is possible? i tried to find something about this, but i didn't find...

gengar
Posts: 26
Joined: Thu Mar 18, 2010 12:28 am
antibot: No, of course not.

Re: Zoom in horizontal axis only (Newbie questions...)

Post by gengar » Wed Apr 28, 2010 7:46 pm

I think you can get the bounds of the selected area. So, clone the chart, place the clone in another frame, and set the upper/lowerbounds of the axes according to the selected area.

antonioli
Posts: 12
Joined: Sat Apr 24, 2010 3:28 pm
antibot: No, of course not.

Re: Zoom in horizontal axis only (Newbie questions...)

Post by antonioli » Wed Apr 28, 2010 8:17 pm

Ok, thks, but how i can get the data? have you some code to explain?

antonioli
Posts: 12
Joined: Sat Apr 24, 2010 3:28 pm
antibot: No, of course not.

Re: Zoom in horizontal axis only (Newbie questions...)

Post by antonioli » Fri Jul 02, 2010 7:03 pm

Hi!
A newbie question question: how i can perfom a average of a serie (is using createMovingAverage?)?
For example I have a serie with 5000 values and I want a serie with 2500 values. How I can do this?

Locked