Page 1 of 1
CursorTool
Posted: Tue Dec 21, 2010 6:41 pm
by 15355183
I have a main chart with about 10 traces that capture live data. There's an option to capture that chart - which basically clones it and copies it to another panel. On this capture panel, there are 2 Cursor Tools.
When i first implemented the cursorTools, they worked fine, then out of no where the cursors that appear when you mouse over the lines stopped showing. I had no idea what caused it since i didn't changed the code. I then just remade the class, added everything to it again and it work just fine. Now again, they stopped working. The lines still show up, you can move them, etc. but the cursors that appear when you mouse over the lines do not show up.
Re: CursorTool
Posted: Tue Dec 21, 2010 6:49 pm
by 15355183
Here's the code:
Code: Select all
private CursorTool tool1, tool2;
...
tool1 = new CursorTool(this.getChart());
tool1.setStyle(CursorToolStyle.HORIZONTAL);
tool1.getPen().setColor(Color.YELLOW);
tool1.setActive(false);
tool1.addCursorListener(new CursorTool.CursorListener() {
public void cursorMoved(CursorEvent e)
{
....
}
});
...
//Another class class enables or disables them
public void enableCursorTools()
{
tool1.setActive(true);
}
public void disableCursorTools()
{
tool1.setActive(false);
}
Re: CursorTool
Posted: Wed Dec 22, 2010 3:24 pm
by yeray
Hi Turc,
If you activate your cursor tools, I don't see any reason why they can't work fine.
Here is the code I'm using and the tools seem to work fine:
Code: Select all
private com.steema.teechart.styles.Points points1;
private com.steema.teechart.tools.CursorTool tool1, tool2;
private void initChart() {
tChart1.getAspect().setView3D(false);
points1 = new com.steema.teechart.styles.Points(tChart1.getChart());
points1.fillSampleValues(10);
tool1 = new com.steema.teechart.tools.CursorTool(tChart1.getChart());
tool1.setStyle(com.steema.teechart.tools.CursorToolStyle.HORIZONTAL);
tool1.getPen().setColor(com.steema.teechart.drawing.Color.YELLOW);
tool1.addCursorListener(new com.steema.teechart.tools.CursorTool.CursorListener() {
public void cursorMoved(com.steema.teechart.tools.CursorTool.CursorEvent e)
{
}
});
tool2 = new com.steema.teechart.tools.CursorTool(tChart1.getChart());
tool2.setStyle(com.steema.teechart.tools.CursorToolStyle.VERTICAL);
tool2.getPen().setColor(com.steema.teechart.drawing.Color.BLUE);
}
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Re: CursorTool
Posted: Wed Dec 22, 2010 5:25 pm
by 15355183
The code for the CursorTools were never changed after they were implemented - and worked. I did however add code to that class (CapturedChart) and the main class where the CapturedChart gets its chart from, but why would any of that affect the cursor tools?
I made a simple program and the cursortools worked - as in the cursor appears on top of the line, but on my main program, the lines appear but the cursors still DO NOT appear when i mouse over them.
Re: CursorTool
Posted: Fri Dec 24, 2010 12:15 pm
by narcis
Hi Turc,
Turc wrote:The code for the CursorTools were never changed after they were implemented - and worked. I did however add code to that class (CapturedChart) and the main class where the CapturedChart gets its chart from, but why would any of that affect the cursor tools?
This is impossible for us to predict without knowing what changed in that class. Can you reproduce the problem with the code snippet Yeray posted?
Turc wrote:I made a simple program and the cursortools worked - as in the cursor appears on top of the line, but on my main program, the lines appear but the cursors still DO NOT appear when i mouse over them.
If the problem persists, could you please attach a simple example project we can run "as-is" to reproduce the problem here using the binary release of TeeChart?
Thanks in advance.