Zooming in charts

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Zooming in charts

Post by Marius » Tue Feb 05, 2008 9:15 am

Hi again. Hope it is OK that I ask some questions again :)

When zooming into charts (e.g. densly populated scatter plots), are there any experience with the new view not being populated after zoom? Every now and then when I zoom in, the new view is empty until I drag the view outside the one I just created. When I then drag it back, the values suddenly appears... If you want I can include a screenie-sequence illustrating the behavior.

Also, it seems that while selecting the area in which to zoom in, one of the processors runs up to close to 100% before the area is selected. Is there any way I can make TeeChart wait with the calculations (or whatever) until I release the button? This problem could of course be related to my program, but as I understand the program doesn't really do anything at all while I play in the chart window.

Thanks in advance!

Marius Lunde

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 05, 2008 11:04 am

Hi Marius,

It would be really helpful if you could send us simple example projects we can run "as-is" to reproduce the issues here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Post by Marius » Thu Feb 07, 2008 10:34 am

Hiya Narcis

I guess I got the answer I was looking for; that you have not experienced the vanishing-points-when-zooming problem before. So, as I am unable to make a simple program that reproduce the issue, I assume the error is in some way related to my program

For the performance-issue you can just run the TeeChartDemo and hold the zoom-button clicked while moving the square around, monitoring the CPU usage. It's no big deal but could be of some interest to you. Also, when looking at the Demo, you can observe the "Neatest Point"-app: If you drag the points out of the chart (either south or east in this case, but also west and north can happen), the marks are still visible though the points are outside the view :) No biggie but might also be of interest...


Anyways; I have two hopefully small, practical questions:

I have for a long time now been trying to display a single Mark (with arbitrary text) after selecting a Point in one out of several plotted Series, and would really appreciate some hints. My challenges are:

I am not able to distinguish which Series I click, if there are several Series in a chart. Is there any method similar to the
Point = TChart.getChart().getSeries(someSeries).clicked(MouseEvent.getPoint());,
like
Series = TChart.getChart().clicked(MouseEvent.getPoint()); ? Or do I need to create different listeners on all Series I am creating in order to distinguish when clicking?

Second, after obtaining the wanted series and the point number, I want to display the Mark of that Point. I try to use
MarksItem mark = aSelectedSeries.getMarks().getItems().get(pickedPointNumber);
mark.setText("Something"+someting);
mark.setVisible(true);

but nothing pops up in my chart. Is this procedure correct?

Thanks alot in advance
Best regards!

Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Post by Marius » Thu Feb 07, 2008 12:33 pm

By the way I uploaded a small program (as a JAR) onto the public.attachments-group just to illustrate the issue with the Marks and also showing another issue conserning appending text on an axis. If you want the code I can post it as well.

Enjoy 8)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 07, 2008 12:42 pm

Hi Marius,
For the performance-issue you can just run the TeeChartDemo and hold the zoom-button clicked while moving the square around, monitoring the CPU usage. It's no big deal but could be of some interest to you. Also, when looking at the Demo, you can observe the "Neatest Point"-app: If you drag the points out of the chart (either south or east in this case, but also west and north can happen), the marks are still visible though the points are outside the view Smile No biggie but might also be of interest...
Ok, I've been able to reproduce the performance issue here and we will investigate it.

Regarding marks not being clipped you can set their Clip property to true:

Code: Select all

                tChart.getSeries(0).getMarks().setClip(true);
I am not able to distinguish which Series I click, if there are several Series in a chart. Is there any method similar to the
Point = TChart.getChart().getSeries(someSeries).clicked(MouseEvent.getPoint());,
like
Series = TChart.getChart().clicked(MouseEvent.getPoint()); ? Or do I need to create different listeners on all Series I am creating in order to distinguish when clicking?
Ok, I recommend you to do something as in the example I posted here.
Second, after obtaining the wanted series and the point number, I want to display the Mark of that Point. I try to use
MarksItem mark = aSelectedSeries.getMarks().getItems().get(pickedPointNumber);
mark.setText("Something"+someting);
mark.setVisible(true);

but nothing pops up in my chart. Is this procedure correct?
My suggestion would be using Annotation tools here. There's an example of that on this thread. It is in Spanish but you can find the example on second Marc's post from 23rd March 2007.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 07, 2008 12:53 pm

Hi Marius,
By the way I uploaded a small program (as a JAR) onto the public.attachments-group just to illustrate the issue with the Marks and also showing another issue conserning appending text on an axis. If you want the code I can post it as well.
Sorry but I can't find the program at the public newsgroups. Can you please try posting it at the upload page as well?

http://www.steema.net/upload

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Post by Marius » Thu Feb 07, 2008 1:05 pm

First of all thanks alot for the previous tips :D

I noticed after I wrote the reply to you that the posting onto the Newsgroup didnt work for some reason (I get a response from the server saying the file is too large, but it is only 1.2 Mb, basically a few lines of code and the TeeChart-lib) :?

For some reason I can't access the upload page either, sorry hehe. I'm just told that IE cant display the page (http://www.steema.net/upload )

Any ideas?

EDIT:

I can't seem to be able to upload it, so I'll just post the code snippet here. Sorry about the space, but then you can at least look at it if you are curious

Code: Select all

import com.steema.teechart.TChart; 
import com.steema.teechart.styles.Points; 
import com.steema.teechart.styles.Series; 
import javax.swing.JFrame; 
import javax.swing.JPanel; 
public class ZoomTest extends JFrame 
{ 
    JPanel dmb = new JPanel(); 
    TChart myChart = new TChart(); 
    public static void main(String[] args) 
    { 
        new ZoomTest(); 
    } 
    public ZoomTest() 
    { 
        initialize(); 
        demoOnAxisNames(); 
    } 
    public void initialize() 
    { 
        double[] testData = new double[50]; 
        double[] testX = new double[50]; 
        myChart.getChart().getAspect().setView3D(false); 
        for(int i=0;i<50;i++) 
        { 
            testData[i] = (i+50)*Math.pow(Math.random(),Math.random()); 
            testX[i] = i; 
        } 
        myChart.getChart().getAxes().getLeft().getTitle().setCustomSize(50); 
        Points p = new Points(myChart.getChart().chart); 
        p.add(testData); 
        p.getXValues().setValues(testX); 
        p.getMarks().setVisible(true); 
        myChart.addSeries(p); 
        dmb.add(myChart); 
        super.add(dmb); 
        super.setSize(600,400); 
        super.show(); 
    } 
    public void demoOnAxisNames() 
    { 
        String prev = null; 
        String curr = null; 
        myChart.getAxes().getLeft().getTitle().setText("This text shrinks"); 
        for(int i=0;i<4;i++) 
        { 
            // Notice how all previous title-inputs shrinks one letter  every time 
            // something new is added and getText() is used to get it 
            prev = myChart.getAxes().getLeft().getTitle().getText(); 
            curr = prev+"This text shrinks"; 
            myChart.getAxes().getLeft().getTitle().setText(curr); 
        } 
    } 
}
Last edited by Marius on Thu Feb 07, 2008 1:59 pm, edited 1 time in total.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 07, 2008 2:43 pm

Hi Marius,

Thanks for sending the code. Yes, the upload page wasn't working fine. Hopefuly it's working now.

Anyway, I've been able to reproduce the axis title issue and this seems a bug to me. I've added this defect (TJ71012806) to our bug list to be investigated and fixed for next releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply