Hi,
I am trying to create a graph in which two or more Legend texts can be same as they represent the same type of data but they are being displayed for different parameter values.
For example, there may be two Legends with name: "Frequency" but they represent Frequency of two different People or for the same person over a different time range.
As in a set of parameters, a user can select any two different combination to draw a series, i intend to display the selected parameter as a tooltip of the respective legends to differentiate.
Let me know if any such feature is already available in TeeChart for Java. In case if you know of any alternative, do let me know.
Thanks and regards.
Mausam
Tooltip on Legend
Re: Tooltip on Legend
Hi Mausam,
If I understood well what you want to do, you could use OnMouseMove event to check if the mouse is over the legend (and over what item). Then you could show the text you want. Here it is an example:
If I understood well what you want to do, you could use OnMouseMove event to check if the mouse is over the legend (and over what item). Then you could show the text you want. Here it is an example:
Code: Select all
com.steema.teechart.tools.MarksTip markstip1;
String text;
private void initChart() {
tChart1.getAspect().setView3D(false);
for (int i=0; i<3; i++)
{
new com.steema.teechart.styles.Bar(tChart1.getChart());
tChart1.getSeries(i).fillSampleValues();
}
markstip1 = new com.steema.teechart.tools.MarksTip(tChart1.getChart());
tChart1.addChartPaintListener(new ChartPaintListener() {
public void axesPainting(ChartDrawEvent arg0) {}
public void chartPainted(ChartDrawEvent arg0) {
markstip1.chart.getToolTip().setText(text);
}
public void chartPainting(ChartDrawEvent arg0) {}
public void seriesPainting(ChartDrawEvent arg0) {}
public void seriesPainted(ChartDrawEvent arg0) {}
});
tChart1.addMouseMotionListener(new MouseMotionListener() {
public void mouseDragged(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {
int clickedIndex = tChart1.getLegend().clicked(e.getX(),e.getY());
if (clickedIndex > -1)
{
text = tChart1.getSeries(clickedIndex).titleOrName();
tChart1.repaint();
}
}
});
}
Best Regards,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |