problem with radar

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

problem with radar

Post by rubby » Thu Aug 29, 2013 3:32 am

Hello,

I create a radar in TChart and put it on a JPanel,
When i change the size of panel,
the radar will change the size of itself. However,in a wrong way.

When I compare the radar with the radar generated by excel,
this confirm my judge.

Could you please tell me how to address this problem?
Thanks.

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with radar

Post by Yeray » Thu Aug 29, 2013 10:45 am

Hi,

Could you please post some screenshots of the problem and a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: problem with radar

Post by rubby » Fri Aug 30, 2013 3:05 am

My code is as follows.
In the attachment, you can find two png files.
In the first png (radar1.png), you will see the radar graph is wrong.
In the second png(radar2.png), you will find that the value "33" is not showed correctly either.

Thus, when user changes the size of the dialog, the radar graph changes in a wrong mode.


Code: Select all

import com.steema.teechart.Dimension;
import com.steema.teechart.Rectangle;
import com.steema.teechart.TChart;
import com.steema.teechart.editors.ChartEditor;
import com.steema.teechart.styles.Radar;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JDialog;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

/**
 *
 * @author
 */
public class TestTeeChartJunit extends JDialog {

    public TestTeeChartJunit() {
        this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        setSize(new Dimension(581, 380));

        setTitle("TeeChart for Java - Swing example application");

        tChart2 = new TChart();
        tChart2.setGraphics3D(null);
//        tChart2.addSeries(new Line());
//        tChart2.getSeries(0).fillSampleValues(); //随机数


//        tChart2.addSeries(new Bar());
//        tChart2.getSeries(0).add(10);
//        tChart2.addSeries(new Bar());
//        tChart2.getSeries(1).add(13);
//        tChart2.addSeries(new Bar());
//        tChart2.getSeries(2).add(49);
//        tChart2.addSeries(new Bar());
//        tChart2.getSeries(3).add(55);
         Radar   series2 = new com.steema.teechart.styles.Radar(tChart2.getChart());
       series2.add(50); series2.add(33); series2.add(56); series2.add(88);series2.add(108);

        tChart2.setBounds(new Rectangle(0, 0, 500, 500));

        //设置图标的属性
        tChart2.getAspect().setView3D(false); // no 3D
        // tChart2.getLegend().setText("jw legend");
        this.add(tChart2);
        tChart2.setComponentPopupMenu(popup);
        JMenuItem item = new JMenuItem("Property");
        item.addActionListener(new RightListener(tChart2));
        popup.add(item);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        TestTeeChartJunit myChart = new TestTeeChartJunit();
    }
    TChart tChart2;
    JPopupMenu popup = new JPopupMenu();
}

class RightListener implements ActionListener {

    TChart tChart2 = null;

    public RightListener(TChart chart) {
        this.tChart2 = chart;
    }

    public void actionPerformed(ActionEvent e) {
        ChartEditor.editChart(tChart2.getChart());
    }
}
Attachments
radar2.png
radar2.png (62.15 KiB) Viewed 28415 times
radar1.png
radar1.png (54.18 KiB) Viewed 28404 times

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with radar

Post by Yeray » Tue Sep 03, 2013 10:13 am

Hi,
rubby wrote:In the first png (radar1.png), you will see the radar graph is wrong.
In the second png(radar2.png), you will find that the value "33" is not showed correctly either.
This code:

Code: Select all

Radar series1 = new Radar(tChart1.getChart());
series1.add(50);
series1.add(33);
series1.add(56);
series1.add(88);
series1.add(108);

tChart1.getAspect().setView3D(false);
Gives me this:
TeeChart.png
TeeChart.png (19.16 KiB) Viewed 28386 times
That looks as your radar1.png image. However, I'm not sure to find any alternative in your code to generate the radar2.png.
Also, in radar2.png I think the value "33" is drawn correctly. Note it's the lower value in the series, so the axis minimum starts on it by default, so it's drawn on the center.

Then, adding this:

Code: Select all

series1.setCircled(true);
I think will give you the expected result for radar1.png.

And adding this:

Code: Select all

