TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
-
Jesse
- Newbie
![Newbie Newbie](./images/ranks/1star.gif)
- Posts: 28
- Joined: Tue Mar 11, 2008 12:00 am
- Location: Austin, TX
Post
by Jesse » Thu Jun 19, 2008 3:49 am
Here is a very simple use of Box plot.
Why is the whisker showing up
inside the box?
Am I doing something wrong? It seems like the bottom whisker is wrapped up and ending on the median.
Code: Select all
package com.amd.ngeda.chart.teechart;
import javax.swing.JFrame;
import com.steema.teechart.TChart;
import com.steema.teechart.drawing.Color;
import com.steema.teechart.styles.Box;
public class TestBrokenBox {
/**
* @param args
*/
public static void main(String[] args) {
JFrame frame = new JFrame("HelloWorldSwing");
TChart teeChart = new TChart();
teeChart.setBackColor(new Color(255, 255, 255));
teeChart.getAspect().setView3D(false);
Box box = new Box(teeChart.getChart());
double[] yvals = new double[] { 9, 9, 9, 8, 8, 8, 7, 7, 6, 6 };
box.getYValues().setCount(yvals.length);
box.getYValues().setValues(yvals);
frame.getContentPane().add(teeChart);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
-
Jesse
- Newbie
![Newbie Newbie](./images/ranks/1star.gif)
- Posts: 28
- Joined: Tue Mar 11, 2008 12:00 am
- Location: Austin, TX
Post
by Jesse » Thu Jun 19, 2008 4:02 am
I went and found some more data on the net to compare results. The data that I found was a tutorial on how to create a box plot. I tried the data and it worked. I have been thinking to myself that there is a bug in TChart relating to how tightly the data is clustered. I know... I'm "grasping at straws".
Anyway, I noticed that the test data in this example was SORTED. Sure enough, I get different results when the data is sorted.
Huh? So, do we have to sort the data before using it?!?! Is this the solution?
Are there any other charts types that have a similar requirement?
---
Jesse Steinfort
-
Narcís
- Site Admin
![Site Admin Site Admin](./images/ranks/6stars.gif)
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Thu Jun 19, 2008 8:44 am
Hi Jesse,
The internal calculations (median, percentiles) assume ordered values i.e. you must order the values before you add them to box series.
No, I can't think of other series that need sorted values.
-
Jesse
- Newbie
![Newbie Newbie](./images/ranks/1star.gif)
- Posts: 28
- Joined: Tue Mar 11, 2008 12:00 am
- Location: Austin, TX
Post
by Jesse » Thu Jun 19, 2008 2:30 pm
Thanks. Please update your documentation for the next guy.
![Smile :-)](./images/smilies/icon_smile.gif)