Page 1 of 1

problem with radar

Posted: Thu Aug 29, 2013 3:32 am
by 17466735
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.

Re: problem with radar

Posted: Thu Aug 29, 2013 10:45 am
by yeray
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.

Re: problem with radar

Posted: Fri Aug 30, 2013 3:05 am
by 17466735
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());
    }
}

Re: problem with radar

Posted: Tue Sep 03, 2013 10:13 am
by yeray
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 24192 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 24202 times

Re: problem with radar

Posted: Tue Sep 10, 2013 8:00 am
by 17466735
Thanks Yeray , my problem is addressed.

Re: problem with radar

Posted: Thu Nov 21, 2013 6:50 am
by 17466735
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.

Re: problem with radar

Posted: Thu Nov 21, 2013 11:02 am
by narcis
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.

Re: problem with radar

Posted: Tue Feb 18, 2014 2:51 am
by 17466735
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.

Re: problem with radar

Posted: Thu Feb 20, 2014 9:55 am
by narcis
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.

Re: problem with radar

Posted: Mon Feb 24, 2014 8:10 am
by 17466735
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.

Re: problem with radar

Posted: Tue Feb 25, 2014 12:59 pm
by yeray
Hi,

I've made a test and the following seems to work fine for me here.
JavaApplication1.zip
(4.51 KiB) Downloaded 1013 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);
    }

Re: problem with radar

Posted: Thu Feb 27, 2014 12:45 am
by 17466735
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.