series1.getVertAxis().setAutomaticMinimum(false);
series1.getVertAxis().setMinimum(0);
I think will draw the "33" where you'd expect.
TeeChart.png
TeeChart.png (19.16 KiB) Viewed 28396 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: problem with radar

Post by rubby » Tue Sep 10, 2013 8:00 am

Thanks Yeray , my problem is addressed.

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: problem with radar

Post by rubby » Thu Nov 21, 2013 6:50 am

Hello,

I still find that radar graph of teechart is different from the excel radar.
one is anticlockwise, the other is clockwise .
I do not find any method to set the radar graph of teechat to clockwise.

Does it exist?
thank you.

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

Re: problem with radar

Post by Narcís » Thu Nov 21, 2013 11:02 am

Hi rubby,

There's setClockWiseLabels for that. It should reverse the painting order of series and labels but it's not working so I have added it [ID450] to the bug list to be fixed.
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

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: problem with radar

Post by rubby » Tue Feb 18, 2014 2:51 am

Hello,

I encounter a strange problem with radar graph.

the axis is not in the right position.【radar axis wrong position.png】
what i need it the one in the attachment 【radar correct position.png】.

How can i set the current position of this axis by myself.
is it radar.getVertAxis()... or something else?
Thanks.
Attachments
radar correct position.png
radar correct position.png (87.77 KiB) Viewed 28121 times
radar axis  wrong position.png
radar axis wrong position.png (90.06 KiB) Viewed 28112 times

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

Re: problem with radar

Post by Narcís » Thu Feb 20, 2014 9:55 am

Hi rubby,

I can not reproduce this. Are those screen-shots made with different TeeChart versions? Otherwise, which settings differ from one chart to the other?

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

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: problem with radar

Post by rubby » Mon Feb 24, 2014 8:10 am

Hello,
I am sorry for late reply because of something.
This always happens when i saved the radar graph as xml files and import it again (in my software which integrates Teechart).
However, i can not reproduce this problem by a simple example.

this screen-shots use the same and latest version.


Thanks.

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with radar

Post by Yeray » Tue Feb 25, 2014 12:59 pm

Hi,

I've made a test and the following seems to work fine for me here.
JavaApplication1.zip
(4.51 KiB) Downloaded 1500 times

Code: Select all

    String tmpName = "E:\\tmp\\JavaXML.xml";

    //Initialize
    private void initChart() {
        commander1.setChart(tChart1.getChart());

        Random rnd = new Random();
        for (int i = 0; i < 2; i++) {
            Radar tmpRadar = new Radar(tChart1.getChart());
            for (int j = 0; j < 5; j++) {
                tmpRadar.add(50+rnd.nextDouble()*25);
            }

            tmpRadar.setCircled(true);
            tmpRadar.getVertAxis().setMinMax(0, 100);
            tmpRadar.getBrush().setVisible(false);
        }
    }

    //Export to XML Button
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            tChart1.getExport().getData().getXML().save(tmpName);
        } catch (IOException e) {
            System.out.println(e);
        }
    }

    //Clean Chart Button
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        tChart1.removeAllSeries();
    }

    //Import from XML Button
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        try {
            tChart1.getImport().getXML().open(tmpName);
        } catch (IOException ex) {
            System.out.println(ex);
        } catch (ClassNotFoundException ex) {
            System.out.println(ex);
        }

        for (int i = 0; i < tChart1.getSeriesCount(); i++) {
            if (tChart1.getSeries(i) instanceof Radar) {
                Radar tmpRadar = (Radar) tChart1.getSeries(i);
                tmpRadar.setCircled(true);

                tmpRadar.getVertAxis().setAutomaticMinimum(false);
                tmpRadar.getVertAxis().setMinimum(0);

                tmpRadar.getBrush().setVisible(false);
            }
        }

        tChart1.getAspect().setOrthogonal(true);
    }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: problem with radar

Post by rubby » Thu Feb 27, 2014 12:45 am

Hello,

thanks for the reply.
I also code some simple examples, but the problem can not happen either. :(
I would let you know if i get the idea of how to reproduce this problem.

Thanks.

Post Reply