Including a small dummy-program to illustrate, just as text. You'll notice how -1 is always returned when clicking, both in- and outside the series.
If you would rather want a jar I can make it next time, but now you also see the src
Thanks in advance!
Marius
Code: Select all
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.steema.teechart.TChart;
import com.steema.teechart.styles.Histogram;
public class ClickTest extends JFrame implements ActionListener, MouseListener
{
JPanel dmb = new JPanel();
TChart myChart = new TChart();
JButton newSerButton = new JButton("Press for histogram");
int indicator = 0;
double[] testData = new double[100];
double[] testX = new double[100];
double[] testData1 = new double[50];
double[] testX1 = new double[50];
double[] testData2 = new double[50];
double[] testX2 = new double[50];
public static void main(String[] args)
{
new ClickTest().setVisible(true);
}
public ClickTest()
{
initialize();
}
public void initialize()
{
/******************/
for(int i=0;i<100;i++)
{
testData[i] = (i+50)*Math.pow(Math.random(),Math.random());
testX[i] = i;
}
/******************/
myChart.getChart().getAspect().setView3D(false);
newSerButton.addActionListener(this);
dmb.add(myChart);
dmb.add(newSerButton);
super.add(dmb);
super.setSize(600,400);
}
public void addSeries()
{
Histogram p = new Histogram(myChart.getChart().chart);
p.add(testData);
myChart.getChart().addSeries(p);
myChart.addMouseListener(this);
myChart.repaint();
}
public void actionPerformed(ActionEvent e)
{
addSeries();
}
public void mouseClicked(MouseEvent e)
{
for(int j = 0; j < myChart.getSeriesCount(); j++)
{
System.out.println("clicked: "+myChart.getSeries().getSeries(j).clicked(e.getPoint()));
}
}
public void mousePressed(MouseEvent e)
{
}
public void mouseReleased(MouseEvent e)
{
}
public void mouseExited(MouseEvent e)
{
}
public void mouseEntered(MouseEvent e)
{
}
}