Page 1 of 1

Zooming in charts

Posted: Tue Feb 05, 2008 9:15 am
by 7667185
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

Posted: Tue Feb 05, 2008 11:04 am
by narcis
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.

Posted: Thu Feb 07, 2008 10:34 am
by 7667185
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!

Posted: Thu Feb 07, 2008 12:33 pm
by 7667185
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)

Posted: Thu Feb 07, 2008 12:42 pm
by narcis
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!

Posted: Thu Feb 07, 2008 12:53 pm
by narcis
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.

Posted: Thu Feb 07, 2008 1:05 pm
by 7667185
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); 
        } 
    } 
}

Posted: Thu Feb 07, 2008 2:43 pm
by narcis
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.